/* ═══════════════════════════════════════════════════════
   SUSHI CATCH! — Premium Redesign
   Japanese Fine Dining · Cormorant + Outfit · Lacquer Red
═══════════════════════════════════════════════════════ */

/* ── Design Tokens ──────────────────────────────────── */
:root {
  --blue: #254bdf;
  --bg:           #D4AB6A;
  --surface:      #FAF4E2;
  --surface-tint: #F5ECCE;
  --ink:          #1A1612;
  --ink-mid:      #6B6460;
  --ink-light:    #B8B0A8;
  --red:          #6B3A1A;
  --red-hover:    #522C12;
  --border:       rgba(26,22,18,0.10);
  --border-fine:  rgba(26,22,18,0.07);
  --belt-color:   #676767;
  --shadow-xs:    0 1px 3px rgba(26,22,18,0.06);
  --shadow-sm:    0 2px 8px rgba(26,22,18,0.07);
  --shadow-md:    0 8px 32px rgba(26,22,18,0.09);
  --radius-lg:    16px;
  --radius-md:    12px;
  --radius-sm:    10px;
  --font-display: 'Cormorant Garamond', 'Georgia', serif;
  --font-body:    'Outfit', 'Segoe UI', sans-serif;
}

/* ── Reset & Base ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow-x: hidden; }
body {
  font-family: var(--font-body);
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255,248,200,0.16) 0px,  rgba(255,248,200,0.16) 1px,
      transparent              1px,  transparent              6px,
      rgba(255,248,200,0.09) 6px,  rgba(255,248,200,0.09) 7px,
      transparent              7px,  transparent              15px,
      rgba(0,0,0,0.06)       15px, rgba(0,0,0,0.06)       16px,
      transparent             16px, transparent             25px,
      rgba(255,248,200,0.11) 25px, rgba(255,248,200,0.11) 26px,
      transparent             26px, transparent             38px,
      rgba(0,0,0,0.04)       38px, rgba(0,0,0,0.04)       39px,
      transparent             39px, transparent             52px
    ),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

/* ── Title Screen ───────────────────────────────────── */
#title-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: transparent;
}

.title-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 60px 52px 52px;
  text-align: center;
  max-width: 460px; width: 100%;
  border: 1px solid var(--border);
}

.title-card h1 {
  font-family: var(--font-body);
  font-size: clamp(2rem, 5.5vw, 3rem);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.05;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
  white-space: nowrap;
}

/* thin red rule under title */
.title-card h1::after {
  content: '';
  display: block;
  width: 40px; height: 1.5px;
  background: var(--red);
  margin: 14px auto 0;
}

.tagline {
  font-size: 0.9rem; font-weight: 400;
  color: var(--ink-mid); line-height: 1.75;
  margin-bottom: 36px; margin-top: 20px;
  letter-spacing: 0.2px;
}

.title-sushi-row {
  font-size: 1.7rem; letter-spacing: 12px;
  margin-bottom: 40px;
  opacity: 0.85;
}

#start-btn {
  font-family: var(--font-body); font-size: 0.85rem;
  font-weight: 600; letter-spacing: 2px; text-transform: uppercase;
  color: var(--surface);
  background: var(--red);
  border: none; border-radius: var(--radius-sm);
  padding: 16px 52px; cursor: pointer;
  box-shadow: none;
  transition: background 0.2s ease, transform 0.15s ease;
  outline: none;
}
#start-btn:hover  { background: var(--red-hover); transform: translateY(-1px); }
#start-btn:active { transform: translateY(0); }
#start-btn:focus-visible { outline: 2px solid var(--red); outline-offset: 4px; }

/* ── Game Screen ────────────────────────────────────── */
#game-screen { display: flex; flex-direction: column; min-height: 100vh; background: var(--surface); }

#game-header {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body); font-size: 0.8rem;
  font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase;
  padding: 0 24px 0 176px; min-height: 84px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}

