*, *::before, *::after { box-sizing: border-box; }

:root {
  --psy-red: #8b1e1e;
  --psy-gold: #d4a84b;
  --psy-cream: #f5ebe0;
  --psy-ink: #1a0f0c;
  --psy-green: #2d5a3d;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0a0605;
  color: var(--psy-cream);
  font-family: 'DM Sans', system-ui, sans-serif;
}

#psy-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: none;
}

.psy-hud {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  padding: 16px 20px;
}

.psy-hud-top {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.psy-tasks {
  background: rgba(20, 10, 8, 0.72);
  border: 1px solid rgba(212, 168, 75, 0.35);
  border-radius: 6px;
  padding: 12px 14px;
  min-width: 220px;
  font-size: 0.82rem;
}

.psy-tasks h3 {
  margin: 0 0 8px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  color: var(--psy-gold);
  letter-spacing: 0.06em;
}

.psy-tasks li {
  list-style: none;
  margin: 4px 0;
  opacity: 0.85;
}

.psy-tasks li.done {
  text-decoration: line-through;
  opacity: 0.4;
  color: #8a9;
}

.psy-tasks ul { margin: 0; padding: 0; }

.psy-noise-wrap {
  background: rgba(20, 10, 8, 0.72);
  border: 1px solid rgba(212, 168, 75, 0.35);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  min-width: 140px;
}

.psy-noise-track {
  margin-top: 6px;
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
}

.psy-noise-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3a8, #d4a84b, #c33);
  transition: width 0.1s;
}

.psy-prompt {
  position: absolute;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 8px 16px;
  background: rgba(0,0,0,0.55);
  border-radius: 4px;
  font-size: 0.95rem;
  opacity: 0;
  transition: opacity 0.25s;
}

.psy-prompt.is-on { opacity: 1; }

.psy-hint {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-size: 0.72rem;
  opacity: 0.45;
}

.psy-hint kbd {
  padding: 1px 5px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 3px;
  font-size: 0.7rem;
}

.psy-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(139, 30, 30, 0.35), transparent 55%),
    linear-gradient(180deg, #1a0c08 0%, #0a0504 100%);
}

