/* Shared design system for /seminar/prob pages
   Mirrors the main www.kodama-lab.com/index.html styling
   School colors: Hosei orange #F08300 + blue #003F8C */

:root {
  --bg-0: #ffffff;
  --bg-1: #f6f8fc;
  --bg-2: #eef2f8;
  --surface: #ffffff;
  --surface-soft: #f7f9fd;
  --surface-strong: #eef3fa;
  --border: rgba(0, 63, 140, 0.14);
  --border-strong: rgba(0, 63, 140, 0.28);
  --text: #16223a;
  --text-dim: #4a5a78;
  --text-mute: #7c89a3;
  --primary: #003f8c;
  --primary-strong: #002a66;
  --primary-soft: #e6eef9;
  --accent: #f08300;
  --accent-strong: #d97200;
  --accent-soft: #fff1de;
  --grad: linear-gradient(135deg, #003f8c 0%, #2a6ec3 55%, #f08300 100%);
  --grad-soft: linear-gradient(135deg, rgba(0,63,140,0.10) 0%, rgba(240,131,0,0.10) 100%);
  --shadow-1: 0 1px 2px rgba(15, 30, 60, 0.04), 0 8px 24px rgba(15, 30, 60, 0.06);
  --shadow-glow: 0 0 0 1px rgba(0, 63, 140, 0.18), 0 12px 32px rgba(240, 131, 0, 0.14);
  --radius: 16px;
  --radius-lg: 22px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', 'Noto Sans JP', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg-0);
  line-height: 1.7;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Floating tinted orbs */
body::before, body::after {
  content: '';
  position: fixed;
  width: 50vmax; height: 50vmax;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.22;
  z-index: -1;
  pointer-events: none;
  animation: kl-float 24s ease-in-out infinite;
}
body::before {
  background: radial-gradient(circle, #003f8c 0%, transparent 60%);
  top: -22vmax; left: -18vmax;
}
body::after {
  background: radial-gradient(circle, #f08300 0%, transparent 60%);
  bottom: -25vmax; right: -22vmax;
  animation-delay: -12s;
}
@keyframes kl-float {
  0%, 100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(8vmax, -4vmax) scale(1.08); }
  66% { transform: translate(-6vmax, 5vmax) scale(0.95); }
}

.grid-overlay {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(0,63,140,0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0,63,140,0.04) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}

a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; display: block; }
hr { border: 0; height: 1px; background: linear-gradient(to right, transparent, var(--border-strong), transparent); margin: 32px 0; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  background: rgba(255,255,255,0.85);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 14px 24px;
  display: flex; align-items: center; gap: 18px;
  flex-wrap: wrap;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; letter-spacing: .02em;
  font-size: 16px;
}
.brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px rgba(240,131,0,.55);
}
.brand .grad-text {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.brand a { color: inherit; }
.brand .crumbs {
  margin-left: 6px;
  color: var(--text-mute);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
}
.brand .crumbs a { color: var(--text-dim); }
.brand .crumbs a:hover { color: var(--accent); }
.brand .crumbs .sep { margin: 0 6px; color: var(--text-mute); }
.top-spacer { flex: 1; }

.clocks {
  display: flex; align-items: center; gap: 14px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}
.clock { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.clock svg { width: 40px; height: 40px; display: block; }
.clock .face { fill: #eef3fa; stroke: var(--primary); stroke-width: 2; }
.clock .tick { stroke: var(--text-mute); stroke-width: 1; stroke-linecap: round; }
.clock .tick-h { stroke: var(--primary); stroke-width: 1.6; }
.clock .hand-h { stroke: #16223a; stroke-width: 3; stroke-linecap: round; }
.clock .hand-m { stroke: #16223a; stroke-width: 2.2; stroke-linecap: round; }
.clock .hand-s { stroke: #f08300; stroke-width: 1.2; stroke-linecap: round; }
.clock .pivot { fill: var(--accent); }
.clock .label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 9px; letter-spacing: .12em;
  color: var(--text-mute);
  text-transform: uppercase;
  font-weight: 600;
}
.clock.is-night .face { fill: #0e1420; stroke: var(--accent); }
.clock.is-night .tick { stroke: rgba(255,255,255,0.3); }
.clock.is-night .tick-h { stroke: var(--accent); }
.clock.is-night .hand-h, .clock.is-night .hand-m { stroke: #f4f6fb; }
@media (max-width: 640px) {
  .clocks .clock:nth-child(2) { display: none; }
  .brand .crumbs { display: none; }
}

.lang-pick {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-dim);
}
.lang-pick select {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 6px 10px; font-size: 13px; cursor: pointer;
  font-family: inherit;
}
.lang-pick select:focus { outline: none; border-color: var(--accent); }

/* Layout shell */
.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.container-wide { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

/* Hero (landing) */
.hero {
  padding: 80px 24px 56px;
  max-width: 1080px; margin: 0 auto;
  text-align: center;
  position: relative;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--primary-soft);
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--primary);
  backdrop-filter: blur(8px);
}
.hero-eyebrow .pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(240,131,0,0.7);
  animation: kl-pulse 2s ease-in-out infinite;
}
@keyframes kl-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(.85); }
}
.hero h1 {
  font-family: 'Klee One', 'Yu Mincho', 'YuMincho', '游明朝', 'Hiragino Mincho ProN', 'MS Mincho', serif;
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 3.8rem);
  letter-spacing: .12em;
  line-height: 1.2;
  margin: 22px 0 18px;
}
.hero h1 .grad-text {
  background: var(--grad);
  background-size: 200% 200%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: kl-shimmer 8s ease-in-out infinite;
}
@keyframes kl-shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.hero-sub {
  max-width: 760px; margin: 0 auto;
  font-size: clamp(.98rem, 1.4vw, 1.1rem);
  color: var(--text-dim);
  line-height: 1.8;
}
.hero-meta {
  margin-top: 24px;
  display: flex; flex-wrap: wrap; gap: 10px;
  justify-content: center;
}
.pill {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  color: var(--text-dim);
  transition: all .25s;
}
.pill:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); transform: translateY(-1px); }

