/* ==========================================================================
   smy-system.css — SmyFamilyGames design system (Apple-native)

   Single source of truth for tokens: type, color, radius, material, motion.
   System fonts only. Loaded BEFORE styles.css; context classes
   (.smy-controller / .smy-display) carry enough specificity to win over the
   legacy global body styles that ship later in the cascade.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens — light (default)
   -------------------------------------------------------------------------- */

:root {
  color-scheme: dark;

  /* Fonts ---------------------------------------------------------------- */
  --font-text: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro",
    system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro",
    system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-rounded: ui-rounded, "SF Pro Rounded", "SF Compact Rounded",
    -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Type scale ----------------------------------------------------------- */
  --size-large-title: 34px;
  --leading-large-title: 41px;
  --tracking-large-title: -0.4px;

  --size-title1: 28px;
  --leading-title1: 34px;
  --tracking-title1: -0.34px;

  --size-title2: 22px;
  --leading-title2: 28px;
  --tracking-title2: -0.26px;

  --size-title3: 20px;
  --leading-title3: 25px;
  --tracking-title3: 0px;

  --size-headline: 17px;
  --leading-headline: 22px;
  --tracking-headline: 0px;

  --size-body: 17px;
  --leading-body: 22px;

  --size-callout: 16px;
  --leading-callout: 21px;

  --size-subhead: 15px;
  --leading-subhead: 20px;

  --size-footnote: 13px;
  --leading-footnote: 18px;

  --size-caption1: 12px;
  --leading-caption1: 16px;

  --size-caption2: 11px;
  --leading-caption2: 13px;

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-heavy: 800;

  /* System colors — dark (site default, Apple HIG) ---------------------- */
  --accent: #0A84FF;
  --accent-pressed: #0A6FD1;
  --accent-tint: rgba(10, 132, 255, 0.22);

  --green: #30D158;
  --red: #FF453A;
  --orange: #FF9F0A;
  --yellow: #FFD60A;
  --indigo: #5E5CE6;
  --pink: #FF375F;
  --teal: #40C8E0;
  --mint: #63E6E2;

  /* Labels --------------------------------------------------------------- */
  --label-primary: #FFFFFF;
  --label-secondary: rgba(235, 235, 245, 0.60);
  --label-tertiary: rgba(235, 235, 245, 0.30);
  --label-quaternary: rgba(235, 235, 245, 0.18);
  --label-on-accent: #FFFFFF;

  /* Backgrounds ---------------------------------------------------------- */
  --bg-grouped: #000000;
  --bg-grouped-secondary: #1C1C1E;
  --bg-elevated: #1C1C1E;
  --bg-base: #000000;

  /* Fills ---------------------------------------------------------------- */
  --fill-primary: rgba(120, 120, 128, 0.36);
  --fill-secondary: rgba(120, 120, 128, 0.32);
  --fill-tertiary: rgba(118, 118, 128, 0.24);
  --fill-quaternary: rgba(118, 118, 128, 0.18);

  /* Separators ----------------------------------------------------------- */
  --separator: rgba(84, 84, 88, 0.65);
  --separator-opaque: #38383A;
  --hairline: 0.5px;

  /* Materials ------------------------------------------------------------ */
  --material-thin: rgba(30, 30, 32, 0.72);
  --material-regular: rgba(28, 28, 30, 0.82);
  --material-thick: rgba(24, 24, 26, 0.94);
  --material-blur: saturate(180%) blur(20px);

  /* Player seat colors --------------------------------------------------- */
  --player-0: #0A84FF;
  --player-1: #30D158;
  --player-2: #FF9F0A;
  --player-3: #FF375F;
  --player-4: #5E5CE6;
  --player-5: #40C8E0;
  --player-6: #FF453A;
  --player-7: #FFD60A;

  /* Radii ---------------------------------------------------------------- */
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  /* Elevation ------------------------------------------------------------ */
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-sheet: 0 -2px 12px rgba(0, 0, 0, 0.6), 0 -24px 60px rgba(0, 0, 0, 0.7);

  /* Motion --------------------------------------------------------------- */
  --ease-smy: cubic-bezier(0.32, 0.72, 0, 1);
  --dur-fast: 200ms;
  --dur-med: 300ms;
  --dur-slow: 400ms;
  --press-scale: 0.96;

  /* Layout --------------------------------------------------------------- */
  --gutter: 20px;
  --stack-gap: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --tap-min: 44px;
}

/* Dark is the default. Light remains available via html.smy-light. */

/* --------------------------------------------------------------------------
   3. Contexts — controller (phone) and display (TV)
   -------------------------------------------------------------------------- */

body.smy-controller,
body.smy-display {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-text);
  font-size: var(--size-body);
  line-height: var(--leading-body);
  font-weight: var(--weight-regular);
  color: var(--label-primary);
  background: var(--bg-grouped);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior: none;
}

body.smy-controller {
  padding:
    calc(var(--safe-top) + 12px)
    calc(var(--safe-right) + var(--gutter))
    calc(var(--safe-bottom) + 12px)
    calc(var(--safe-left) + var(--gutter));
  box-sizing: border-box;
}

body.smy-display {
  padding:
    calc(var(--safe-top) + 32px)
    calc(var(--safe-right) + 40px)
    calc(var(--safe-bottom) + 32px)
    calc(var(--safe-left) + 40px);
  box-sizing: border-box;
  /* TV is read-only furniture: nothing here should invite a tap. */
  cursor: default;
  user-select: none;
}

body.smy-controller *,
body.smy-display * {
  box-sizing: border-box;
}

/* The display sits further away, so everything scales up. */
body.smy-display {
  font-size: clamp(20px, 1.6vw, 28px);
  line-height: 1.35;
}

.smy-controller-main {
  display: block;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding-bottom: calc(var(--safe-bottom) + 8px);
}

