﻿:root {
  --wood-dark: #20120d;
  --wood: #4a2b1d;
  --gold: #e6bf73;
  --cream: #fff1d3;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--cream);
  font-family: "Microsoft JhengHei", "Noto Sans TC", Arial, sans-serif;
  background:
    radial-gradient(circle at top, rgba(230, 191, 115, 0.24), transparent 34rem),
    linear-gradient(135deg, #120b08, #342014 55%, #160c08);
}

button {
  border: 0;
  border-radius: 8px;
  padding: 12px 18px;
  color: #1c100b;
  background: var(--gold);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 0 #8e5a27;
}

button:hover {
  filter: brightness(1.08);
}

button:active {
  transform: translateY(4px);
  box-shadow: 0 4px 0 #8e5a27;
}

.app {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  padding: clamp(8px, 2vmin, 20px);
  overflow: hidden;
}

.game-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(100%, 1120px);
  height: calc(100dvh - clamp(16px, 4vmin, 40px));
  max-height: calc(100dvh - clamp(16px, 4vmin, 40px));
  padding: clamp(10px, 1.8vmin, 22px);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08), transparent 18%, rgba(0, 0, 0, 0.24)),
    repeating-linear-gradient(90deg, #3b2116 0 18px, #54301f 18px 34px);
  border: 14px solid #2a1710;
  border-radius: 8px;
  box-shadow: var(--shadow), inset 0 0 0 6px #714528;
}

.brand-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.brand-mark {
  display: grid;
  width: clamp(42px, 6vmin, 54px);
  height: clamp(42px, 6vmin, 54px);
  place-items: center;
  color: #2a1710;
  background: var(--cream);
  border: 4px solid var(--gold);
  border-radius: 50%;
  font-size: 24px;
  font-weight: 900;
}

.eyebrow {
  margin: 0;
  color: var(--gold);
  font-size: 14px;
  font-weight: 800;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 5vmin, 54px);
  line-height: 1.05;
}

.status-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.status-row span {
  padding: 8px;
  text-align: center;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(230, 191, 115, 0.5);
  border-radius: 8px;
  font-weight: 800;
}

.status-row strong {
  color: var(--gold);
}

.play-area {
  display: grid;
  grid-template-columns: minmax(280px, auto) minmax(210px, 300px);
  align-items: stretch;
  justify-content: center;
  min-height: 0;
  gap: 14px;
}

.board-wrap {
  position: relative;
  width: auto;
  height: 100%;
  max-width: 100%;
  aspect-ratio: 2 / 3;
  justify-self: end;
  overflow: hidden;
  background:
    radial-gradient(circle at 10% 12%, rgba(180, 57, 41, 0.36), transparent 9rem),
    radial-gradient(circle at 90% 70%, rgba(198, 96, 43, 0.34), transparent 10rem),
    repeating-linear-gradient(90deg, #23130d 0 14px, #321c12 14px 28px);
  border: 8px solid #1c100b;
  border-radius: 8px;
  box-shadow: inset 0 0 0 5px #6f4328;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#fireworkCanvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
}

.prize-history {
  height: 100%;
  padding: 14px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(230, 191, 115, 0.5);
  border-radius: 8px;
  min-height: 0;
}

.prize-history h2 {
  margin-bottom: 8px;
  color: var(--gold);
  font-size: 20px;
}

.prize-history ol {
  display: grid;
  align-content: start;
  gap: 8px;
  max-height: calc(100% - 36px);
  margin: 0;
  padding-left: 24px;
  overflow: auto;
}

.prize-history li {
  color: #ffe5b2;
  font-weight: 800;
}

.empty-prize {
  color: rgba(255, 229, 178, 0.72);
}

.prize-dialog {
  width: min(92vw, 440px);
  padding: 0;
  color: var(--cream);
  background: transparent;
  border: 0;
}

.prize-dialog::backdrop {
  background: rgba(0, 0, 0, 0.64);
}

.dialog-card {
  padding: 28px;
  text-align: center;
  background: linear-gradient(145deg, rgba(230, 191, 115, 0.18), transparent), #2a1710;
  border: 3px solid var(--gold);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.dialog-card h2 {
  margin-bottom: 10px;
  color: var(--gold);
  font-size: 36px;
}

.dialog-card p {
  color: #ffe5b2;
}

@media (max-width: 520px) {
  .app {
    padding: 8px;
  }

  .game-shell {
    width: min(100%, 760px);
    height: auto;
    max-height: none;
    border-width: 8px;
  }

  .play-area {
    grid-template-columns: 1fr;
  }

  .board-wrap {
    width: 100%;
    height: auto;
    justify-self: stretch;
  }

  .prize-history ol {
    max-height: 110px;
  }

  .brand-area {
    justify-content: flex-start;
  }

  .controls {
    grid-template-columns: 1fr;
  }
}
