/* =============================================================
   webcore.css: PrepSession's visual language: an early-2000s library
   study desk on a Win98-era computer. Dark navy-green (library lamps,
   reading-room leather), the original tan, cream paper, pixel icons and
   window chrome. Loaded last on every page so it can restyle shared
   components through tokens.

   Performance rules: no backdrop-filter, no fixed backgrounds, no blend
   modes, no always-running animations. Textures are small static tiles.
   ============================================================= */

:root {
  /* Readable type does the work; pixel type is kept for decoration (logo, hero,
     boot lines, desktop icons, window title bars, status bar, hit counter). */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-ui: "Poppins", ui-sans-serif, system-ui, sans-serif;
  --font-pixel: "Pixelify Sans", "Poppins", ui-sans-serif, system-ui, sans-serif;
  --font-crt: "VT323", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r-sm: 4px; --r-md: 6px; --r-lg: 10px; --r-xl: 14px;
  --hard-shadow: 3px 3px 0 rgba(18, 48, 43, 0.13);
  --bevel-light: rgba(255, 255, 255, 0.9);
  --bevel-dark: rgba(22, 30, 20, 0.35);
}

/* Highlighter-pen selection: the one study habit we keep. */
::selection { background: var(--highlighter); color: #1b2a25; }

/* ---------- Desk textures (static tiles; cheap to paint) ---------- */
body.app {
  background:
    radial-gradient(rgba(107, 101, 72, 0.16) 1px, transparent 1.3px) 0 0 / 22px 22px,
    var(--bg);
}
html[data-theme="dark"] body.app {
  --hard-shadow: 3px 3px 0 rgba(0, 0, 0, 0.45);
  --bevel-light: rgba(226, 220, 194, 0.12);
  --bevel-dark: rgba(0, 0, 0, 0.55);
  background:
    radial-gradient(rgba(207, 198, 162, 0.07) 1px, transparent 1.3px) 0 0 / 22px 22px,
    var(--bg);
}
@media (prefers-color-scheme: dark) {
  html[data-theme="system"] body.app {
    --hard-shadow: 3px 3px 0 rgba(0, 0, 0, 0.45);
    --bevel-light: rgba(226, 220, 194, 0.12);
    --bevel-dark: rgba(0, 0, 0, 0.55);
    background:
      radial-gradient(rgba(207, 198, 162, 0.07) 1px, transparent 1.3px) 0 0 / 22px 22px,
      var(--bg);
  }
}

/* ---------- Type: a bookish serif for headings, bold sans for labels and numbers ---------- */
.page-head h1, .section-title, .exam-hero h1, .recap-hero h1, .ws-done h2, .task-title, .science-page h1, .deck-title, .form-box h2 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.012em;
  font-optical-sizing: auto;
}
.page-head h1 { font-size: clamp(1.9rem, 3.4vw, 2.6rem); line-height: 1.12; }
.eyebrow {
  font-family: var(--font-ui);
  font-weight: 700;
  letter-spacing: 0.1em;
}
.panel-head h2, .panel-head h3 { font-family: var(--font-ui); font-weight: 700; letter-spacing: 0; }
.stat-value, .ring-label strong, .exam-days, .exam-count .exam-days, .run-total, .mock-score strong, .plan-summary strong {
  font-family: var(--font-ui);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums lining-nums;
}
.stat-value, .stat .stat-value { font-size: 2rem; line-height: 1.05; }
@media (max-width: 720px) { .stat .stat-value { font-size: 1.7rem; } }
.ring .ring-label strong { font-size: 1.6rem; line-height: 1; }
.task-ring .ring-label strong { font-size: 1.75rem !important; line-height: 1; }
.score-ring .ring-label strong { font-size: 1.6rem; }
.run-total { font-size: 1.12rem; }
.plan-summary strong { font-size: 1.6rem; line-height: 1.1; }
.mock-score strong { font-size: 2.3rem; }
.exam-count .exam-days { font-size: 3rem; line-height: 1; }
.kbd { font: 600 0.72rem/1.5 ui-monospace, "SFMono-Regular", Menlo, monospace; padding: 0 5px; }