.smy-display-main {
  display: block;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}

.smy-display-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.smy-display-header > * {
  margin: 0;
}

.smy-stack {
  display: flex;
  flex-direction: column;
  gap: var(--stack-gap);
}

.smy-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* --------------------------------------------------------------------------
   4. Type utilities
   -------------------------------------------------------------------------- */

.smy-large-title,
.smy-title1,
.smy-title2 {
  font-family: var(--font-display);
}

.smy-large-title {
  font-size: var(--size-large-title);
  line-height: var(--leading-large-title);
  letter-spacing: var(--tracking-large-title);
  font-weight: var(--weight-bold);
  margin: 0;
}

.smy-title1 {
  font-size: var(--size-title1);
  line-height: var(--leading-title1);
  letter-spacing: var(--tracking-title1);
  font-weight: var(--weight-bold);
  margin: 0;
}

.smy-title2 {
  font-size: var(--size-title2);
  line-height: var(--leading-title2);
  letter-spacing: var(--tracking-title2);
  font-weight: var(--weight-semibold);
  margin: 0;
}

.smy-title3 {
  font-size: var(--size-title3);
  line-height: var(--leading-title3);
  letter-spacing: var(--tracking-title3);
  font-weight: var(--weight-semibold);
  margin: 0;
}

.smy-headline {
  font-size: var(--size-headline);
  line-height: var(--leading-headline);
  font-weight: var(--weight-semibold);
  margin: 0;
}

.smy-body {
  font-size: var(--size-body);
  line-height: var(--leading-body);
  font-weight: var(--weight-regular);
  margin: 0;
}

.smy-callout {
  font-size: var(--size-callout);
  line-height: var(--leading-callout);
  margin: 0;
}

.smy-subhead {
  font-size: var(--size-subhead);
  line-height: var(--leading-subhead);
  margin: 0;
}

.smy-footnote {
  font-size: var(--size-footnote);
  line-height: var(--leading-footnote);
  margin: 0;
}

.smy-caption1 {
  font-size: var(--size-caption1);
  line-height: var(--leading-caption1);
  margin: 0;
}

.smy-caption2 {
  font-size: var(--size-caption2);
  line-height: var(--leading-caption2);
  margin: 0;
}

.smy-rounded { font-family: var(--font-rounded); }
.smy-mono { font-family: var(--font-mono); }

.smy-label-secondary { color: var(--label-secondary); }
.smy-label-tertiary { color: var(--label-tertiary); }
.smy-accent { color: var(--accent); }
.smy-positive { color: var(--green); }
.smy-negative { color: var(--red); }
.smy-center { text-align: center; }

.tabular,
.smy-tabular,
.smy-timer-label,
.smy-score-value,
.smy-scoreboard,
.smy-room-code {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* --------------------------------------------------------------------------
   5. Materials
   -------------------------------------------------------------------------- */

.smy-material {
  background: var(--material-thick);
}

@supports ((-webkit-backdrop-filter: blur(20px)) or (backdrop-filter: blur(20px))) {
  .smy-material {
    background: var(--material-regular);
    -webkit-backdrop-filter: var(--material-blur);
    backdrop-filter: var(--material-blur);
  }
}

/* --------------------------------------------------------------------------
   6. Phase header, room code, QR
   -------------------------------------------------------------------------- */

.smy-phase-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: 560px;
  margin: 0 auto 20px;
}

.smy-phase-header > div:first-child {
  min-width: 0;
}

.smy-room-code {
  font-family: var(--font-rounded);
  font-size: 52px;
  line-height: 1.04;
  letter-spacing: 0.14em;
  font-weight: var(--weight-heavy);
  text-indent: 0.14em; /* keeps the tracked block optically centered */
  color: var(--label-primary);
  margin: 2px 0 0;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-smy),
    color var(--dur-fast) var(--ease-smy);
}

.smy-room-code:active {
  transform: scale(var(--press-scale));
}

.smy-room-code.is-copied {
  color: var(--green);
}

.smy-room-code-display {
  font-size: clamp(72px, 12vw, 180px);
  letter-spacing: 0.1em;
  text-indent: 0.1em;
  cursor: default;
}

.smy-room-code-display:active {
  transform: none;
}

.smy-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.smy-qr:empty {
  display: none;
}

.smy-qr canvas,
.smy-qr img,
.smy-qr svg {
  display: block;
  border-radius: var(--radius-sm);
}

.smy-join-url {
  word-break: break-all;
  text-align: center;
  color: var(--accent);
  font-weight: var(--weight-medium);
}

/* --------------------------------------------------------------------------
   7. Buttons
   -------------------------------------------------------------------------- */

.smy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap-min);
  padding: 13px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-text);
  font-size: var(--size-headline);
  line-height: var(--leading-headline);
  font-weight: var(--weight-semibold);
  color: var(--label-primary);
  background: var(--fill-tertiary);
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
  transition: transform var(--dur-fast) var(--ease-smy),
    background-color var(--dur-fast) var(--ease-smy),
    opacity var(--dur-fast) var(--ease-smy);
}

.smy-btn:active:not(:disabled) {
  transform: scale(var(--press-scale));
}

.smy-btn:disabled,
.smy-btn[aria-disabled="true"] {
  opacity: 0.4;
  cursor: not-allowed;
}

.smy-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.smy-btn-primary {
  color: var(--label-on-accent);
  background: var(--accent);
}

.smy-btn-primary:active:not(:disabled) {
  background: var(--accent-pressed);
}

.smy-btn-secondary {
  color: var(--accent);
  background: var(--fill-tertiary);
}

.smy-btn-destructive {
  color: #FFFFFF;
  background: var(--red);
}

.smy-btn-plain {
  background: transparent;
  color: var(--accent);
  min-height: 36px;
  padding: 8px 12px;
}

