/* The frame around every page (design/redesign-2026-10/theme.css: app shell, sidebar, thread rows,
   top bar, game header, tabs, menu, page layout, breakpoints; NOTES.md §7). The sidebar's thread
   rows follow T3 Code's sidebar/SidebarThreadRow.tsx. */

/* ---------------------------------------------------------------- app shell */
.app {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100dvh;
}
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.side {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 10px 10px;
  background: var(--bg-side);
  box-shadow: inset -1px 0 0 var(--line);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.side-top {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 4px 0 8px;
  margin-bottom: 6px;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.wordmark svg {
  width: 22px;
  height: 22px;
  color: var(--accent);
}
.side-top .icon-btn {
  margin-left: auto;
}
.side-search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  margin-bottom: 8px;
  border-radius: var(--r-3);
  color: var(--ink-3);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: var(--fs-14);
}
.side-search kbd {
  margin-left: auto;
}
.nav-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: var(--r-2);
  font-size: var(--fs-14);
  font-weight: 520;
  color: var(--ink-2);
  transition: background-color var(--t-fast) var(--ease);
}
.nav-row > .i {
  color: var(--ink-3);
}
.nav-row:hover {
  background: var(--hover);
}
.nav-row[aria-current='page'],
.nav-row.is-current {
  background: var(--surface-3);
  color: var(--ink);
}
.nav-row[aria-current='page'] > .i {
  color: var(--ink);
}
.nav-row .count,
.nav-row .end {
  margin-left: auto;
}
.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 10px 6px;
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--ink-4);
}
.game-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 8px;
  border-radius: var(--r-2);
  font-size: var(--fs-14);
  font-weight: 540;
  color: var(--ink-2);
  transition: background-color var(--t-fast) var(--ease);
}
.game-row:hover {
  background: var(--hover);
}
.game-row .name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.game-row .end {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.game-row.is-open {
  color: var(--ink);
}
.side-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 10px 6px 2px 8px;
  box-shadow: inset 0 1px 0 var(--line);
}
.side-foot .who {
  display: grid;
  min-width: 0;
  line-height: 1.25;
}
.side-foot .who b {
  font-size: var(--fs-14);
  font-weight: 600;
}
.side-foot .who span {
  font-size: var(--fs-12);
  color: var(--ink-3);
}
.side-foot .icon-btn {
  margin-left: auto;
}
.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--scrim);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-med) var(--ease);
}
.scrim.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* top bar (phone and tablet only) */
.topbar {
  display: none;
}

/* ---------------------------------------------------------------- game header and tabs */
.game-head {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  gap: 10px;
  padding: 14px var(--gutter) 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: inset 0 -1px 0 var(--line);
}
.game-id {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.game-id h1 {
  font-family: var(--font-serif);
  font-size: var(--fs-24);
  font-weight: 450;
  letter-spacing: -0.01em;
  line-height: 1.1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.game-facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 -10px;
  min-width: 0;
}
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 10px;
  flex: none;
  font-size: var(--fs-15);
  font-weight: 560;
  color: var(--ink-3);
  transition: color var(--t-fast) var(--ease);
}
.tab .i {
  width: 17px;
  height: 17px;
}
.tab:hover {
  color: var(--ink);
}
.tab[aria-current='page'] {
  color: var(--ink);
}
.tab[aria-current='page']::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--ink);
}
.tab.is-more {
  font-size: var(--fs-14);
}
.tab-spacer {
  flex: 1;
}

/* the More menu (and every popover menu) */
.menu-wrap {
  position: relative;
  display: inline-flex;
}
.menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 60;
  min-width: 220px;
  padding: 6px;
  border-radius: var(--r-4);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  transform-origin: top left;
  transition-property: opacity, scale;
  transition-duration: var(--t-med);
  transition-timing-function: var(--ease-out);
}
.menu.is-right {
  left: auto;
  right: 0;
  transform-origin: top right;
}
/* createMenu places its menus with an inline left: a right edge too would stretch them */
.menu.is-fixed.is-right {
  right: auto;
}
@starting-style {
  .menu {
    opacity: 0;
    scale: 0.97;
  }
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border-radius: var(--r-2); /* 14 - 6 */
  font-size: var(--fs-14);
  color: var(--ink-2);
  text-align: left;
}
.menu-item .i {
  color: var(--ink-3);
}
.menu-item:hover {
  background: var(--hover);
  color: var(--ink);
}
.menu-item .count,
.menu-item .end {
  margin-left: auto;
}
.menu-sep {
  height: 1px;
  margin: 6px 4px;
  background: var(--line);
}

