:root {
  --bg: #f5f7fb;
  --ink: #182235;
  --muted: #7b8798;
  --line: #dfe6ef;
  --blue: #2474ff;
  --green: #0aa06e;
  --amber: #b65a12;
  --panel: rgba(255, 255, 255, .82);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 12%, rgba(36, 116, 255, .12), transparent 30%),
    radial-gradient(circle at 86% 8%, rgba(10, 160, 110, .12), transparent 28%),
    var(--bg);
}

button, input, select { font: inherit; }
button { border: 0; cursor: pointer; }
.hidden { display: none !important; }
.shell { width: min(960px, calc(100% - 28px)); margin: 0 auto; padding: 14px 0 30px; }
.topbar, .admin-head { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 14px; }
.eyebrow { margin: 0 0 6px; color: var(--blue); font-size: 13px; font-weight: 800; letter-spacing: 0; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(26px, 3vw, 38px); letter-spacing: 0; }
h2 { font-size: 21px; margin-bottom: 12px; }
.user-pill, .chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  border: 1px solid var(--line);
  color: #39465a;
  font-weight: 700;
}

.auth-grid, .workspace, .admin-grid { display: grid; grid-template-columns: 1fr .9fr; gap: 18px; align-items: start; }
.panel, .intro, .widget {
  background: var(--panel);
  border: 1px solid rgba(210, 219, 232, .9);
  box-shadow: 0 24px 70px rgba(40, 55, 80, .09);
  backdrop-filter: blur(22px);
  border-radius: 24px;
}
.intro { min-height: 330px; padding: 34px; position: relative; overflow: hidden; }
.intro h2 { font-size: clamp(28px, 3.4vw, 42px); line-height: 1.12; max-width: 520px; margin-bottom: 12px; }
.intro p { color: var(--muted); font-size: 16px; line-height: 1.65; max-width: 520px; }
.glass-orbit {
  width: 94px; height: 94px; border-radius: 26px; margin-bottom: 36px;
  background: linear-gradient(145deg, rgba(255,255,255,.95), rgba(214,233,255,.7));
  border: 1px solid white;
  box-shadow: inset 0 0 30px rgba(255,255,255,.8), 0 26px 70px rgba(36,116,255,.18);
}
.auth-panel, .panel { padding: 20px; }
label { display: grid; gap: 8px; color: #566277; font-weight: 750; margin-bottom: 14px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.86);
  color: var(--ink);
  outline: none;
}
input, select { min-height: 48px; padding: 0 15px; }
textarea { min-height: 132px; padding: 14px 15px; resize: vertical; line-height: 1.55; }
textarea::placeholder { color: #9aa7b8; }
input:focus, select:focus, textarea:focus { border-color: #8bbcff; box-shadow: 0 0 0 4px rgba(36,116,255,.12); }
.segmented, .mode-switch, .tabs { display: flex; gap: 8px; padding: 6px; background: #edf2f8; border-radius: 18px; margin-bottom: 18px; }
.segmented button, .mode-switch button, .tabs button {
  flex: 1;
  min-height: 42px;
  border-radius: 13px;
  background: transparent;
  color: #536072;
  font-weight: 850;
}
.segmented .active, .mode-switch .active, .tabs .active { background: white; color: var(--ink); box-shadow: 0 8px 24px rgba(44, 59, 82, .1); }
.primary {
  min-height: 52px;
  padding: 0 22px;
  border-radius: 18px;
  background: var(--green);
  color: white;
  font-weight: 900;
  box-shadow: 0 12px 26px rgba(10,160,110,.25);
}
.ghost { min-height: 44px; padding: 0 16px; border-radius: 14px; background: #edf2f8; color: #334155; font-weight: 800; }
.wide { width: 100%; }
.hint { color: var(--muted); font-size: 14px; margin: 14px 0 0; }
.tabs { margin-bottom: 22px; }
.tabs button[data-action="logout"] { flex: 0 0 auto; padding: 0 18px; }
.workspace { grid-template-columns: 220px minmax(0, 1fr); }
.side { position: sticky; top: 20px; }
.category-list { display: grid; gap: 8px; margin-bottom: 14px; }
.category-card {
  width: 100%;
  min-height: 48px;
  border-radius: 15px;
  background: rgba(255,255,255,.72);
  border: 1px solid var(--line);
  padding: 9px 12px;
  text-align: left;
  font-weight: 900;
  color: var(--ink);
}
.category-card span { display: block; color: var(--muted); font-size: 13px; font-weight: 700; margin-top: 3px; }
.category-card.active { border-color: #7db6ff; background: #eef6ff; }
.widget { min-height: 470px; padding: 24px; display: grid; align-content: stretch; min-width: 0; }
.empty-state { align-self: center; text-align: center; color: var(--muted); }
.quiz { min-height: 420px; display: grid; grid-template-rows: auto auto 1fr auto; text-align: center; min-width: 0; }
.quiz-meta { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.quiz-meta .chip:nth-child(2) { color: #1f66df; background: #edf4ff; }
.quiz-meta .chip:nth-child(3) { color: var(--amber); background: #fff5e5; }
.meaning { font-size: clamp(28px, 3.8vw, 44px); line-height: 1.12; font-weight: 950; margin-bottom: 6px; overflow-wrap: anywhere; }
.prefix { color: #9aa7b8; font-size: 14px; font-weight: 850; }
.slots { display: flex; justify-content: center; align-items: end; flex-wrap: wrap; gap: 10px; margin: 54px auto 28px; min-height: 48px; max-width: 100%; }
.slot { flex: 0 1 44px; width: 44px; min-width: 22px; border-bottom: 5px solid #cfd8e3; color: #26364d; font-size: 26px; font-weight: 950; text-transform: uppercase; }
.slot.filled { border-color: #98c8ff; }
.slot.hint-letter { color: #2c3a50; border-color: #98c8ff; }
.slot.correct-letter { color: #07845c; border-color: #35c18f; }
.slot.wrong-letter { color: #d13b3b; border-color: #ef6b6b; }
.answer-input { height: 60px; border-radius: 18px; text-align: center; font-size: 20px; font-weight: 850; }
.quiz-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.quiz-actions button { min-width: 190px; }
.secondary { min-height: 52px; padding: 0 18px; border-radius: 18px; background: #eef3f9; color: #334155; font-weight: 900; }
.timer { color: #ef4444; font-weight: 950; }
.feedback { min-height: 28px; margin-top: 12px; font-weight: 900; }
.feedback.good { color: #07845c; }
.feedback.bad { color: #d13b3b; }
.leaderboard, .table-list { display: grid; gap: 10px; }
.rank-row, .table-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.68);
}
.rank-row strong { font-size: 20px; }
.word-form { display: grid; grid-template-columns: 1fr 1fr 1.4fr .8fr .8fr auto; gap: 10px; margin-bottom: 22px; }
.category-form { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 10px; margin-bottom: 14px; }
.import-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; margin-bottom: 22px; }
.import-form textarea { grid-row: span 2; }
.admin-grid { grid-template-columns: 1.4fr .8fr; }
.table-row { grid-template-columns: 1fr auto; text-align: left; }
.table-row small { color: var(--muted); display: block; margin-top: 4px; }
.mini-actions { display: flex; gap: 8px; }
.mini-actions button { min-height: 34px; padding: 0 10px; border-radius: 10px; background: #eef3f9; color: #334155; font-weight: 800; }

@media (max-width: 860px) {
  .auth-grid, .workspace, .admin-grid { grid-template-columns: 1fr; }
  .intro { min-height: auto; padding: 26px; }
  .side { position: static; }
  .widget { padding: 22px; min-height: 560px; }
  .slots { margin-top: 70px; }
  .word-form { grid-template-columns: 1fr; }
  .category-form, .import-form { grid-template-columns: 1fr; }
  .import-form textarea { grid-row: auto; }
  .topbar { align-items: flex-start; flex-direction: column; }
}
