/* The game page (/<slug>): concept A, "Slim bar". Layout and the page's own states, on the design-system tokens and
   components (/shared/cv-tokens.css, /shared/cv-components.css: .cv-game-bar, .cv-link, .cv-rank-empty). Nothing here
   applies outside body.page-game.cv-ds. One thin bar over a full-bleed frame; the game inside the frame is untouched.
   The element names game.js reads (#game, .game-bar, .game-bar__links, .game-tag, .game-notice*) are kept. */

.page-game.cv-ds {
  box-sizing: border-box;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  background: var(--color-bg);
  color: var(--color-text);
  font: var(--weight-regular) var(--text-body)/var(--leading-body) var(--font-body);
}
.page-game.cv-ds *, .page-game.cv-ds *::before, .page-game.cv-ds *::after { box-sizing: border-box; }
.page-game.cv-ds [hidden] { display: none !important; }
.page-game.cv-ds ::selection { background: var(--color-primary); color: var(--color-on-primary); }

/* the frame: full bleed under the bar */
.page-game.cv-ds .game-stage {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: var(--color-bg);
}

/* the version tag in the bar (shared/card.js tagChip + game.js): the design system's coin tag, small. It keeps its
   width while it says COPIED, and never pushes TREE / INDEX off the bar (the name gives way first). */
.page-game.cv-ds .game-bar .game-tag {
  flex: none;
  width: auto;
  min-width: 0;
  min-height: 0;
  max-width: 40vw;
  padding: .55em .8em;
  border: 0;
  border-radius: var(--radius-tag);
  background: var(--material-tag);
  color: var(--color-take);
  font: var(--weight-regular) 13px/1 var(--font-display);
  letter-spacing: var(--tracking-tag);
  text-transform: none;
  white-space: nowrap;
  overflow: hidden;
  box-shadow: none;
  transform: none;
  cursor: copy;
  transition: background var(--duration-press) var(--ease-standard);
}
.page-game.cv-ds .game-bar .game-tag :is(.tag__prefix, .tag__name) { color: var(--color-take); overflow-wrap: normal; }
.page-game.cv-ds .game-bar button.game-tag:is(:hover, :active) { background: var(--material-tag-hover); border: 0; box-shadow: none; transform: none; }
.page-game.cv-ds .game-bar button.game-tag:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); box-shadow: none; }
.page-game.cv-ds .game-bar button.game-tag.tag--copied,
.page-game.cv-ds .game-bar button.game-tag.tag--copied:hover { background: var(--color-take); color: var(--color-on-take); animation: none; }
.page-game.cv-ds .game-bar .game-tag .tag__copied { color: var(--color-on-take); }
.page-game.cv-ds .game-bar .game-tag.tag--none { cursor: default; background: var(--color-surface-sunken); color: var(--color-text-muted); font-family: var(--font-body); }