.smy-btn-block {
  width: 100%;
}

a.smy-btn {
  color: inherit;
}

a.smy-btn-primary {
  color: var(--label-on-accent);
  -webkit-text-fill-color: var(--label-on-accent);
}

a.smy-btn-secondary {
  color: var(--accent);
}

a.smy-btn-plain {
  color: var(--accent);
}

/* Thumb zone: primary actions pinned within reach at the bottom. */
.smy-thumb-zone {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
  padding: 12px 0 calc(var(--safe-bottom) + 12px);
  background: linear-gradient(
    to bottom,
    color-mix(in srgb, var(--bg-grouped) 0%, transparent),
    var(--bg-grouped) 28%
  );
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .smy-thumb-zone {
    background: var(--bg-grouped);
  }
}

.smy-thumb-zone .smy-btn {
  width: 100%;
}

/* --------------------------------------------------------------------------
   8. Cards, sheets, waiting, pills
   -------------------------------------------------------------------------- */

.smy-card {
  padding: 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.smy-prompt-card {
  padding: 20px;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.smy-prompt-card .smy-prompt-text {
  font-family: var(--font-display);
  font-size: var(--size-title2);
  line-height: var(--leading-title2);
  letter-spacing: var(--tracking-title2);
  font-weight: var(--weight-semibold);
  margin: 6px 0 0;
}

.smy-eyebrow {
  display: block;
  font-size: var(--size-caption1);
  line-height: var(--leading-caption1);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--label-secondary);
}

.smy-connection-pill {
  position: fixed;
  top: calc(var(--safe-top) + 8px);
  left: 50%;
  z-index: 100;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: var(--size-footnote);
  line-height: var(--leading-footnote);
  font-weight: var(--weight-semibold);
  color: var(--label-primary);
  background: var(--material-thick);
  box-shadow: var(--shadow-card);
  animation: smy-pill-in var(--dur-med) var(--ease-smy);
}

@supports ((-webkit-backdrop-filter: blur(20px)) or (backdrop-filter: blur(20px))) {
  .smy-connection-pill {
    background: var(--material-regular);
    -webkit-backdrop-filter: var(--material-blur);
    backdrop-filter: var(--material-blur);
  }
}

.smy-connection-pill[hidden] {
  display: none;
}

@keyframes smy-pill-in {
  from { opacity: 0; transform: translate(-50%, -12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.smy-sheet {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: var(--gutter);
  padding-bottom: calc(var(--safe-bottom) + var(--gutter));
  background: rgba(0, 0, 0, 0.4);
}

.smy-sheet[hidden] {
  display: none;
}

.smy-sheet-card {
  width: 100%;
  max-width: 480px;
  padding: 24px 20px calc(24px + var(--safe-bottom));
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sheet);
  animation: smy-sheet-up var(--dur-slow) var(--ease-smy);
}

.smy-sheet-card > * + * {
  margin-top: 8px;
}

@keyframes smy-sheet-up {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.smy-waiting {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 20px;
  text-align: center;
  color: var(--label-secondary);
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.smy-waiting-dots {
  display: flex;
  gap: 6px;
}

.smy-waiting-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--label-tertiary);
  animation: smy-bounce 1.2s var(--ease-smy) infinite;
}

.smy-waiting-dots span:nth-child(2) { animation-delay: 0.15s; }
.smy-waiting-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes smy-bounce {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-5px); }
}

.smy-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--size-caption2);
  line-height: 18px;
  font-weight: var(--weight-semibold);
  color: var(--label-secondary);
  background: var(--fill-tertiary);
}

.smy-badge-host {
  color: var(--label-on-accent);
  background: var(--accent);
}

.smy-badge-done {
  color: #FFFFFF;
  background: var(--green);
}

.smy-error {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: var(--size-subhead);
  color: var(--red);
  background: color-mix(in srgb, var(--red) 12%, transparent);
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .smy-error { background: var(--fill-tertiary); }
}

/* --------------------------------------------------------------------------
   9. Player list + avatars
   -------------------------------------------------------------------------- */

.smy-player-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.smy-player {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 16px;
  border-bottom: var(--hairline) solid var(--separator);
  transition: opacity var(--dur-med) var(--ease-smy);
}

.smy-player:last-child {
  border-bottom: none;
}

.smy-player-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: var(--weight-medium);
}

.smy-player-status {
  color: var(--label-tertiary);
}

.smy-player-kick {
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  padding: 6px 0;
}

.smy-save-picker {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

.smy-save-picker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.smy-player.is-away {
  opacity: 0.5;
}

.smy-player.is-me .smy-player-name {
  color: var(--accent);
}

.smy-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-family: var(--font-rounded);
  font-size: var(--size-footnote);
  font-weight: var(--weight-bold);
  letter-spacing: 0.02em;
  color: #FFFFFF;
  background: var(--seat-color, var(--accent));
  text-transform: uppercase;
}

.smy-avatar-away {
  color: var(--label-secondary);
  background: var(--fill-secondary);
  box-shadow: inset 0 0 0 var(--hairline) var(--separator);
}

.smy-avatar-lg {
  width: 56px;
  height: 56px;
  font-size: var(--size-title3);
}

/* --------------------------------------------------------------------------
   10. Timers
   -------------------------------------------------------------------------- */

.smy-timer-bar {
  position: relative;
  flex: 0 0 auto;
  width: 120px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: var(--fill-tertiary);
  overflow: hidden;
}

.smy-timer-bar[hidden] {
  display: none;
}

.smy-timer-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  border-radius: var(--radius-pill);
  background: var(--accent);
  transition: width var(--dur-fast) linear,
    background-color var(--dur-med) var(--ease-smy);
}

.smy-timer-bar.is-urgent .smy-timer-fill {
  background: var(--red);
}