/* ── Belt ───────────────────────────────────────────── */
#belt-wrap {
  width: 100%; overflow: hidden; position: relative;
  background: var(--belt-color);
  box-shadow: inset 0 5px 14px rgba(0,0,0,0.35), inset 0 -5px 14px rgba(0,0,0,0.28);
  border-top: 4px solid #3C3C3C; border-bottom: 4px solid #3C3C3C;
}
#belt-track { position: relative; width: 100%; height: 160px; }
#belt-stripe-layer {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent 0px, transparent 54px,
    rgba(0,0,0,0.55) 54px, rgba(0,0,0,0.55) 59px
  );
  animation: beltScroll 1.6s linear infinite; pointer-events: none;
}
@keyframes beltScroll { from { background-position-x: 0; } to { background-position-x: -59px; } }
#belt-wrap::before, #belt-wrap::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 80px; z-index: 10; pointer-events: none;
}
#belt-wrap::before { left:  0; background: linear-gradient(90deg,  rgba(38,38,38,0.92), transparent); }
#belt-wrap::after  { right: 0; background: linear-gradient(270deg, rgba(38,38,38,0.92), transparent); }
#belt-plates { position: absolute; inset: 0; overflow: visible; }

/* ── Sushi Plate ────────────────────────────────────── */
.sushi-plate {
  position: absolute; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: grab; transition: filter 0.12s ease, transform 0.12s ease;
  user-select: none; -webkit-tap-highlight-color: transparent; touch-action: none;
}
.sushi-plate:hover {
  filter: brightness(1.06) drop-shadow(0 4px 14px rgba(0,0,0,0.32));
  transform: translateY(calc(-50% - 3px));
}
.sushi-plate:active { cursor: grabbing; }
.sushi-plate svg { display: block; width: 80px; height: 80px; filter: drop-shadow(0 3px 7px rgba(0,0,0,0.28)); }
.sushi-plate .plate-label { display: none; }
.plate-wrong { animation: plateWrong 0.55s ease forwards; }
@keyframes plateWrong {
  0%,100% { filter: none; }
  25%,75%  { filter: brightness(0.65) drop-shadow(0 0 14px rgba(220,40,40,0.95)); }
}

/* ── Toast ──────────────────────────────────────────── */
.game-toast {
  position: fixed; top: 60px; left: 50%;
  transform: translateX(-50%) translateY(-10px);
  font-family: var(--font-body); font-size: 0.8rem;
  font-weight: 600; letter-spacing: 0.5px;
  padding: 9px 22px; border-radius: var(--radius-sm);
  pointer-events: none; opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease; z-index: 999;
}
.game-toast.toast-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-error { background: var(--red); color: #fff; }

/* ── Game Body ──────────────────────────────────────── */
#game-body {
  display: flex; gap: 16px; flex: 1;
  padding: 20px 20px; max-width: 960px; margin: 0 auto; width: 100%;
  align-items: flex-start;
}

/* ── Menu Panel ─────────────────────────────────────── */
#menu-panel {
  background: #FFFFFF;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 22px 18px;
  min-width: 178px; max-width: 210px; flex-shrink: 0;
  height: fit-content;
  border: 1px solid var(--border);
}
#menu-panel h2 {
  font-family: var(--font-body);
  font-size: 0.7rem; font-weight: 600;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--ink-mid);
  margin-bottom: 16px; text-align: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