/* Section heading */
section { margin-bottom: 56px; }
.sec-head {
  display: flex; align-items: baseline; gap: 14px;
  margin: 0 0 22px;
}
.sec-head h2 {
  font-family: 'Space Grotesk', 'Noto Sans JP', sans-serif;
  font-size: clamp(1.3rem, 2.2vw, 1.7rem);
  font-weight: 600;
  letter-spacing: .02em;
  margin: 0;
  color: var(--primary);
  position: relative;
  padding-left: 14px;
}
.sec-head h2::before {
  content: ''; position: absolute;
  left: 0; top: 50%; transform: translateY(-50%);
  width: 4px; height: 70%;
  background: var(--accent);
  border-radius: 2px;
}
.sec-head .ribbon { flex: 1; height: 1px; background: linear-gradient(to right, var(--border-strong), transparent); }
.sec-head .num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px; color: var(--accent); font-weight: 600; letter-spacing: .1em;
}

/* Card grid (used on landing) */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.card-btn {
  position: relative;
  display: block;
  padding: 18px 18px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
  color: var(--text);
  transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s, border-color .35s;
  overflow: hidden;
}
.card-btn::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: var(--grad);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity .35s;
  pointer-events: none;
}
.card-btn:hover {
  transform: translateY(-3px);
  border-color: transparent;
  box-shadow: 0 18px 40px rgba(0,63,140,0.18), 0 0 0 1px rgba(240,131,0,0.22);
  color: var(--text);
}
.card-btn:hover::before { opacity: 1; }
.card-btn .num-tag {
  display: inline-block;
  font-family: 'Space Grotesk', monospace;
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); font-weight: 700;
  margin-bottom: 4px;
}
.card-btn .title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .02em;
  margin: 4px 0 4px;
  color: var(--text);
}
.card-btn .desc {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.55;
}
.card-btn .arrow {
  position: absolute; top: 14px; right: 14px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  border: 1px solid var(--accent-strong);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 14px;
  transition: transform .3s;
  opacity: 0;
}
.card-btn:hover .arrow { opacity: 1; transform: rotate(-45deg); }

