/* Direction D (combined): shared kit for every screen. Evolved from B (the liked home) with A/C wardrobe pieces.
   Tokens come from apps/mobile/src/ui/theme.ts, ui/hub/parts.tsx, ui/online/EntryKit.tsx and gacha/look.ts.
   Kit changes vs today: see d/index.html. */

@font-face { font-family: 'Fredoka'; src: url('fonts/Fredoka-500.ttf') format('truetype'); font-weight: 500; }
@font-face { font-family: 'Fredoka'; src: url('fonts/Fredoka-600.ttf') format('truetype'); font-weight: 600; }
@font-face { font-family: 'Fredoka'; src: url('fonts/Fredoka-700.ttf') format('truetype'); font-weight: 700; }
@font-face { font-family: 'Lilita'; src: url('fonts/LilitaOne.ttf') format('truetype'); }

:root {
  /* toy kit */
  --wood: #d9965a; --wood-dark: #a86a3e; --wood-light: #f2c48a; --bark: #543018;
  --ink: #4a2a14; --muted: #7a5a3e; --paper: #fff3dc; --cream: #fffaf0;
  --gold: #ffd24a; --gold-dark: #d99a1e; --gold-edge: #b97d14; --coin-light: #ffe48a;
  --leaf: #4f9a3a; --leaf-edge: #3c7a2b; --leaf-tint: #e4f1d3; --leaf-ink: #33661f;
  --danger: #b8322f; --you: #3b2a8a; --turn: #e0782e; --dot: #e8456b;
  --lift: rgba(120, 70, 30, .36);
  /* gacha tiers (gacha/look.ts) */
  --t-common: #cfc8b8; --t-rare: #4f8dff; --t-epic: #b25cff; --t-legendary: #ffb81a; --t-ultra: #ff5fa8;
  --g-ink: #24183f; --g-night: #120d2e; --g-dusk: #1c1450;
  /* category tabs */
  --c-grief: #cc5460; --c-chaos: #e0a830; --c-nice: #2ba040; --c-defense: #3b6fd0;
  /* rank tiers (ranking.ts tier ids) */
  --r-acorn: #b07a45; --r-bronze: #c77b4a; --r-silver: #aeb6c2; --r-gold: #f0b429; --r-platinum: #4fc3b8; --r-diamond: #6b8cff; --r-grand: #d25cff;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-pop: cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body { font-family: 'Fredoka', system-ui, sans-serif; font-weight: 600; font-size: 14px; color: var(--ink); background: #2b3a1f; user-select: none; }
::selection { background: var(--gold); color: var(--ink); }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
:focus-visible { outline: 3px solid #3a2010; outline-offset: 2px; border-radius: 12px; }
.num { font-variant-numeric: tabular-nums; }

/* icons (sprite injected by kit.js) */
.i { width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: middle; }
.i-sm { width: 14px; height: 14px; } .i-lg { width: 26px; height: 26px; }

/* display text: outlined Lilita, the game's sign voice */
.disp { font-family: 'Lilita', 'Fredoka', sans-serif; font-weight: 400; letter-spacing: .01em; color: #fff; paint-order: stroke fill; -webkit-text-stroke: 5px var(--ink); text-shadow: 0 3px 0 var(--ink); }
.disp-thin { -webkit-text-stroke-width: 3.5px; text-shadow: 0 2px 0 var(--ink); }

/* floating wooden pill: the only chrome shape outside a sheet */
.pill { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 18px;
  background: var(--paper); border: 2.5px solid var(--wood-dark); box-shadow: 0 3px 0 var(--wood-dark), 0 8px 14px -8px rgba(40, 20, 5, .55);
  font-weight: 700; font-size: 14px; color: var(--ink); white-space: nowrap; }
.pill::before { content: ''; position: absolute; left: 10px; right: 10px; top: 2px; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, .8); }
.pill.round { width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 50%; }
.pill.round::before { left: 9px; right: 9px; }
.pill.wood { background: linear-gradient(#e7a96c, var(--wood)); color: #fff; border-color: var(--bark); box-shadow: 0 3px 0 var(--bark), 0 8px 14px -8px rgba(40, 20, 5, .6); }
.pill.wood::before { background: rgba(255, 230, 190, .55); }
/* 44 px hit area around small pills */
.hit::after { content: ''; position: absolute; inset: -6px; }

.acorns .i { width: 18px; height: 18px; }

/* gold and cream toy buttons */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 18px; border-radius: 14px;
  font-weight: 700; font-size: 17px; border: 3px solid var(--wood-dark); background: var(--cream); color: var(--ink);
  box-shadow: 0 4px 0 var(--wood-dark), 0 10px 16px -10px rgba(40, 20, 5, .6); transition: transform .12s var(--ease-out), box-shadow .12s; }
.btn::before { content: ''; position: absolute; left: 12px; right: 12px; top: 3px; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, .85); }
.btn:active, .btn.pressed { transform: translateY(3px); box-shadow: 0 1px 0 var(--wood-dark); }
.btn.gold { background: linear-gradient(#ffe27a, var(--gold) 55%, #f6c23a); border-color: var(--gold-edge); box-shadow: 0 4px 0 var(--gold-edge), 0 10px 18px -10px rgba(120, 70, 0, .7); }
.btn.gold:active { box-shadow: 0 1px 0 var(--gold-edge); }
.btn.leaf { background: linear-gradient(#78c45a, var(--leaf)); color: #fff; border-color: var(--leaf-edge); box-shadow: 0 4px 0 var(--leaf-edge), 0 10px 18px -10px rgba(20, 60, 10, .7); }
.btn.ghost { background: rgba(255, 250, 240, .9); }
.btn[disabled], .btn.off { filter: saturate(.3); opacity: .6; cursor: default; }

/* desktop key cap */
.key { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 5px; font-size: 11px; font-weight: 700;
  color: var(--ink); background: var(--cream); border: 1.5px solid var(--wood-dark); box-shadow: 0 2px 0 var(--wood-dark); }

/* compact sheet: what opens at a station (never a full page) */
.sheet { position: absolute; left: 0; right: 0; bottom: 0; background: var(--paper); border-radius: 22px 22px 0 0; border: 3px solid var(--wood-dark); border-bottom: 0;
  box-shadow: 0 -10px 30px -12px rgba(30, 15, 0, .55); }
.sheet::before { content: ''; position: absolute; top: 7px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: #e0c49c; }

/* face token (toy-token icon) */
.face { width: 32px; height: 32px; border-radius: 50%; flex: none; background: var(--cream) center / cover no-repeat; }

/* tier chip */
.tier { display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: 9px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #fff; }
.tier.common { background: #9b927f; } .tier.rare { background: var(--t-rare); } .tier.epic { background: var(--t-epic); }
.tier.legendary { background: #e39a00; } .tier.ultra { background: linear-gradient(90deg, #ff5fa8, #ffb81a, #6fe08a, #4f8dff, #b25cff); text-shadow: 0 1px 0 rgba(0, 0, 0, .25); }

/* world tags: tiny labels that float by things in the 3D scene */
.wtag { position: absolute; display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px 0 2px; border-radius: 11px; background: rgba(255, 250, 240, .94);
  border: 2px solid var(--wood-dark); box-shadow: 0 2px 0 var(--wood-dark); font-size: 12px; font-weight: 700; white-space: nowrap; transform: translate(-50%, -50%); }
.wtag .face { width: 18px; height: 18px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* ---------- Direction D additions ---------- */
:root { --r-acorn: #b07a45; --t-ink: #24183f; --press: translateY(3px); --tap: 44px; }
.btn:active, .btn.pressed, .pill:active { transition-duration: .04s; }
.pill:active, .pill.pressed { transform: translateY(2px); box-shadow: 0 1px 0 var(--wood-dark); }

/* world and ui layers: every screen draws its 3D world in #world and its chrome in #ui (measured separately) */
#world { position: absolute; inset: 0; overflow: hidden; }
#world > img.fallback, .live[data-scene] > img.fallback { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#ui { position: absolute; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }

/* live 3D slots (live.js) */
.live { position: absolute; }
.live > iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; }
.live[data-scene] { inset: 0; }
.live.pending:not([data-scene]), .live-mark { border-radius: 46% 46% 40% 40% / 52% 52% 38% 38%; border: 2px dashed rgba(255, 255, 255, .75);
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .5) 50%, transparent 70%) 0 0 / 300% 100% no-repeat,
    radial-gradient(60% 52% at 50% 44%, rgba(255, 250, 240, .6), rgba(255, 243, 220, .22) 70%, rgba(255, 243, 220, .08));
  animation: shimmer 1.8s ease-in-out infinite; }
@keyframes shimmer { from { background-position: 120% 0, 0 0; } to { background-position: -20% 0, 0 0; } }
.live-tag { position: absolute; left: 50%; bottom: 14%; transform: translateX(-50%); z-index: 2; display: inline-flex; align-items: center; gap: 5px; max-width: 96%;
  padding: 3px 8px 3px 3px; border-radius: 9px; background: rgba(36, 24, 63, .82); color: #fff; font: 600 10.5px/1.2 'Fredoka', sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.live-tag b { padding: 1px 5px; border-radius: 6px; background: #ff5fa8; font-weight: 700; letter-spacing: .04em; }
.live-tag i { font-style: normal; color: #d7cfff; }
.live.wired > .live-tag, .live.wired > img.fallback, html.scene-wired .live-mark { display: none; }
.live[data-scene].pending > .live-tag { left: auto; right: 8px; bottom: auto; top: 66px; transform: none; opacity: .9; }
html.desk .live[data-scene].pending > .live-tag { top: 76px; right: 24px; }
.live-mark > .live-tag { max-width: none; overflow: visible; }
html.hide-tags .live-tag { display: none; }
.live-mark { position: absolute; }

/* hit-area helper: a 44 px minimum around anything smaller */
.tap { position: relative; } .tap::after { content: ''; position: absolute; left: 50%; top: 50%; width: max(100%, 44px); height: max(100%, 44px); transform: translate(-50%, -50%); }