#target-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.target-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: transparent;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.target-item:hover { background: var(--bg); border-color: var(--border); }
.target-svg { display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.target-svg svg { width: 34px; height: 34px; display: block; }
.target-name {
  font-family: var(--font-body); font-weight: 500;
  font-size: 0.8rem; color: var(--ink); line-height: 1.25;
}
.target-item.collected { opacity: 0.38; }
.target-item.collected .target-name { text-decoration: line-through; color: var(--ink-mid); }

/* ── Right Column ───────────────────────────────────── */
#right-column { flex: 1; display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
#mouse-game-anchor { display: none; }

/* ── Drop Table — Bamboo Mat ────────────────────────── */
#drop-table {
  width: 100%; min-height: 200px;
  border-radius: var(--radius-md);
  background: repeating-linear-gradient(
    180deg,
    #8C9F3C 0px, #9EAF44 2.5px,
    rgba(238,228,165,0.72) 2.5px, rgba(238,228,165,0.72) 3.5px,
    #8C9F3C 3.5px, #9EAF44 6px,
    rgba(238,228,165,0.72) 6px, rgba(238,228,165,0.72) 7px,
    #8C9F3C 7px, #9EAF44 9.5px,
    rgba(238,228,165,0.72) 9.5px, rgba(238,228,165,0.72) 10.5px,
    #8C9F3C 10.5px, #9EAF44 13px,
    rgba(238,228,165,0.72) 13px, rgba(238,228,165,0.72) 14px,
    #8C9F3C 14px, #9EAF44 16.5px,
    rgba(230,215,148,0.5) 16.5px, rgba(230,215,148,0.5) 18.5px
  );
  border: 10px solid #C9A87C;
  box-shadow:
    inset 0 0 0 2px rgba(255,255,255,0.2),
    inset 4px 0 8px rgba(0,0,0,0.08),
    inset -4px 0 8px rgba(0,0,0,0.08),
    inset 0 6px 14px rgba(0,0,0,0.14),
    0 4px 18px rgba(0,0,0,0.12);
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  align-content: center; justify-items: center;
  gap: 10px; padding: 16px 90px 16px 16px;
  overflow-y: auto; transition: box-shadow 0.2s ease;
}
#game-hint {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-body); font-size: 0.9rem; font-weight: 700;
  color: rgba(0,0,0,0.75); letter-spacing: 0.3px;
  background: rgba(255,255,255,0.88);
  border-radius: 8px;
  padding: 8px 22px;
  white-space: nowrap;
  pointer-events: none; user-select: none;
  transition: opacity 0s;
}
#drop-table.drop-active {
  box-shadow:
    inset 0 0 0 2px rgba(255,255,255,0.2),
    inset 0 6px 14px rgba(0,0,0,0.1),
    0 0 0 2px rgba(181,41,30,0.55),
    0 6px 24px rgba(181,41,30,0.12);
}

/* ── Table Slots ────────────────────────────────────── */
.table-slot {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border-radius: var(--radius-sm); padding: 4px;
  border: 2px solid transparent; flex-shrink: 0;
}
.table-slot svg { display: block; width: 80px; height: 80px; }
.table-slot .plate-label { display: none; }
.table-slot.filled { animation: plateLand 0.32s cubic-bezier(.34,1.56,.64,1) forwards; }
@keyframes plateLand { from { transform: scale(0.5); opacity: 0.3; } to { transform: scale(1); opacity: 1; } }

/* ── Napkin + Chopsticks ─────────────────────────────── */
#table-utensils {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 58px; height: 128px;
  background: linear-gradient(155deg, #FAFAF6 0%, #F1ECE2 100%);
  border-radius: var(--radius-sm);
  border: 1.5px solid rgba(130,185,200,0.45);
  box-shadow:
    0 2px 10px rgba(0,0,0,0.12),
    inset 0 0 0 5px rgba(170,215,225,0.12);
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.chopstick-pair { display: flex; gap: 10px; align-items: flex-start; }
.chopstick {
  border-radius: 3px 3px 1px 1px;
  background: linear-gradient(
    180deg,
    #C9A96E 0%, #A07840 40%,
    #8B6239 70%, #46280A 100%
  );
  box-shadow: 1px 0 3px rgba(0,0,0,0.28), -1px 0 1px rgba(255,255,255,0.1);
}
.chopstick-1 { width: 5px; height: 102px; }
.chopstick-2 { width: 5px; height: 102px; }

/* ── Summary Screen ─────────────────────────────────── */
#summary-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(200,160,80,0.78); backdrop-filter: blur(14px);
  z-index: 500; padding: 24px;
}
.summary-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 32px 28px 28px;
  text-align: center; max-width: 360px; width: 100%;
  border: 1px solid var(--border);
}
.summary-card h1 {
  font-family: var(--font-body);
  font-size: 1.7rem; font-weight: 600;
  color: var(--ink); margin-bottom: 6px;
  letter-spacing: -0.3px;
}