.smy-timer-bar .smy-timer-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--size-footnote);
  font-weight: var(--weight-bold);
  color: var(--label-primary);
  mix-blend-mode: normal;
}

.smy-timer-ring {
  position: relative;
  flex: 0 0 auto;
  width: 140px;
  height: 140px;
}

.smy-timer-ring[hidden] {
  display: none;
}

.smy-timer-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.smy-ring-bg,
.smy-ring-fg {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
}

.smy-ring-bg {
  stroke: var(--fill-tertiary);
}

.smy-ring-fg {
  stroke: var(--accent);
  stroke-dasharray: 339.292;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset var(--dur-fast) linear,
    stroke var(--dur-med) var(--ease-smy);
}

.smy-timer-ring.is-urgent .smy-ring-fg {
  stroke: var(--red);
}

.smy-timer-ring .smy-timer-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: var(--weight-bold);
  color: var(--label-primary);
}

/* --------------------------------------------------------------------------
   11. Inputs
   -------------------------------------------------------------------------- */

.smy-input {
  display: block;
  width: 100%;
  min-height: var(--tap-min);
  padding: 12px 16px;
  border: var(--hairline) solid var(--separator);
  border-radius: var(--radius-sm);
  font-family: var(--font-text);
  font-size: var(--size-body); /* 17px keeps iOS from zooming on focus */
  line-height: var(--leading-body);
  color: var(--label-primary);
  background: var(--bg-elevated);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color var(--dur-fast) var(--ease-smy),
    box-shadow var(--dur-fast) var(--ease-smy);
}

.smy-input::placeholder {
  color: var(--label-tertiary);
}

.smy-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

textarea.smy-input {
  min-height: 110px;
  resize: vertical;
  line-height: 1.4;
}

.smy-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.smy-field-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.smy-field-row .smy-input {
  flex: 1 1 auto;
}

.smy-input-number {
  flex: 0 0 84px;
  text-align: center;
}

.smy-settings {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
}

.smy-settings .smy-field {
  gap: 4px;
}

/* Join screen: one box per room-code character. */
.smy-code-digits {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.smy-code-digits input,
.smy-code-digit {
  width: 60px;
  height: 72px;
  padding: 0;
  border: var(--hairline) solid var(--separator);
  border-radius: var(--radius-md);
  font-family: var(--font-rounded);
  font-size: 36px;
  font-weight: var(--weight-bold);
  text-align: center;
  text-transform: uppercase;
  color: var(--label-primary);
  background: var(--bg-elevated);
  caret-color: var(--accent);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color var(--dur-fast) var(--ease-smy),
    transform var(--dur-fast) var(--ease-smy),
    box-shadow var(--dur-fast) var(--ease-smy);
}

.smy-code-digits input:focus,
.smy-code-digit:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
  transform: scale(1.04);
}

.smy-code-digits input:not(:placeholder-shown),
.smy-code-digit.is-filled {
  border-color: var(--accent);
}

/* --------------------------------------------------------------------------
   12. Vote grid / choices
   -------------------------------------------------------------------------- */

.smy-vote-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 480px) {
  .smy-vote-grid.smy-vote-grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.smy-vote-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 14px 16px;
  border: var(--hairline) solid var(--separator);
  border-radius: var(--radius-md);
  font-family: var(--font-text);
  font-size: var(--size-callout);
  line-height: var(--leading-callout);
  font-weight: var(--weight-medium);
  text-align: left;
  color: var(--label-primary);
  background: var(--bg-elevated);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: transform var(--dur-fast) var(--ease-smy),
    border-color var(--dur-fast) var(--ease-smy),
    background-color var(--dur-fast) var(--ease-smy);
}

.smy-vote-btn:active:not(:disabled) {
  transform: scale(var(--press-scale));
}

.smy-vote-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.smy-vote-btn.is-selected {
  border-color: var(--accent);
  background: var(--accent-tint);
}

.smy-vote-btn.is-correct {
  border-color: var(--green);
  background: color-mix(in srgb, var(--green) 16%, transparent);
}

.smy-vote-btn.is-wrong {
  border-color: var(--red);
  background: color-mix(in srgb, var(--red) 14%, transparent);
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .smy-vote-btn.is-correct,
  .smy-vote-btn.is-wrong { background: var(--fill-tertiary); }
}

.smy-vote-btn .smy-vote-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-family: var(--font-rounded);
  font-size: var(--size-footnote);
  font-weight: var(--weight-bold);
  color: #FFFFFF;
  background: var(--seat-color, var(--accent));
}

.smy-vote-btn .smy-vote-text {
  flex: 1 1 auto;
  min-width: 0;
}

.smy-vote-btn .smy-vote-meta {
  flex: 0 0 auto;
  color: var(--label-secondary);
  font-size: var(--size-footnote);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   13. Codenames guess board
   -------------------------------------------------------------------------- */

.smy-guess-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.smy-word-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 6px 4px;
  border: var(--hairline) solid var(--separator);
  border-radius: var(--radius-sm);
  font-family: var(--font-text);
  font-size: var(--size-caption1);
  font-weight: var(--weight-semibold);
  line-height: 1.15;
  text-align: center;
  word-break: break-word;
  color: var(--label-primary);
  background: var(--bg-elevated);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: transform var(--dur-fast) var(--ease-smy),
    opacity var(--dur-med) var(--ease-smy);
}

.smy-word-card:active:not(:disabled) {
  transform: scale(var(--press-scale));
}

.smy-word-card:disabled {
  cursor: default;
}

.smy-word-card.is-revealed {
  opacity: 0.85;
  color: #FFFFFF;
}

