/* Additions for the real app (sign-in, quiz types, forum, notices). Uses the tokens from styles.css. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.tabs-inner { grid-template-columns: repeat(5, 1fr); gap: 2px; }
.tab { font-size: 11px; }

/* Sign-in and forms */
.auth { max-width: 420px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; padding-top: 4vh; }
.auth-card { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.auth-switch { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; font-size: 14px; }
input[type="email"], input[type="password"], textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 11px; min-height: 42px; width: 100%;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-row label { flex: 1 1 120px; display: flex; gap: 8px; align-items: center; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 14px; }
.radio-row input { accent-color: var(--accent); margin: 0; }
.radio-row label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.hint { font-size: 12.5px; color: var(--muted); }
.form-ok { color: var(--good); font-size: 13.5px; font-weight: 600; }
.center-msg { padding: 28px 20px; display: flex; flex-direction: column; gap: 10px; text-align: center; align-items: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 20;
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 500;
  max-width: min(92vw, 480px); box-shadow: 0 6px 24px rgba(0, 0, 0, .18); }
.toast.is-error { background: var(--bad); color: var(--surface); }
.top-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.avatar-btn { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-family: var(--font-display); display: grid; place-items: center; }
.code-card { padding: 16px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.code { font-family: var(--font-display); font-size: 28px; font-weight: 800; letter-spacing: .12em; font-variant-numeric: tabular-nums; }

/* Quiz types */
.levels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.level-card { padding: 14px; display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-align: left; min-width: 0; }
.level-card:hover { border-color: var(--accent); }
.level-card b { font-family: var(--font-display); font-size: 16px; }
.level-card .hint { line-height: 1.35; }
.level-card .chip { align-self: flex-start; margin-top: 4px; }
.level-tag { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); }
.level-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.lv-theory { background: var(--good); } .lv-simple { background: var(--accent); } .lv-intermediate { background: var(--warn); } .lv-advanced { background: var(--bad); } .lv-mixed { background: var(--muted); }
.cheer { padding: 14px 16px; background: var(--good-soft); border-radius: 12px; font-size: 14px; }
.cheer b { color: var(--good); }

/* Forum */
.post { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; width: 100%; text-align: left; border-top: 1px solid var(--line); }
.post:first-child { border-top: 0; }
button.post:hover .post-title { color: var(--accent); }
.post-title { font-weight: 600; font-size: 15px; }
.post-meta { display: flex; gap: 6px 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); align-items: center; }
.post-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.role-teacher { color: var(--accent); font-weight: 700; }
.reply { padding: 14px 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.reply.is-teacher { background: var(--accent-soft); }
.hidden-note { font-size: 12px; color: var(--bad); font-weight: 600; }
.mini-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.mini { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.mini:hover { color: var(--accent); text-decoration: underline; }
.rules { font-size: 13px; color: var(--muted); padding: 12px 14px; border: 1px dashed var(--line); border-radius: 12px; }
@media (max-width: 380px) { .levels { grid-template-columns: 1fr; } }

/* ===== Extras: goal, check-in, help, flashcards, tutor, live quiz, question editor ===== */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.btn-lg { min-height: 54px; font-size: 17px; padding: 13px 22px; }
.spinner-sm { display: inline-block; width: 14px; height: 14px; border-width: 2px; vertical-align: -2px; margin-right: 4px; }
.goal, .checkin, .help, .live-banner { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.goal-num { font-size: 15px; } .goal-num b { font-family: var(--font-display); font-size: 24px; }
.goal-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.goal-row select { flex: 1 1 220px; min-width: 0; }
.checkin { background: var(--accent-soft); border-color: transparent; }
.checkin .link { align-self: flex-start; }
.feel-row { display: flex; flex-wrap: wrap; gap: 8px; }
.feel { flex: 1 1 120px; min-height: 46px; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; color: var(--ink); }
.feel:hover { border-color: var(--accent); }
.help { background: var(--warn-soft); border-color: transparent; }
.live-banner { background: var(--accent-soft); border-color: var(--accent); }
.flash { padding: 24px 20px; min-height: 220px; display: flex; flex-direction: column; gap: 14px; justify-content: center; }
.flash-text { font-size: 19px; line-height: 1.45; font-weight: 500; text-wrap: pretty; }
.flash-back { border-top: 1px dashed var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.flash-answer { font-family: var(--font-display); font-weight: 700; font-size: 20px; color: var(--good); }
.tutor { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.tutor-btn { margin-top: 2px; }
.tutor-msg { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); max-width: 92%; overflow-wrap: anywhere; }
.tutor-msg.is-me { align-self: flex-end; background: var(--good-soft); }
.tutor-form { display: flex; flex-direction: column; gap: 8px; }
.tutor-form .btn { align-self: flex-start; }
.board-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.board-bar .btn { min-height: 38px; padding: 7px 14px; font-size: 14px; }
.board { padding: clamp(18px, 3vw, 36px); display: flex; flex-direction: column; gap: 18px; }
.board h1 { font-size: clamp(24px, 4vw, 40px); }
.board-sub { font-size: clamp(16px, 2.2vw, 22px); }
.board-q { font-size: clamp(20px, 3vw, 34px); line-height: 1.35; font-weight: 600; text-wrap: pretty; }
.board .opt { font-size: clamp(16px, 2.2vw, 24px); padding: 16px 18px; }
.board .opt-letter { width: 36px; height: 36px; font-size: 18px; }
.board-foot { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.board-count { font-size: clamp(16px, 2vw, 22px); } .board-count b { font-family: var(--font-display); font-size: 1.6em; }
.live-opt { align-items: center; flex-wrap: wrap; }
div.live-opt { cursor: default; }
.live-bar { flex: 1 0 100%; height: 10px; border-radius: 6px; background: var(--paper, var(--line)); overflow: hidden; order: 3; }
.live-bar span { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.live-opt.is-correct .live-bar span { background: var(--good); }
.live-count { font-family: var(--font-display); font-weight: 700; margin-left: auto; }
.opt-edit { display: flex; gap: 10px; align-items: center; }
.opt-edit input[type="text"] { flex: 1; min-width: 0; }
.opt-edit input[type="radio"] { width: 20px; height: 20px; flex: 0 0 auto; }
fieldset[hidden] { display: none !important; }
