/* Beta presentation layer.
   Loaded after the app styles. Nothing here applies unless the document has
   data-theme="ice" (set only on the beta hostname). The base stays the app's
   pure-black surfaces; the beta only changes the accent. */

:root[data-theme="ice"] {
  --accent: #a9e8ff;
  /* The app chrome follows the landing's pure-black base; the accent is the
     only colour. */
  --darkerer: #000;
}

:root[data-theme="ice"][data-order="ash"] {
  --accent: #c63a28;
}

:root[data-theme="ice"][data-order="halo"] {
  --accent: #eeb044;
}

:root[data-theme="ice"][data-order="void"] {
  --accent: #a9e8ff;
}

/* The beta keeps the app square, with the same one-cut primary action as the
   public design pass. */
:root[data-theme="ice"] .btn.primary {
  clip-path: polygon(0 0, calc(100% - 0.55rem) 0, 100% 0.55rem, 100% 100%, 0 100%);
}

:root[data-theme="ice"] .btn.primary:hover {
  border-color: color-mix(in srgb, var(--accent) 84%, #fff);
  background: color-mix(in srgb, var(--accent) 84%, #fff);
}

:root[data-theme="ice"] .btn.primary:focus-visible {
  outline-offset: -4px;
}

/* ---------- shared surface pass ----------
   The app pages keep their own layouts, but they share the landing's measure:
   a taller black bar, a larger display title, and a quieter result row. */
:root[data-theme="ice"] .topbar {
  height: 64px;
}

:root[data-theme="ice"] .side-head {
  height: 64px;
}

:root[data-theme="ice"] #q {
  height: 40px;
}

:root[data-theme="ice"] .chapter-title-wrap h1 {
  font-size: clamp(24px, 4vw, 38px);
  letter-spacing: 0.04em;
}

:root[data-theme="ice"] .kicker {
  color: var(--accent);
}

:root[data-theme="ice"] .jukebox-heading,
:root[data-theme="ice"] .board-heading,
:root[data-theme="ice"] .ask-heading,
:root[data-theme="ice"] .ask-hero-heading {
  font-size: clamp(21px, 3.2vw, 28px);
  letter-spacing: 0.12em;
}

:root[data-theme="ice"] .result {
  padding-block: 18px;
}

:root[data-theme="ice"] .result .snippet {
  font-size: 16px;
  line-height: 1.72;
}

@media (max-width: 900px) {
  :root[data-theme="ice"] .topbar {
    height: auto;
  }
}

/* Search filters, available from the sticky bar at any scroll position. */
.filter-jump {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.filter-jump[hidden] {
  display: none;
}

.filter-count {
  display: inline-grid;
  place-items: center;
  min-width: 1.4em;
  height: 1.4em;
  padding: 0 0.25em;
  border: 1px solid currentColor;
  font-size: 0.72em;
  line-height: 1;
}

.filter-count[hidden] {
  display: none;
}

.filters-dialog {
  width: min(780px, calc(100vw - 2rem));
  max-width: 100%;
  max-height: min(86vh, 920px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--da);
  background: var(--darkerer);
  color: var(--text-sub);
}

.filters-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(3px);
}

.filters-dialog-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 52px;
  padding: 0 16px 0 20px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--darkerer);
}

.filters-dialog-bar h2 {
  margin: 0;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.filters-dialog-body {
  max-height: calc(min(86vh, 920px) - 52px);
  overflow-y: auto;
  padding: 18px 20px 28px;
}

.filters-dialog #advanced {
  max-width: none;
  margin: 0;
  border: 0;
  padding: 0;
}

.filters-dialog #advanced-details > summary {
  display: none;
}

.filters-dialog .advanced-hint {
  margin-top: 0;
}

.filters-dialog .advanced-footer {
  position: sticky;
  bottom: -28px;
  margin-top: 18px;
  padding: 14px 0 8px;
  background: linear-gradient(180deg, transparent, var(--darkerer) 22%);
}