.smy-word-card.role-red { background: var(--red); border-color: transparent; color: #FFFFFF; }
.smy-word-card.role-blue { background: var(--accent); border-color: transparent; color: #FFFFFF; }
.smy-word-card.role-civilian { background: var(--fill-primary); border-color: transparent; color: var(--label-primary); }
.smy-word-card.role-assassin { background: var(--label-primary); border-color: transparent; color: var(--bg-elevated); }

/* Spymasters see the key as a tint so unrevealed words stay readable. */
.smy-word-card.is-key:not(.is-revealed) {
  color: var(--label-primary);
  border-width: 2px;
  border-style: solid;
  background: var(--bg-elevated);
}

.smy-word-card.is-key.role-red:not(.is-revealed) { border-color: var(--red); }
.smy-word-card.is-key.role-blue:not(.is-revealed) { border-color: var(--accent); }
.smy-word-card.is-key.role-civilian:not(.is-revealed) { border-color: var(--separator-opaque); }
.smy-word-card.is-key.role-assassin:not(.is-revealed) { border-color: var(--label-primary); }

.smy-team-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-card);
  font-variant-numeric: tabular-nums;
}

.smy-team-red { color: var(--red); font-weight: var(--weight-bold); }
.smy-team-blue { color: var(--accent); font-weight: var(--weight-bold); }

/* --------------------------------------------------------------------------
   14. Scoreboard
   -------------------------------------------------------------------------- */

.smy-scoreboard {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.smy-score-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 16px;
  border-bottom: var(--hairline) solid var(--separator);
}

.smy-score-row:last-child {
  border-bottom: none;
}

.smy-score-rank {
  flex: 0 0 24px;
  font-family: var(--font-rounded);
  font-weight: var(--weight-bold);
  color: var(--label-secondary);
  font-variant-numeric: tabular-nums;
}

.smy-score-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: var(--weight-medium);
}

.smy-score-value {
  flex: 0 0 auto;
  font-family: var(--font-rounded);
  font-size: var(--size-title3);
  font-weight: var(--weight-bold);
}

.smy-score-row.is-leader .smy-score-value {
  color: var(--green);
}

.smy-clue-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.smy-clue-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-card);
}

.smy-clue-item .smy-clue-name {
  flex: 0 0 auto;
  font-weight: var(--weight-semibold);
  color: var(--label-secondary);
}

.smy-role-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  text-align: center;
  color: #FFFFFF;
  background: var(--accent);
  box-shadow: var(--shadow-card);
}

.smy-role-card.role-imposter { background: var(--red); }
.smy-role-card.role-jester { background: var(--orange); }
.smy-role-card.role-villager { background: var(--green); }

/* --------------------------------------------------------------------------
   15. Display-only layout helpers
   -------------------------------------------------------------------------- */

.smy-display .smy-display-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.smy-display .smy-card,
.smy-display .smy-prompt-card,
.smy-display .smy-waiting {
  padding: 32px;
  border-radius: 28px;
}

.smy-display .smy-prompt-card .smy-prompt-text {
  font-size: clamp(32px, 3.4vw, 64px);
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.smy-display .smy-player-list,
.smy-display .smy-scoreboard {
  border-radius: 28px;
}

.smy-display .smy-player,
.smy-display .smy-score-row {
  min-height: 76px;
  padding: 14px 28px;
}

.smy-display .smy-avatar {
  width: 52px;
  height: 52px;
  font-size: 20px;
}

.smy-display .smy-word-card {
  min-height: 96px;
  font-size: clamp(14px, 1.2vw, 24px);
}

.smy-display .smy-guess-board {
  gap: 12px;
}

/* --------------------------------------------------------------------------
   16. Motion preferences
   -------------------------------------------------------------------------- */

.smy-fade-in {
  animation: smy-fade-in var(--dur-med) var(--ease-smy);
}

@keyframes smy-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  body.smy-controller *,
  body.smy-display *,
  body.smy-controller *::before,
  body.smy-display *::before,
  body.smy-controller *::after,
  body.smy-display *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .smy-btn:active:not(:disabled),
  .smy-vote-btn:active:not(:disabled),
  .smy-word-card:active:not(:disabled),
  .smy-room-code:active {
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   17. Code Breaker board + Puzzle Escape locks
   -------------------------------------------------------------------------- */

.smy-cb-slots {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.smy-cb-slot {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  box-shadow: inset 0 0 0 0.5px var(--separator);
}

.smy-cb-slot.is-empty {
  background: var(--fill-tertiary);
  box-shadow: inset 0 0 0 1.5px var(--separator);
}

.smy-cb-draft { margin: 12px 0; }

.smy-cb-palette {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 12px 0;
}

.smy-cb-swatch {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: var(--radius-pill);
  box-shadow: inset 0 0 0 0.5px var(--separator), 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: transform var(--dur-fast, 100ms) var(--ease-smy);
  cursor: pointer;
}

.smy-cb-swatch:active { transform: scale(0.9); }

.smy-cb-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.smy-cb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: var(--fill-quaternary);
  border-radius: var(--radius-sm);
}

.smy-cb-row .smy-cb-slot { width: 22px; height: 22px; }

.smy-cb-pegs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  max-width: 96px;
  justify-content: flex-end;
}

.smy-cb-peg {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-pill);
}

.smy-cb-peg-black { background: var(--label-primary); }
.smy-cb-peg-white { background: transparent; box-shadow: inset 0 0 0 1.5px var(--label-secondary); }

.smy-solved {
  background: rgba(52, 199, 89, 0.10);
  box-shadow: inset 0 0 0 0.5px var(--green);
}

.smy-input.is-wrong {
  box-shadow: inset 0 0 0 1.5px var(--red);
  animation: smy-shake 0.4s var(--ease-smy);
}

@keyframes smy-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

@media (prefers-reduced-motion: reduce) {
  .smy-input.is-wrong { animation: none; }
}

/* --------------------------------------------------------------------------
   18. Art Exhibit — canvas + gallery
   -------------------------------------------------------------------------- */

