/**
 * RoccOS Win98 Game Chrome — see js/core/game-chrome.js
 *
 * In-window menu bar + dropdowns, flex body, sunken status bar and a small
 * modal message box. Uses the shared --win98-* tokens (tokens.css) so it
 * matches the title bars, taskbar, Start menu and context menu. Every cursor
 * routes through the --cur-* tokens plus the --crt-cursor intent token.
 */

.gc-root {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--win98-face);
  color: var(--win98-text);
  font-family: var(--font-system);
  font-size: 12px;
  line-height: 1.2;
  user-select: none;
  -webkit-user-select: none;
  cursor: var(--cur-arrow); --crt-cursor: arrow;
}

.gc-root [hidden] { display: none !important; }

/* ── Menu bar ── */
.gc-menubar {
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 1px 2px;
  background: var(--win98-face);
  box-shadow: inset 0 -1px 0 var(--win98-shadow), 0 1px 0 var(--win98-light);
  position: relative;
  z-index: 2;
}

.gc-menu-btn {
  appearance: none;
  border: 0;
  border-radius: 0;
  margin: 0;
  padding: 3px 7px;
  background: transparent;
  color: var(--win98-text);
  font: inherit;
  letter-spacing: 0;
  text-transform: none;
  cursor: var(--cur-arrow); --crt-cursor: arrow;
}

.gc-menu-btn u,
.gc-label u {
  text-decoration: underline;
  text-underline-offset: 1px;
}

/* Win98 menu bar: hovering shows a thin raised box; open = sunken. */
.gc-menu-btn:hover {
  box-shadow: inset -1px -1px 0 var(--win98-shadow), inset 1px 1px 0 var(--win98-light);
}

.gc-menu-btn.is-open {
  box-shadow: inset 1px 1px 0 var(--win98-shadow), inset -1px -1px 0 var(--win98-light);
}

.gc-menu-btn:focus-visible {
  outline: 1px dotted var(--win98-text);
  outline-offset: -3px;
}

/* ── Dropdowns ── */
.gc-dropdown {
  position: absolute;
  z-index: 20;
  min-width: 160px;
  padding: 2px;
  background: var(--win98-face);
  box-shadow:
    inset -1px -1px 0 var(--win98-dark),
    inset 1px 1px 0 var(--win98-hilight),
    inset -2px -2px 0 var(--win98-shadow),
    inset 2px 2px 0 var(--win98-light),
    2px 2px 0 rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  animation: gc-menu-in 140ms var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1));
  transform-origin: top left;
}

@keyframes gc-menu-in {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: translateY(0); }
}

.gc-menu-item {
  appearance: none;
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 4px;
  width: 100%;
  margin: 0;
  padding: 3px 10px 3px 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--win98-text);
  font: inherit;
  text-align: left;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  cursor: var(--cur-arrow); --crt-cursor: arrow;
}

.gc-menu-item:hover,
.gc-menu-item:focus-visible,
.gc-menu-item.is-open {
  background: var(--win98-select);
  color: var(--win98-select-text);
  outline: none;
}

.gc-menu-item.is-disabled,
.gc-menu-item.is-disabled:hover {
  background: transparent;
  color: var(--win98-shadow);
  text-shadow: 1px 1px 0 var(--win98-light);
  cursor: var(--cur-arrow); --crt-cursor: arrow;
}

.gc-check {
  text-align: center;
  font-weight: 700;
}

.gc-shortcut {
  padding-left: 18px;
  text-align: right;
}

.gc-shortcut.gc-arrow {
  font-size: 8px;
}

.gc-sep {
  height: 2px;
  margin: 3px 2px;
  background: linear-gradient(to bottom, var(--win98-shadow) 50%, var(--win98-light) 50%);
}

/* ── Body ── */
.gc-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* ── Status bar ── */
.gc-status {
  flex: 0 0 auto;
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--win98-face);
  box-shadow: inset 0 1px 0 var(--win98-light);
}

