:root {
  --bg: #0f1226;
  --bg2: #1a1f3c;
  --card: #ffffff;
  --ink: #1c2033;
  --muted: #6b7280;
  --accent: #ff6b2c;
  --accent2: #7c5cff;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --chip: #eef0f7;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter Tight", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #fff;
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg2) 60%, #2a1c3c 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
}

.site-header { text-align: center; margin: 12px 0 20px; }
.site-header h1 { margin: 0; font-size: 2rem; letter-spacing: 2px; }
.subtitle { margin: 6px 0 0; color: #c9cde6; font-size: .95rem; }

.card {
  background: var(--card);
  color: var(--ink);
  width: 100%;
  max-width: 520px;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  justify-content: space-between;
  align-items: center;
  font-size: .9rem;
  color: var(--muted);
}
.score b { color: var(--accent); font-size: 1.1rem; }

.puzzle {
  text-align: center;
  font-size: clamp(2.6rem, 11vw, 6rem);
  line-height: 1.1;
  margin: 8px 0 4px;
  font-weight: 700;
  word-break: break-word;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.prompt { text-align: center; color: var(--muted); margin: 0 0 16px; }

.answerForm { margin-bottom: 16px; }

.answerGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, 48px);
  gap: 10px;
  justify-content: center;
  min-height: 50px;
}

.answerSlot {
  width: 48px;
  height: 48px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  background: var(--chip);
  color: var(--ink);
  font-size: 1.45rem;
  font-weight: 700;
  text-align: center;
  outline: none;
}
.answerSlot:focus {
  border-color: var(--accent2);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(124, 92, 255, .16);
}
.answerSlot.ok {
  background: #dcfce7;
  border-color: #86efac;
  color: var(--ok);
  opacity: 1;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  padding: 12px 18px;
  font-weight: 600;
}
.ghost { background: var(--chip); color: var(--ink); }
.primary { background: var(--accent2); color: #fff; }
button:disabled { opacity: .45; cursor: not-allowed; }

.feedback { text-align: center; min-height: 1.4em; margin: 12px 0; font-weight: 600; }
.feedback.ok { color: var(--ok); }
.feedback.warn { color: var(--warn); }
.feedback.bad { color: var(--bad); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

.site-footer { margin-top: 24px; color: #9aa0c2; font-size: .8rem; text-align: center; }

/* ---- mode picker ---- */
.picker { text-align: center; }
.pickerTitle { margin: 4px 0 20px; font-size: 1.15rem; color: var(--ink); }
.pickerGrid { display: grid; gap: 14px; }
.modeBtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px;
  background: var(--chip);
  color: var(--ink);
  border-radius: 16px;
  text-align: center;
}
.modeBtn:hover { background: #e6e3f7; }
.modeEmoji {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  font-size: 1.2rem; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}
.modeName { font-size: 1.15rem; font-weight: 700; }
.modeDesc { font-size: .85rem; color: var(--muted); }

/* ---- English word mode ---- */
.wordForm { display: flex; gap: 10px; margin-bottom: 14px; }
.wordInput {
  flex: 1;
  font-size: 1.2rem;
  padding: 12px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  outline: none;
  text-align: center;
  letter-spacing: 1px;
}
.wordInput:focus { border-color: var(--accent2); box-shadow: 0 0 0 3px rgba(124,92,255,.16); }
.wordForm button { background: var(--accent); color: #fff; }

.foundList { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; min-height: 40px; margin-bottom: 8px; }
.chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; height: 36px; padding: 0 12px;
  border-radius: 10px; background: var(--chip); color: var(--muted);
  font-size: 1.05rem; font-weight: 600;
}
.chip.ok { background: #dcfce7; color: var(--ok); }

@media (max-width: 400px) {
  .puzzle { font-size: 4.5rem; }
  .card { padding: 18px; }
}