.psy-overlay[hidden] { display: none !important; }
.psy-overlay--dim { background: rgba(5, 2, 2, 0.88); }
.psy-overlay--dead { background: radial-gradient(ellipse at center, #3a1010, #050000); }
.psy-overlay--win {
  background: radial-gradient(ellipse at 50% 40%, rgba(45, 90, 61, 0.4), #0a0805);
}

.psy-card {
  max-width: 440px;
  text-align: center;
}

.psy-credit {
  margin: 0 0 8px;
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  opacity: 0.55;
}

.psy-title {
  margin: 0;
  font-family: 'Cormorant Garamond', 'Noto Sans Thai', serif;
  font-size: clamp(2.8rem, 10vw, 4rem);
  font-weight: 700;
  color: var(--psy-gold);
  text-shadow: 0 0 40px rgba(212, 168, 75, 0.35);
}

.psy-sub {
  margin: 12px 0 24px;
  line-height: 1.5;
  opacity: 0.85;
}

.psy-menu-mock {
  background: linear-gradient(180deg, #2a1810, #1a100c);
  border: 2px solid var(--psy-gold);
  border-radius: 4px;
  padding: 20px;
  margin: 0 0 28px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}

.psy-menu-label {
  margin: 0 0 8px;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--psy-gold);
  opacity: 0.8;
}

.psy-dish {
  margin: 0;
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  color: var(--psy-cream);
  transition: color 0.6s, text-shadow 0.6s;
}

.psy-dish--horror {
  color: #ff6b5a;
  text-shadow: 0 0 24px rgba(255, 60, 40, 0.6);
  font-size: 2.4rem;
  margin: 16px 0 24px;
}

.psy-dish-note {
  margin: 8px 0 0;
  font-size: 0.8rem;
  opacity: 0.55;
}

.psy-close-line {
  margin: 0 0 12px;
  font-size: 1.15rem;
  opacity: 0;
  animation: psy-fade-in 0.8s ease forwards;
}

.psy-close-line--delay { animation-delay: 1.2s; }
.psy-close-line--delay2 { animation-delay: 2.4s; }

@keyframes psy-fade-in {
  to { opacity: 1; }
}

.psy-btn {
  display: inline-block;
  margin: 6px 4px;
  padding: 12px 26px;
  border: 1px solid rgba(212, 168, 75, 0.4);
  border-radius: 3px;
  background: rgba(40, 20, 14, 0.9);
  color: var(--psy-cream);
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  text-decoration: none;
}

.psy-btn--primary {
  background: linear-gradient(180deg, #a03028, #6a1814);
  border-color: rgba(255, 180, 100, 0.45);
  box-shadow: 0 0 24px rgba(160, 40, 30, 0.3);
}

.psy-btn:hover { filter: brightness(1.1); }

.psy-links {
  margin: 18px 0 0;
  font-size: 0.8rem;
  opacity: 0.55;
}

.psy-links a { color: var(--psy-gold); }

.psy-dead-title { color: #e05040; font-family: 'Cormorant Garamond', serif; }
.psy-win-title { color: var(--psy-gold); font-family: 'Cormorant Garamond', serif; }

.psy-card h2 {
  font-family: 'Cormorant Garamond', serif;
  margin: 0 0 16px;
}

/* ── Dinner / closing cutscene ─────────────────────────────────────────── */

.psy-dinner {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.psy-dinner[hidden] { display: none !important; }

.psy-dinner-room {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 24px 16px 28px;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(180, 80, 40, 0.25), transparent 50%),
    linear-gradient(180deg, #3a1810 0%, #1a0c08 45%, #0d0806 100%);
  transition: filter 1.2s ease, background 1.2s ease;
  overflow: hidden;
}

.psy-dinner-room.is-dimming {
  filter: brightness(0.45) saturate(0.7);
}

.psy-dinner-room.is-closed {
  filter: brightness(0.28) saturate(0.5);
  background:
    radial-gradient(ellipse at 50% 30%, rgba(80, 20, 20, 0.35), transparent 55%),
    linear-gradient(180deg, #120808 0%, #080404 100%);
}

.psy-dinner-wall {
  position: absolute;
  top: 8%;
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, 88vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.psy-dinner-sign {
  width: 100%;
  padding: 18px 20px;
  background: linear-gradient(180deg, #2a1810, #1a100c);
  border: 2px solid var(--psy-gold);
  border-radius: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  text-align: center;
  transition: border-color 0.8s, box-shadow 0.8s;
}

.psy-dinner-sign.is-cursed {
  border-color: #ff4a3a;
  box-shadow: 0 0 40px rgba(255, 40, 30, 0.35);
}

.psy-wall-sign-label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--psy-gold);
  margin-bottom: 6px;
}

.psy-wall-sign-dish {
  display: block;
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.8rem, 6vw, 2.4rem);
  color: var(--psy-cream);
  transition: color 0.6s, text-shadow 0.6s;
}

.psy-wall-sign-dish.is-horror {
  color: #ff6b5a;
  text-shadow: 0 0 28px rgba(255, 60, 40, 0.7);
}

.psy-dinner-neon {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  letter-spacing: 0.35em;
  font-size: 1.1rem;
  color: #ff3a5a;
  text-shadow: 0 0 12px rgba(255, 40, 80, 0.9), 0 0 40px rgba(255, 40, 80, 0.5);
  padding: 6px 18px;
  border: 2px solid rgba(255, 60, 90, 0.7);
  border-radius: 4px;
  transition: opacity 0.8s, color 0.8s, text-shadow 0.8s, border-color 0.8s;
}

.psy-dinner-neon.is-off {
  color: #3a2020;
  border-color: #2a1515;
  text-shadow: none;
  opacity: 0.5;
}

.psy-dinner-table {
  position: relative;
  width: min(520px, 94vw);
  margin-bottom: 100px;
  padding: 28px 24px 20px;
  background: linear-gradient(180deg, #5a3420 0%, #3a2010 40%, #2a160c 100%);
  border-radius: 8px 8px 0 0;
  box-shadow:
    0 -4px 0 #6a4028,
    0 20px 60px rgba(0,0,0,0.6);
  text-align: center;
}

.psy-place-mat {
  position: absolute;
  inset: 16px 20px 48px;
  background: radial-gradient(ellipse at center, #2a4a30, #1a3020);
  border-radius: 50%;
  opacity: 0.35;
}

.psy-plate-wrap {
  position: relative;
  width: min(280px, 60vw);
  height: min(280px, 60vw);
  margin: 0 auto 12px;
  transition: transform 0.5s ease;
}

.psy-plate-wrap.is-eating {
  animation: psy-eat-nudge 0.6s ease;
}

@keyframes psy-eat-nudge {
  0%, 100% { transform: scale(1) rotate(0deg); }
  40% { transform: scale(0.96) rotate(-2deg); }
  70% { transform: scale(1.02) rotate(1deg); }
}

.psy-plate-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 8px 28px rgba(0,0,0,0.55);
}

.psy-chopsticks {
  position: absolute;
  right: -8%;
  top: 20%;
  width: 8px;
  height: 55%;
  background: linear-gradient(180deg, #c8a070, #8a6040);
  border-radius: 4px;
  transform: rotate(25deg);
  box-shadow: 3px 0 0 #a08050;
  opacity: 0.9;
  transition: transform 0.4s, opacity 0.4s;
}

.psy-chopsticks.is-lifted {
  transform: rotate(-15deg) translate(-20px, -30px);
  opacity: 0.7;
}

.psy-steam {
  position: absolute;
  left: 50%;
  top: 10%;
  width: 120px;
  height: 80px;
  margin-left: -60px;
  background: radial-gradient(ellipse at 50% 80%, rgba(255,255,255,0.15), transparent 70%);
  animation: psy-steam 2.5s ease-in-out infinite;
  pointer-events: none;
}

.psy-steam.is-gone { opacity: 0; animation: none; }

@keyframes psy-steam {
  0%, 100% { transform: translateY(0) scaleX(1); opacity: 0.5; }
  50% { transform: translateY(-18px) scaleX(1.15); opacity: 0.2; }
}

.psy-table-label {
  position: relative;
  margin: 0;
  font-size: 0.85rem;
  color: rgba(245, 235, 224, 0.7);
  font-family: 'Cormorant Garamond', serif;
}

.psy-dinner-caption {
  position: absolute;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%);
  width: min(480px, 92vw);
  margin: 0;
  padding: 14px 20px;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(212, 168, 75, 0.35);
  border-radius: 6px;
  font-size: 1.05rem;
  line-height: 1.45;
  text-align: center;
  font-family: 'Cormorant Garamond', serif;
}

.psy-dinner-next {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}

.psy-plate-wrap.is-watching .psy-plate-img {
  filter: saturate(1.1) contrast(1.05);
}

.psy-plate-eyes {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  width: 42%;
  height: 14%;
  display: none;
  justify-content: space-between;
  padding: 0 8%;
  pointer-events: none;
}

.psy-plate-wrap.is-watching .psy-plate-eyes {
  display: flex;
}

.psy-plate-eye {
  width: 28%;
  aspect-ratio: 1;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(0,0,0,0.4);
  position: relative;
}

.psy-plate-eye::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 52%;
  width: 45%;
  height: 45%;
  background: #1a0a08;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