.smy-draw-canvas {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #fff;
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 0 0.5px var(--separator);
  touch-action: none;
  display: block;
  margin: 8px 0;
  cursor: crosshair;
}

.smy-art-toolbar {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 8px 0;
}

.smy-art-swatch { width: 34px; height: 34px; }
.smy-art-swatch.is-selected { box-shadow: inset 0 0 0 0.5px var(--separator), 0 0 0 3px var(--accent); }
.smy-art-size { min-width: 44px; padding: 8px 10px; }

.smy-exhibit-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: #fff;
  border-radius: var(--radius-sm);
  display: block;
}

.smy-exhibit { padding: 12px; }

.smy-exhibit-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 8px 0;
}

.smy-exhibit-pick,
.smy-vote-card-btn {
  border: none;
  background: none;
  padding: 0;
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 2px transparent;
  transition: transform var(--dur-fast) var(--ease-smy), box-shadow var(--dur-fast) var(--ease-smy);
  cursor: pointer;
  width: 100%;
  display: block;
}

.smy-vote-card-btn { margin: 8px 0; }
.smy-exhibit-pick:active,
.smy-vote-card-btn:active { transform: scale(0.97); }
.smy-exhibit-pick.is-selected { box-shadow: 0 0 0 3px var(--accent); }

.smy-caption-picks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0;
}

