/* Spoin Coworker — Design Tokens */
:root {
  --font-sans: 'Pretendard Variable', Pretendard, ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --font-display: 'Space Grotesk', 'Pretendard Variable', ui-sans-serif, system-ui, sans-serif;
  --font-serif: 'Instrument Serif', ui-serif, Georgia, serif;

  /* dark mode (default) */
  --bg-base: #0A1020;
  --bg-deep: #060A15;
  --bg-surface: #121A2E;
  --bg-elevated: #1A2440;
  --bg-elevated-2: #232F50;
  --border-soft: rgba(168, 200, 255, 0.10);
  --border-mid: rgba(168, 200, 255, 0.18);
  --border-strong: rgba(168, 200, 255, 0.32);

  --text-primary: #E8F0FF;
  --text-secondary: #95A8CC;
  --text-muted: #5E708F;
  --text-faint: #3A4866;

  /* pastel blue family */
  --blue-50: #EAF2FF;
  --blue-100: #C9DCFF;
  --blue-200: #A8C8FF;
  --blue-300: #7FA8F5;
  --blue-400: #5B89E8;
  --blue-500: #3F6BD0;
  --blue-600: #2E4FA0;

  /* neon accents */
  --neon-lime: #CCFF3F;
  --neon-cyan: #5DFFE3;
  --neon-pink: #FF6BD3;

  --accent: var(--neon-lime);
  --primary: var(--blue-200);

  /* status */
  --ok: #58E2A7;
  --warn: #FFD15E;
  --danger: #FF6B8E;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --shadow-1: 0 1px 0 rgba(255,255,255,.04) inset, 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 1px 0 rgba(255,255,255,.05) inset, 0 8px 24px rgba(0,0,0,.5);
  --shadow-glow: 0 0 0 1px rgba(168,200,255,.2), 0 0 28px rgba(168,200,255,.25);
}

[data-theme="light"] {
  --bg-base: #F4F6FB;
  --bg-deep: #E9EDF6;
  --bg-surface: #FFFFFF;
  --bg-elevated: #FFFFFF;
  --bg-elevated-2: #F1F4FB;
  --border-soft: rgba(20, 40, 80, 0.08);
  --border-mid: rgba(20, 40, 80, 0.16);
  --border-strong: rgba(20, 40, 80, 0.30);

  --text-primary: #0E1830;
  --text-secondary: #3A4868;
  --text-muted: #6A7693;
  --text-faint: #95A0B8;

  --blue-50: #E8EEFF;
  --blue-100: #2845D8;
  --blue-200: #1E37BA;
  --blue-300: #14299E;
  --blue-400: #0E1F7D;
  --blue-500: #0A1758;
  --blue-600: #060F3B;

  /* In light, swap neon → solid cobalt + jersey-orange highlight ink */
  --neon-lime: #FF5A1F;
  --neon-cyan: #1E37BA;
  --accent: #FF5A1F;
  --primary: #0E1830;
  --ok: #1F8A5B;
  --warn: #B47A00;
  --danger: #B4242E;
  --shadow-2: 0 1px 0 rgba(255,255,255,1) inset, 0 8px 24px rgba(20,40,80,.10);
}

/* COURT theme — editorial sports magazine: cream paper + cobalt + jersey orange */
[data-theme="court"] {
  --bg-base: #EFEAD8;
  --bg-deep: #E5DFC8;
  --bg-surface: #F7F3E4;
  --bg-elevated: #FFFCF1;
  --bg-elevated-2: #E8E2CA;
  --border-soft: rgba(14, 26, 70, 0.10);
  --border-mid: rgba(14, 26, 70, 0.20);
  --border-strong: rgba(14, 26, 70, 0.45);

  --text-primary: #0E1A46;
  --text-secondary: #2E3A6A;
  --text-muted: #6B6852;
  --text-faint: #A39D80;

  --blue-50: #E8EEFF;
  --blue-100: #C4D2FF;
  --blue-200: #2845D8;
  --blue-300: #1E37BA;
  --blue-400: #14299E;
  --blue-500: #0E1F7D;
  --blue-600: #0A1758;

  --primary: #0E1A46;
  --accent: #FF5A1F;          /* jersey orange */
  --neon-lime: #FF5A1F;
  --neon-cyan: #14299E;
  --ok: #1F8A5B;
  --warn: #E8A91B;
  --danger: #C4322E;

  --shadow-1: 0 1px 0 rgba(255,255,255,.7) inset, 0 1px 2px rgba(14,26,70,.08);
  --shadow-2: 0 2px 0 rgba(14,26,70,.06), 0 8px 24px rgba(14,26,70,.10);
  --shadow-glow: 0 0 0 2px #0E1A46;
}

/* alt palettes via [data-palette] */
[data-palette="ice"] {
  --neon-lime: #5DFFE3;
  --accent: #5DFFE3;
}
[data-palette="violet"] {
  --neon-lime: #C9A0FF;
  --accent: #C9A0FF;
  --blue-200: #B4A8FF;
  --primary: #B4A8FF;
}
[data-palette="pink"] {
  --neon-lime: #FF6BD3;
  --accent: #FF6BD3;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01', 'cv01';
  overflow: hidden;
}