/* Content page */
.content {
  max-width: 920px;
  margin: 32px auto 64px;
  padding: 0 24px;
}
.content-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 36px clamp(20px, 4vw, 48px);
  box-shadow: var(--shadow-1);
}
.content h1, .content-card h1 {
  font-family: 'Klee One', 'Yu Mincho', 'YuMincho', serif;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  letter-spacing: .08em;
  color: var(--primary);
  margin: 0 0 8px;
  font-weight: 600;
}
.content-card .lead {
  color: var(--text-dim);
  margin: 0 0 28px;
  font-size: 14px;
}
.content-card h2 {
  font-family: 'Space Grotesk', 'Noto Sans JP', sans-serif;
  color: var(--primary);
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: .02em;
  margin: 36px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border-strong);
}
.content-card h3 {
  color: var(--primary-strong);
  font-size: 1.1rem;
  margin: 24px 0 10px;
}
.content-card p { margin: 12px 0; }
.content-card ul, .content-card ol {
  padding-left: 1.4em;
  margin: 14px 0;
}
.content-card li { margin: 6px 0; }
.content-card li::marker { color: var(--accent); }
.content-card b, .content-card strong { color: var(--primary-strong); }
.content-card pre, .content-card code, .content-card .src-pre {
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, 'Roboto Mono', monospace;
}
.content-card pre, .content-card .src-pre {
  background: #0e1420;
  color: #d6dcec;
  padding: 16px 18px;
  border-radius: 12px;
  font-size: 13px;
  overflow-x: auto;
  border: 1px solid #1d2840;
  line-height: 1.6;
}
.content-card pre .kw, .content-card .src-pre .kw { color: #ffb56b; font-weight: 600; }
.content-card pre .str, .content-card .src-pre .str { color: #a3e7c5; }
.content-card pre .num, .content-card .src-pre .num { color: #ffd479; }
.content-card pre .com, .content-card .src-pre .com { color: #6f7c97; font-style: italic; }
.content-card code {
  background: var(--surface-strong);
  color: var(--primary-strong);
  padding: 2px 6px; border-radius: 6px;
  font-size: 0.92em;
}
.content-card pre code, .content-card .src-pre code {
  background: transparent; color: inherit; padding: 0;
}

.content-card .figure {
  text-align: center;
  margin: 22px 0;
}
.content-card .figure img {
  display: inline-block;
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
}
.content-card .figure figcaption {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--text-mute);
}

/* Equation block */
.eq {
  display: block;
  margin: 14px 0;
  padding: 12px 18px;
  background: var(--surface-strong);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  font-family: 'Space Grotesk', monospace;
  font-size: 1.02em;
  color: var(--primary-strong);
}
.eq.center { text-align: center; }

/* Pretty table */
.pretty-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 18px 0;
  font-size: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.pretty-table th, .pretty-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.pretty-table th {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .03em;
}
.pretty-table tr:last-child td { border-bottom: none; }
.pretty-table tr:hover td { background: var(--surface-soft); }

/* Problem callout */
.callout {
  margin: 22px 0;
  padding: 18px 22px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary-soft), var(--accent-soft));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
}
.callout .label {
  display: inline-block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.callout.problem .label::before { content: '◎ '; }
.callout.task .label { color: var(--primary); }
.callout.task .label::before { content: '▶ '; }

/* Page navigation (prev/next/up) */
.pagenav {
  display: flex; flex-wrap: wrap; gap: 10px;
  align-items: center;
  margin: 0 0 28px;
}
.pagenav a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  color: var(--text-dim);
  transition: all .2s;
}
.pagenav a:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}
.pagenav a.up { color: var(--primary); }
.pagenav a.up:hover { color: var(--primary-strong); border-color: var(--primary); background: var(--primary-soft); }
.pagenav .arrow { font-family: 'Space Grotesk', sans-serif; font-weight: 700; }