.smy-exhibit-versus {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

@media (prefers-reduced-motion: reduce) {
  .smy-exhibit-pick:active,
  .smy-vote-card-btn:active { transform: none; }
}

/* --------------------------------------------------------------------------
   19. Casefile — investigation desk
   -------------------------------------------------------------------------- */

.smy-desk {
  margin: -4px -2px 0;
  padding: 10px 6px 18px;
  border-radius: 14px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(0, 0, 0, .07) 0 2px,
      transparent 2px 13px
    ),
    linear-gradient(180deg, #4a3728 0%, #2c2118 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 220, 170, .08);
}
.smy-desk-head { margin: 0 6px 4px; }
.smy-desk-head .smy-title3 { color: #f3e6d0; }
.smy-desk-progress {
  margin: 0 6px 8px;
  color: #d7c4a6;
  font-size: 13px;
}
.smy-desk-nav {
  display: flex;
  gap: 8px;
  margin: 4px 6px 12px;
}
.smy-desk-nav-btn {
  flex: 1;
  border: 0;
  border-radius: 999px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, .35);
  color: #d7c4a6;
  font: inherit;
  font-weight: 700;
}
.smy-desk-nav-btn.is-on {
  background: #c9a66b;
  color: #1c140c;
}
.smy-desk-nav-btn { font-size: 14px; padding: 10px 8px; }
.smy-intake { display: flex; flex-direction: column; gap: 12px; padding: 12px 10px 20px; }
.smy-intake .smy-title2 { color: #f3e6d0; margin: 0; }
.smy-intake-person {
  display: flex;
  gap: 12px;
  background: #f4ead2;
  color: #1c140c;
  padding: 12px;
  border-radius: 4px;
  box-shadow: 0 8px 16px rgba(0,0,0,.28);
}
.smy-intake-face {
  flex: 0 0 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #3d342c;
  color: #f0e6d6;
  font-weight: 800;
  font-size: 18px;
}
.smy-intake-copy { flex: 1; min-width: 0; }
.smy-intake-copy .smy-title3,
.smy-intake-copy .smy-body,
.smy-intake-copy .smy-footnote { color: #1c140c; margin: 0 0 4px; }
.smy-timeline-wrap { display: flex; flex-direction: column; gap: 12px; padding: 0 4px 8px; }
.smy-timeline-board { display: flex; flex-direction: column; gap: 8px; }
.smy-pin {
  display: flex;
  gap: 6px;
  background: #f6f1e4;
  color: #1c140c;
  border-radius: 2px;
  box-shadow: 0 6px 14px rgba(0,0,0,.28);
  padding: 4px 4px 4px 8px;
}
.smy-pin.is-on { box-shadow: 0 0 0 2px #c9a66b, 0 6px 14px rgba(0,0,0,.28); }
.smy-pin-body {
  flex: 1;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  padding: 8px 4px;
}
.smy-pin-time {
  margin: 0 0 4px;
  font-weight: 800;
  letter-spacing: .06em;
  font-size: 13px;
}
.smy-pin-x {
  flex: 0 0 40px;
  border: 0;
  background: transparent;
  color: #5c4030;
  font-size: 22px;
}
.smy-pin-form { display: flex; flex-direction: column; gap: 8px; }
.smy-pin-form .smy-input { background: #f4ead2; color: #1c140c; }
.smy-desk-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 10px;
  padding: 0 4px;
}
.smy-desk-grid-display { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.smy-cork {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 10px;
  padding: 14px 10px 18px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 22%, rgba(0,0,0,.12) 0 1.5px, transparent 2px),
    radial-gradient(circle at 70% 58%, rgba(0,0,0,.1) 0 1.5px, transparent 2px),
    #c4a574;
  box-shadow: inset 0 0 0 1px rgba(90, 60, 20, .25);
}
.smy-file {
  appearance: none;
  position: relative;
  border: 0;
  text-align: left;
  min-height: 138px;
  padding: 12px;
  border-radius: 3px 16px 6px 6px;
  background: #c9a66b;
  color: #1c140c;
  box-shadow: 0 10px 18px rgba(0,0,0,.32);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transform: rotate(-0.6deg);
}
.smy-desk-grid .smy-file:nth-child(2n) { transform: rotate(1.1deg); }
.smy-desk-grid .smy-file:nth-child(3n) { transform: rotate(-1.4deg); }
.smy-file:active { transform: rotate(0) scale(.98); }
.smy-file-kicker {
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  opacity: .72;
  font-weight: 700;
}
.smy-file-title {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.15;
}
.smy-file-meta { font-size: 12px; opacity: .78; }
.smy-file-face {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 76px;
  margin: -4px -4px 4px;
  background: #3d342c;
  color: #f0e6d6;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: .04em;
}
.smy-file.is-brief {
  background: linear-gradient(#efe0c0, #d7c7a3);
}
.smy-file.is-timeline { background: #8f9aa3; color: #101418; }
.smy-file.is-hint {
  background: #5c4a2e;
  color: #f3e2b8;
  box-shadow: 0 10px 18px rgba(0,0,0,.32), inset 0 0 0 1px rgba(243,226,184,.2);
}
.smy-file.is-document { background: linear-gradient(#e8d5a8, #c9a66b); }
.smy-file.is-digital {
  background: #101c18;
  color: #b6f3cf;
  border-radius: 14px;
  box-shadow: 0 10px 18px rgba(0,0,0,.4), inset 0 0 0 2px #1c332c;
}
.smy-file.is-physical {
  background:
    repeating-linear-gradient(-45deg, #6b1d1d 0 8px, #1a120c 8px 16px) top / 100% 14px no-repeat,
    #2b1c16;
  color: #f0d2c8;
  border-radius: 6px;
  padding-top: 22px;
}
.smy-file.is-photo,
.smy-file.is-witness {
  background: #f4efe4;
  border-radius: 2px;
  padding: 8px 8px 18px;
}
.smy-file.is-locked {
  background: #1c1612;
  color: #e7d3b0;
  box-shadow: inset 0 0 0 1px rgba(231,211,176,.22);
}
.smy-file.is-locked::after {
  content: '';
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e25555, #7a1414);
  box-shadow: 0 3px 0 #4a0d0d;
}
.smy-file.is-lock {
  background: linear-gradient(#3a3a3c, #161618);
  color: #f0e6d2;
  border-radius: 14px;
}
.smy-file.is-lock-open { background: #2c3a2c; color: #d7f0d7; }
.smy-file.is-suspect {
  background: #f6f1e4;
  color: #1a1510;
  border-radius: 2px;
  padding: 18px 8px 14px;
  min-height: 168px;
  box-shadow: 0 1px 0 #ddd, 0 10px 16px rgba(0,0,0,.28);
  transform: rotate(-1.2deg);
}
.smy-cork .smy-file.is-suspect:nth-child(2n) { transform: rotate(1.6deg); }
.smy-file.is-suspect::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ff6b6b, #9b1c1c);
  box-shadow: 0 2px 0 #5c1010;
}
.smy-file.is-accused { box-shadow: 0 0 0 3px var(--accent), 0 10px 16px rgba(0,0,0,.28); }
.smy-file.is-killer { background: #5a1d1d; color: #ffd7d7; }

.smy-inspect {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0,0,0,.78);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: env(safe-area-inset-top) 0 0;
}
.smy-inspect-sheet {
  width: min(560px, 100%);
  max-height: 92dvh;
  overflow: auto;
  background: #14110e;
  border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: smy-sheet-up .32s var(--ease-smy);
}
.smy-inspect-sheet.is-paper { background: #cbb894; color: #1c140c; }
.smy-inspect-sheet.is-paper .smy-headline,
.smy-inspect-sheet.is-paper .smy-title3,
.smy-inspect-sheet.is-paper .smy-body,
.smy-inspect-sheet.is-paper .smy-footnote { color: #1c140c; }
.smy-inspect-sheet.is-device { background: #070a09; }
.smy-inspect-sheet.is-bag { background: #16110d; }
.smy-inspect-sheet.is-lock { background: #0c0c0e; }
.smy-inspect-sheet.is-dossier { background: #1a1814; }
.smy-inspect-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.smy-inspect-close {
  border: 0;
  background: rgba(255,255,255,.12);
  color: inherit;
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  font-weight: 700;
}
.smy-inspect-sheet.is-paper .smy-inspect-close {
  background: rgba(0,0,0,.12);
}

.smy-paper {
  position: relative;
  background: #f4ead2;
  color: #1c140c;
  padding: 18px 16px 20px;
  border-radius: 2px;
  box-shadow: 0 10px 24px rgba(0,0,0,.35);
}
.smy-paper-title {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  opacity: .55;
  font-weight: 800;
}
.smy-paper-body {
  white-space: pre-wrap;
  font-family: "Iowan Old Style", Palatino, "Times New Roman", serif;
  font-size: 16px;
  line-height: 1.5;
}
.smy-paper-report { background: #f7f1de; }
.smy-paper-report::after {
  content: 'CASE FILE';
  position: absolute;
  right: 12px;
  bottom: 10px;
  font-size: 11px;
  letter-spacing: .18em;
  font-weight: 800;
  color: rgba(160, 28, 28, .35);
  transform: rotate(-8deg);
}
.smy-paper-digital,
.smy-device {
  background: #0d1612;
  color: #b6f3cf;
}
.smy-paper-digital .smy-paper-body,
.smy-device-body {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.smy-device {
  border-radius: 28px;
  padding: 10px;
  box-shadow: 0 16px 32px rgba(0,0,0,.45), inset 0 0 0 2px #1b2c26;
}
.smy-device-bezel {
  background: #08110e;
  border-radius: 20px;
  padding: 10px 12px 16px;
  min-height: 180px;
}
.smy-device-bar {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: .08em;
  opacity: .55;
  margin-bottom: 12px;
  font-family: var(--font-mono);
}
.smy-paper-physical,
.smy-bag {
  background: #2b1c1a;
  color: #f3d5cc;
}
.smy-bag {
  border: 2px solid #c9a66b;
  border-radius: 8px;
  padding: 16px;
}
.smy-bag-stamp {
  margin: 0 0 6px;
  text-align: center;
  letter-spacing: .22em;
  font-weight: 800;
  color: #e25555;
}
.smy-bag-tag {
  margin: 0 0 12px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  opacity: .7;
}
.smy-polaroid {
  background: #f6f1e4;
  color: #1c140c;
  padding: 10px 10px 18px;
  box-shadow: 0 12px 24px rgba(0,0,0,.35);
}
.smy-polaroid-shot {
  min-height: 120px;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,.18), transparent 40%),
    linear-gradient(#3c3a36, #1c1a18);
  color: #e8dcc8;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  font-weight: 700;
  margin-bottom: 10px;
}
.smy-paper-lined {
  background:
    repeating-linear-gradient(#f7f1de, #f7f1de 27px, #c9d7e6 28px);
  color: #1c140c;
  padding: 18px 16px 8px;
}
.smy-paper-lined .smy-paper-body { line-height: 28px; }
.smy-paper-alibi { background: #e7eef4; }
.smy-paper-motive { background: #f3ddd3; }
.smy-paper-hint { background: #efe0b8; }

.smy-envelope {
  min-height: 220px;
  border-radius: 12px;
  padding: 28px 18px 20px;
  text-align: center;
  background:
    linear-gradient(180deg, #3a2c20 0 48px, transparent 48px),
    #1a1510;
  box-shadow: inset 0 0 0 1px rgba(231,211,176,.25);
}
.smy-wax {
  width: 74px;
  height: 74px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e25555, #8b1a1a);
  color: #f7d4d4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  letter-spacing: .16em;
  font-weight: 800;
  box-shadow: 0 6px 0 #5a1010, 0 12px 18px rgba(0,0,0,.35);
}

.smy-timeline {
  list-style: none;
  margin: 8px 8px 0;
  padding: 0 0 0 14px;
  border-left: 2px solid #c9a66b;
}
.smy-timeline-item {
  position: relative;
  margin: 0 0 16px;
  padding: 0 0 0 14px;
}
.smy-timeline-item::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 7px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #c9a66b;
  box-shadow: 0 0 0 3px rgba(201,166,107,.25);
}

.smy-padlock { display: flex; flex-direction: column; align-items: center; }
.smy-padlock-shackle {
  width: 92px;
  height: 54px;
  border: 10px solid #cfcfcf;
  border-bottom: 0;
  border-radius: 50px 50px 4px 4px;
  margin-bottom: -10px;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.35);
}
.smy-padlock-body {
  width: 100%;
  background: linear-gradient(#3f3f42, #1a1a1c);
  border-radius: 18px;
  padding: 22px 14px 16px;
  box-shadow: 0 14px 28px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.14);
}
.smy-padlock-label {
  margin: 0 0 12px;
  text-align: center;
  letter-spacing: .18em;
  font-size: 11px;
  font-weight: 800;
  color: #c9a66b;
}
.smy-lock { display: flex; flex-direction: column; gap: 14px; }
.smy-lock.is-wrong,
.smy-padlock.is-wrong,
.smy-journal.is-wrong { animation: smy-lock-shake .45s ease; }
@keyframes smy-lock-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}
@keyframes smy-sheet-up {
  from { transform: translateY(28px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.smy-lock-wheels, .smy-lock-slots {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}
.smy-lock-wheel {
  width: 48px;
  border-radius: 8px;
  background:
    linear-gradient(#555, #222 18%, #111 82%, #444);
  color: #f5f5f5;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), 0 6px 10px rgba(0,0,0,.35);
}
.smy-lock-nudge {
  width: 100%;
  min-height: 32px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 6px 0;
  font-size: 11px;
}
.smy-lock-digit {
  appearance: none;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  padding: 6px 0 8px;
  font-variant-numeric: tabular-nums;
}
.smy-lock-slot {
  width: 34px;
  height: 46px;
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  text-transform: uppercase;
  border: 0;
  border-radius: 6px;
  background:
    linear-gradient(#6a5a3a, #3b2f1c);
  color: #f6e6c2;
  box-shadow: inset 0 0 0 1px rgba(255,220,160,.28), 0 4px 8px rgba(0,0,0,.35);
}
.smy-journal {
  background: #2a1d14;
  border-radius: 8px;
  padding: 16px;
  box-shadow: inset 0 0 0 1px rgba(201,166,107,.25);
}
.smy-lock-phrase {
  text-transform: uppercase;
  letter-spacing: .14em;
  background: #f4ead2;
  color: #1c140c;
  font-weight: 700;
}

.smy-casefile-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.smy-desk-nav { flex-wrap: wrap; }
.smy-note-list { display: flex; flex-direction: column; gap: 8px; }
.smy-note {
  background: #f4ead2;
  color: #1c140c;
  padding: 12px;
  border-radius: 2px;
  box-shadow: 0 6px 14px rgba(0,0,0,.28);
}
.smy-note .smy-body,
.smy-note .smy-footnote { color: #1c140c; margin: 0 0 6px; }
.smy-note-x {
  border: 0;
  background: transparent;
  color: #5c4030;
  font: inherit;
  font-size: 13px;
  padding: 0;
}

@media (min-width: 720px) {
  body.smy-casefile .smy-controller-main {
    max-width: 920px;
  }
  body.smy-casefile .smy-desk-grid,
  body.smy-casefile .smy-cork {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  body.smy-casefile .smy-inspect {
    align-items: center;
    padding: 24px;
  }
  body.smy-casefile .smy-inspect-sheet {
    border-radius: 18px;
    max-height: 86vh;
    width: min(640px, 100%);
  }
}

@media (min-width: 1100px) {
  body.smy-casefile .smy-controller-main {
    max-width: 1240px;
  }
  body.smy-casefile .smy-desk-grid,
  body.smy-casefile .smy-cork {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

[hidden] {
  display: none !important;
}