/* a new version went live: the tag flashes once in its own coin */
.page-game.cv-ds .game-tag--fresh { animation: game-tag-fresh 1.6s var(--ease-standard) 1; }
@keyframes game-tag-fresh {
  0% { box-shadow: 0 0 0 0 var(--color-take); }
  35% { box-shadow: 0 0 0 4px var(--color-take-tint-hover), 0 0 22px var(--color-take); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* the "New version deployed" notice under the bar: a flat raised panel, a bar along its foot in the tree's fruit colour
   (game.js sets --notice-glow from the tree's palette), polite and self-dismissing */
.page-game.cv-ds .game-notice {
  position: fixed;
  z-index: 20;
  top: calc(env(safe-area-inset-top, 0px) + 60px + var(--space-4));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: max-content;
  max-width: min(92vw, 640px);
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--color-surface-raised);
  box-shadow: inset 0 -3px 0 var(--notice-glow, var(--color-primary));
  color: var(--color-text);
  animation: game-notice-in .35s var(--ease-standard);
}
.page-game.cv-ds .game-notice__text { margin: 0; font: var(--weight-regular) var(--text-small)/1.4 var(--font-body); }
.page-game.cv-ds .game-notice__text b { font-weight: var(--weight-semibold); color: var(--color-primary); }
.page-game.cv-ds .game-notice__text code { font: var(--weight-regular) var(--text-xs)/1 var(--font-display); color: var(--color-take); }
.page-game.cv-ds .game-notice__about {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: var(--space-1);
  color: var(--color-text-muted);
  font: var(--weight-regular) var(--text-xs)/1.45 var(--font-body);
  overflow-wrap: anywhere;
}
.page-game.cv-ds .game-notice__about--open { display: block; overflow: visible; }
.page-game.cv-ds .game-notice__more {
  display: block;
  width: fit-content;
  margin: var(--space-1) 0 0;
  padding: 0 0 2px;
  border: 0;
  background: none;
  color: var(--color-link);
  font: var(--weight-medium) var(--text-eyebrow)/1.2 var(--font-body);
  box-shadow: inset 0 -2px 0 var(--color-link-underline);
  cursor: pointer;
}
.page-game.cv-ds .game-notice__more:hover { box-shadow: inset 0 -2px 0 var(--color-primary); }
.page-game.cv-ds .game-notice__more:focus-visible { outline: var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-xs); }
.page-game.cv-ds .game-notice__close {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-primary-strong);
  font: var(--weight-medium) 18px/1 var(--font-body);
  cursor: pointer;
}
.page-game.cv-ds .game-notice__close:hover { background: var(--color-surface-sunken); }
.page-game.cv-ds .game-notice__close:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
@keyframes game-notice-in { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* the copy fallback toast (shared/card.js makes #tag-toast.toast when the browser refuses to copy) */
.page-game.cv-ds .toast {
  position: fixed;
  z-index: 40;
  left: var(--toast-left, 50%);
  top: var(--toast-top, 8px);
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
  margin: 0;
  padding: var(--space-3) var(--space-5);
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-surface-raised);
  color: var(--color-text);
  font: var(--weight-regular) var(--text-small)/1.3 var(--font-body);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-fade) var(--ease-standard);
}
.page-game.cv-ds .toast.toast--shown { opacity: 1; }

/* not playable yet: the empty-state box, centred where the frame would be */
.page-game.cv-ds .game-empty {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--space-5);
  min-height: 0;
  padding: var(--space-gutter);
}
.page-game.cv-ds .game-empty__box {
  justify-items: center;
  max-width: min(calc(46ch + var(--space-6) + var(--space-6)), 100%);
  text-align: center;
}
/* the cabinet: an arcade machine with nothing on its screen (the picture the not-playable page has always shown),
   in design-system colours: flat tones, a dark screen with a faint mint glow, one mint button as the only accent */
.page-game.cv-ds .game-cabinet {
  display: grid;
  gap: var(--space-3);
  width: min(260px, 60vw);
  padding: var(--space-4);
  border: 1px solid var(--color-surface-raised);
  border-radius: var(--radius-xl);
  background: var(--color-surface);
}
.page-game.cv-ds .game-cabinet__screen {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--color-surface-sunken);
  box-shadow: inset 0 0 0 1px var(--color-surface-raised);
}
.page-game.cv-ds .game-cabinet__screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(110% 85% at 50% 42%, var(--color-primary-tint) 0%, transparent 70%);
}
.page-game.cv-ds .game-cabinet__led {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border-radius: var(--radius-pill);
  background: var(--color-idle);
}
.page-game.cv-ds .game-cabinet__panel { display: flex; align-items: center; gap: var(--space-2); }
.page-game.cv-ds .game-cabinet__panel i {
  width: 14px;
  height: 14px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-raised);
}
.page-game.cv-ds .game-cabinet__panel i:first-child { background: var(--color-primary); box-shadow: 0 3px 0 var(--color-primary-edge); }
.page-game.cv-ds .game-cabinet__panel b {
  width: 48px;
  height: 10px;
  margin-left: auto;
  border-radius: var(--radius-pill);
  background: var(--color-surface-sunken);
}
.page-game.cv-ds .game-empty__state { color: var(--color-text-muted); }
.page-game.cv-ds .game-empty__note { margin: 0; color: var(--color-text-muted); }

/* phone: the bar keeps the mark, the name and the two links; the tag stays on wider screens (it is in the notice too) */
@media (max-width: 600px) {
  .page-game.cv-ds .game-bar .game-tag { display: none; }
  .page-game.cv-ds .game-notice { top: calc(env(safe-area-inset-top, 0px) + 56px + var(--space-3)); }
}

@media (prefers-reduced-motion: reduce) {
  .page-game.cv-ds .game-tag--fresh, .page-game.cv-ds .game-notice { animation: none; }
  .page-game.cv-ds .game-bar .game-tag, .page-game.cv-ds .toast { transition: none; }
}