.gc-status-cell {
  flex: 1 1 0;
  min-width: 0;
  padding: 2px 6px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  box-shadow: inset 1px 1px 0 var(--win98-shadow), inset -1px -1px 0 var(--win98-light);
  font-variant-numeric: tabular-nums;
}

/* ── Win98 push button (message box OK, game prompts) ── */
.gc-btn {
  appearance: none;
  min-width: 75px;
  padding: 4px 12px;
  border: 0;
  border-radius: 0;
  background: var(--win98-face);
  color: var(--win98-text);
  font: inherit;
  letter-spacing: 0;
  text-transform: none;
  box-shadow:
    inset -1px -1px 0 var(--win98-dark),
    inset 1px 1px 0 var(--win98-light),
    inset -2px -2px 0 var(--win98-shadow),
    inset 2px 2px 0 var(--win98-hilight);
  cursor: var(--cur-hand); --crt-cursor: hand;
}

.gc-btn:active {
  box-shadow:
    inset 1px 1px 0 var(--win98-dark),
    inset -1px -1px 0 var(--win98-light),
    inset 2px 2px 0 var(--win98-shadow),
    inset -2px -2px 0 var(--win98-hilight);
}

.gc-btn:focus-visible {
  outline: 1px dotted var(--win98-text);
  outline-offset: -5px;
}

/* ── Message box ── */
.gc-modal-scrim {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(0, 0, 0, 0.12);
}

.gc-msgbox {
  width: min(320px, 100%);
  background: var(--win98-face);
  box-shadow:
    inset -1px -1px 0 var(--win98-dark),
    inset 1px 1px 0 var(--win98-hilight),
    inset -2px -2px 0 var(--win98-shadow),
    inset 2px 2px 0 var(--win98-light),
    3px 3px 0 rgba(0, 0, 0, 0.3);
  padding: 3px;
  animation: gc-box-in 200ms var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1));
}

@keyframes gc-box-in {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

.gc-msgbox-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 20px;
  padding: 0 2px 0 6px;
  background: var(--win98-select);
  color: var(--win98-select-text);
  font-weight: 700;
}

.gc-msgbox-x {
  appearance: none;
  width: 16px;
  height: 14px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--win98-face);
  color: var(--win98-dark);
  font: 700 11px/1 var(--font-system);
  box-shadow:
    inset -1px -1px 0 var(--win98-dark),
    inset 1px 1px 0 var(--win98-light),
    inset -2px -2px 0 var(--win98-shadow),
    inset 2px 2px 0 var(--win98-hilight);
  cursor: var(--cur-hand); --crt-cursor: hand;
}

.gc-msgbox-x::after { content: '\00d7'; }

.gc-msgbox-body {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 12px 8px;
}

.gc-msgbox-icon {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
}

.gc-msgbox-text p {
  margin: 0 0 6px;
  user-select: text;
  -webkit-user-select: text;
}

.gc-msgbox-actions {
  display: flex;
  justify-content: center;
  padding: 4px 0 8px;
}

/* ── Host contexts ── */

/* Mobile springboard: the app view content normally sizes to its content and
   centres; a game frame should fill the view instead. */
.mob-appview-content:has(> .gc-root) {
  flex: 1 1 auto;
  margin: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.mob-appview-content > .gc-root {
  flex: 1 1 auto;
}

/* Coarse pointers: roomier menu targets. */
@media (pointer: coarse) {
  .gc-menu-btn { padding: 8px 12px; }
  .gc-menu-item { padding: 8px 12px 8px 4px; }
}

/* /accordion launcher panels are flow layout (height: auto) — give the frame
   a definite height so the body has something to fill. */
.launcher-panel .gc-root {
  height: min(78vh, 560px);
}

@media (prefers-reduced-motion: reduce) {
  .gc-dropdown,
  .gc-msgbox { animation: none; }
}
