/* =========================================================
   Chaehongse.kr — 개인 홈페이지
   ========================================================= */
:root {
  --bg: #f4f7fd;
  --surface: #ffffff;
  --surface-2: #f2f5fc;
  --text: #0b1230;
  --muted: #64748b;
  --line: #e4e9f4;
  --primary: #1d6bff;
  --primary-hover: #3a7fff;
  --primary-soft: rgba(29, 107, 255, 0.10);
  --green: #12b981;
  --amber: #f59e0b;
  --red: #ef4444;
  --shadow: 0 10px 30px rgba(28, 48, 100, 0.08);
  --shadow-lg: 0 18px 44px rgba(28, 48, 100, 0.16);
  --topbar-bg: rgba(255, 255, 255, 0.86);
  --hero-title: #0b1030;
  --radius: 18px;
  --font: 'Inter', 'Noto Sans KR', 'Malgun Gothic', 'Apple SD Gothic Neo', system-ui, sans-serif;
  --font-display: 'Outfit', 'Inter', 'Noto Sans KR', sans-serif;
  --font-hand: 'Gaegu', 'Noto Sans KR', cursive;
}

:root[data-theme="dark"] {
  --bg: #080d1b;
  --surface: #111a30;
  --surface-2: #17223d;
  --text: #e8eefc;
  --muted: #93a3c2;
  --line: #22304f;
  --primary: #3b82f6;
  --primary-hover: #5b97fb;
  --primary-soft: rgba(59, 130, 246, 0.16);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.5);
  --topbar-bg: rgba(10, 16, 32, 0.86);
  --hero-title: #f3f6ff;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s, color 0.25s;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

.wrap { width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 28px; }
.muted { color: var(--muted); }
.ic { width: 1.25em; height: 1.25em; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.c-blue { color: var(--primary); }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--primary); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { left: 8px; }
kbd { font: 600 0.72rem var(--font); padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }

/* ---------------- Topbar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: 58px;
  display: flex; align-items: center; gap: 24px;
  padding: 0 28px;
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 700; font-size: 1.32rem; letter-spacing: -0.01em; white-space: nowrap; }
.brand svg { width: 30px; height: 30px; color: var(--primary); }
.nav { display: flex; gap: 6px; margin: 0 auto; }
.nav a { position: relative; padding: 18px 16px; font-weight: 500; font-size: 0.95rem; color: var(--text); opacity: 0.8; white-space: nowrap; }
.nav a:hover { opacity: 1; }
.nav a.active { color: var(--primary); opacity: 1; font-weight: 600; }
.nav a.active::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 2px; background: var(--primary); border-radius: 2px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.search-pill {
  display: flex; align-items: center; gap: 10px; width: 270px; height: 38px; padding: 0 14px;
  background: var(--surface-2); border: 1px solid transparent; border-radius: 999px;
  color: var(--muted); font-size: 0.85rem; text-align: left; white-space: nowrap;
}
.search-pill:hover { border-color: var(--line); }
.search-pill span { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border: none; border-radius: 50%; background: transparent; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .ic { width: 22px; height: 22px; }
.avatar { background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: 48px; min-width: 210px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
}
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: none; background: none; border-radius: 9px; font-size: 0.9rem; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--surface-2); }
.menu hr { border: none; border-top: 1px solid var(--line); margin: 6px 0; }

/* ---------------- Buttons ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 56px; padding: 0 28px; border: none; border-radius: 16px; font-weight: 600; font-size: 0.98rem; white-space: nowrap; transition: transform 0.12s, box-shadow 0.15s, background 0.15s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(180deg, #2f7bff, #1660f0); color: #fff; box-shadow: 0 8px 22px rgba(29, 107, 255, 0.4); }
.btn-primary:hover { background: linear-gradient(180deg, #4a8cff, #2a6cf5); }
.btn-light { background: rgba(255, 255, 255, 0.92); color: #0b1230; box-shadow: 0 6px 20px rgba(28, 48, 100, 0.12); }
.btn-light:hover { background: #fff; }
.btn-sm { height: 40px; padding: 0 16px; border-radius: 11px; font-size: 0.9rem; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 0.82rem; font-weight: 500; white-space: nowrap; }
.chip-btn:hover { color: var(--text); border-color: var(--primary); }
.chip-btn.danger:hover { color: var(--red); border-color: var(--red); }
.link-btn { display: inline-flex; align-items: center; gap: 4px; border: none; background: none; color: var(--primary); font-size: 0.84rem; font-weight: 500; white-space: nowrap; }
.link-btn:hover { text-decoration: underline; }

/* ---------------- Hero ---------------- */
.hero { position: relative; min-height: clamp(470px, 33vw, 560px); overflow: hidden; }
.hero-bg { position: absolute; inset: 0; background: #cfd9f0 url('/static/hero.jpg') center 62% / cover no-repeat; }
.hero-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, var(--bg) 100%); }
:root[data-theme="dark"] .hero-bg::before { content: ""; position: absolute; inset: 0; background: rgba(6, 10, 24, 0.5); }
.hero-inner { position: relative; padding-top: 64px; padding-bottom: 120px; }
.eyebrow { font-size: 0.82rem; font-weight: 500; letter-spacing: 0.42em; color: var(--hero-title); opacity: 0.85; }
.hero-title { margin-top: 10px; font-family: var(--font-display); font-weight: 700; font-size: clamp(3rem, 5.4vw, 4.7rem); line-height: 1.05; letter-spacing: -0.03em; color: var(--hero-title); text-shadow: 0 2px 24px rgba(255, 255, 255, 0.45); }
.hero-title span { color: #1d4ed8; }
:root[data-theme="dark"] .hero-title { text-shadow: none; }
:root[data-theme="dark"] .hero-title span { color: #6aa2ff; }
.hero-headline { margin-top: 14px; font-size: clamp(1.6rem, 2.5vw, 2.2rem); font-weight: 500; line-height: 1.32; color: var(--hero-title); text-shadow: 0 1px 18px rgba(255, 255, 255, 0.5); }
.hero-sub { margin-top: 16px; font-size: 1.05rem; line-height: 1.7; color: var(--hero-title); opacity: 0.9; text-shadow: 0 1px 14px rgba(255, 255, 255, 0.55); }
:root[data-theme="dark"] .hero-headline, :root[data-theme="dark"] .hero-sub { text-shadow: none; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 30px; }
.hero-quote { position: absolute; top: 84px; right: 28px; margin: 0; font-family: var(--font-hand); font-size: 1.85rem; line-height: 1.45; color: #1c2547; text-align: left; text-shadow: 0 1px 12px rgba(255, 255, 255, 0.5); }
.hero-quote blockquote { margin: 0; }
.hero-quote::after { content: ""; display: block; width: 38px; height: 2px; margin: 12px auto 0; background: currentColor; opacity: 0.6; }
:root[data-theme="dark"] .hero-quote { color: #f2f5ff; text-shadow: 0 1px 10px rgba(0, 0, 0, 0.6); }

/* ---------------- App cards ---------------- */
.app-cards { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: -78px; }
.app-card { position: relative; display: flex; align-items: center; gap: 20px; min-height: 140px; padding: 20px 22px; overflow: hidden; border-radius: 20px; box-shadow: var(--shadow-lg); transition: transform 0.18s, box-shadow 0.18s; isolation: isolate; }
.app-card:hover { transform: translateY(-4px); }
.app-card.skeleton { background: var(--surface); animation: shimmer 1.4s infinite alternate; }
@keyframes shimmer { from { opacity: 0.55; } to { opacity: 1; } }
.app-icon { display: grid; place-items: center; width: 78px; height: 78px; flex-shrink: 0; border-radius: 20px; }
.app-icon .ic { width: 38px; height: 38px; stroke-width: 1.9; }
.app-info { min-width: 0; flex: 1; }
.app-info h3 { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.app-info p { margin-top: 2px; font-size: 0.95rem; opacity: 0.8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.svc-state { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.svc-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.svc-state[data-state="up"]::before { background: var(--green); box-shadow: 0 0 0 3px rgba(18, 185, 129, 0.25); }
.svc-state[data-state="degraded"]::before { background: var(--amber); }
.svc-state[data-state="down"]::before { background: var(--red); }
.app-go { display: grid; place-items: center; width: 42px; height: 42px; flex-shrink: 0; border-radius: 50%; }
.app-go .ic { width: 20px; height: 20px; }

.app-card.stock { color: #fff; background: linear-gradient(120deg, #0c1a3c 0%, #173a7c 100%); }
.app-card.stock::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0.55; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 140' preserveAspectRatio='none'%3E%3Cpolyline points='0,120 30,105 60,112 90,84 120,92 150,60 185,70 220,38 260,46 300,16' fill='none' stroke='%2360a5fa' stroke-width='2.5'/%3E%3Cpolyline points='0,132 40,124 80,128 120,110 160,116 200,96 250,102 300,84' fill='none' stroke='%233b82f6' stroke-width='1.6' opacity='.6'/%3E%3C/svg%3E") right bottom / 62% 80% no-repeat; }
.app-card.stock .app-icon { background: rgba(59, 130, 246, 0.22); border: 1px solid rgba(96, 165, 250, 0.45); color: #60a5fa; }
.app-card.stock .app-go { background: rgba(255, 255, 255, 0.16); }

.app-card.english { color: #1c2350; background: linear-gradient(120deg, #eef0ff 0%, #d7dcfb 100%); }
.app-card.english::before { content: ""; position: absolute; right: -30px; top: -40px; width: 220px; height: 220px; z-index: -1; border-radius: 50%; background: radial-gradient(circle, rgba(129, 140, 248, 0.45), transparent 70%); }
.app-card.english .app-icon { background: #fff; color: #4f46e5; box-shadow: 0 6px 18px rgba(79, 70, 229, 0.22); }
.app-card.english .app-go { background: rgba(255, 255, 255, 0.8); }

.app-card.manager { color: #0d3b30; background: linear-gradient(120deg, #e6fbf3 0%, #c9f1e3 100%); }
.app-card.manager::before { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 55%; z-index: -1; opacity: 0.5; background: url('/static/rack.jpg') center / cover; -webkit-mask-image: linear-gradient(90deg, transparent, #000 65%); mask-image: linear-gradient(90deg, transparent, #000 65%); }
.app-card.manager .app-icon { background: #fff; color: #0f9d6e; box-shadow: 0 6px 18px rgba(16, 185, 129, 0.25); }
.app-card.manager .app-go { background: rgba(255, 255, 255, 0.75); }

:root[data-theme="dark"] .app-card.english { color: #e8eaff; background: linear-gradient(120deg, #1d2050 0%, #2b2f78 100%); }
:root[data-theme="dark"] .app-card.english .app-icon { background: rgba(255, 255, 255, 0.12); color: #a5b4fc; box-shadow: none; }
:root[data-theme="dark"] .app-card.english .app-go { background: rgba(255, 255, 255, 0.14); }
:root[data-theme="dark"] .app-card.manager { color: #dcfbef; background: linear-gradient(120deg, #0d2e28 0%, #12463a 100%); }
:root[data-theme="dark"] .app-card.manager .app-icon { background: rgba(255, 255, 255, 0.10); color: #4ade80; box-shadow: none; }
:root[data-theme="dark"] .app-card.manager .app-go { background: rgba(255, 255, 255, 0.14); }

/* ---------------- Features ---------------- */
.features { display: grid; grid-template-columns: repeat(5, 1fr); margin: 36px 0 26px; }
.features li { display: flex; align-items: center; gap: 14px; padding: 6px 20px; }
.features li + li { border-left: 1px solid var(--line); }
.ft-icon { display: grid; place-items: center; width: 52px; height: 52px; flex-shrink: 0; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); color: var(--text); }
.ft-icon .ic { width: 26px; height: 26px; }
.features strong { display: block; font-size: 0.92rem; white-space: nowrap; }
.features small { display: block; margin-top: 2px; color: var(--muted); font-size: 0.8rem; white-space: nowrap; }

/* ---------------- Live status ---------------- */
.live { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; padding: 14px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.live-head { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.live-head small { color: var(--muted); }
.pulse-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(18, 185, 129, 0.55); } 70% { box-shadow: 0 0 0 10px rgba(18, 185, 129, 0); } 100% { box-shadow: 0 0 0 0 rgba(18, 185, 129, 0); } }
.live-stats { display: flex; flex: 1; justify-content: flex-end; flex-wrap: wrap; gap: 8px 34px; }
.stat { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.stat small { color: var(--muted); font-size: 0.8rem; }
.stat b { font-family: var(--font-display); font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.stat b.bad { color: var(--red); }
.stat b.warn { color: var(--amber); }

/* ---------------- Trio panels ---------------- */
.trio { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 1.05fr); gap: 22px; margin-top: 26px; }
.trio > * { min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h3, .panel h3 { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; font-weight: 700; white-space: nowrap; }

.update-list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 0.9rem; }
.update-list li:first-child { border-top: none; }
.update-list a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.update-list a:hover { color: var(--primary); }
.update-list time { color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tag { min-width: 66px; padding: 3px 12px; border-radius: 999px; font-size: 0.76rem; font-weight: 600; text-align: center; white-space: nowrap; background: var(--primary-soft); color: var(--primary); }
.tag-home { background: rgba(6, 182, 212, 0.14); color: #0891b2; }
.tag-blog { background: rgba(249, 115, 22, 0.14); color: #ea580c; }
.tag-manager { background: rgba(16, 185, 129, 0.14); color: #059669; }
.tag-stock { background: rgba(37, 99, 235, 0.14); color: #2563eb; }
.tag-english { background: rgba(139, 92, 246, 0.14); color: #7c3aed; }

.quote-card { position: relative; overflow: hidden; padding: 0; min-height: 250px; }
.quote-bg { position: absolute; inset: 0; background: url('/static/quote.jpg') center / cover; }
:root[data-theme="dark"] .quote-bg { filter: brightness(0.5) saturate(0.85); }
.quote-body { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; height: 100%; padding: 22px 26px; }
.quote-text { flex: 1; max-width: 88%; font-family: var(--font-hand); font-size: 1.7rem; line-height: 1.5; color: #2a3358; }
:root[data-theme="dark"] .quote-text { color: #eef2ff; }
.q-mark { margin-right: 8px; font-family: Georgia, serif; font-size: 2.4rem; line-height: 0; vertical-align: -0.35em; color: #7b8bd6; }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.q-tile { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface-2); border: 1px solid transparent; border-radius: 14px; min-width: 0; transition: border-color 0.15s, transform 0.15s; }
.q-tile:hover { border-color: var(--primary); transform: translateY(-1px); }
.q-ic { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; }
.q-ic .ic { width: 22px; height: 22px; }
.q-ic.stock { background: rgba(37, 99, 235, 0.14); color: #2563eb; }
.q-ic.english { background: rgba(139, 92, 246, 0.16); color: #7c3aed; }
.q-ic.manager { background: rgba(16, 185, 129, 0.16); color: #059669; }
.q-ic.blog { background: rgba(249, 115, 22, 0.16); color: #ea580c; }
.q-ic.pin { background: rgba(100, 116, 139, 0.16); color: var(--muted); font-weight: 700; font-size: 1rem; }
.q-txt { min-width: 0; flex: 1; }
.q-txt strong { display: block; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-txt small { color: var(--muted); font-size: 0.75rem; }
.q-tile > .ic { display: none; }
.q-tile-wrap { position: relative; min-width: 0; }
.q-add { white-space: nowrap; justify-content: center; color: var(--muted); border: 1px dashed var(--line); background: transparent; font-size: 0.85rem; gap: 6px; }
.q-add:hover { color: var(--primary); }
.q-del { position: absolute; top: -8px; right: -8px; display: none; place-items: center; width: 22px; height: 22px; border: none; border-radius: 50%; background: var(--red); color: #fff; }
.q-del .ic { width: 12px; height: 12px; stroke-width: 2.6; }
.editing .q-del { display: grid; }

/* ---------------- About ---------------- */
.about { display: grid; grid-template-columns: 1fr 1.1fr; gap: 40px; align-items: center; margin-top: 60px; padding: 40px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.kicker { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.3em; color: var(--primary); }
.about h2, .section-head h2 { margin-top: 8px; font-size: clamp(1.5rem, 2.2vw, 2rem); line-height: 1.3; letter-spacing: -0.02em; }
.about-text > p:not(.kicker) { margin: 14px 0 24px; color: var(--muted); line-height: 1.75; }
.about-feats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.about-feats li { display: flex; gap: 12px; padding: 16px; background: var(--surface-2); border-radius: 14px; }
.about-feats .ic { width: 24px; height: 24px; margin-top: 2px; color: var(--primary); }
.about-feats strong { display: block; font-size: 0.92rem; }
.about-feats small { display: block; margin-top: 2px; color: var(--muted); font-size: 0.8rem; line-height: 1.45; }

/* ---------------- Tools ---------------- */
.tools { margin-top: 60px; }
.section-head { margin-bottom: 22px; }
.section-head .muted { margin-top: 6px; font-size: 0.9rem; }
.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.tool { display: flex; flex-direction: column; gap: 14px; min-height: 340px; padding: 22px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.tool > header { display: flex; align-items: center; justify-content: space-between; }
.tool h3 { display: flex; align-items: center; gap: 8px; font-size: 1.02rem; }
.tool small { color: var(--muted); font-size: 0.8rem; }
.tool > footer { display: flex; gap: 8px; margin-top: auto; }
textarea, input[type="text"] { width: 100%; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; color: var(--text); font: inherit; font-size: 0.92rem; }
textarea:focus, input[type="text"]:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
#noteArea { flex: 1; min-height: 190px; resize: none; line-height: 1.6; }
.todo-form { display: flex; gap: 8px; }
.todo-list { flex: 1; max-height: 220px; overflow-y: auto; }
.todo-list li { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.todo-list input { width: 18px; height: 18px; accent-color: var(--primary); flex-shrink: 0; }
.todo-list span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.todo-list li.done span { text-decoration: line-through; color: var(--muted); }
.todo-list button { border: none; background: none; color: var(--muted); padding: 4px; border-radius: 6px; }
.todo-list button:hover { color: var(--red); }
.todo-empty { color: var(--muted); font-size: 0.86rem; padding: 18px 4px; }

.pomo-modes { display: flex; gap: 8px; }
.mode { flex: 1; height: 36px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 0.85rem; font-weight: 500; }
.mode.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pomo-dial { position: relative; width: 170px; height: 170px; margin: 4px auto; }
.pomo-dial svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.pomo-dial circle { fill: none; stroke-width: 7; }
.pomo-dial .track { stroke: var(--line); }
.pomo-dial .bar { stroke: var(--primary); stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 0; transition: stroke-dashoffset 0.4s linear; }
.pomo-time { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 2.2rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.tool:has(.pomo-dial) > footer { justify-content: center; }

/* ---------------- Footer ---------------- */
.footer { margin-top: 70px; padding: 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.84rem; text-align: center; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--primary); }
.footer .sep { margin: 0 8px; opacity: 0.5; }

/* ---------------- Dialog / Palette ---------------- */
.dialog { width: min(420px, calc(100vw - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.dialog::backdrop { background: rgba(8, 13, 27, 0.55); backdrop-filter: blur(3px); }
.dialog h3 { margin-bottom: 14px; }
.dialog label { display: block; margin-bottom: 12px; font-size: 0.85rem; color: var(--muted); }
.dialog input { margin-top: 6px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.form-error { margin-bottom: 8px; color: var(--red); font-size: 0.84rem; }

.palette { width: min(640px, calc(100vw - 24px)); margin: 12vh auto 0; padding: 0; overflow: hidden; }
.pal-input { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.pal-input input { margin: 0; padding: 4px 0; border: none; background: transparent; font-size: 1.05rem; box-shadow: none !important; }
.pal-list { max-height: 50vh; overflow-y: auto; padding: 8px; }
.pal-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.pal-item[aria-selected="true"] { background: var(--primary-soft); }
.pal-type { min-width: 56px; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); font-size: 0.72rem; font-weight: 600; text-align: center; }
.pal-main { min-width: 0; flex: 1; }
.pal-main strong { display: block; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-main small { display: block; color: var(--muted); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-empty { padding: 22px; color: var(--muted); text-align: center; font-size: 0.9rem; }
.pal-foot { display: flex; gap: 16px; padding: 10px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.76rem; }

/* ---------------- Blog ---------------- */
.blog-hero { padding: 56px 0 24px; }
.blog-hero h1 { margin-top: 8px; font-size: clamp(1.9rem, 3vw, 2.6rem); letter-spacing: -0.02em; }
.blog-hero p { margin-top: 10px; color: var(--muted); }
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 22px; padding-bottom: 20px; }
.post-card { display: flex; flex-direction: column; gap: 10px; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transition: transform 0.15s, border-color 0.15s; }
.post-card:hover { transform: translateY(-3px); border-color: var(--primary); }
.post-card h2 { font-size: 1.2rem; line-height: 1.4; }
.post-card p { color: var(--muted); font-size: 0.92rem; line-height: 1.65; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 0.8rem; }
.post-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.post-tags span { padding: 2px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 0.75rem; font-weight: 600; }
.article { max-width: 760px; margin: 0 auto; padding: 48px 0 10px; }
.article > header h1 { margin: 12px 0 14px; font-size: clamp(1.7rem, 3vw, 2.4rem); line-height: 1.3; letter-spacing: -0.02em; }
.prose { margin-top: 30px; font-size: 1.04rem; line-height: 1.9; }
.prose h2 { margin: 2em 0 0.6em; font-size: 1.45rem; }
.prose h3 { margin: 1.8em 0 0.5em; font-size: 1.2rem; }
.prose p { margin: 0 0 1.1em; }
.prose ul, .prose ol { margin: 0 0 1.2em; padding-left: 1.4em; }
.prose ul { list-style: disc; }
.prose li { margin: 0.25em 0; }
.prose a { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
.prose blockquote { margin: 1.4em 0; padding: 4px 0 4px 18px; border-left: 4px solid var(--primary); color: var(--muted); font-family: var(--font-hand); font-size: 1.35rem; line-height: 1.6; }
.prose code { padding: 2px 6px; border-radius: 6px; background: var(--surface-2); font-size: 0.9em; }
.prose pre { overflow-x: auto; padding: 16px 18px; border-radius: 12px; background: var(--surface-2); line-height: 1.6; }
.prose pre code { padding: 0; background: none; }
.prose hr { border: none; border-top: 1px solid var(--line); margin: 2em 0; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.9rem; }
.back-link:hover { color: var(--primary); }
.back-link .ic { transform: rotate(180deg); }
.state-msg { padding: 60px 0; color: var(--muted); text-align: center; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1240px) {
  .features { grid-template-columns: repeat(3, 1fr); row-gap: 14px; }
  .features li:nth-child(4) { border-left: none; }
  .trio { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .trio .quick { grid-column: 1 / -1; }
  .hero-quote { display: none; }
}
@media (max-width: 1020px) {
  .search-pill { width: 190px; }
  .app-cards { grid-template-columns: 1fr; margin-top: -60px; }
  .about { grid-template-columns: 1fr; padding: 28px; }
  .tool-grid { grid-template-columns: 1fr; }
  .tool { min-height: 0; }
}
@media (max-width: 800px) {
  .topbar { gap: 8px; padding: 0 14px; }
  .nav { margin: 0; overflow-x: auto; scrollbar-width: none; }
  .nav a { padding: 18px 10px; }
  .search-pill { width: 40px; padding: 0; justify-content: center; }
  .search-pill span, .search-pill kbd { display: none; }
  .brand { font-size: 1.1rem; }
  .brand svg { width: 24px; height: 24px; }
  .wrap { padding: 0 16px; }
  .features { grid-template-columns: 1fr 1fr; }
  .features li { padding: 6px 8px; }
  .features li:nth-child(odd) { border-left: none; }
  .features li:nth-child(even) { border-left: 1px solid var(--line); }
  .features li:nth-child(4) { border-left: 1px solid var(--line); }
  .trio { grid-template-columns: 1fr; }
  .about-feats { grid-template-columns: 1fr; }
  .live-stats { justify-content: flex-start; }
  .hero-inner { padding-top: 40px; }
  .btn { height: 50px; padding: 0 20px; }
  .top-actions { gap: 4px; margin-left: auto; }
}
@media (max-width: 520px) {
  .nav { display: none; }
  .quick-grid { grid-template-columns: 1fr; }
  .update-list li { flex-wrap: wrap; }
  .app-card { padding: 16px; gap: 14px; }
  .app-icon { width: 60px; height: 60px; }
  .post-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
