:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-muted: #eef2f8;
  --text: #172033;
  --muted: #5c6a80;
  --line: #d9e0ec;
  --primary: #1769e0;
  --primary-dark: #0d4da9;
  --accent: #f6b73c;
  --shadow: 0 16px 40px rgba(24, 42, 75, 0.09);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; line-height: 1.7; }
a { color: var(--primary-dark); }
button, input, select, textarea { font: inherit; }
button, .button { cursor: pointer; }
.site-header { background: #10213d; color: #fff; }
.header-inner, .main-container, .site-footer-inner { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.header-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { color: #fff; font-size: 1.25rem; font-weight: 800; text-decoration: none; letter-spacing: .02em; }
.header-nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.header-nav a { color: #dbe8ff; text-decoration: none; font-size: .92rem; }
.header-nav a:hover { color: #fff; }
.main-container { padding: 56px 0 72px; }
.hero { display: grid; grid-template-columns: 1.5fr 1fr; gap: 36px; align-items: center; margin-bottom: 48px; }
.eyebrow { color: var(--primary); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: .78rem; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 14px; }
h1 { font-size: clamp(2rem, 5vw, 3.7rem); letter-spacing: -.04em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
h3 { font-size: 1.15rem; }
.lead { color: var(--muted); font-size: 1.08rem; max-width: 680px; }
.hero-panel { background: linear-gradient(135deg, #1769e0, #173667); color: #fff; border-radius: 24px; padding: 28px; box-shadow: var(--shadow); }
.hero-panel strong { display: block; font-size: 2.2rem; line-height: 1.15; margin-bottom: 10px; }
.hero-panel p { color: #dbe8ff; margin: 0; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 18px; }
.section-heading p { color: var(--muted); margin: 0; }
.category-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 30px; }
.category-nav a { display: inline-flex; align-items: center; border: 1px solid #b9cdf0; border-radius: 999px; background: #e9f1ff; color: var(--primary-dark); padding: 7px 12px; text-decoration: none; font-size: .92rem; font-weight: 700; }
.category-nav a:hover { background: #dbe8ff; }
.tool-category + .tool-category { margin-top: 38px; }
.tool-category .section-heading { margin-bottom: 14px; }
.tool-card h4 { font-size: 1.15rem; line-height: 1.25; margin: 0 0 10px; }
.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px; box-shadow: 0 6px 18px rgba(24, 42, 75, 0.04); }
.tool-card { display: flex; flex-direction: column; min-height: 210px; }
.tool-card p { color: var(--muted); margin: 0 0 18px; }
.tool-card .button { margin-top: auto; align-self: flex-start; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 0; border-radius: 10px; background: var(--primary); color: #fff; padding: 10px 16px; text-decoration: none; font-weight: 700; }
.button:hover { background: var(--primary-dark); }
.button.secondary { background: var(--surface-muted); color: var(--text); }
.button.danger { background: #b63838; }
.tool-page { max-width: 920px; }
.tool-intro { margin-bottom: 24px; }
.tool-card-wide { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px; box-shadow: var(--shadow); }
.option-fieldset { border: 0; margin: 0 0 18px; padding: 0; }
.option-fieldset legend { font-weight: 800; margin-bottom: 8px; }
.choice-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.choice, .inline-choice { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-muted); padding: 8px 11px; cursor: pointer; }
.choice input, .inline-choice input { width: auto; margin: 0; accent-color: var(--primary); }
.direction-options .choice { background: #e9f1ff; border-color: #b9cdf0; font-weight: 700; }
.preset-group { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 4px 0 20px; }
.preset-button { padding: 7px 11px; font-size: .9rem; }
.conversion-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.conversion-grid textarea { min-height: 260px; }
.count-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; color: var(--muted); font-size: .9rem; }
.count-line strong { color: var(--text); font-variant-numeric: tabular-nums; }
.copy-status { min-height: 1.7em; margin: 6px 0 0; color: var(--primary-dark); font-weight: 700; }
.explanation { margin-top: 20px; }
.explanation p { color: var(--muted); }
.explanation li + li { margin-top: 5px; }
.text-button { align-self: flex-start; border: 0; padding: 0; background: transparent; color: var(--primary-dark); cursor: pointer; font-size: .9rem; }
.age-result { margin-top: 24px; }
.age-hero { background: linear-gradient(135deg, #1769e0, #173667); color: #fff; border-radius: 16px; padding: 24px; }
.age-hero .small { color: #dbe8ff; }
.age-hero strong { display: block; font-size: clamp(2.7rem, 8vw, 4.8rem); line-height: 1.1; letter-spacing: -.04em; }
.age-hero > span:last-child { color: #dbe8ff; font-size: 1.08rem; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.metric-card { display: flex; flex-direction: column; gap: 2px; background: var(--surface-muted); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.metric-card strong { font-size: 1.28rem; line-height: 1.35; overflow-wrap: anywhere; }
.metric-card > span:last-child { color: var(--muted); font-size: .9rem; }
.age-table { margin-top: 0; }
.unit-input { display: flex; align-items: stretch; }
.unit-input input { min-width: 0; border-radius: 8px 0 0 8px; }
.unit-input span { display: inline-flex; align-items: center; border: 1px solid #bdc8d9; border-left: 0; border-radius: 0 8px 8px 0; background: var(--surface-muted); color: var(--muted); padding: 0 13px; font-weight: 700; }
.bmi-result { margin-top: 24px; }
.bmi-hero { background: linear-gradient(135deg, #1769e0, #173667); color: #fff; border-radius: 16px; padding: 24px; }
.bmi-hero .small, .bmi-hero > span:last-child { color: #dbe8ff; }
.bmi-hero strong { display: block; font-size: clamp(3rem, 10vw, 5rem); line-height: 1.05; letter-spacing: -.05em; }
.bmi-hero > span:last-child { font-size: 1.15rem; font-weight: 800; }
.bmi-scale-wrap { margin: 20px 0 10px; }
.bmi-scale-labels, .bmi-scale-values { display: flex; justify-content: space-between; color: var(--muted); font-size: .82rem; }
.bmi-scale-labels { display: grid; grid-template-columns: 14% 26% 60%; text-align: center; }
.bmi-scale-labels span:first-child { text-align: left; }
.bmi-scale-labels span:last-child { text-align: right; }
.bmi-scale { position: relative; display: flex; height: 14px; margin: 6px 0 4px; border-radius: 999px; overflow: visible; background: var(--surface-muted); }
.bmi-segment { display: block; height: 14px; }
.bmi-segment:first-child { width: 14%; border-radius: 999px 0 0 999px; background: #7cc4e8; }
.bmi-segment:nth-child(2) { width: 26%; background: #7ed6a5; }
.bmi-segment:nth-child(3) { width: 60%; border-radius: 0 999px 999px 0; background: #f3b875; }
.bmi-marker { position: absolute; top: -5px; width: 4px; height: 24px; border-radius: 4px; background: #172033; box-shadow: 0 0 0 3px #fff; transform: translateX(-2px); }
.bmi-scale-values span:nth-child(2) { margin-left: 3%; }
.bmi-scale-values span:nth-child(3) { margin-left: 3%; }
.bmi-scale-values span:last-child { margin-left: auto; }
.metric-card-message { font-size: 1rem !important; line-height: 1.45 !important; }
.bmi-summary-table { margin-top: 0; }
.bmi-table { margin-top: 28px; }
.bmi-table caption { margin-bottom: 8px; text-align: left; color: var(--muted); font-weight: 800; }
.bmi-table tr.is-current td { background: #e9f1ff; color: var(--primary-dark); font-weight: 800; }
.bmi-table td:last-child { color: var(--primary-dark); font-size: .86rem; white-space: nowrap; }
.source-note { font-size: .9rem; }
.stroke-editor { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
.stroke-editor .section-heading { margin-bottom: 12px; }
.name-stroke-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.name-stroke-grid h3 { margin-bottom: 8px; }
.stroke-row { display: grid; grid-template-columns: 42px minmax(80px, 1fr) 28px auto; align-items: center; gap: 8px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-muted); }
.stroke-row + .stroke-row { margin-top: 7px; }
.stroke-character { font-size: 1.25rem; font-weight: 800; text-align: center; }
.stroke-row input { padding: 7px 9px; }
.stroke-unit { color: var(--muted); }
.stroke-row small { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.name-result { margin-top: 24px; }
.name-hero { background: linear-gradient(135deg, #1769e0, #173667); color: #fff; border-radius: 16px; padding: 24px; }
.name-hero .small, .name-hero > span:last-child { color: #dbe8ff; }
.name-hero strong { display: block; font-size: clamp(1.8rem, 5vw, 3.1rem); line-height: 1.2; margin: 5px 0; }
.name-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.name-grid-card { display: flex; flex-direction: column; gap: 2px; min-height: 126px; padding: 14px; border: 1px solid var(--line); border-top: 4px solid var(--primary); border-radius: 12px; background: var(--surface-muted); }
.name-grid-card strong { font-size: 1.5rem; line-height: 1.25; }
.name-grid-card.fortune-good { border-top-color: #41a66c; }
.name-grid-card.fortune-caution { border-top-color: #d79d35; }
.name-grid-card.fortune-bad { border-top-color: #bd5960; }
.fortune-label { font-weight: 800; color: var(--primary-dark); }
.fortune-good .fortune-label { color: #247445; }
.fortune-caution .fortune-label { color: #91630b; }
.fortune-bad .fortune-label { color: #9e2d35; }
.name-table { margin-top: 8px; }
.name-table caption { margin-bottom: 8px; text-align: left; color: var(--muted); font-weight: 800; }
.name-table th:first-child { width: 15%; }
.name-table th:nth-child(2) { width: 25%; }
.formula-note { margin-bottom: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
label { font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid #bdc8d9; border-radius: 8px; padding: 10px 12px; background: #fff; color: var(--text); }
textarea { min-height: 180px; resize: vertical; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0; }
.notice { background: #fff8e6; border-left: 4px solid var(--accent); padding: 12px 16px; color: #654c15; }
.error { color: #a42424; font-weight: 700; }
.result { margin-top: 20px; }
.result:empty { display: none; }
.result-box { background: #101927; color: #eff6ff; border-radius: 10px; padding: 16px; overflow-x: auto; white-space: pre-wrap; word-break: break-word; }
.lookup-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.lookup-heading h2 { margin: 2px 0 0; overflow-wrap: anywhere; }
.status-pills { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.status-pill { display: inline-flex; align-items: center; border-radius: 999px; background: #e5f5eb; color: #17663a; padding: 4px 10px; font-size: .83rem; font-weight: 800; }
.detail-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.detail-row { display: grid; grid-template-columns: minmax(110px, .7fr) 1.3fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.detail-row dt { color: var(--muted); font-weight: 700; }
.detail-row dd { margin: 0; overflow-wrap: anywhere; }
.lookup-section { margin-top: 24px; }
.lookup-section h3 { margin-bottom: 10px; }
.timeline { display: grid; gap: 8px; }
.timeline-item { display: flex; justify-content: space-between; gap: 16px; padding: 10px 12px; background: var(--surface-muted); border-radius: 8px; }
.timeline-item time { color: var(--muted); font-variant-numeric: tabular-nums; }
.entity-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.entity-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.entity-card h4 { margin: 0 0 2px; overflow-wrap: anywhere; }
.entity-role, .entity-value { color: var(--muted); margin: 4px 0 0; overflow-wrap: anywhere; }
.raw-details { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 14px; }
.raw-details summary { cursor: pointer; color: var(--primary-dark); font-weight: 700; }
.raw-details .result-box { margin-bottom: 0; margin-top: 12px; }
.data-table { width: 100%; border-collapse: collapse; margin-top: 18px; background: var(--surface); }
.data-table th, .data-table td { border: 1px solid var(--line); padding: 9px 10px; text-align: left; vertical-align: top; }
.data-table th { width: 34%; background: var(--surface-muted); }
.timer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.timer-card { background: var(--surface-muted); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.timer-card .timer-time { font-variant-numeric: tabular-nums; font-size: 2rem; font-weight: 800; letter-spacing: .04em; margin: 8px 0; }
.timer-card .actions { margin: 8px 0 0; }
.timer-card .button { padding: 7px 10px; font-size: .9rem; }
.iframe-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 20px; }
.iframe-grid iframe { width: 100%; min-height: 360px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
#youtube-frame { display: block; width: 100%; height: clamp(360px, 56.25vw, 620px); margin: 22px 0; border: 1px solid var(--line); border-radius: 12px; background: #101927; }
.site-footer { border-top: 1px solid var(--line); color: var(--muted); }
.site-footer-inner { padding: 24px 0 38px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.small { color: var(--muted); font-size: .9rem; }
@media (max-width: 800px) {
  .hero { grid-template-columns: 1fr; }
  .tool-grid { grid-template-columns: repeat(2, 1fr); }
  .name-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .header-inner { align-items: flex-start; padding: 14px 0; flex-direction: column; }
  .main-container { padding-top: 36px; }
  .tool-grid, .form-grid, .timer-grid, .iframe-grid, .detail-list, .entity-grid, .conversion-grid, .metric-grid, .name-stroke-grid, .name-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .section-heading { display: block; }
  .lookup-heading, .timeline-item { display: block; }
  .status-pills { justify-content: flex-start; margin-top: 10px; }
  .timeline-item time { display: block; margin-bottom: 2px; }
  #youtube-frame { height: clamp(220px, 56.25vw, 360px); }
}
