:root {
  --bg: #fef6e4;
  --card: #ffffff;
  --primary: #ff6b6b;
  --primary-dark: #e85555;
  --secondary: #4ecdc4;
  --accent: #ffd166;
  --purple: #a78bfa;
  --ink: #2d2a32;
  --muted: #7a7686;
  --success: #2ecc71;
  --danger: #ef4444;
  --radius: 18px;
  font-size: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  min-height: 100%;
}

body { display: flex; flex-direction: column; min-height: 100vh; }

button {
  font-family: inherit;
  cursor: pointer;
}

input {
  font-family: inherit;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-size: 1.4rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.brand-emoji { font-size: 1.6rem; }

.app-nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.nav-btn {
  border: none;
  background: rgba(255,255,255,0.2);
  color: white;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
}

.nav-btn:hover { background: rgba(255,255,255,0.35); }
.nav-btn-quiet { background: transparent; text-decoration: underline; }

.points-pill {
  background: var(--accent);
  color: #5c3d00;
  font-weight: 800;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
}

.app-main {
  flex: 1;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

.app-footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.app-footer a { color: var(--muted); }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 6px 20px rgba(45, 42, 50, 0.08);
  margin-bottom: 1.25rem;
}

h1, h2, h3 { line-height: 1.2; margin-top: 0; }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.4rem; }

.subtitle { color: var(--muted); margin-top: -0.5rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.5rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: white;
  background: var(--primary);
  box-shadow: 0 4px 0 var(--primary-dark);
  transition: transform 0.05s ease;
}
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--primary-dark); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn-secondary { background: var(--secondary); box-shadow: 0 4px 0 #35a29b; }
.btn-secondary:active { box-shadow: 0 2px 0 #35a29b; }
.btn-purple { background: var(--purple); box-shadow: 0 4px 0 #7c5fe0; }
.btn-purple:active { box-shadow: 0 2px 0 #7c5fe0; }
.btn-block { width: 100%; }
.btn-outline {
  background: transparent;
  color: var(--ink);
  border: 2px solid #e2ded6;
  box-shadow: none;
}

.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 700; margin-bottom: 0.3rem; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  border: 2px solid #e2ded6;
  font-size: 1.05rem;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
}
.hint { color: var(--muted); font-size: 0.85rem; }

.error-box {
  background: #fde8e8;
  color: #a12727;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-weight: 600;
}
.success-box {
  background: #e6f9ee;
  color: #1a7a44;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.menu-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 6px 20px rgba(45, 42, 50, 0.08);
  border: none;
  font-weight: 800;
  font-size: 1.15rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.menu-card .emoji { font-size: 2.5rem; }
.menu-card:hover { transform: translateY(-2px); }

.timer-bar-track {
  background: #eee6da;
  border-radius: 999px;
  height: 14px;
  overflow: hidden;
  margin: 0.75rem 0;
}
.timer-bar-fill {
  height: 100%;
  background: var(--secondary);
  transition: width 1s linear;
}
.timer-bar-fill.low { background: var(--danger); }

.word-display {
  font-size: 2.4rem;
  font-weight: 800;
  text-align: center;
  padding: 1rem;
  letter-spacing: 0.05em;
  word-break: break-word;
}

.chapter-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}
.chapter-btn {
  background: var(--card);
  border: 2px solid #e2ded6;
  border-radius: 14px;
  padding: 1rem;
  font-weight: 700;
  text-align: left;
}
.chapter-btn:hover { border-color: var(--primary); }
.chapter-btn small { display: block; color: var(--muted); font-weight: 400; }

.word-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}
.word-chip {
  background: var(--accent);
  color: #5c3d00;
  font-weight: 700;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  font-size: 1.1rem;
}

.speaker-btn {
  border: none;
  background: var(--purple);
  color: white;
  border-radius: 999px;
  width: 3.2rem;
  height: 3.2rem;
  font-size: 1.5rem;
  box-shadow: 0 4px 0 #7c5fe0;
}

.result-banner {
  text-align: center;
  padding: 1.5rem;
}
.result-banner .big-emoji { font-size: 3.5rem; display: block; margin-bottom: 0.5rem; }

table.board-table {
  width: 100%;
  border-collapse: collapse;
}
table.board-table th, table.board-table td {
  padding: 0.6rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid #eee6da;
}
table.board-table tr.me { background: #fff6d8; font-weight: 800; }
.rank-badge {
  display: inline-block;
  min-width: 1.8rem;
  text-align: center;
  font-weight: 800;
}

.gift-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}
.gift-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: 0 6px 20px rgba(45, 42, 50, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.gift-card img, .gift-card .no-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  background: #f2ede2;
}
.gift-card .no-image {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}
.badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}
.badge.pending { background: #fff3cd; color: #7a5b00; }
.badge.approved { background: #d7ecff; color: #0a5a9c; }
.badge.fulfilled { background: #d7f7e3; color: #146c3a; }
.badge.rejected { background: #ffe0e0; color: #a12727; }

.tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tab-btn {
  border: none;
  background: #f2ede2;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  font-weight: 700;
}
.tab-btn.active { background: var(--primary); color: white; }

.center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.flex-row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.text-muted { color: var(--muted); }

@media (max-width: 480px) {
  :root { font-size: 16px; }
  .word-display { font-size: 1.8rem; }
  .app-header { padding: 0.6rem 0.7rem; }
  .brand { font-size: 1.15rem; }
}
