/* One glass frame over the world: top bar, sections at the left, content at the right.
   The glass is a pre-blurred copy of the scene (img/bg-frame.webp = bg.webp with .scene::after, blur 28px at 1920 wide,
   saturate 1.2) laid exactly over the scene, not a live backdrop-filter: a live full-screen blur made Chromium repaint the
   whole window on every frame, which in the game costs a full-size texture upload per frame. */
.frame {
  /* The scene is a 16:9 image covering the viewport; the same box, measured from the frame's border edge. */
  --scene-w: max(100vw, calc(100vh * 16 / 9));
  --scene-h: max(100vh, calc(100vw * 9 / 16));
  position: fixed;
  inset: var(--frame-gap);
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  grid-template-rows: var(--header-h) minmax(0, 1fr);
  grid-template-areas: "top top" "side main";
  border-radius: var(--r-xl);
  background:
    linear-gradient(var(--glass), var(--glass)),
    url(../img/bg-frame.webp) calc((100vw - var(--scene-w)) / 2 - var(--frame-gap)) calc((100vh - var(--scene-h)) / 2 - var(--frame-gap)) / var(--scene-w) var(--scene-h) no-repeat;
  background-origin: border-box;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-frame);
  overflow: hidden;
  animation: frame-in 0.55s var(--ease) both;
}
/* Fade only: the baked glass must stay registered with the scene under it, so the frame is never scaled. */
@keyframes frame-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── top bar ─────────────────────────────────────────────── */
.topbar {
  grid-area: top;
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr) auto;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-right: 1.25rem;
}
.brand { display: flex; align-items: center; height: 100%; padding-left: 1.5rem; }
.brand img { height: 2.9rem; width: auto; }
.top-mid { display: flex; align-items: center; justify-content: center; gap: 1.5rem; min-width: 0; }
.clock { display: flex; flex-direction: column; justify-content: center; line-height: 1.2; }
.clock b { font-weight: 600; font-size: 1.0625rem; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.clock span { font-size: 0.8125rem; color: var(--text-2); white-space: nowrap; }
.locator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-left: 1.5rem;
  border-left: 1px solid var(--line);
  font-size: 0.8125rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.locator .dot { width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 0.25rem var(--mint-soft); animation: pulse 2.4s ease-in-out infinite; }
.locator b { color: var(--text-2); font-weight: 500; }
.top-right { display: flex; align-items: center; gap: 0.625rem; }
.who {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 3.1rem;
  padding: 0 0.9rem 0 0.4rem;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
}
.avatar {
  position: relative;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 0.6rem;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1rem;
  color: var(--on-light);
  background: linear-gradient(135deg, #eef1f6, #b6bfcd);
  flex: none;
  overflow: hidden;
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.who-name { font-weight: 600; font-size: 0.9rem; line-height: 1.15; white-space: nowrap; }
.who-role { font-size: 0.75rem; color: var(--text-3); white-space: nowrap; }
.who-sep { width: 1px; height: 1.9rem; background: var(--line-2); margin: 0 0.15rem; }
.who-bal { display: flex; flex-direction: column; justify-content: center; gap: 0.15rem; font-variant-numeric: tabular-nums; }
.who-bal span { display: flex; align-items: center; gap: 0.4rem; font-weight: 600; font-size: 0.875rem; line-height: 1.1; white-space: nowrap; }
.who-bal .ic { width: 0.95rem; height: 0.95rem; }
.who-bal .money-line .ic { color: var(--ruby); }
.who-bal .pts-line { font-size: 0.8125rem; }
.who-bal .pts-line .ic { color: var(--gold); }
.top-right .btn-icon { width: 3.1rem; height: 3.1rem; border-radius: var(--r-md); }

/* ── sections ────────────────────────────────────────────── */
.side { grid-area: side; display: flex; flex-direction: column; padding: 1.125rem 0.9rem 1rem; min-height: 0; }
.nav { display: flex; flex-direction: column; gap: 0.35rem; overflow-y: auto; min-height: 0; padding-right: 0.125rem; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  height: 2.9rem;
  padding: 0 1.1rem;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  font-weight: 500;
  font-size: 0.95rem;
  text-align: left;
  width: 100%;
  flex: none;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.nav-item .ic { width: 1.2rem; height: 1.2rem; color: var(--text-3); transition: color var(--t-fast); }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item:hover .ic { color: var(--text-2); }
.nav-item[aria-current="page"] {
  background: var(--surface-3);
  border-color: var(--line-2);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset;
}
.nav-item[aria-current="page"] .ic { color: var(--text); }
/* a hint is waiting in the section (the sunset hint of «Крафт»): a quiet dot, no number */
.nav-dot { margin-left: auto; width: 0.5rem; height: 0.5rem; flex: none; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.nav-count {
  margin-left: auto;
  min-width: 1.3rem;
  height: 1.3rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--ruby);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.side-foot { margin-top: auto; padding-top: 0.75rem; display: flex; flex-direction: column; gap: 0.625rem; }
.keys { display: flex; gap: 0.75rem; font-size: 0.7rem; color: var(--text-4); padding: 0 0.6rem; flex-wrap: wrap; }
.keys kbd { font: 600 0.65rem var(--font); padding: 0.1rem 0.35rem; border: 1px solid var(--line-2); border-radius: 0.3rem; color: var(--text-3); margin-right: 0.15rem; }

/* ── content ─────────────────────────────────────────────── */
.main { grid-area: main; display: grid; grid-template-columns: minmax(0, 1fr); min-height: 0; position: relative; }
.main.has-aside { grid-template-columns: minmax(0, 1fr) var(--aside-w); }
.content { overflow-y: auto; overflow-x: hidden; padding: 1.75rem 2.25rem 2.25rem 1.75rem; min-height: 0; }
.aside { overflow-y: auto; min-height: 0; padding: 1.75rem 1.75rem 2.25rem 0; display: flex; flex-direction: column; gap: 1rem; }
/* the entrance plays once per section change, not on every data refresh */
.main.fresh .content > * { animation: rise 0.45s var(--ease) both; }
.main.fresh .content > *:nth-child(2) { animation-delay: 0.04s; }
.main.fresh .content > *:nth-child(3) { animation-delay: 0.08s; }
.main.fresh .content > *:nth-child(4) { animation-delay: 0.12s; }
.main.fresh .content > *:nth-child(5) { animation-delay: 0.16s; }
.main.fresh .content > *:nth-child(n + 6) { animation-delay: 0.2s; }
.main.fresh .aside > * { animation: rise 0.45s var(--ease) 0.1s both; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.25rem; margin-bottom: 1.5rem; }
.page-title { font-size: 2.5rem; font-weight: 600; letter-spacing: -0.025em; line-height: 1.05; }
.page-sub { margin-top: 0.45rem; color: var(--text-2); font-size: 1rem; max-width: 46rem; }
.page-actions { display: flex; gap: 0.5rem; align-items: center; flex: none; padding-bottom: 0.35rem; }

/* where the player stands (state.place, js/place.js): one quiet line over the page head and the aside, only the pin
   in colour, never taller than one line; no controls — it goes when the server stops sending the place */
.main.has-place { grid-template-rows: auto minmax(0, 1fr); }
.main.has-place .content, .main.has-place .aside { padding-top: 0.75rem; }
.place-bar {
  grid-column: 1 / -1;
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: fit-content;
  max-width: calc(100% - 4rem);
  height: 1.875rem;
  margin: 1.125rem 2.25rem 0 1.75rem;
  padding: 0 0.8rem 0 0.65rem;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.8125rem;
  color: var(--text-2);
  white-space: nowrap;
  animation: rise 0.45s var(--ease) both;
}
.place-bar .ic { width: 1rem; height: 1rem; color: var(--sky); }
.place-bar b, .place-bar b + span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* short of room, the name gives way first: the player knows where they clicked, the line says what is due there */
.place-bar b { flex: 0 3 auto; font-weight: 600; color: var(--text); }
.place-bar b + span::before { content: "·"; margin-right: 0.5rem; color: var(--text-3); }

/* floating status: connection, delays */
.notice {
  position: absolute;
  top: 0.875rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: min(46rem, calc(100% - 3rem));
  padding: 0.5rem 0.875rem;
  border-radius: var(--r-md);
  background: var(--glass-strong);
  border: 1px solid rgba(240, 169, 74, 0.35);
  color: var(--text);
  font-size: 0.8125rem;
  box-shadow: var(--shadow-pop);
  animation: rise 0.3s var(--ease) both;
}
.notice.info { border-color: rgba(116, 184, 255, 0.35); }
.notice .ic { color: var(--amber); }
.notice.info .ic { color: var(--sky); }

@media (max-width: 1100px) {
  .main.has-aside { display: block; overflow-y: auto; }
  .main.has-aside .content, .main.has-aside .aside { overflow: visible; }
  .main.has-aside .aside { padding: 0 2.25rem 2.25rem 1.75rem; }
  .locator { display: none; }
}