/* thin divider under heading */
.summary-card h1::after {
  content: '';
  display: block; width: 28px; height: 1px;
  background: var(--red); margin: 12px auto 0;
}

.summary-grade {
  font-family: var(--font-body);
  font-size: 4.5rem; font-weight: 700;
  color: var(--red); line-height: 1;
  margin: 12px 0 6px;
  letter-spacing: -2px;
}
.summary-stats {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 6px; margin-bottom: 22px; margin-top: 14px;
}
.summary-stats div {
  background: var(--surface-tint); border-radius: var(--radius-sm);
  padding: 14px 8px; display: flex; flex-direction: column; gap: 6px;
  border: 1px solid var(--border);
}
.summary-stats span {
  font-size: 0.55rem; color: var(--ink-mid);
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px;
}
.summary-stats strong {
  font-family: var(--font-body); font-size: 1.1rem;
  font-weight: 600; color: var(--ink);
}
#next-btn {
  font-family: var(--font-body); font-size: 0.8rem;
  font-weight: 600; letter-spacing: 2px; text-transform: uppercase;
  color: var(--surface); background: var(--red);
  border: none; border-radius: var(--radius-sm); padding: 14px 44px; cursor: pointer;
  transition: background 0.18s, transform 0.12s;
}
#next-btn:hover { background: var(--red-hover); transform: translateY(-1px); }
.summary-btns { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
#again-btn {
  font-family: var(--font-body); font-size: 0.8rem;
  font-weight: 600; letter-spacing: 2px; text-transform: uppercase;
  color: var(--red); background: transparent;
  border: 1px solid var(--red); border-radius: var(--radius-sm);
  padding: 14px 44px; cursor: pointer;
  transition: background 0.18s, transform 0.12s;
}
#again-btn:hover { background: rgba(181,41,30,0.05); transform: translateY(-1px); }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 480px) {
  .title-card { padding: 40px 24px 36px; }
  #start-btn { padding: 14px 40px; }
  #belt-track { height: 130px; }
  .sushi-plate svg { width: 64px; height: 64px; }
  #game-body { flex-direction: column; padding: 12px 12px; gap: 12px; }
  #right-column { flex: none; width: 100%; }
  #drop-table { min-height: 240px; grid-template-columns: repeat(2, minmax(0, 1fr)); padding-right: 72px; }
  .table-slot svg { width: min(64px, 100%); height: auto; }
  #table-utensils { width: 46px; height: 108px; }
  .chopstick-1, .chopstick-2 { height: 84px; }
  #menu-panel { max-width: 100%; width: 100%; }
  #target-list { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .target-item { flex: 1 1 calc(50% - 6px); min-width: 120px; }
  #game-header { font-size: 0.72rem; padding: 0 14px 0 142px; min-height: 76px; }
}
@media (max-width: 375px) {
  .title-card h1 { font-size: 2.6rem; }
  .target-item { flex: 1 1 100%; }
}

/* ── Emoji Pop ──────────────────────────────────────── */
@keyframes emoji-float {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  55%  { opacity: 1; transform: translateY(-50px) scale(1.35); }
  100% { opacity: 0; transform: translateY(-76px) scale(0.85); }
}
.emoji-pop {
  position: fixed; z-index: 1000;
  font-size: 1.9rem; pointer-events: none; user-select: none;
  transform: translate(-50%, -50%);
  animation: emoji-float 0.7s cubic-bezier(.22,.61,.36,1) forwards;
}

/* ── Summary Emoji ──────────────────────────────────── */
@keyframes grade-settle {
  0%   { transform: scale(1.4); opacity: 0; }
  60%  { transform: scale(0.95); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.summary-emoji { display: none; }

/* ── Fullscreen Button ──────────────────────────────── */
#fullscreen-btn {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 999;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: rgba(26,22,18,0.45);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.55;
  transition: opacity 0.15s;
}
#fullscreen-btn:hover { opacity: 1; }
