/* Study Buddy — warm study-buddy, blue accent, bold experimental */
:root {
  --bg: #fbfaf7;
  --paper: #f3eee3;
  --paper-deep: #ebe3d0;
  --ink: #14162b;
  --ink-soft: #3b3d55;
  --ink-mute: #72748a;
  --ink-whisper: #a8a9b8;
  --line: #e6e2d6;
  --line-soft: #ece8dc;

  --blue: oklch(0.55 0.18 265);
  --blue-deep: oklch(0.45 0.2 265);
  --blue-soft: oklch(0.92 0.04 265);
  --blue-wash: oklch(0.97 0.02 265);

  --coral: oklch(0.70 0.17 35);
  --coral-soft: oklch(0.93 0.05 35);
  --mint: oklch(0.80 0.10 160);
  --lemon: oklch(0.92 0.12 95);

  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 16px;
  --radius-xl: 24px;

  --shadow-s: 0 1px 2px rgba(20, 22, 43, 0.06);
  --shadow-m: 0 2px 6px rgba(20, 22, 43, 0.06), 0 8px 24px rgba(20, 22, 43, 0.06);
  --shadow-l: 0 6px 24px rgba(20, 22, 43, 0.08), 0 24px 64px rgba(20, 22, 43, 0.08);

  --font-display: "Fraunces", "Cambria", "Georgia", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-sans); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }

.sg {
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  overflow: hidden;
  position: relative;
}

.display { font-family: var(--font-display); font-weight: 500; letter-spacing: -0.02em; }
.mono { font-family: var(--font-mono); font-feature-settings: "ss01"; }

/* Top bar used in most screens */
.sg-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.sg-topbar .brand {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-size: 16px; letter-spacing: -0.01em;
  font-weight: 500; font-style: italic;
}
.sg-topbar .brand .mark {
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--ink); color: var(--bg);
  display: grid; place-items: center; font-family: var(--font-display);
  font-size: 12px; font-weight: 600; font-style: normal;
  transform: rotate(-4deg);
}

/* Avatar */
.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--coral); color: white;
  display: grid; place-items: center; font-size: 10px; font-weight: 600;
  letter-spacing: 0.02em;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 8px;
  border: 1px solid var(--ink); background: var(--ink); color: white;
  font: 500 12px/1 var(--font-sans); cursor: pointer;
  transition: transform 0.08s, background 0.12s;
}
.btn:hover { transform: translateY(-0.5px); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--line-soft); }
.btn.blue { background: var(--blue); border-color: var(--blue); color: white; }
.btn.blue:hover { background: var(--blue-deep); border-color: var(--blue-deep); }
.btn.small { padding: 5px 9px; font-size: 11px; }

/* Chip */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 999px;
  background: var(--line-soft); color: var(--ink-soft);
  font: 500 10.5px/1 var(--font-sans);
  border: 1px solid var(--line);
}
.chip.blue { background: var(--blue-wash); color: var(--blue-deep); border-color: var(--blue-soft); }
.chip.coral { background: var(--coral-soft); color: #8a3a20; border-color: oklch(0.85 0.08 35); }
.chip.mint { background: oklch(0.95 0.04 160); color: #1f5c48; border-color: oklch(0.85 0.06 160); }

/* Hand-drawn underline — scribbled highlight */
.scribble {
  position: relative; display: inline-block;
}
.scribble::after {
  content: ""; position: absolute; left: -2%; right: -2%; bottom: 2px;
  height: 9px;
  background: var(--lemon); opacity: 0.55;
  z-index: -1;
  border-radius: 4px;
  transform: skewX(-6deg) rotate(-0.8deg);
}

.paper-card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-s);
}

.sg-card {
  background: white; border: 1px solid var(--line);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-s);
}

/* File type glyphs */
.file-glyph {
  width: 36px; height: 44px; flex-shrink: 0; position: relative;
  border-radius: 4px; border: 1px solid var(--line);
  background: white;
  display: grid; place-items: center;
  font: 600 9px/1 var(--font-mono);
  color: var(--ink-mute);
}
.file-glyph::before {
  content: ""; position: absolute; top: 0; right: 0;
  width: 10px; height: 10px;
  border-left: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: var(--line-soft);
}
.file-glyph.pdf { color: #b03a2e; }
.file-glyph.ppt { color: #c06020; }
.file-glyph.doc { color: #1f4f9e; }
.file-glyph.txt { color: var(--ink-mute); }
.file-glyph.img { color: #2e7a4f; }

/* Grid paper background option */
.grid-paper {
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* Dotted */
.dotted {
  background-image: radial-gradient(circle, var(--line) 1px, transparent 1.5px);
  background-size: 18px 18px;
}

/* Kbd */
.kbd {
  display: inline-block; padding: 1px 5px; border-radius: 4px;
  background: white; border: 1px solid var(--line); border-bottom-width: 2px;
  font: 500 10px/1.5 var(--font-mono); color: var(--ink-soft);
}

/* Subtle pulsing dot for live states */
@keyframes pulse-dot { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }
.pulse { animation: pulse-dot 1.4s ease-in-out infinite; }

/* Scrollbars inside screens */
.sg ::-webkit-scrollbar { width: 6px; height: 6px; }
.sg ::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.sg ::-webkit-scrollbar-track { background: transparent; }