/* ---------- Panels: crisp edge + hard offset shadow (a 2004 "window") ---------- */
body.app .panel {
  border-radius: var(--r-lg);
  border: 1px solid var(--line-strong);
  box-shadow: inset 1px 1px 0 var(--bevel-light), var(--hard-shadow);
}
body.app .panel-head { background: linear-gradient(180deg, var(--surface-2), var(--surface)); }
body.app .stat { border-radius: var(--r-md); }

/* ---------- Buttons: pressable, with a pixel-hard edge ---------- */
.ui-btn { border-radius: var(--r-md); }
.ui-btn.primary {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 3px 0 var(--pine-900, #0b1d19);
  transform: translateY(0);
}
.ui-btn.primary:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 3px 0 var(--pine-900, #0b1d19), 0 0 0 3px rgba(47, 101, 89, 0.18); }
.ui-btn.primary:active { transform: translateY(3px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 0 0 var(--pine-900, #0b1d19); }
html[data-theme="dark"] .ui-btn.primary { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 3px 0 #6b6548; }
html[data-theme="dark"] .ui-btn.primary:active { box-shadow: 0 0 0 #6b6548; }
@media (prefers-color-scheme: dark) {
  html[data-theme="system"] .ui-btn.primary { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 3px 0 #6b6548; }
}
.ui-btn.ai {
  background: linear-gradient(120deg, #12302b, #2f6559 55%, #9f9773) !important;
  box-shadow: 0 3px 0 #0b1d19;
}
.ui-btn.ai::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.28) 48%, transparent 66%) -200% 0 / 200% 100% no-repeat;
  transition: background-position 0.7s var(--ease);
}
.ui-btn.ai { position: relative; overflow: hidden; }
.ui-btn.ai:hover::after { background-position: 200% 0; }

/* ---------- Window chrome (Win98 title bar), used by dialogs + landing windows ---------- */
.win {
  position: relative;
  background: var(--surface, #fff);
  border: 1px solid var(--line-strong, rgba(60, 52, 28, 0.26));
  border-radius: var(--r-md);
  box-shadow: inset 1px 1px 0 var(--bevel-light), var(--hard-shadow);
  overflow: hidden;
}
.win-bar {
  display: flex; align-items: center; gap: 8px;
  min-height: 30px; padding: 3px 4px 3px 10px;
  background: linear-gradient(90deg, var(--title-a), var(--title-b));
  color: #fff;
  font: 600 0.82rem/1.2 var(--font-pixel);
  letter-spacing: 0.02em;
  user-select: none;
}
.win-bar .win-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win-bar img.px { height: 16px; }
.win-btns { display: inline-flex; gap: 3px; }
.win-btns > span, .win-x {
  width: 20px; height: 18px; display: grid; place-items: center;
  background: #d9cfae; color: #1b2a25;
  border: 1px solid; border-color: #fff #4d4630 #4d4630 #fff;
  box-shadow: inset -1px -1px 0 #8f8763;
  font: 700 0.72rem/1 var(--font-pixel);
}
.win-body { padding: 16px; }

/* PS.modal dialogs → windows */
.modal { border-radius: var(--r-md); overflow: hidden; box-shadow: inset 1px 1px 0 var(--bevel-light), 6px 6px 0 rgba(5, 14, 11, 0.22), var(--shadow-xl); }
.modal-head {
  background: linear-gradient(90deg, var(--title-a), var(--title-b));
  padding: 6px 6px 6px 14px !important;
  border-bottom: 0 !important;
}
.modal-head h2 { color: #fff; font: 700 1rem/1.3 var(--font-ui) !important; letter-spacing: 0; }
.modal-head .ui-btn.icon {
  min-width: 26px; min-height: 24px; width: 26px; height: 24px; padding: 0;
  background: #d9cfae; color: #1b2a25; border-radius: 2px;
  border: 1px solid; border-color: #fff #4d4630 #4d4630 #fff;
  box-shadow: inset -1px -1px 0 #8f8763;
}
.modal-head .ui-btn.icon:hover { background: #e6ddc0; }
.modal-head .ui-btn.icon:active { border-color: #4d4630 #fff #fff #4d4630; transform: none; }
html[data-theme="dark"] { --title-a: #10261f; --title-b: #2f6559; }
@media (prefers-color-scheme: dark) { html[data-theme="system"] { --title-a: #10261f; --title-b: #2f6559; } }
.modal-pic { display: flex; gap: 16px; align-items: flex-start; }
.modal-pic img.px { flex-shrink: 0; height: 48px; margin-top: 2px; }

/* ---------- Pixel icons ---------- */
img.px { image-rendering: pixelated; image-rendering: crisp-edges; width: auto; display: inline-block; vertical-align: middle; }
img.px.lift-on-hover { transition: transform 0.15s var(--ease); }
a:hover > img.px.lift-on-hover, button:hover > img.px.lift-on-hover { transform: translateY(-2px); }
html[data-theme="dark"] img.px.on-dark, html[data-theme="dark"] .app img.px.halo { filter: drop-shadow(0 0 1px rgba(230, 215, 170, 0.9)) drop-shadow(0 0 6px rgba(201, 188, 138, 0.25)); }
@media (prefers-color-scheme: dark) { html[data-theme="system"] .app img.px.halo { filter: drop-shadow(0 0 1px rgba(230, 215, 170, 0.9)) drop-shadow(0 0 6px rgba(201, 188, 138, 0.25)); } }

/* ---------- Header: taskbar + Start-button logo ---------- */
.site-header { border-bottom: 1px solid var(--line-strong, rgba(60, 52, 28, 0.2)) !important; }
.logo-container { gap: 10px; text-decoration: none; padding: 4px 12px 4px 6px; border-radius: var(--r-md); border: 1px solid transparent; transition: border-color var(--dur), background var(--dur); }
.logo-container:hover { border-color: var(--line-strong, rgba(60, 52, 28, 0.2)); background: rgba(255, 253, 246, 0.6); }
.logo-full { display: block; height: 40px; width: auto; }
@media (max-width: 640px) { .logo-full { height: 32px; } }
html[data-theme="dark"] body.app .logo-container:hover { background: rgba(207, 198, 162, 0.06); }
.navigation .nav-study { border-radius: var(--r-md) !important; font-family: var(--font-ui); font-weight: 700; letter-spacing: 0.08em !important; box-shadow: 0 3px 0 var(--pine-900, #0b1d19); }
.navigation .nav-study:active { transform: translateY(3px); box-shadow: none; }
body.app .navigation .nav-study { box-shadow: 0 3px 0 var(--line-strong); }
.avatar { font-family: var(--font-ui); font-weight: 700; }
.navigation .btnLogin-popup, .navigation .btnSignup-popup { border-radius: var(--r-md) !important; font-family: var(--font-ui) !important; font-weight: 600 !important; letter-spacing: 0.04em; }
.navigation .btnSignup-popup { box-shadow: 0 3px 0 var(--pine-900, #0b1d19); }
.navigation .btnSignup-popup:active { transform: translateY(3px); box-shadow: none; }

/* ---------- Auth modal as a window ---------- */
.wrapper { border-radius: var(--r-md) !important; padding: 0 !important; overflow: hidden; background: var(--paper-50) !important;
  box-shadow: inset 1px 1px 0 #fff, 6px 6px 0 rgba(5, 14, 11, 0.3), var(--shadow-xl) !important; }
.wrapper .win-bar { position: relative; }
.wrapper .form-box { padding: 22px 28px 26px; }
.wrapper .icon-close { top: 4px !important; right: 5px !important; width: 26px !important; height: 24px !important; border-radius: 2px !important;
  background: #d9cfae !important; color: #1b2a25 !important; border: 1px solid; border-color: #fff #4d4630 #4d4630 #fff; font-size: 1rem !important; z-index: 2; }
.form-box h2 { font-weight: 700 !important; }
.wrapper .btn { border-radius: var(--r-md) !important; box-shadow: 0 3px 0 #0b1d19; }
.wrapper .btn:active { transform: translateY(3px); box-shadow: none; }

/* ---------- Toasts with a pixel icon ---------- */
.toast img.px { height: 22px; flex-shrink: 0; }

/* ---------- Footer: a Win98 status bar ---------- */
.statusbar {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 6px clamp(10px, 3vw, 24px);
  background: #d9cfae; color: #1b2a25;
  border-top: 1px solid #fff; box-shadow: inset 0 1px 0 #fff, 0 -1px 0 #8f8763;
  font: 500 0.85rem/1.2 var(--font-pixel);
}
.statusbar .sb-cell {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; min-height: 26px;
  border: 1px solid; border-color: #8f8763 #fff #fff #8f8763; background: #d9cfae;
}
.statusbar .sb-cell.grow { flex: 1; }
.statusbar a { color: #1b2a25; text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
.statusbar a:hover { color: #12302b; text-decoration: underline; }
.statusbar ion-icon { font-size: 1.05rem; }
.statusbar .sb-clock { font-family: var(--font-crt); font-size: 1.1rem; min-width: 64px; justify-content: center; }

/* ---------- Dictation (mic) button ---------- */
.dictate-btn { gap: 6px; }
.dictate-btn img.px { height: 20px; }
.dictate-btn.listening { border-color: var(--bad) !important; color: var(--bad) !important; animation: dictate-pulse 1.2s ease-in-out infinite; }
@keyframes dictate-pulse { 50% { box-shadow: 0 0 0 5px rgba(192, 51, 43, 0.18); } }
.textarea-tools { display: flex; justify-content: flex-end; gap: 6px; margin-top: -4px; }

/* ---------- Upload dropzone: attach (paperclip) + image file ---------- */
.drop-icons { display: inline-flex; align-items: flex-end; gap: 10px; margin-bottom: 4px; }
.drop-icons img.px { height: 46px; transition: transform 0.2s var(--ease); }
.drop-icons img.px + img.px { height: 40px; }
.dropzone:hover .drop-icons img.px, .dropzone.drag .drop-icons img.px { transform: translateY(-3px) rotate(-4deg); }
.dropzone:hover .drop-icons img.px + img.px, .dropzone.drag .drop-icons img.px + img.px { transform: translateY(-3px) rotate(5deg); }

/* ---------- Session sound toggle ---------- */
.sound-btn img.px { height: 20px; }

@media (prefers-reduced-motion: reduce) {
  .ui-btn.ai::after { display: none; }
  .dictate-btn.listening { animation: none; }
}

/* Dashboard "new deck" tile: a notes file waiting to become a deck */
.deck-new-ico { height: 44px; transition: transform 0.2s var(--ease); }
.deck-new:hover .deck-new-ico { transform: translateY(-3px) rotate(-5deg); }


/* Why the sign-up modal opened (e.g. a guest tried to upload notes). */
.auth-reason { margin: -4px 0 14px; padding: 9px 12px; border-left: 3px solid #c9a227; background: #fbf3d5; color: #2a2616; font-size: 0.88rem; line-height: 1.45; border-radius: 0 4px 4px 0; text-align: left; }
.auth-reason[hidden] { display: none; }

/* Unverified account: a slim notice under the header */
.verify-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px clamp(16px, 4vw, 40px); background: #fbf3d5; color: #2a2616; border-bottom: 1px solid #e2d6a8; font-size: 0.9rem; }
.verify-banner .grow { flex: 1; min-width: 200px; }
.verify-banner .verify-dev { font-weight: 600; color: #2f6559; }
.verify-banner .ui-btn { color: #2a2616; border-color: #c9bf96; }
