:root {
  --sand: #f4ead9;
  --sand-dark: #e6d5b8;
  --terracotta: #c1602c;
  --terracotta-dark: #9c4a1f;
  --espresso: #3a2b22;
  --ink: #2a1f18;
  --muted: #8a7a68;
  --card: #fffaf2;
  --success: #3f7d4f;
  --error: #b3401f;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--sand);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 20px 16px 40px;
}

.center-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  color: var(--muted);
}

h1 {
  font-size: 22px;
  margin: 8px 0 0;
  color: var(--espresso);
}

h2 {
  font-size: 15px;
  color: var(--muted);
  margin: 24px 0 8px;
}

.subtitle {
  color: var(--muted);
  margin: 4px 0 20px;
  font-size: 14px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 2px 10px rgba(58, 43, 34, 0.08);
}

/* 배너 */
.banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  text-align: center;
  padding: 10px 12px;
  font-size: 14px;
  color: #fff;
  background: var(--espresso);
}
.banner-success { background: var(--success); }
.banner-error { background: var(--error); }
.hidden { display: none; }

/* 인증 화면 */
.auth-screen { padding-top: 40px; }
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.tab-btn {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 999px;
  background: var(--sand-dark);
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}
.tab-btn.active {
  background: var(--terracotta);
  color: #fff;
}

form label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}
form input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  font-size: 16px;
  border: 1px solid var(--sand-dark);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}
form input:focus {
  outline: 2px solid var(--terracotta);
  outline-offset: 1px;
}

button { font-family: inherit; }

.primary-btn, form button[type="submit"] {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 10px;
  background: var(--terracotta);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.primary-btn:disabled, form button:disabled {
  opacity: 0.5;
  cursor: default;
}

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px;
}

.back-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 0 12px;
}

.hint {
  margin-top: 24px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  text-align: center;
}

/* 홈 화면 */
.home-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}
.home-nickname { font-size: 19px; font-weight: 700; color: var(--espresso); }
.home-cardno { font-size: 12px; color: var(--muted); margin-top: 2px; }

.stamp-card { text-align: center; }
.stamp-count {
  font-size: 40px;
  font-weight: 800;
  color: var(--terracotta-dark);
}
.stamp-unit { font-size: 16px; margin-left: 4px; color: var(--muted); }

.stamp-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin: 14px 0 18px;
}
.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}
.dot.filled { background: var(--terracotta); }
.dot-extra {
  font-size: 12px;
  color: var(--muted);
  align-self: center;
}

/* 리워드 목록 */
.reward-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.reward-item {
  background: var(--card);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 1px 4px rgba(58, 43, 34, 0.06);
}
.reward-item.reward-inactive { opacity: 0.55; }
.reward-main { display: flex; justify-content: space-between; font-weight: 700; }
.reward-cost { color: var(--terracotta-dark); }
.reward-sub {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}
.reward-request-btn {
  border: none;
  border-radius: 999px;
  background: var(--terracotta);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  cursor: pointer;
}
.reward-request-btn:disabled {
  background: var(--sand-dark);
  color: var(--muted);
  cursor: default;
}
.reward-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 20px 0; }

/* 대기 화면 */
.wait-screen { text-align: center; padding-top: 60px; }
.countdown {
  font-size: 44px;
  font-weight: 800;
  color: var(--terracotta-dark);
  margin: 30px 0;
  font-variant-numeric: tabular-nums;
}
