:root {
  --brand: #e0554a;
  --brand-dark: #b8382f;
  --bg: #fff8f0;
  --card: #ffffff;
  --ink: #2b2320;
  --muted: #7a6f68;
  --good: #2e9e5b;
  --bad: #d64545;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 1rem 3rem;
}

.card {
  background: var(--card);
  border-radius: 1rem;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
  padding: 2rem;
  width: 100%;
  max-width: 28rem;
}

h1 {
  font-size: 1.5rem;
  margin: 0 0 0.25rem;
}

.subtitle {
  color: var(--muted);
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}

input[type="text"], select {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #eadfd6;
  border-radius: 0.6rem;
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

input[type="text"]:focus, select:focus {
  outline: none;
  border-color: var(--brand);
}

button {
  font: inherit;
  cursor: pointer;
}

.btn {
  width: 100%;
  padding: 0.85rem;
  border: none;
  border-radius: 0.6rem;
  background: var(--brand);
  color: white;
  font-size: 1.05rem;
  font-weight: 600;
}

.btn:hover { background: var(--brand-dark); }
.btn:disabled { background: #d9c9c0; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  color: var(--brand);
  border: 2px solid var(--brand);
}
.btn-secondary:hover { background: #fdeceb; }

.error {
  background: #fbe9e9;
  color: var(--bad);
  padding: 0.6rem 0.8rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.top-bar {
  width: 100%;
  max-width: 28rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.top-bar a { color: var(--brand); text-decoration: none; }

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border: 2px solid #eadfd6;
  border-radius: 0.7rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  background: white;
  text-align: left;
  width: 100%;
  font-size: 1.05rem;
  color: var(--ink);
}

.list-item:hover { border-color: var(--brand); }
.list-item .count { color: var(--muted); font-size: 0.85rem; }

/* game screen */
.game-progress {
  width: 100%;
  max-width: 28rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}

.hanzi {
  font-size: 4.5rem;
  text-align: center;
  margin: 1rem 0 2rem;
}

.options {
  display: grid;
  gap: 0.75rem;
}

.option-btn {
  padding: 1rem;
  border: 2px solid #eadfd6;
  border-radius: 0.7rem;
  background: white;
  font-size: 1.2rem;
  color: var(--ink);
}

.option-btn:hover:not(:disabled) { border-color: var(--brand); }
.option-btn.correct { background: #e5f6ec; border-color: var(--good); }
.option-btn.incorrect { background: #fbe9e9; border-color: var(--bad); }
.option-btn:disabled { cursor: default; }

.result {
  text-align: center;
}

.result .big-score {
  font-size: 3rem;
  font-weight: 700;
  color: var(--brand);
  margin: 1rem 0;
}

/* admin */
.admin-card { max-width: 56rem; }

.admin-card h2 { font-size: 1.15rem; margin: 1.75rem 0 0.75rem; }
.admin-card h2:first-of-type { margin-top: 0; }

table.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}
table.admin-table th, table.admin-table td {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid #eadfd6;
  font-size: 0.95rem;
  vertical-align: middle;
}
table.admin-table th { color: var(--muted); font-weight: 600; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #f3ece5;
  color: var(--ink);
  border-radius: 1rem;
  padding: 0.15rem 0.5rem 0.15rem 0.7rem;
  font-size: 0.8rem;
  margin: 0 0.25rem 0.25rem 0;
}
.chip button {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1;
  padding: 0;
}
.chip button:hover { color: var(--bad); }

.inline-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1.5rem;
}
.inline-form input[type="text"], .inline-form select {
  width: auto;
  flex: 1;
  min-width: 8rem;
  margin-bottom: 0;
}
.inline-form .btn { width: auto; padding: 0.6rem 1rem; white-space: nowrap; }

.row-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.row-actions select {
  width: auto;
  max-width: 9rem;
  margin-bottom: 0;
  padding: 0.35rem 0.4rem;
  font-size: 0.82rem;
  border-radius: 0.5rem;
}

.admin-table input[type="text"] {
  width: 100%;
  min-width: 8rem;
  padding: 0.4rem 0.5rem;
  margin-bottom: 0;
  font-size: 0.9rem;
  border-radius: 0.4rem;
}

.confirm-row { color: var(--bad); }

.btn-small {
  padding: 0.35rem 0.6rem;
  font-size: 0.82rem;
  border-radius: 0.5rem;
  border: 2px solid #eadfd6;
  background: white;
  color: var(--ink);
  white-space: nowrap;
}
.btn-small:hover { border-color: var(--brand); }
.btn-danger { color: var(--bad); border-color: #f2caca; }
.btn-danger:hover { background: #fbe9e9; border-color: var(--bad); }
