/* ฟินจัง (2026-11-14, phase 32): the menu, the cup shelf and the play layer.
   The page parts use the site's theme tokens (Day and Night); the play layer
   sits on the game's own warm canvas, so its words are always ink. */

/* style.css pads every <section> 56px top and bottom (food.css undoes it the same way) */
.fj-page > section { padding: 0 !important; }
.fj-page > section + section { margin-top: 18px; }

/* ---------- hello ---------- */
.fj-hello .cc-body { display: flex; align-items: center; gap: 14px; }
.fj-hero { position: relative; width: 84px; height: 72px; flex: none; }
.fj-hero-cup { position: absolute; left: 0; bottom: 0; width: 64px; height: 64px; }
.fj-hero-mali { position: absolute; right: 0; top: 0; width: 42px; height: 42px; animation: fjBob 2.4s ease-in-out infinite; }
@keyframes fjBob { 50% { transform: translateY(-3px) rotate(-3deg); } }
.fj-say { margin: 0; font-weight: 700; line-height: 1.6; }

/* ---------- the menu of mini-games ---------- */
.fj-h2 { margin: 0 0 10px; font: 700 1.15rem/1.4 "Chakra Petch", Inter, "SukhumvitSet", system-ui, sans-serif; color: var(--text, #111111); }
.fj-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.fj-card {
  border-radius: var(--card-r, 22px); padding: 12px;
  background: var(--card-bg, var(--surface, #faf8f3)); color: var(--text, #111111);
  border: 1px solid var(--edge, rgba(17, 17, 17, .08));
}
.fj-main { grid-column: 1 / -1; display: grid; gap: 10px; padding: 16px; }
.fj-main-h { display: flex; align-items: center; gap: 12px; }
.fj-ic { display: inline-flex; width: 48px; height: 48px; flex: none; }
.fj-ic img, .fj-ic svg { width: 48px; height: 48px; }
.fj-name { margin: 0; font: 700 1.05rem/1.4 "Chakra Petch", Inter, "SukhumvitSet", system-ui, sans-serif; }
.fj-main .fj-name { font-size: 1.3rem; }
.fj-pick { margin: 0; font-size: .85rem; color: var(--muted, #6b655c); }
.fj-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.fj-chip {
  min-height: 44px; padding: 4px 12px 4px 8px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line-strong, rgba(17, 17, 17, .16)); background: transparent; color: var(--text, #111111);
  font: 600 .9rem/1.3 Inter, "SukhumvitSet", system-ui, sans-serif; touch-action: manipulation;
}
.fj-chip[aria-pressed="true"] { background: var(--pill, #111111); color: var(--pill-text, #f8f5ee); border-color: transparent; }
.fj-chip:disabled { cursor: default; opacity: .6; padding-left: 12px; }
.fj-lock { flex: none; color: var(--text, #111111); }
.fj-chip small { font-size: .75rem; font-weight: 600; opacity: .85; }
.fj-chip .fj-cup { flex: none; }
.fj-chip:focus-visible, .fj-go:focus-visible, .fj-next:focus-visible, .fj-ib:focus-visible { outline: 3px solid #ffd23f; outline-offset: 2px; }
.fj-go {
  justify-self: start; min-height: 52px; min-width: 160px; padding: 10px 26px; border: 0; border-radius: 999px; cursor: pointer;
  background: #ff4b2b; color: #111111; touch-action: manipulation;
  font: 700 1.15rem/1.3 "Chakra Petch", Inter, "SukhumvitSet", system-ui, sans-serif;
  box-shadow: 0 4px 0 var(--ink-sh, #111111);
}
.fj-go:active { transform: translateY(3px); box-shadow: none; }
.fj-err { margin: 0; color: var(--accent-text, #c22c0e); font-weight: 600; }
.fj-soon { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 14px 8px; }
.fj-soon .fj-ic { filter: grayscale(.55); opacity: .75; }
.fj-soon .fj-name { font-size: .92rem; }
.fj-tag {
  padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; line-height: 1.6;
  background: var(--fill, rgba(17, 17, 17, .06)); color: var(--muted, #6b655c);
}

/* ---------- the cup shelf ---------- */
.fj-count { margin: -4px 0 10px; color: var(--muted, #6b655c); font-size: .9rem; }
.fj-shelf-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  /* a wooden plank under every row */
  grid-auto-rows: 74px;
  background-image: linear-gradient(to bottom, transparent 64px, #d9b088 64px, #c3946a 74px);
  background-size: 100% 74px; border-radius: 10px;
}
.fj-slot { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 12px; gap: 2px; }
.fj-slot .fj-cup { display: block; }
.fj-dots { display: flex; gap: 2px; height: 0; overflow: visible; transform: translateY(8px); }
.fj-dots i { width: 5px; height: 5px; border-radius: 50%; background: rgba(43, 26, 18, .25); }
.fj-dots i.on { background: #fffdf6; box-shadow: 0 0 0 1px rgba(43, 26, 18, .55); }
.fj-empty { margin: 0; display: flex; align-items: center; gap: 10px; line-height: 1.6; }
.fj-empty img { width: 48px; height: 48px; flex: none; }
.fj-more { margin: 8px 0 0; color: var(--muted, #6b655c); font-size: .85rem; }

/* ---------- play layer ---------- */
html.fj-on, html.fj-on body { overflow: hidden; }
.fj-play {
  position: fixed; inset: 0; z-index: 2147482000;
  background: #f6e3cd; overflow: hidden;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.fj-play[hidden] { display: none; }
#fjCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.fj-top {
  position: absolute; left: 0; right: 0; top: 0; z-index: 2;
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  color: #2b1a12; pointer-events: none;
}
.fj-step {
  margin: 0; text-align: center; pointer-events: none;
  font: 700 clamp(1.15rem, 5.4vw, 1.55rem)/1.3 "Chakra Petch", Inter, "SukhumvitSet", system-ui, sans-serif;
}
.fj-step b { font-variant-numeric: tabular-nums; color: #c22c0e; margin-right: 4px; }
.fj-ib {
  width: 44px; height: 44px; border-radius: 14px; border: 0; cursor: pointer; pointer-events: auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(43, 26, 18, .1); color: #2b1a12; touch-action: manipulation;
}
.fj-bot {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  display: grid; justify-items: center; gap: 8px; min-height: 112px; align-content: end;
  padding: 0 max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  pointer-events: none;
}
.fj-hint {
  margin: 0; min-height: 1.6em; padding: 4px 14px; border-radius: 999px; text-align: center;
  background: rgba(255, 251, 244, .82); color: #2b1a12;
  font: 700 .98rem/1.6 "Chakra Petch", Inter, "SukhumvitSet", system-ui, sans-serif;
  opacity: 0; transition: opacity .25s; pointer-events: none;
}
.fj-hint.on { opacity: 1; }
.fj-next {
  min-height: 52px; min-width: 168px; padding: 10px 28px; border: 0; border-radius: 999px; cursor: pointer;
  background: #ff4b2b; color: #111111; pointer-events: auto; touch-action: manipulation;
  font: 700 1.15rem/1.3 "Chakra Petch", Inter, "SukhumvitSet", system-ui, sans-serif;
  box-shadow: 0 4px 0 #111111;
}
/* hidden keeps its room, so the glass never jumps when the button comes and goes */
.fj-next[hidden] { display: inline-block; visibility: hidden; }
.fj-next:active { transform: translateY(3px); box-shadow: none; }

@media (max-width: 380px) {
  .fj-grid { gap: 8px; }
  .fj-soon { padding: 12px 4px; }
  .fj-soon .fj-name { font-size: .85rem; }
}
@media (prefers-reduced-motion: reduce) {
  .fj-hero-mali { animation: none; }
  .fj-hint { transition: none; }
}
