/* ===== Science Olympiad Study Site — Design System ===== */

:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #f0f2f7;
  --border: #e2e6ef;
  --text: #1b2233;
  --text-soft: #59617a;
  --accent: #2f6df6;
  --accent-soft: #e8f0ff;
  --accent-2: #16a36a;
  --warn: #d9822b;
  --danger: #d64545;
  --shadow: 0 1px 3px rgba(20, 30, 60, .06), 0 6px 20px rgba(20, 30, 60, .06);
  --radius: 14px;
  --radius-sm: 9px;
  --max: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f131c;
    --surface: #181d29;
    --surface-2: #1f2533;
    --border: #2b3242;
    --text: #e8ecf5;
    --text-soft: #9aa4bd;
    --accent: #5b8cff;
    --accent-soft: #1c2740;
    --accent-2: #3ecf8e;
    --shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

/* ===== Header ===== */
.site-header {
  background: linear-gradient(135deg, #2f6df6 0%, #5b3df6 55%, #16a36a 130%);
  color: #fff;
  padding: 34px 0 30px;
}
.site-header .wrap { display: flex; flex-direction: column; gap: 6px; }
.site-header h1 { margin: 0; font-size: 1.7rem; letter-spacing: -.02em; }
.site-header h1 a { color: #fff; text-decoration: none; }
.site-header p { margin: 0; opacity: .9; font-size: .98rem; }
.breadcrumb { font-size: .9rem; opacity: .9; margin-bottom: 4px; }
.breadcrumb a { color: #fff; text-decoration: underline; text-underline-offset: 2px; }

/* ===== Search ===== */
.search-box {
  margin-top: 18px;
  position: relative;
}
.search-box input {
  width: 100%;
  padding: 13px 16px 13px 44px;
  font-size: 1rem;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .96);
  color: #1b2233;
  box-shadow: var(--shadow);
}
.search-box input:focus { outline: 3px solid rgba(255, 255, 255, .5); }
.search-box svg {
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: #59617a;
}

/* ===== Main ===== */
main { padding: 30px 0 70px; }
.section-title { font-size: 1.15rem; margin: 0 0 14px; letter-spacing: -.01em; }
.muted { color: var(--text-soft); }

/* ===== Event grid ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform .12s ease, box-shadow .12s ease;
}
a.card:hover { text-decoration: none; transform: translateY(-3px); box-shadow: 0 10px 30px rgba(20,30,60,.12); }
.card .cat {
  font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft); align-self: flex-start;
  padding: 3px 9px; border-radius: 100px;
}
.card h3 { margin: 2px 0 0; font-size: 1.12rem; color: var(--text); letter-spacing: -.01em; }
.card p { margin: 0; color: var(--text-soft); font-size: .9rem; }
.card .stats { margin-top: auto; padding-top: 8px; display: flex; gap: 14px; font-size: .8rem; color: var(--text-soft); }
.card .stats span { display: inline-flex; align-items: center; gap: 4px; }

.empty { color: var(--text-soft); padding: 40px 0; text-align: center; }
.snippet { font-size: .82rem; color: var(--text-soft); }
.snippet mark, mark { background: #ffe9a8; color: inherit; padding: 0 2px; border-radius: 3px; }
@media (prefers-color-scheme: dark) { mark { background: #5a4a16; color: #ffe9a8; } }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin: 22px 0 22px; flex-wrap: wrap; }
.tab {
  appearance: none; border: none; background: none; cursor: pointer;
  font: inherit; font-size: .95rem; font-weight: 600; color: var(--text-soft);
  padding: 10px 16px; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab .count { font-size: .72rem; background: var(--surface-2); padding: 1px 7px; border-radius: 100px; margin-left: 5px; color: var(--text-soft); }

.panel { display: none; }
.panel.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ===== Notes ===== */
.note { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 22px 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.note h3 { color: var(--accent); letter-spacing: -.01em; }
.note ul { padding-left: 20px; }
.note li { margin: 5px 0; }
.note .term { font-weight: 700; color: var(--text); }
.note table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: .92rem; }
.note th, .note td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; }
.note th { background: var(--surface-2); }

/* ===== Flashcards ===== */
.flash-controls { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.flashcard {
  perspective: 1400px; height: 260px; cursor: pointer; user-select: none;
  max-width: 560px; margin: 0 auto 16px;
}
.flashcard-inner {
  position: relative; width: 100%; height: 100%;
  transition: transform .5s; transform-style: preserve-3d;
}
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0; backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 28px; border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow); background: var(--surface);
}
.flash-face .label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-soft); position: absolute; top: 14px; left: 18px; }
.flash-front .q { font-size: 1.3rem; font-weight: 600; letter-spacing: -.01em; }
.flash-back { transform: rotateY(180deg); background: var(--accent-soft); }
.flash-back .a { font-size: 1.02rem; }
.flash-hint { font-size: .75rem; color: var(--text-soft); position: absolute; bottom: 12px; }