/* Demo box (for JS-converted Java samples) */
.demo {
  margin: 22px 0;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.demo .demo-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface-strong);
  border-bottom: 1px solid var(--border);
}
.demo .demo-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600; color: var(--primary);
  letter-spacing: .04em;
  font-size: 14px;
}
.demo .demo-tag {
  font-family: 'Space Grotesk', monospace;
  font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent); font-weight: 700;
  padding: 3px 8px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent-soft);
}
.demo .demo-body {
  padding: 18px;
  display: flex; flex-direction: column;
  gap: 14px;
  align-items: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(0,63,140,0.06), transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(240,131,0,0.07), transparent 50%);
}
.demo canvas {
  background: #f6f8fc;
  border: 1px solid var(--border);
  border-radius: 10px;
  display: block;
  max-width: 100%;
}
.demo .controls {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center;
}
.demo button {
  font-family: inherit;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: white;
  cursor: pointer;
  transition: all .2s;
  font-weight: 500;
}
.demo button:hover { background: var(--primary-strong); border-color: var(--primary-strong); transform: translateY(-1px); }
.demo button.alt { background: var(--surface); color: var(--primary); }
.demo button.alt:hover { background: var(--primary-soft); }
.demo input[type="range"], .demo input[type="number"] {
  font-family: inherit;
}
.demo input[type="number"] {
  width: 80px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.demo label {
  font-size: 13px;
  color: var(--text-dim);
  display: inline-flex; align-items: center;
  gap: 6px;
}
.demo .readout {
  font-family: 'Space Grotesk', monospace;
  font-size: 13px;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

/* Footer */
.footer {
  max-width: 1080px; margin: 32px auto 0;
  padding: 28px 24px 36px;
  display: flex; flex-wrap: wrap; gap: 12px;
  align-items: center; justify-content: space-between;
  font-size: 12.5px; color: var(--text-mute);
  border-top: 1px solid var(--border);
}
.footer .footer-brand {
  display: flex; align-items: center; gap: 8px;
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: .04em; font-weight: 600;
  color: var(--text-dim);
}
.footer .footer-brand .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px rgba(240,131,0,0.5);
}

/* Reveal-on-scroll */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s, transform .7s; }
.reveal.visible { opacity: 1; transform: none; }

/* Night theme */
:root.theme-night {
  --bg-0: #0a0f1c;
  --bg-1: #101728;
  --bg-2: #161e34;
  --surface: #131a2c;
  --surface-soft: #161e33;
  --surface-strong: #1c2540;
  --border: rgba(120, 160, 220, 0.15);
  --border-strong: rgba(120, 160, 220, 0.32);
  --text: #e6ecf7;
  --text-dim: #b6c2da;
  --text-mute: #7d8aaa;
  --primary: #6ba9ff;
  --primary-strong: #97c0ff;
  --primary-soft: #182846;
  --accent: #ffa844;
  --accent-strong: #ffc678;
  --accent-soft: #2a1d0a;
  --grad: linear-gradient(135deg, #6ba9ff 0%, #b491ff 55%, #ffa844 100%);
  --shadow-1: 0 1px 2px rgba(0,0,0,0.5), 0 8px 24px rgba(0,0,0,0.4);
}
:root.theme-night .topbar { background: rgba(10,15,28,0.85); }
:root.theme-night body::before { opacity: 0.18; }
:root.theme-night body::after { opacity: 0.16; }
:root.theme-night .content-card pre, :root.theme-night .content-card .src-pre {
  background: #050810;
  border-color: #1d2840;
}