body.dialog-open {
  overflow: hidden;
}

@media (max-width: 900px) {
  .filter-jump {
    padding: 0 9px;
    font-size: 0;
  }

  .filter-jump::before {
    content: "Filters";
    font-size: 12px;
  }

  .filter-count {
    font-size: 10px;
  }

  /* The filter affordance has to fit beside the brand and the language
     switch. YURI remains available on larger screens; the search-first beta
     phone bar spends that width on the sticky filter button instead. */
  :root[data-theme="ice"] #yuri-toggle {
    display: none;
  }
}


/* The search/reader shell uses the landing's wordmark and mode rail when
   there is room; the old icon shortcuts return on narrower screens. */
.surface-nav {
  display: none;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.surface-nav a {
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  color: var(--text-subber);
  font: 700 11px/1 var(--sans);
  letter-spacing: 0.04em;
  text-decoration: none;
}

.surface-nav a:hover,
.surface-nav a.is-active {
  color: var(--accent-text);
  border-bottom-color: var(--accent);
}

.top-brand {
  align-items: center;
}

.brand-mark {
  width: 22px;
  height: 22px;
  margin-right: 6px;
  flex: none;
  color: var(--accent);
}

.brand-slash {
  margin-left: 4px;
  color: var(--text-subberer);
  font-weight: 400;
}

@media (min-width: 1300px) {
  :root[data-theme="ice"] .topbar-inner,
  :root[data-theme="ice"] .main {
    max-width: 84rem;
  }

  :root[data-theme="ice"] .surface-nav {
    display: flex;
  }

  :root[data-theme="ice"] .topbar .top-modes,
  :root[data-theme="ice"] .topbar .top-sep {
    display: none;
  }
}

@media (max-width: 1299px) {
  :root[data-theme="ice"] .surface-nav {
    display: none;
  }
}

/* Secondary surfaces carry the same little wordmark as the app topbar. */
.back-mark {
  width: 16px;
  height: 16px;
  margin-right: 3px;
  color: var(--accent);
  vertical-align: -3px;
}

/* The game's visual-novel frame is a square screen. Keep the same reader
   width, let the frame take its height from that width, and centre it. */
:root[data-theme="ice"] .vn-stage {
  width: min(100%, 880px);
  height: auto;
  min-height: 0;
  aspect-ratio: 1 / 1;
  margin-inline: auto;
}

:root[data-theme="ice"] .vn:fullscreen .vn-stage,
:root[data-theme="ice"] .vn.vn-fill .vn-stage {
  width: min(100%, 100dvh);
  height: auto;
  min-height: 0;
  aspect-ratio: 1 / 1;
  margin: auto;
}

/* One vertical nav: modes live above the chapter tree. */
:root[data-theme="ice"] .topbar .top-modes,
:root[data-theme="ice"] .topbar .top-sep {
  display: none;
}

.side-modes {
  display: grid;
  flex: none;
  padding: 0.3rem 14px 0.55rem;
  border-bottom: 1px solid var(--line);
}

.side-modes a {
  padding: 0.44rem 0;
  color: var(--text-sub);
  font: 700 11px/1.2 var(--sans);
  letter-spacing: 0.04em;
  text-decoration: none;
}

.side-modes a:hover {
  color: var(--accent-text);
}

/* The app topbar carries the same order control as the landing. */
.app-orders {
  display: none;
}

:root[data-theme="ice"] .app-orders {
  display: flex;
}

:root[data-theme="ice"] .app-orders button {
  padding: 0 7px;
  font-size: 10px;
  letter-spacing: 0.04em;
}

/* ---------------------------------------------------------------------------
   BlaBla is part of the same black shell now: square chrome, one accent,
   rectangular messages with a cut corner, and portrait tiles instead of
   floating circles. The prototype's rounded cards are not the product.
   --------------------------------------------------------------------------- */

:root[data-theme="ice"] .bla-frame {
  border-radius: 0;
  border-color: var(--line);
  background: #000;
}

:root[data-theme="ice"] .bla-rail,
:root[data-theme="ice"] .bla-pane {
  background: #000;
}

:root[data-theme="ice"] .bla-rail {
  border-right-color: var(--line);
}

:root[data-theme="ice"] .bla-rail-head,
:root[data-theme="ice"] .bla-head,
:root[data-theme="ice"] .bla-threads {
  border-color: var(--line);
}

:root[data-theme="ice"] .bla-rail-title,
:root[data-theme="ice"] .bla-head-title {
  color: var(--text);
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: 0.08em;
}

:root[data-theme="ice"] .bla-search {
  height: 34px;
  border-radius: 0;
  border-color: var(--line-strong);
  background: #000;
  color: var(--text);
}

:root[data-theme="ice"] .bla-room {
  border-left-width: 1px;
  border-left-color: transparent;
}

:root[data-theme="ice"] .bla-room:hover,
:root[data-theme="ice"] .bla-room[aria-current="true"] {
  background: var(--surface-2);
}

:root[data-theme="ice"] .bla-room[aria-current="true"] {
  border-left-color: var(--accent);
}

:root[data-theme="ice"] .bla-av,
:root[data-theme="ice"] .bla-member,
:root[data-theme="ice"] .bla-msg-av {
  border-radius: 0;
  border-color: var(--line-strong);
  background: #000;
}

:root[data-theme="ice"] .bla-av {
  color: var(--text-subber);
}

:root[data-theme="ice"] .bla-member,
:root[data-theme="ice"] .bla-msg-av {
  overflow: hidden;
}

:root[data-theme="ice"] .bla-chip {
  border-radius: 0;
  border-color: var(--line);
  background: #000;
  color: var(--text-subber);
}

:root[data-theme="ice"] .bla-chip[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

:root[data-theme="ice"] .bla-bub {
  border-radius: 0;
  border-color: var(--line);
  background: var(--surface-1);
}

:root[data-theme="ice"] .bla-msg.mine .bla-bub {
  border-radius: 0;
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, #000);
  color: var(--text);
}

:root[data-theme="ice"] .bla-msg.sys .bla-bub {
  background: transparent;
  color: var(--text-subber);
}

:root[data-theme="ice"] .bla-msg.thought .bla-bub {
  border-color: var(--line-strong);
  color: var(--text-sub);
}

:root[data-theme="ice"] .blabla-link,
:root[data-theme="ice"] .blabla-cut,
:root[data-theme="ice"] .blabla-sheet-panel {
  border-radius: 0;
  border-color: var(--line);
  background: #000;
}

:root[data-theme="ice"] .blabla-link:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, #000);
}

:root[data-theme="ice"] .blabla-link-icon,
:root[data-theme="ice"] .blabla-link-go {
  color: var(--accent);
}

:root[data-theme="ice"] .blabla-cut-tag,
:root[data-theme="ice"] .blabla-sheet-title {
  color: var(--accent);
}

:root[data-theme="ice"] .vn-chat {
  border-radius: 0;
  border-color: var(--line);
  background: #000;
}

:root[data-theme="ice"] .vn-chat-head {
  border-color: var(--line);
}

:root[data-theme="ice"] .vn-chat-av {
  border-radius: 0;
  overflow: hidden;
  background: #000;
}

:root[data-theme="ice"] .vn-chat-bub {
  border-radius: 0;
  border-color: var(--line);
  background: var(--surface-1);
}

:root[data-theme="ice"] .vn-chat-msg.mine .vn-chat-bub {
  border-radius: 0;
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, #000);
}

:root[data-theme="ice"] .vn-chat-msg.sys .vn-chat-bub {
  background: transparent;
  color: var(--text-subber);
}

:root[data-theme="ice"] .vn-chat-msg.thought .vn-chat-bub {
  border-color: var(--line-strong);
  color: var(--text-sub);
}

@media (max-width: 900px) {
  :root[data-theme="ice"] .vn-chat {
    border-radius: 0;
  }
}
