
@layer page {
  :root { --explorer-chat: clamp(390px, 26vw, 640px); }

  .explorer-page { overflow-x: hidden; }
  .explorer {
    width: min(calc(100vw - var(--fw-shell-gutter)), var(--fw-shell));
    min-height: 0;
    flex: 1 0 auto;
    margin: 16px auto 12px;
  }
  .explorer-header-stack { margin-bottom: 12px; }
  .explorer-pathbar { min-width: 0; }

  .explorer-toolbar {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    align-items: center;
    gap: 16px;
    min-height: 88px;
    padding: 14px 16px 15px;
    background: var(--fw-canvas);
  }
  .explorer-actions {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
  }
  .explorer-search-control {
    min-width: 280px;
    width: min(590px, 58vw);
    display: flex;
    align-items: center;
    gap: 7px;
    flex: 1 1 360px;
  }
  .explorer-search-control .search-box { width: auto; flex: 1 1 auto; }

  .explorer-count {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border: 1px solid var(--fw-rule);
    border-radius: 999px;
    background: var(--fw-canvas-2);
    color: var(--fw-muted);
    font-family: var(--fw-mono);
    font-size: 9.5px;
    font-weight: 700;
    white-space: nowrap;
  }

  .search-box {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 210px;
    width: min(470px, 44vw);
    height: 40px;
    border: 1px solid var(--fw-rule-strong);
    border-radius: 999px;
    background: white;
    transition: border-color .15s ease, box-shadow .15s ease, width .2s ease;
  }
  .search-box:focus-within { border-color: var(--fw-blue); box-shadow: 0 0 0 4px rgba(36,72,216,.08); }
  .search-icon { width: 37px; display: grid; place-items: center; color: var(--fw-muted); }
  .search-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }
  .search-input { flex: 1; min-width: 0; height: 100% !important; padding: 0 3px !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; font-size: 12px; }
  .search-input:focus { box-shadow: none !important; }
  .search-clear { width: 33px; height: 33px; margin-right: 3px; border: 0; border-radius: 50%; background: transparent; color: var(--fw-faint); font-size: 18px; line-height: 1; }
  .search-clear:hover { background: var(--fw-canvas-2); color: var(--fw-coral); }

  .explorer-party-control { display: inline-flex; align-items: center; gap: 7px; }
  .explorer-party-button,
  .explorer-party-active,
  .explorer-party-result-button,
  .explorer-party-room-actions a,
  .explorer-party-room-actions button {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 11px;
    border: 1px solid var(--fw-rule-strong);
    border-radius: 7px;
    background: var(--fw-canvas);
    color: var(--fw-ink);
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
  }
  .explorer-party-button { border-color: var(--fw-blue); color: var(--fw-blue-deep); background: var(--fw-blue-soft); }
  .explorer-party-button:hover { background: #e2e7ff; }
  .explorer-party-active { border-color: #add5c3; background: var(--fw-green-soft); color: var(--fw-green); }

  .explorer-content-layout {
    display: grid;
    grid-template-columns: minmax(0,1fr) var(--explorer-chat);
    gap: 12px;
    align-items: start;
  }
  .explorer-content-main {
    min-width: 0;
    border: 1px solid var(--fw-rule-strong);
    border-radius: var(--fw-radius);
    background: var(--fw-canvas);
    box-shadow: var(--fw-shadow-soft);
    overflow: clip;
    min-height: var(--fw-stage-min-height);
  }
  .explorer-chat-rail { min-width: 0; align-self: start; position: sticky; top: 16px; }
  .explorer-chat-rail:empty { display: none; }
  .explorer-content-layout:has(.explorer-chat-rail:empty) { grid-template-columns: minmax(0,1fr); }

  .explorer-quick-sections, .explorer-party-rooms { border-bottom: 1px solid var(--fw-rule); }
  .explorer-quick-block { padding: 16px 18px 18px; }
  .explorer-quick-head, .explorer-party-rooms-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
  }
  .explorer-quick-head strong, .explorer-party-rooms-head strong {
    font-family: var(--fw-serif);
    font-size: 18px;
    font-weight: 500;
  }
  .explorer-party-rooms-head > span { color: var(--fw-muted); font-family: var(--fw-mono); font-size: 9px; }
  .explorer-quick-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 7px; }
  .explorer-quick-card {
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--fw-rule);
    border-radius: 8px;
    background: var(--fw-canvas-2);
    color: var(--fw-ink);
    text-decoration: none;
    transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
  }
  .explorer-quick-card:hover { transform: translateY(-2px); border-color: #aeb9f4; box-shadow: 0 8px 22px rgba(36,72,216,.08); }
  .explorer-quick-card strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
  .explorer-quick-card span { color: var(--fw-muted); font-family: var(--fw-mono); font-size: 9px; }
  .explorer-quick-card progress { width: 100%; height: 4px; border: 0; border-radius: 99px; overflow: hidden; background: #e3dfd6; }
  .explorer-quick-card progress::-webkit-progress-bar { background: #e3dfd6; }
  .explorer-quick-card progress::-webkit-progress-value { background: var(--fw-blue); }
  .explorer-quick-card progress::-moz-progress-bar { background: var(--fw-blue); }

  .explorer-party-rooms { padding: 16px 18px 18px; }
  .explorer-party-rooms-list { display: grid; gap: 7px; }
  .explorer-party-room {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 11px 12px;
    border: 1px solid var(--fw-rule);
    border-radius: 8px;
    background: var(--fw-canvas-2);
  }
  .explorer-party-room.is-active { border-color: #aeb9f4; background: var(--fw-blue-soft); }
  .explorer-party-room-main { min-width: 0; display: grid; gap: 2px; }
  .explorer-party-room-state { color: var(--fw-blue); font-family: var(--fw-mono); font-size: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
  .explorer-party-room-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .explorer-party-room-main small { font-size: 9px; }
  .explorer-party-room-actions { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
  .explorer-party-room-actions a, .explorer-party-room-actions button { min-height: 30px; padding: 5px 8px; }
  .explorer-party-room-actions .danger { color: var(--fw-danger); border-color: #e2b9b7; }
  .explorer-party-room-active { color: var(--fw-green); font-family: var(--fw-mono); font-size: 9px; font-weight: 700; }

  .explorer-library-surface { min-width: 0; }
  .grid-wrap { overflow: hidden; }
  .grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
  .grid thead { display: none; }
  .grid tbody tr { height: 50px; border-bottom: 1px solid var(--fw-rule); background: transparent; }
  .grid tbody tr:last-child { border-bottom: 0; }
  .grid tbody tr:hover { background: #f8f9ff; }
  .grid tbody tr.selected { background: var(--fw-blue-soft); }
  .grid td { padding: 0; border: 0; }
  .item-link {
    position: relative;
    min-height: 50px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 7px 16px 7px 18px;
    color: var(--fw-ink);
    text-decoration: none;
    outline: 0;
  }
  .item-link::after {
    content: "→";
    margin-left: auto;
    color: transparent;
    font-family: var(--fw-mono);
    font-size: 13px;
    transform: translateX(-4px);
    transition: color .12s ease, transform .12s ease;
  }
  .entry-row:hover .item-link::after, .item-link:focus-visible::after { color: var(--fw-blue); transform: none; }
  .item-link:focus-visible { box-shadow: inset 3px 0 0 var(--fw-blue); background: #f8f9ff; }
  .ico { width: 22px; height: 22px; flex: 0 0 auto; }
  .item-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 650; letter-spacing: -.01em; }
  .parent-row .item-label { font-family: var(--fw-mono); }
  .parent-row .item-link { color: var(--fw-muted); }
  .entry-row.is-feature-disabled .item-link { cursor: not-allowed; }

  .item-link[data-auth-required="true"] { cursor: pointer; }
  .item-link[data-auth-required="true"]::after { content: "Konto"; padding: 2px 6px; border: 1px solid var(--fw-rule); border-radius: 999px; color: var(--fw-muted); font-family: var(--fw-mono); font-size: 9px; font-weight: 700; transform: none; }
  .entry-row:hover .item-link[data-auth-required="true"]::after, .item-link[data-auth-required="true"]:focus-visible::after { color: var(--fw-blue); }

  .explorer-auth-dialog {
    width: min(430px, calc(100vw - 32px));
    padding: 0;
    border: 1px solid var(--fw-rule-strong);
    border-radius: 10px;
    background: var(--fw-canvas);
    color: var(--fw-ink);
    box-shadow: 0 24px 70px rgba(31,29,23,.20);
  }
  .explorer-auth-dialog::backdrop { background: rgba(24,26,32,.35); backdrop-filter: blur(2px); }
  .explorer-auth-dialog-body { position: relative; padding: 24px; }
  .explorer-auth-dialog-close {
    position: absolute; top: 10px; right: 10px; width: 32px; height: 32px;
    border: 0; border-radius: 50%; background: transparent; color: var(--fw-muted); font-size: 22px; line-height: 1;
  }
  .explorer-auth-dialog-close:hover { background: var(--fw-canvas-2); color: var(--fw-ink); }
  .explorer-auth-dialog-brand { display: block; margin-bottom: 14px; color: var(--fw-blue-deep); font-family: var(--fw-serif); font-size: 17px; font-style: italic; font-weight: 700; }
  .explorer-auth-dialog h2 { margin: 0 38px 8px 0; font-family: var(--fw-serif); font-size: 25px; font-weight: 500; }
  .explorer-auth-dialog p { margin: 0; color: var(--fw-muted); font-size: 13px; line-height: 1.55; }
  .explorer-auth-dialog-actions { display: flex; gap: 8px; margin-top: 20px; }
  .explorer-auth-dialog-actions a {
    min-height: 38px; display: inline-flex; align-items: center; justify-content: center; padding: 8px 13px;
    border: 1px solid var(--fw-rule-strong); border-radius: 7px; background: var(--fw-canvas); color: var(--fw-ink); font-size: 12px; font-weight: 750; text-decoration: none;
  }
  .explorer-auth-dialog-actions a.primary { border-color: var(--fw-blue-deep); background: var(--fw-blue); color: #fff; }
  .explorer-auth-dialog-actions a.primary:hover { background: var(--fw-blue-deep); }
  .explorer-empty { padding: 44px 18px; color: var(--fw-muted); text-align: center; }
  .explorer-empty strong { color: var(--fw-ink-2); font-family: var(--fw-serif); font-size: 22px; font-weight: 500; }

  .explorer-search-original-hidden { display: none !important; }
  .explorer-search-status { padding: 30px 18px; color: var(--fw-muted); text-align: center; }
  .explorer-search-row .item-link { background: #fff; }

  .explorer-party-result {
    position: fixed;
    z-index: 90;
    right: 18px;
    bottom: 18px;
    width: min(420px, calc(100vw - 36px));
    display: grid;
    grid-template-columns: minmax(0,1fr) auto auto;
    gap: 7px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--fw-rule-strong);
    border-top: 4px solid var(--fw-blue);
    border-radius: 9px;
    background: var(--fw-canvas);
    box-shadow: var(--fw-shadow);
  }
  .explorer-party-result-copy { grid-column: 1 / -1; }
  .explorer-party-result input { min-width: 0; }
  .explorer-hidden-form { display: none; }
  .explorer-queue-notice {
    position: fixed;
    z-index: 95;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    min-width: min(420px, calc(100vw - 36px));
    padding: 11px 13px;
    border: 1px solid var(--fw-rule-strong);
    border-radius: 8px;
    background: var(--fw-canvas);
    box-shadow: var(--fw-shadow);
  }

  .fw-folder-leave-forward .explorer-content-main { animation: fwFolderOutForward .24s cubic-bezier(.4,0,.2,1) both; }
  .fw-folder-leave-back .explorer-content-main { animation: fwFolderOutBack .24s cubic-bezier(.4,0,.2,1) both; }
  .fw-enter-folder-forward .explorer-content-main { animation: fwFolderInForward .36s cubic-bezier(.16,1,.3,1) both; }
  .fw-enter-folder-back .explorer-content-main { animation: fwFolderInBack .36s cubic-bezier(.16,1,.3,1) both; }
  .fw-enter-auth .explorer-header-stack { animation: fwExplorerHeaderEnter .42s cubic-bezier(.2,.8,.2,1) both; }
  .fw-enter-auth .explorer-content-layout { animation: fwExplorerContentEnter .46s .04s cubic-bezier(.2,.8,.2,1) both; }
  .fw-enter-player .explorer-content-layout { animation: fwExplorerPlayerReturn .32s cubic-bezier(.2,.8,.2,1) both; }

  @keyframes fwFolderOutForward { to { opacity: .58; transform: translateX(-18px) scale(.988); } }
  @keyframes fwFolderOutBack { to { opacity: .58; transform: translateX(18px) scale(1.008); } }
  @keyframes fwFolderInForward { from { opacity: .52; transform: translateX(24px) scale(.992); } to { opacity: 1; transform: none; } }
  @keyframes fwFolderInBack { from { opacity: .62; transform: translateX(-14px) scale(.982); } to { opacity: 1; transform: none; } }
  @keyframes fwExplorerHeaderEnter { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
  @keyframes fwExplorerContentEnter { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
  @keyframes fwExplorerPlayerReturn { from { opacity: 0; transform: scale(.988); } to { opacity: 1; transform: none; } }

  .fw-player-transition {
    --fw-x: 0px; --fw-y: 0px; --fw-w: 1px; --fw-h: 1px;
    position: fixed;
    z-index: 9999;
    left: var(--fw-x);
    top: var(--fw-y);
    width: var(--fw-w);
    height: var(--fw-h);
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 8px;
    background: var(--fw-ink);
    color: white;
    pointer-events: none;
    transition: left .26s cubic-bezier(.2,.8,.2,1), top .26s cubic-bezier(.2,.8,.2,1), width .26s cubic-bezier(.2,.8,.2,1), height .26s cubic-bezier(.2,.8,.2,1), border-radius .26s ease;
  }
  .fw-player-transition::before { content: ""; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(36,72,216,.85), transparent 55%); opacity: .9; }
  .fw-player-transition.is-active { left: 0; top: 0; width: 100vw; height: 100vh; border-radius: 0; }
  .fw-player-transition-label { position: relative; z-index: 1; max-width: min(70vw, 760px); padding: 18px; font-family: var(--fw-serif); font-size: clamp(22px, 4vw, 48px); font-style: italic; text-align: center; opacity: 0; transform: translateY(8px); transition: opacity .15s .09s ease, transform .15s .09s ease; }
  .fw-player-transition.is-active .fw-player-transition-label { opacity: 1; transform: none; }
}


@media (min-width: 2200px) {
  .explorer-toolbar { min-height: 96px; padding: 17px 20px; }
  .explorer-search-control { width: min(760px, 44vw); }
  .search-box { height: 44px; }
  .search-input { font-size: 13px !important; }
  .explorer-count { min-height: 35px; padding-inline: 11px; font-size: 10.5px; }
  .item-link { min-height: 46px; font-size: 13px; }
  .ico { width: 24px; height: 24px; }
}

@media (max-width: 1179px) {
  .explorer { width: min(calc(100vw - var(--fw-shell-gutter)), var(--fw-shell)); min-height: 0; margin-top: 8px; }
  .explorer-content-layout { grid-template-columns: minmax(0,1fr); }
  .explorer-chat-rail { position: static; }
}
@media (max-width: 820px) {
  .explorer-toolbar { grid-template-columns: minmax(0,1fr) auto; align-items: start; gap: 10px; }
  .explorer-actions { gap: 7px; }
  .explorer-actions::before { width: 100%; margin-bottom: 1px; }
  .explorer-search-control { width: min(100%, 600px); flex: 1 1 100%; }
  .search-box { width: min(100%, 520px); flex: 1 1 260px; }
  .explorer-count { display: inline-flex; }
  .explorer-party-room { grid-template-columns: 1fr; }
  .explorer-party-room-actions { justify-content: flex-start; }
}
@media (max-width: 560px) {
  .explorer { width: calc(100vw - var(--fw-shell-gutter)); margin: 4px auto 10px; }
  .explorer-toolbar { padding: 10px; min-height: 68px; }
  .explorer-actions::before { display: none; }
  .explorer-search-control { min-width: 0; width: 100%; flex-basis: 100%; }
  .search-box { min-width: 0; width: 100%; flex: 1 1 auto; }
  .explorer-count { margin-left: 0; }
  .explorer-party-control { width: 100%; }
  .explorer-party-button { flex: 1; }
  .explorer-quick-block, .explorer-party-rooms { padding: 13px 10px; }
  .explorer-quick-list { grid-template-columns: 1fr; }
  .item-link { padding-inline: 12px; }
  .explorer-party-result { right: 4px; bottom: 4px; width: calc(100vw - 8px); grid-template-columns: 1fr; }
}


/* Folder navigation stays visually inside one continuous Explorer surface.
   Chromium/Edge use cross-document View Transitions; older browsers keep the
   softer fallback animations above. */
@media (prefers-reduced-motion: no-preference) {
  @supports (view-transition-name: fw-explorer-plane) {
    .explorer-header-stack { view-transition-name: fw-explorer-header; }
    .explorer-content-main { view-transition-name: fw-explorer-plane; }
    .explorer-chat-rail { view-transition-name: fw-explorer-chat; }

    ::view-transition-old(root),
    ::view-transition-new(root) {
      mix-blend-mode: normal;
      animation-duration: .26s;
      animation-timing-function: ease-out;
    }
    ::view-transition-old(root) { animation-name: fwExplorerRootOld; }
    ::view-transition-new(root) { animation-name: fwExplorerRootNew; }

    ::view-transition-group(fw-explorer-header) {
      animation-duration: .30s;
      animation-timing-function: cubic-bezier(.2,.8,.2,1);
    }
    ::view-transition-group(fw-explorer-plane) {
      z-index: 2;
      animation-duration: .48s;
      animation-timing-function: cubic-bezier(.16,1,.3,1);
    }
    ::view-transition-group(fw-explorer-chat) {
      z-index: 1;
      animation-duration: .22s;
      animation-timing-function: ease-out;
    }
    ::view-transition-old(fw-explorer-header),
    ::view-transition-new(fw-explorer-header),
    ::view-transition-old(fw-explorer-chat),
    ::view-transition-new(fw-explorer-chat) {
      mix-blend-mode: normal;
    }

    html:active-view-transition-type(fw-forward)::view-transition-old(fw-explorer-plane) {
      animation: fwPlaneForwardOld .42s cubic-bezier(.4,0,.2,1) both;
    }
    html:active-view-transition-type(fw-forward)::view-transition-new(fw-explorer-plane) {
      animation: fwPlaneForwardNew .48s cubic-bezier(.16,1,.3,1) both;
    }
    html:active-view-transition-type(fw-back)::view-transition-old(fw-explorer-plane) {
      z-index: 3;
      animation: fwPlaneBackOld .42s cubic-bezier(.4,0,.2,1) both;
    }
    html:active-view-transition-type(fw-back)::view-transition-new(fw-explorer-plane) {
      z-index: 2;
      animation: fwPlaneBackNew .48s cubic-bezier(.16,1,.3,1) both;
    }

    @keyframes fwExplorerRootOld { from { opacity: 1; } to { opacity: .96; } }
    @keyframes fwExplorerRootNew { from { opacity: .94; } to { opacity: 1; } }

    @keyframes fwPlaneForwardOld {
      from { opacity: 1; transform: translateX(0) scale(1); filter: brightness(1); }
      to   { opacity: .46; transform: translateX(-3.2%) scale(.974); filter: brightness(.97); }
    }
    @keyframes fwPlaneForwardNew {
      from { opacity: .18; transform: translateX(5.5%) scale(.994); filter: brightness(1.02); }
      55%  { opacity: 1; }
      to   { opacity: 1; transform: translateX(0) scale(1); filter: none; }
    }
    @keyframes fwPlaneBackOld {
      from { opacity: 1; transform: translateX(0) scale(1); }
      to   { opacity: .08; transform: translateX(7%) scale(1.012); }
    }
    @keyframes fwPlaneBackNew {
      from { opacity: .58; transform: translateX(-2.2%) scale(.975); filter: brightness(.97); }
      to   { opacity: 1; transform: translateX(0) scale(1); filter: none; }
    }
  }
}