.menu-item[aria-current='page'] {
  background: var(--surface-3);
  color: var(--ink);
}
/* ---------------------------------------------------------------- page layout */
.page {
  width: 100%;
  max-width: calc(var(--page) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 28px var(--gutter) 64px;
}
.page.is-wide {
  max-width: none;
}
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 20px;
  margin-bottom: 24px;
}
.page-head .t-small {
  margin-top: 6px;
}
.section {
  margin-top: 40px;
}
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 16px;
  margin-bottom: 12px;
}
.section-head .t-h2 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ---------------------------------------------------------------- shared: the game header extras */
.side-close {
  display: none;
}
@media (max-width: 1023px) {
  .side-close {
    display: inline-grid;
  }
}
.topbar .status {
  margin-right: 2px;
}

/* ---------------------------------------------------------------- tablet and phone */
@media (max-width: 1023px) {
  :root {
    --gutter: 20px;
  }
  .app {
    grid-template-columns: minmax(0, 1fr);
  }
  .side {
    position: fixed;
    z-index: 50;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(300px, 86vw);
    box-shadow: var(--shadow-pop);
    translate: -100% 0;
    transition: translate 260ms var(--ease-out);
  }
  .side:not(.is-open) {
    box-shadow: none;
    visibility: hidden;
    transition: translate 260ms var(--ease-out), visibility 0s 260ms;
  }
  .side.is-open {
    translate: 0 0;
  }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 8px;
    height: var(--bar-h);
    padding: 0 10px;
    background: color-mix(in srgb, var(--bg) 90%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }
  .topbar .where {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    font-weight: 600;
    font-size: var(--fs-15);
  }
  .topbar .icon-btn {
    width: 40px;
    height: 40px;
  }
  .game-head {
    top: var(--bar-h);
    padding-top: 2px;
  }
}
@media (max-width: 720px) {
  :root {
    --gutter: 16px;
  }
  .t-display {
    font-size: 30px;
  }
  .t-title {
    font-size: 26px;
  }
  .game-head .game-id {
    display: none;
  }
  .game-head {
    gap: 0;
  }
  .tab {
    height: 42px;
    padding: 0 9px;
    font-size: var(--fs-14);
  }
  .tab .i {
    display: none;
  }
  .tab.is-more .i {
    display: block;
  }
  .page {
    padding-top: 20px;
  }
}

/* ---------------------------------------------------------------- the app's frame */
.view {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.view:focus {
  outline: none;
}
.view > * {
  min-width: 0;
}
.game {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.game-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.side > nav {
  display: grid;
  gap: 1px;
}
.nav-row {
  width: 100%;
  text-align: left;
}
.side-games {
  display: grid;
  gap: 1px;
}
.game-row[aria-current='page'] {
  background: var(--surface-3);
  color: var(--ink);
}
.game-row .end .t-tiny {
  color: var(--ink-4);
}
.side-foot .who {
  border-radius: var(--r-2);
  padding: 2px 4px;
  margin: -2px -4px;
}
.side-foot a.who:hover b {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.side-foot .who .is-warn {
  color: oklch(var(--tone-ink-l) var(--tone-ink-c) var(--hue-amber));
}
.side-foot .who .is-bad {
  color: oklch(var(--tone-ink-l) var(--tone-ink-c) var(--hue-red));
}
.side-foot .icon-btn + .icon-btn {
  margin-left: 0;
}
.side-scrim {
  z-index: 45;
}
.topbar .where .trunc {
  font-weight: 600;
}
.game-facts .btn {
  margin-left: 2px;
}
.tabs {
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar {
  display: none;
}
.tab .count {
  margin-left: -2px;
}
.tab.is-more[aria-current='page']::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--ink);
}
.tab.is-more[aria-current='page'] {
  color: var(--ink);
}
.tab .flag {
  width: 6px;
  height: 6px;
}
.tab-sep {
  width: 1px;
  height: 18px;
  margin: 0 4px;
  background: var(--line-2);
  flex: none;
}
.is-stale .side-foot .who span::before {
  content: '';
}
.skip {
  position: fixed;
  z-index: 100;
  left: 12px;
  top: 12px;
}
.skip:not(:focus) {
  clip-path: inset(50%);
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
}
main:focus {
  outline: none;
}
