:root {
  color-scheme: light;
  --bg: #f4efe6;
  --bg-accent: #e5d3b3;
  --ink: #1f1b16;
  --muted: #6c6258;
  --card: rgba(255, 250, 242, 0.86);
  --line: rgba(67, 52, 36, 0.12);
  --gold: #c88b2a;
  --teal: #1f8a88;
  --rose: #d15858;
  --shadow: 0 20px 60px rgba(82, 54, 21, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Noto Sans TC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(200, 139, 42, 0.18), transparent 30%),
    radial-gradient(circle at top right, rgba(31, 138, 136, 0.16), transparent 24%),
    linear-gradient(180deg, var(--bg), #fffaf4);
  min-height: 100vh;
}

.page {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 56px;
}

.hero {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.85rem;
  font-weight: 700;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 1.05;
  max-width: 800px;
}

.subtitle {
  margin: 14px 0 0;
  max-width: 720px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

.upload-card,
.preview-card,
.result-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.upload-card,
.preview-card {
  padding: 22px;
}

.upload-box {
  display: grid;
  place-items: center;
  min-height: 300px;
  border: 2px dashed rgba(31, 138, 136, 0.3);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(243, 235, 221, 0.9));
  cursor: pointer;
  text-align: center;
  padding: 24px;
}

.upload-box input {
  display: none;
}

.upload-box span {
  font-size: 1.15rem;
  font-weight: 700;
}

.upload-box small {
  margin-top: 8px;
  color: var(--muted);
}

.actions {
  margin-top: 16px;
}

button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--teal), #2962ff);
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(41, 98, 255, 0.22);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.preview-frame {
  min-height: 364px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(236, 229, 215, 0.95));
  overflow: hidden;
}

.preview-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  max-height: 364px;
}

.preview-frame p {
  color: var(--muted);
}

.result-panel {
  grid-template-columns: 1fr;
  padding: 24px;
}

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.result-head h2 {
  margin: 0;
}

.result-head p {
  margin: 0;
  color: var(--muted);
}

.result-main {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
  padding-top: 22px;
}

.winner-card {
  border-radius: 22px;
  padding: 24px;
  background: linear-gradient(160deg, rgba(200, 139, 42, 0.18), rgba(31, 138, 136, 0.12));
}

.winner-label {
  margin: 0 0 12px;
  color: var(--muted);
}

.winner-card h3 {
  margin: 0;
  font-size: 2rem;
}

.winner-card p:last-child {
  margin: 16px 0 0;
  font-weight: 700;
}

.score-list {
  display: grid;
  gap: 18px;
}

.score-item {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
}

.score-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-weight: 700;
}

.score-bar {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(31, 27, 22, 0.08);
  overflow: hidden;
}

.score-bar div {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--rose));
  transition: width 240ms ease;
}

@media (max-width: 860px) {
  .panel,
  .result-main {
    grid-template-columns: 1fr;
  }

  .page {
    width: min(100% - 20px, 960px);
    padding-top: 24px;
  }
}
