:root {
  --bg: #0f0f12;
  --bg-accent: #1a1a22;
  --surface: #18181d;
  --surface-strong: #222228;
  --surface-soft: #141419;
  --line: #30303a;
  --text: #f3f0ea;
  --muted: #9a958b;
  --warm: #ff5a1f;
  --cool: #295dff;
  --accent: #f0e64a;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: "SUIT", sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 90, 31, 0.08), transparent 20%),
    linear-gradient(135deg, var(--bg) 0%, var(--bg-accent) 100%);
}

.app {
  width: min(100%, 620px);
  margin: 0 auto;
  padding: 18px 14px 28px;
}

.hero {
  position: relative;
  padding: 8px 2px 14px;
  min-height: 180px;
  text-align: left;
  overflow: hidden;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--accent);
}

.hero h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: "SUIT", sans-serif;
  font-size: clamp(2.1rem, 11vw, 4.2rem);
  font-weight: 800;
  line-height: 0.96;
  letter-spacing: -0.05em;
  text-transform: uppercase;
}

.hero-portrait {
  position: absolute;
  right: -4px;
  bottom: 0;
  z-index: 0;
  width: min(46vw, 220px);
  max-height: 100%;
  object-fit: cover;
  object-position: center top;
  opacity: 0.22;
  filter: grayscale(0.08) contrast(1.03);
  pointer-events: none;
}

.panel {
  margin-bottom: 12px;
  padding: 16px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.score {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.metric {
  padding: 12px 10px;
  border: 1px solid #2f2f39;
  border-radius: 6px;
  background: var(--surface-strong);
  text-align: center;
}

.metric span {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
}

.metric strong {
  font-size: 24px;
  font-weight: 700;
}

.stage-grid {
  display: grid;
  gap: 12px;
}

.stage-block,
.result-block {
  display: grid;
  gap: 14px;
}

.block-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
}

.block-head h2 {
  margin: 0 0 4px;
  font-size: 17px;
  text-transform: uppercase;
}

.block-head p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.block-step {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: var(--accent);
  color: #111;
  font-size: 13px;
  font-weight: 800;
}

.total-card {
  padding: 18px 14px;
  border: 2px solid #2e2e38;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(240, 230, 74, 0.12), transparent 60%),
    var(--surface-soft);
  text-align: left;
}

.section-label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
}

.total-card strong {
  display: block;
  font-size: clamp(3rem, 15vw, 5.2rem);
  line-height: 0.95;
}

.hands {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.hand-card {
  border: 2px solid #2f2f39;
  border-radius: 8px;
  padding: 16px 12px;
  background: var(--surface-strong);
  color: var(--text);
  text-align: center;
  display: grid;
  gap: 8px;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease,
    opacity 120ms ease,
    background 120ms ease;
}

.hand-card:not(:disabled) {
  cursor: pointer;
}

.hand-card:not(:disabled):active,
.action:not(:disabled):active {
  transform: translateY(1px);
}

.hand-card.selected {
  border-color: var(--accent);
  background: #202027;
  box-shadow: 0 0 0 2px rgba(240, 230, 74, 0.12);
}

.hand-card:disabled {
  opacity: 0.58;
}

.hand-title {
  font-weight: 700;
}

.hand-icon {
  font-size: 50px;
  line-height: 1;
}

.hand-status {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.guess-actions,
.result-actions {
  display: grid;
  gap: 10px;
}

.guess-actions,
.result-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.action {
  min-height: 54px;
  border: 2px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #111;
}

.action:not(:disabled) {
  cursor: pointer;
}

.action:disabled {
  opacity: 0.38;
}

.action.wide {
  width: 100%;
}

.action.neutral {
  color: var(--text);
  background: #26262f;
  border-color: #3a3a46;
}

#shake-btn {
  min-height: 68px;
  font-size: 18px;
  color: #111;
  background: var(--accent);
  border-color: #d8cf3a;
  box-shadow: 0 10px 0 #8e8623;
}

.action.warm {
  color: #fff4ee;
  background: var(--warm);
  border-color: #c94717;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18);
}

.action.cool {
  color: #eef3ff;
  background: var(--cool);
  border-color: #1c43ba;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18);
}

.action.ghost {
  color: var(--muted);
  background: transparent;
  border-color: #3a3a46;
}

.hint {
  color: var(--accent);
  font-size: 13px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 8, 0.72);
}

.modal-card {
  position: relative;
  width: min(100%, 390px);
  padding: 22px 16px 16px;
  border: 2px solid #393944;
  border-radius: 10px;
  background: #18181d;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.44);
  text-align: left;
}

.modal-state {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--accent);
}

.modal-hero {
  position: relative;
  display: grid;
  margin-bottom: 16px;
}

.speaker-card {
  overflow: hidden;
  border: 2px solid #34343d;
  border-radius: 8px;
  background: #111;
  margin-top: 36px;
}

.speaker-image {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center top;
  filter: contrast(1.06) saturate(0.98);
}

.speech-bubble {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  width: min(78%, 240px);
  padding: 14px 16px 12px;
  border: 3px solid #111;
  border-radius: 14px;
  background: #fffdf8;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.22);
}

.speech-bubble::before {
  content: "";
  position: absolute;
  left: 24px;
  bottom: -16px;
  width: 22px;
  height: 22px;
  background: #fffdf8;
  border-right: 3px solid #111;
  border-bottom: 3px solid #111;
  transform: rotate(35deg) skewX(-8deg);
}

.modal-message {
  margin: 0;
  font-family: "Noto Serif KR", serif;
  font-size: clamp(1.45rem, 8vw, 2.2rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: #111;
}

.modal-reveal {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.reveal-side {
  padding: 12px;
  border: 1px solid #34343d;
  border-radius: 6px;
  background: #23232a;
  text-align: center;
}

.reveal-title {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.board {
  min-height: 40px;
  line-height: 1.6;
  font-size: 26px;
  word-break: break-all;
}

.modal-card.is-win .modal-state {
  color: var(--accent);
}

.modal-card.is-lose .modal-state {
  color: #7da2ff;
}

@media (max-width: 420px) {
  .app {
    padding-inline: 12px;
  }

  .hero {
    min-height: 156px;
  }

  .panel {
    padding: 14px;
    border-radius: 8px;
  }

  .score {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .metric {
    padding: 10px 6px;
  }

  .metric span {
    font-size: 10px;
    margin-bottom: 4px;
  }

  .metric strong {
    font-size: clamp(16px, 5vw, 20px);
  }

  .hands,
  .guess-actions,
  .result-actions,
  .modal-reveal {
    grid-template-columns: 1fr;
  }

  .hand-icon {
    font-size: 44px;
  }

  .hero-portrait {
    width: min(42vw, 150px);
    opacity: 0.18;
  }

  .modal {
    padding: 12px;
  }

  .modal-card {
    padding: 18px 12px 12px;
  }

  .speaker-card {
    margin-top: 52px;
  }

  .speech-bubble {
    width: min(82%, 220px);
    padding: 12px 14px 10px;
  }
}