.btn {
  appearance: none; cursor: pointer; font: inherit; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 9px 16px; border-radius: var(--radius-sm); transition: background .12s;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.flash-progress { font-variant-numeric: tabular-nums; color: var(--text-soft); font-size: .9rem; }

/* ===== Quiz ===== */
.quiz-q { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; box-shadow: var(--shadow); }
.quiz-q .qtext { font-weight: 600; margin-bottom: 12px; }
.quiz-q .qtext .num { color: var(--text-soft); margin-right: 6px; }
.choice { display: block; width: 100%; text-align: left; padding: 11px 14px; margin: 7px 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font: inherit; transition: background .1s, border-color .1s; }
.choice:hover:not(:disabled) { background: var(--surface-2); }
.choice.correct { background: #e4f7ee; border-color: var(--accent-2); color: #0f7a4d; }
.choice.wrong { background: #fdeaea; border-color: var(--danger); color: #a82c2c; }
@media (prefers-color-scheme: dark) {
  .choice.correct { background: #14331f; color: #6fe0a8; }
  .choice.wrong { background: #3a1a1a; color: #f3a0a0; }
}
.explain { margin-top: 10px; font-size: .88rem; color: var(--text-soft); border-left: 3px solid var(--accent); padding-left: 12px; display: none; }
.explain.show { display: block; }
.quiz-summary { background: var(--accent-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; text-align: center; margin-bottom: 16px; }
.quiz-summary .score { font-size: 2rem; font-weight: 800; color: var(--accent); }

/* ===== Footer ===== */
.site-footer { border-top: 1px solid var(--border); padding: 22px 0; color: var(--text-soft); font-size: .85rem; text-align: center; }

@media (max-width: 560px) {
  .site-header h1 { font-size: 1.4rem; }
  .flashcard { height: 230px; }
}

/* ===== AI features ===== */
.site-header { position: relative; }
.ai-gear {
  position: absolute; top: 16px; right: 20px; z-index: 5;
  background: rgba(255, 255, 255, .16); color: #fff;
  border: 1px solid rgba(255, 255, 255, .4); border-radius: 100px;
  padding: 7px 13px; font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer;
}
.ai-gear:hover { background: rgba(255, 255, 255, .3); }

/* Header actions (sign-in + AI setup) */
.header-actions { position: absolute; top: 14px; right: 20px; z-index: 5; display: flex; align-items: center; gap: 10px; }
.header-actions .ai-gear { position: static; top: auto; right: auto; }
.auth-slot { display: flex; align-items: center; }
.auth-btn {
  background: rgba(255, 255, 255, .16); color: #fff; border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 100px; padding: 7px 13px; font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer;
}
.auth-btn:hover { background: rgba(255, 255, 255, .3); }
.auth-user { display: inline-flex; align-items: center; gap: 7px; color: #fff; font-size: .82rem; font-weight: 600; }
.auth-avatar { width: 24px; height: 24px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .5); }
.auth-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-btn.ghost { background: transparent; }
.auth-btn.ghost:hover { background: rgba(255, 255, 255, .18); }
@media (max-width: 560px) { .auth-name { display: none; } .header-actions { gap: 7px; } }

/* ===== Login gate (full-screen sign-in wall) ===== */
html.so-gated, html.so-gated body { overflow: hidden; }
#auth-gate {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), var(--bg) 60%);
}
#auth-gate .gate-card {
  width: 100%; max-width: 380px; text-align: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 34px 30px 30px;
}
#auth-gate .gate-logo { font-size: 2.6rem; line-height: 1; }
#auth-gate .gate-title { margin: 12px 0 6px; font-size: 1.18rem; color: var(--text); }
#auth-gate .gate-sub { margin: 0 0 22px; color: var(--text-soft); font-size: .9rem; line-height: 1.5; }
#auth-gate .gate-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 11px 16px; cursor: pointer;
  background: #fff; color: #3c4043; font-family: var(--font); font-size: .95rem; font-weight: 600;
  border: 1px solid #dadce0; border-radius: var(--radius-sm);
  transition: box-shadow .15s, background .15s;
}
#auth-gate .gate-btn:hover { background: #f8f9fa; box-shadow: 0 1px 3px rgba(60,64,67,.2); }
#auth-gate .gate-msg { min-height: 1em; margin: 16px 0 0; color: var(--danger); font-size: .82rem; line-height: 1.45; }
/* Neutral "checking sign-in" state (shown while the session is re-resolved) */
#auth-gate .gate-checking { display: none; text-align: center; color: var(--text-soft); }
#auth-gate.checking .gate-checking { display: block; }
#auth-gate.checking .gate-card { display: none; }
#auth-gate .gate-checking p { margin: 0; font-size: .9rem; }
#auth-gate .gate-spinner { width: 34px; height: 34px; margin: 0 auto 14px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: so-spin .8s linear infinite; }
@keyframes so-spin { to { transform: rotate(360deg); } }

/* Host-only demo mode label in the header */
.auth-demo { background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .35); border-radius: 100px; padding: 5px 11px; }

/* ===== Host access-admin panel ===== */
#admin-panel {
  position: fixed; inset: 0; z-index: 10001; display: none;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(15, 19, 28, .55);
}
#admin-panel .admin-card {
  width: 100%; max-width: 440px; max-height: 88vh; overflow: auto; position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px 26px 22px;
}
#admin-panel .admin-close {
  position: absolute; top: 12px; right: 14px; border: none; background: none;
  font-size: 1.5rem; line-height: 1; color: var(--text-soft); cursor: pointer;
}
#admin-panel .admin-close:hover { color: var(--text); }
#admin-panel .admin-title { margin: 0 0 4px; font-size: 1.15rem; color: var(--text); }
#admin-panel .admin-sub { margin: 0 0 18px; color: var(--text-soft); font-size: .85rem; line-height: 1.5; }
#admin-panel .admin-section { margin-bottom: 18px; }
#admin-panel .admin-label { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-soft); margin-bottom: 7px; }
#admin-panel .admin-host { font-weight: 600; color: var(--text); background: var(--accent-soft); border-radius: var(--radius-sm); padding: 9px 12px; word-break: break-all; }
#admin-panel .admin-members { list-style: none; margin: 0 0 10px; padding: 0; }
#admin-panel .admin-members li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 6px; font-size: .88rem; color: var(--text); }
#admin-panel .admin-members li span { word-break: break-all; }
#admin-panel .admin-empty { color: var(--text-soft); border-style: dashed; justify-content: flex-start; }
#admin-panel .admin-x { flex: none; border: 1px solid var(--border); background: var(--surface-2); color: var(--danger); border-radius: 7px; padding: 4px 9px; font-size: .78rem; font-weight: 600; cursor: pointer; }
#admin-panel .admin-x:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
#admin-panel .admin-members li span { margin-right: auto; }
#admin-panel .admin-you { font-style: normal; font-size: .78rem; color: var(--text-soft); font-weight: 600; }
#admin-panel .admin-promote { flex: none; border: 1px solid var(--border); background: var(--surface-2); color: var(--accent); border-radius: 7px; padding: 4px 9px; font-size: .78rem; font-weight: 600; cursor: pointer; }
#admin-panel .admin-promote:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
#admin-panel .admin-add { display: flex; gap: 8px; }
#admin-panel .admin-add input { flex: 1 1 auto; min-width: 0; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font: inherit; font-size: .88rem; }
#admin-panel .admin-add .auth-btn { flex: none; background: var(--accent); color: #fff; border: none; padding: 9px 16px; border-radius: var(--radius-sm); font-weight: 600; cursor: pointer; }
#admin-panel .admin-add .auth-btn.danger { background: var(--danger); }
#admin-panel .admin-danger { margin-top: 4px; border-top: 1px solid var(--border); padding-top: 14px; }
#admin-panel .admin-danger summary { cursor: pointer; color: var(--text-soft); font-size: .85rem; font-weight: 600; }
#admin-panel .admin-note { margin: 10px 0; color: var(--text-soft); font-size: .8rem; line-height: 1.45; }
#admin-panel .admin-msg { min-height: 1em; margin: 14px 0 0; color: var(--danger); font-size: .82rem; line-height: 1.45; }
#admin-panel .admin-msg.ok { color: var(--accent-2); }