/* Paper grain — only visible on court theme */
[data-theme="court"] body::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 9999;
  background-image:
    radial-gradient(circle at 17% 23%, rgba(14,26,70,.04) 0 1px, transparent 1px),
    radial-gradient(circle at 73% 59%, rgba(14,26,70,.03) 0 1px, transparent 1px),
    radial-gradient(circle at 41% 89%, rgba(14,26,70,.035) 0 1px, transparent 1px),
    radial-gradient(circle at 88% 12%, rgba(14,26,70,.03) 0 1px, transparent 1px);
  background-size: 7px 7px, 11px 11px, 13px 13px, 9px 9px;
  mix-blend-mode: multiply;
  opacity: .8;
}

.display { font-family: var(--font-display); letter-spacing: -.04em; font-weight: 700; }
.serif { font-family: var(--font-serif); font-style: italic; }
.stencil {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-feature-settings: 'tnum';
}
.tabular { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }

/* court-line divider — thick top + thin bottom, like real basketball court markings */
.courtline {
  border-top: 3px solid var(--text-primary);
  border-bottom: 1px solid var(--text-primary);
  height: 6px;
}
.courtline-thin {
  border-top: 1px solid var(--text-primary);
}

button { font-family: inherit; }
input, textarea, select { font-family: inherit; color: inherit; }

/* placeholder 가독성 — 다크/라이트 양쪽 톤에서 충분히 보이도록 */
input::placeholder, textarea::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}
input:focus::placeholder, textarea:focus::placeholder {
  opacity: 0.5;
}

/* utility */
.mono { font-family: var(--font-mono); }
.dim { color: var(--text-muted); }
.hl { color: var(--accent); }

/* common scrollbar */
.scroll {
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-mid) transparent;
}
.scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 4px; }
.scroll::-webkit-scrollbar-track { background: transparent; }

/* grid background */
.gridbg {
  background-image:
    linear-gradient(rgba(168,200,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(168,200,255,.04) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: -1px -1px;
}

/* dot background */
.dotbg {
  background-image: radial-gradient(circle at 1px 1px, rgba(168,200,255,.10) 1px, transparent 0);
  background-size: 18px 18px;
}

/* basketball court stripes — subtle nod */
.courtbg {
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(168,200,255,.08), transparent 70%),
    radial-gradient(40% 30% at 50% 100%, rgba(204,255,63,.05), transparent 70%);
}

@keyframes orb-pulse {
  0%, 100% { transform: scale(1); filter: blur(0px); }
  50% { transform: scale(1.04); filter: blur(0.4px); }
}
@keyframes orb-rotate {
  to { transform: rotate(360deg); }
}
@keyframes blink-cursor {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes dash {
  to { stroke-dashoffset: -100; }
}
@keyframes fadeup {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Markdown 응답 렌더링 ─── */
.md p { margin: 0 0 8px 0; }
.md p:last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 {
  margin: 14px 0 6px 0; font-weight: 700; line-height: 1.3; letter-spacing: -.01em;
}
.md h1 { font-size: 1.45em; }
.md h2 { font-size: 1.25em; padding-bottom: 4px; border-bottom: 1px solid var(--border-soft); }
.md h3 { font-size: 1.1em; color: var(--accent); }
.md h4, .md h5, .md h6 { font-size: 1em; color: var(--text-secondary); }
.md ul, .md ol { margin: 4px 0 10px 0; padding-left: 22px; }
.md li { margin: 2px 0; line-height: 1.55; }
.md li > p { margin: 0; }
.md code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  color: var(--blue-100);
}
.md pre {
  margin: 8px 0; padding: 10px 12px; border-radius: 8px;
  background: var(--bg-deep); border: 1px solid var(--border-soft);
  overflow-x: auto; font-family: var(--font-mono); font-size: 12px; line-height: 1.5;
}
.md pre code { background: transparent; border: none; padding: 0; color: var(--text-primary); }
.md blockquote {
  margin: 8px 0; padding: 6px 12px;
  border-left: 3px solid var(--accent);
  background: color-mix(in oklab, var(--accent) 5%, transparent);
  color: var(--text-secondary);
}
.md hr { margin: 14px 0; border: 0; border-top: 1px solid var(--border-soft); }
.md a { color: var(--accent); text-decoration: underline; }
.md strong { color: var(--text-primary); font-weight: 700; }
.md em { color: var(--text-secondary); font-style: italic; }
.md table {
  margin: 8px 0; border-collapse: collapse;
  font-size: 12.5px; max-width: 100%; display: block; overflow-x: auto;
}
.md th, .md td {
  padding: 6px 10px;
  border: 1px solid var(--border-soft);
  text-align: left;
  vertical-align: top;
}
.md th {
  background: var(--bg-elevated);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -.005em;
}
.md tr:nth-child(even) td { background: color-mix(in oklab, var(--bg-elevated) 30%, transparent); }
.md del { color: var(--text-faint); text-decoration: line-through; }