/* Setup prompt (shown when AI isn't configured) */
.ai-setup-prompt { text-align: center; padding: 44px 22px; color: var(--text-soft); }
.ai-setup-prompt h3 { color: var(--text); margin: 0 0 8px; }
.ai-setup-prompt p { margin: 0 auto 16px; max-width: 440px; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(12, 16, 24, .55);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 100;
  animation: fade .15s ease;
}
.modal {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  width: 100%; max-width: 470px; padding: 22px 24px 24px; max-height: 90vh; overflow: auto;
}
.modal h3 { margin: 0 0 4px; }
.modal .sub { margin: 0 0 16px; color: var(--text-soft); font-size: .9rem; }
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: .85rem; font-weight: 700; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font: inherit;
}
.field .hint { font-size: .76rem; color: var(--text-soft); margin-top: 6px; }
.field .hint a { color: var(--accent); }
.radio-row { display: flex; gap: 10px; }
.radio-row .opt {
  flex: 1; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 12px; cursor: pointer; font-size: .85rem; font-weight: 600; user-select: none;
}
.radio-row .opt.sel { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.radio-row .opt .opt-sub { display: block; font-weight: 400; font-size: .74rem; color: var(--text-soft); margin-top: 3px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.modal-status { font-size: .82rem; margin-top: 10px; min-height: 1em; }
.modal-status.ok { color: var(--accent-2); }
.modal-status.err { color: var(--danger); }

/* Chat tutor */
.chat {
  display: flex; flex-direction: column; height: 540px; max-height: 72vh;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); overflow: hidden;
}
.chat-head { display: flex; justify-content: flex-end; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.chat-clear { background: none; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 5px 10px; font: inherit; font-size: .8rem; color: var(--text-soft); cursor: pointer; }
.chat-clear:hover { background: var(--surface-2); color: var(--text); }
.chat-msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 86%; padding: 11px 14px; border-radius: 14px; font-size: .93rem; line-height: 1.55; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: var(--surface-2); color: var(--text); border-bottom-left-radius: 4px; }
.msg.ai.err { background: #fdeaea; color: #a82c2c; }
@media (prefers-color-scheme: dark) { .msg.ai.err { background: #3a1a1a; color: #f3a0a0; } }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 16px 4px; }
.chip {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 100px;
  padding: 6px 12px; font: inherit; font-size: .8rem; cursor: pointer; color: var(--text-soft);
}
.chip:hover { background: var(--accent-soft); color: var(--accent); }
.chat-input-row { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.chat-input-row textarea {
  flex: 1; resize: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; font: inherit; background: var(--bg); color: var(--text); max-height: 130px; min-height: 42px;
}
.cursor-blink::after { content: '▋'; margin-left: 1px; animation: blink 1s steps(2) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }

/* Cheat sheet */
.cheatsheet-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.cheatsheet-bar .spacer { flex: 1; }
.cheatsheet-meta { font-size: .8rem; color: var(--text-soft); }
/* Cheat-sheet preview: a real 8.5x11 page rendered at print sizes, then scaled to
   fit the panel width. The page TYPOGRAPHY is injected from JS (sheetTypographyCSS,
   selector .cs-page) so the preview and the printed PDF never diverge. */
.cs-preview { overflow: hidden; margin-top: 4px; }
.cs-page {
  width: 8.5in; min-height: 11in; margin: 0 auto; padding: 0.25in; box-sizing: border-box;
  background: #fff; border-radius: 3px; box-shadow: 0 2px 14px rgba(0, 0, 0, .18);
  transform: scale(var(--cs-scale, 1)); transform-origin: top left;
}
.cs-page .muted { color: #888; }
/* Empty / loading state: drop the page chrome, show a normal-size prompt. */
.cs-page.cs-empty { width: auto; min-height: 0; padding: 18px 2px; background: transparent; box-shadow: none; transform: none; column-count: 1; }
.cs-page.cs-empty .cs-page-title { display: none; }
.cs-page.cs-empty .muted, .cs-page.cs-empty .msg { font-size: .9rem; }
.cs-hub-head { margin-bottom: 18px; }
.cs-pages, .cs-opt { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--text-soft); }
.cs-pages input, .cs-opt select { padding: 7px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font: inherit; }
.cs-pages input { width: 54px; }
.cs-saved-group { display: inline-flex; align-items: center; gap: 10px; }
.cs-saved { max-width: 200px; padding: 7px 28px 7px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cheatsheet-allow { font-size: .82rem; margin: 0 0 14px; color: var(--accent-2); font-weight: 600; }
.cheatsheet-allow.warn { color: var(--warn); }
.cheatsheet-disabled { padding: 22px; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface); }
.cheatsheet-disabled p { margin: 0 0 8px; }
.cheatsheet-disabled p:last-child { margin-bottom: 0; }
.cheatsheet-topics { display: flex; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; }
.cs-topic { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; color: var(--text-soft); flex: 1 1 240px; }
.cs-topic input { padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font: inherit; }

/* Add-your-own notes */
.note.user { border-left: 3px solid var(--accent-2); }
.note .note-head { display: flex; align-items: center; gap: 10px; }
.note .note-head h3 { margin-bottom: 0; }
.note-badge {
  font-size: .64rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700;
  color: var(--accent-2); background: rgba(62, 163, 106, .14); padding: 3px 8px; border-radius: 100px;
}
.note-del {
  margin-left: auto; background: none; border: 1px solid var(--border); color: var(--text-soft);
  border-radius: var(--radius-sm); padding: 4px 10px; font: inherit; font-size: .76rem; cursor: pointer;
}
.note-del:hover { color: var(--danger); border-color: var(--danger); }
.note-add { margin-top: 6px; }
.note-add-form {
  margin-top: 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.note-add-form input, .note-add-form textarea {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font: inherit; padding: 9px 11px; margin-bottom: 10px;
}
.note-add-form textarea { min-height: 110px; resize: vertical; }
.note-add-form input.note-media-file { padding: 9px 11px; cursor: pointer; font-size: .85rem; }
.note-add-form input.note-media-file::file-selector-button {
  font: inherit; font-size: .78rem; font-weight: 600; margin-right: 10px; padding: 5px 11px; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
}
.note-add-actions { display: flex; gap: 8px; justify-content: flex-end; }
.note-add-status { font-size: .82rem; margin-top: 8px; color: var(--text-soft); }
.note-add-status.err { color: var(--danger); }

/* AI fact-check on notes */
.note-fc { margin-top: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.note-fc-btn { flex: 0 0 auto; }
.note-fc-focus {
  flex: 1 1 240px; min-width: 160px; max-width: 460px;
  font: inherit; font-size: .82rem; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text);
}
.note-fc-focus::placeholder { color: var(--text-soft); }
.note-fc-focus:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.note-fc-status { font-size: .8rem; color: var(--text-soft); flex: 1 1 100%; }
.fc-redo { flex: 0 0 auto; margin-top: 4px; }

/* Tests tab */
.tests-intro { margin: 0 0 14px; }
.test-add-form .hint { font-size: .76rem; color: var(--text-soft); margin: 2px 0 10px; }
.tests-list { margin-top: 18px; display: flex; flex-direction: column; gap: 12px; }
.test-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.test-card-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; flex-wrap: wrap; }
.test-toggle {
  flex: 1 1 auto; text-align: left; font: inherit; font-weight: 700; font-size: .98rem;
  background: none; border: none; color: var(--text); cursor: pointer; padding: 0; display: flex; align-items: center; gap: 8px;
}
.test-caret { color: var(--text-soft); font-size: .8rem; }
.test-meta { font-size: .78rem; color: var(--text-soft); }
.test-pill { font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.test-pill.ok { background: var(--accent-soft); color: var(--accent-2); }
.test-pill.warn { background: #fbf0dd; color: #b45309; }
.test-card-body { padding: 0 14px 14px; }
.test-summary { font-size: .85rem; color: var(--text-soft); margin: 0 0 12px; }
.test-q { border-top: 1px solid var(--border); padding: 12px 0; }
.test-q:first-of-type { border-top: none; }
.test-q-head { display: flex; gap: 9px; align-items: baseline; }
.test-q-badge { flex: 0 0 auto; font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.test-q-badge.ok { background: var(--accent-soft); color: var(--accent-2); }
.test-q-badge.warn { background: #fbf0dd; color: #b45309; }
.test-q-text { font-weight: 600; font-size: .92rem; }
.test-q-ans { font-size: .88rem; margin: 7px 0 0; color: var(--text); }
.test-q-gap { margin: 10px 0 0; border: 1px solid var(--border); border-left: 3px solid #d79a3a; border-radius: var(--radius-sm); background: var(--surface-2); padding: 10px 12px; }
.test-gap-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #b45309; margin-bottom: 6px; }
.test-gap-body { font-size: .87rem; margin-bottom: 8px; }
.test-q-actions { margin-top: 9px; display: flex; align-items: center; gap: 8px; }
.test-explain-status { font-size: .8rem; color: var(--text-soft); }
.test-explanation { margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); padding: 12px 14px; font-size: .9rem; }

/* Quiz top bar (new quiz / review mistakes) */
.quiz-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.quiz-tagline { font-size: .85rem; font-weight: 600; color: var(--text-soft); }
.quiz-bar-status { font-size: .82rem; color: var(--text-soft); }
.quiz-bar-status.err { color: var(--danger); }
/* Topic + difficulty pickers for the AI quiz */
.quiz-topics, .quiz-diff { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: -4px 0 16px; }
.quiz-diff { margin-top: -8px; }
.quiz-topics-label { font-size: .82rem; font-weight: 600; color: var(--text-soft); margin-right: 2px; }
.qtopic, .qdiff { border: 1px solid var(--border); background: var(--surface); color: var(--text-soft); border-radius: 100px; padding: 5px 12px; font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; transition: background .12s, color .12s, border-color .12s; }
.qtopic:hover, .qdiff:hover { border-color: var(--accent); color: var(--text); }
.qtopic.active, .qdiff.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.quiz-mastered { margin-top: 10px; }
.note-fc-status.ok { color: var(--accent-2); }
.note-fc-status.err { color: var(--danger); }
.note-fc-result {
  margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); padding: 12px 14px;
}
.fc-head { font-weight: 700; font-size: .84rem; margin-bottom: 8px; }
.fc-changes { margin: 0 0 12px; padding-left: 18px; font-size: .84rem; color: var(--text); }
.fc-changes li { margin-bottom: 5px; }
.fc-actions { display: flex; gap: 8px; }
.note-corrected-badge {
  display: inline-flex; align-items: center; gap: 8px; margin-left: 10px; vertical-align: middle;
  font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--accent); background: var(--accent-soft); padding: 2px 9px; border-radius: 20px;
}
.fc-revert {
  font: inherit; font-size: .82em; font-weight: 600; text-transform: none; letter-spacing: 0;
  background: none; border: none; color: var(--accent); cursor: pointer; text-decoration: underline; padding: 0;
}
.note-mode { margin-bottom: 12px; }
.note-confirm { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; font-size: .8rem; color: var(--text-soft); }
.btn-mini {
  font: inherit; font-size: .75rem; font-weight: 600; padding: 4px 10px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer;
}
.btn-mini:hover { background: var(--surface-2); }
.btn-mini.danger { border-color: var(--danger); color: var(--danger); }
.btn-mini.danger:hover { background: var(--danger); color: #fff; }

/* Quiz creator */
.note-add-form select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font: inherit; margin-bottom: 10px;
}
.qc-label { display: block; font-size: .85rem; font-weight: 700; margin-bottom: 6px; }
.quiz-create { margin-top: 18px; }
.quiz-meta-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }

/* Event layout + reminders side panel */
.event-layout { display: flex; gap: 22px; align-items: flex-start; }
.event-main { flex: 1; min-width: 0; }
.event-side { width: 300px; flex-shrink: 0; position: sticky; top: 20px; transition: width .15s ease; }
.reminders {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.reminders-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.reminders-head h3 { margin: 0; font-size: 1rem; letter-spacing: -.01em; }
.reminders-collapse {
  background: none; border: none; cursor: pointer; font-size: 1rem; color: var(--text-soft);
  padding: 4px 7px; border-radius: var(--radius-sm); line-height: 1;
}
.reminders-collapse:hover { background: var(--surface-2); color: var(--text); }
.reminders-body { padding: 12px 14px; }
.reminders-hint { margin: 0 0 10px; font-size: .78rem; color: var(--text-soft); }
#reminders-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.reminder { display: flex; align-items: flex-start; gap: 8px; font-size: .88rem; background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 10px; }
.reminder-text { flex: 1; cursor: pointer; line-height: 1.4; word-break: break-word; }
.reminder.done .reminder-text { text-decoration: line-through; color: var(--text-soft); }
.reminder-del { background: none; border: none; color: var(--text-soft); cursor: pointer; font-size: 1.2rem; line-height: 1; padding: 0 2px; }
.reminder-del:hover { color: var(--danger); }
.reminder-empty { list-style: none; color: var(--text-soft); font-size: .85rem; }
.reminder-add { display: flex; gap: 6px; }
.reminder-add input {
  flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font: inherit; font-size: .85rem; padding: 8px 9px;
}
.reminder-add button { padding: 8px 12px; }

/* collapsed: shrink the sidebar to a slim toggle bar */
.event-side.collapsed { width: 46px; }
.event-side.collapsed .reminders-head { justify-content: center; padding: 10px 6px; }
.event-side.collapsed .reminders-head h3 { display: none; }
.event-side.collapsed .reminders-body { display: none; }

@media (max-width: 760px) {
  .event-layout { flex-direction: column; }
  .event-side { width: 100%; position: static; }
  .event-side.collapsed { width: 100%; }
  .event-side.collapsed .reminders-head { justify-content: space-between; padding: 12px 14px; }
  .event-side.collapsed .reminders-head h3 { display: block; }
}

/* ---- 3D Build model panel ---- */
.b3d-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.b3d-constraints { flex: 1; min-width: 220px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font: inherit; }
.b3d-hint { font-size: .82rem; margin: 0 0 14px; }
.b3d-layout { display: flex; gap: 16px; align-items: stretch; flex-wrap: wrap; }
.b3d-viewer { flex: 1 1 420px; min-width: 300px; height: 460px; border: 1px solid var(--border); border-radius: var(--radius); background: linear-gradient(180deg, #f7f9fc, #eef1f6); overflow: hidden; position: relative; display: flex; align-items: center; justify-content: center; }
.b3d-viewer canvas { display: block; width: 100% !important; height: 100% !important; }
.b3d-placeholder { padding: 20px; text-align: center; }
.b3d-stats { flex: 1 1 300px; min-width: 260px; }
.b3d-title { margin: 0 0 6px; color: var(--accent); }
.b3d-summary { margin: 0 0 12px; color: var(--text-soft); }
.b3d-stats h4 { margin: 16px 0 6px; font-size: .92rem; }
.b3d-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.b3d-table th, .b3d-table td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; vertical-align: top; }
.b3d-table thead th { background: var(--surface-2); }
.b3d-table tbody th { background: var(--surface-2); white-space: nowrap; width: 1%; }
.b3d-notes { margin: 6px 0 0; padding-left: 18px; font-size: .86rem; color: var(--text-soft); }
.b3d-notes li { margin-bottom: 4px; }
.b3d-legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.b3d-chip { display: inline-flex; align-items: center; gap: 5px; font-size: .76rem; color: var(--text-soft); background: var(--surface-2); border: 1px solid var(--border); border-radius: 100px; padding: 3px 9px; }
.b3d-swatch { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.b3d-setup { padding: 22px; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface); }
.b3d-setup p { margin: 0 0 12px; }
@media (prefers-color-scheme: dark) { .b3d-viewer { background: linear-gradient(180deg, #1c2230, #161a24); } }

/* 3D Build: AI-suggestion update row */
.b3d-update { display: flex; gap: 10px; align-items: center; margin: 0 0 12px; flex-wrap: wrap; }

/* 3D Build: material legality */
.b3d-mat-warn, .b3d-mat-ok, .b3d-mat-note { font-size: .84rem; border-radius: var(--radius-sm); padding: 9px 12px; margin: 0 0 14px; }
.b3d-mat-warn { background: #fdeede; border: 1px solid #f0c38a; color: #8a5212; }
.b3d-mat-ok { background: #e7f7ee; border: 1px solid #aee3c5; color: #1c6b43; }
.b3d-mat-note { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-soft); }
.b3d-bad { color: var(--danger); font-weight: 700; white-space: nowrap; }
.b3d-good { color: var(--accent-2); font-weight: 700; }
@media (prefers-color-scheme: dark) {
  .b3d-mat-warn { background: #3a2a12; border-color: #6b4a1c; color: #f0c38a; }
  .b3d-mat-ok { background: #143226; border-color: #1c6b43; color: #8fe0b4; }
}

/* Quiz: ciphertext block (Codebusters decode questions) */
.quiz-cipher { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.02rem; letter-spacing: .18em; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0 0 12px; overflow-x: auto; white-space: pre-wrap; word-break: break-word; }

/* ===== Codebusters practice quiz ===== */
.cb-controls { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.cb-pick { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.cb-pick-label { font-size: .85rem; font-weight: 600; color: var(--text-soft); margin-right: 2px; }
.cb-chip { appearance: none; cursor: pointer; font: inherit; font-size: .82rem; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-soft); padding: 5px 12px; border-radius: 100px; }
.cb-chip:hover { color: var(--text); }
.cb-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.cb-chip.cb-all { font-weight: 600; background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft); }
.cb-gen-row { display: flex; align-items: center; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.cb-count { font-size: .85rem; color: var(--text-soft); display: inline-flex; align-items: center; gap: 6px; }
.cb-count select { padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font: inherit; }
.cb-qhead { font-weight: 600; margin-bottom: 10px; }
.cb-qhead .num { color: var(--accent); margin-right: 4px; }
.cb-hint { font-weight: 400; font-size: .85rem; color: var(--text-soft); }
.cb-freq-scroll { overflow-x: auto; margin: 0 0 10px; }
.cb-freq { border-collapse: collapse; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .72rem; }
.cb-freq th, .cb-freq td { border: 1px solid var(--border); width: 22px; text-align: center; padding: 2px 0; }
.cb-freq th { background: var(--surface-2); color: var(--text-soft); }
.cb-freq td.z { color: var(--border); }
.cb-answer { width: 100%; resize: vertical; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font: inherit; padding: 9px 11px; margin: 4px 0 8px; }
.cb-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cb-result { font-size: .88rem; font-weight: 600; }
.cb-result.ok { color: var(--accent-2); }
.cb-result.bad { color: var(--danger); }
.cb-reveal { margin-top: 10px; padding: 10px 12px; background: var(--accent-soft); border-radius: var(--radius-sm); font-size: .9rem; }
.cb-reveal .cb-tip { color: var(--text-soft); font-size: .85rem; }

/* AI setup: web-search checkbox */
.ai-check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.ai-check input { width: auto; margin: 0; flex: none; }

/* ---- Timed test mode + short-answer questions + quiz record ------------- */
.test-strip { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; }
.test-clock { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.15rem; color: var(--accent); }
.test-clock.low { color: var(--danger); }
.test-prog { font-size: .82rem; color: var(--text-soft); margin-right: auto; }
.choice.picked { background: var(--accent-soft); border-color: var(--accent); }

.qtag { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 100px; font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .03em; background: var(--surface-2); color: var(--text-soft); border: 1px solid var(--border); vertical-align: middle; }
.qtag.diff-hard { color: #a82c2c; border-color: #e6b8b8; }
.qtag.diff-easy { color: #0f7a4d; border-color: #b8e0cc; }

.frq-input { display: block; width: 100%; margin: 8px 0; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; resize: vertical; }
.frq-input:focus { outline: none; border-color: var(--accent); }
.frq-input[readonly] { background: var(--surface-2); color: var(--text-soft); }
.frq-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.frq-note { font-size: .82rem; color: var(--text-soft); }
.frq-note.ok { color: #0f7a4d; }
.frq-note.bad { color: var(--danger); }
.frq-model { margin-top: 10px; font-size: .88rem; border-left: 3px solid var(--accent-2); padding: 2px 0 2px 12px; color: var(--text-soft); }
.frq-mark { display: flex; gap: 8px; margin-top: 8px; }
.frq-mark.got { opacity: .6; }
.frq-mark.lost { opacity: .6; }

.quiz-stats { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: -4px 0 16px;
  background: var(--accent-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }
.quiz-stats-main { font-size: .95rem; font-weight: 600; }
.quiz-stats-sub { font-size: .82rem; color: var(--text-soft); margin-right: auto; }
.quiz-spark { display: inline-flex; align-items: flex-end; gap: 3px; height: 22px; }
.quiz-spark .spark { display: block; width: 7px; border-radius: 2px; background: var(--text-soft); }
.quiz-spark .spark.hi { background: var(--accent-2); }
.quiz-spark .spark.mid { background: var(--accent); }
.quiz-spark .spark.lo { background: var(--danger); }
@media (prefers-color-scheme: dark) {
  .qtag.diff-hard { color: #f3a0a0; border-color: #5a3030; }
  .qtag.diff-easy { color: #6fe0a8; border-color: #245c40; }
  .frq-note.ok { color: #6fe0a8; }
}

/* ---- Updates tab: team board + site changelog --------------------------- */
.upd-h { font-size: 1.05rem; font-weight: 700; margin: 0 0 4px; }
.upd-sub { font-size: .85rem; color: var(--text-soft); margin: 0 0 14px; }
.upd-board { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 26px; }
.upd-form { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; }
.upd-input { flex: 1; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font: inherit; resize: vertical; min-height: 44px; }
.upd-input:focus { outline: none; border-color: var(--accent); }
.upd-post-btn { flex: none; }
.upd-list { display: flex; flex-direction: column; gap: 10px; }
.upd-post { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 14px; }
.upd-text { font-size: .93rem; line-height: 1.5; }
.upd-meta { display: flex; align-items: center; gap: 10px; margin-top: 7px; font-size: .78rem; color: var(--text-soft); }
.upd-by { font-weight: 700; color: var(--accent); }
.upd-when { margin-right: auto; }
.upd-del { opacity: 0; transition: opacity .12s; }
.upd-post:hover .upd-del, .upd-del:focus { opacity: 1; }

@media (max-width: 560px) {
  .upd-form { flex-direction: column; }
  .upd-input { width: 100%; }
  .upd-post-btn { width: 100%; }
}

/* ---- Key dates (Updates tab) -------------------------------------------- */
.cal-board { margin-bottom: 22px; }
.cal-form { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.cal-form input, .cal-form select { padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font: inherit; font-size: .88rem; }
.cal-form input:focus, .cal-form select:focus { outline: none; border-color: var(--accent); }
.cal-in-title { flex: 1; min-width: 180px; }
.cal-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cal-row { display: flex; align-items: center; gap: 13px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 13px; }
.cal-row.today { border-color: var(--accent); background: var(--accent-soft); }
.cal-row.past { opacity: .55; }
.cal-date { flex: none; width: 46px; text-align: center; line-height: 1.1; }
.cal-mon { display: block; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--danger); }
.cal-day { display: block; font-size: 1.3rem; font-weight: 800; }
.cal-body { flex: 1; min-width: 0; }
.cal-title { font-size: .93rem; font-weight: 600; }
.cal-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; font-size: .78rem; color: var(--text-soft); }
.cal-kind { font-weight: 600; }
.cal-del { flex: none; opacity: 0; transition: opacity .12s; }
.cal-row:hover .cal-del, .cal-del:focus { opacity: 1; }
.cal-past { margin-top: 12px; }
.cal-past summary { cursor: pointer; font-size: .82rem; color: var(--text-soft); font-weight: 600; }
.cal-past .cal-list { margin-top: 10px; }
.upd-readonly { font-size: .85rem; color: var(--text-soft); font-style: italic; margin: 0 0 14px; }
@media (max-width: 560px) {
  .cal-form input, .cal-form select, .cal-form .btn { width: 100%; }
  .cal-del { opacity: 1; }
  .upd-del { opacity: 1; }
}
