:root {
  --ame-bg: #0e1116;
  --ame-surface: #151a22;
  --ame-surface-2: #1b222c;
  --ame-border: #232a36;
  --ame-border-hi: #333b48;
  --ame-text: #e8ecf2;
  --ame-text-sub: #8a94a6;
  --ame-text-muted: #5a6474;
  --ame-accent: #34d399;
  --ame-accent-hi: #6ee7b7;
  --ame-on-accent: #06231a;
  --ame-accent-bg: #0c2b22;
  --ame-warn: #fbbf24;
  --ame-danger: #fca5a5;
  --ame-radius-card: 12px;
  --ame-radius-button: 8px;
  --ame-content: 760px;
  --ame-grid: 1080px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--ame-bg);
  color: var(--ame-text);
  font-family: "Noto Sans JP", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.9;
  overflow-wrap: anywhere;
}

img, svg, iframe { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

:focus-visible {
  outline: 2px solid var(--ame-accent-hi);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 8px 12px;
  border-radius: var(--ame-radius-button);
  background: var(--ame-accent);
  color: var(--ame-on-accent);
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--ame-border);
  background: rgba(14, 17, 22, 0.96);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(calc(100% - 40px), var(--ame-grid));
  min-height: 72px;
  margin: 0 auto;
}

.brand { display: inline-flex; align-items: center; min-height: 44px; }
.brand img { width: 148px; height: 32px; }

.primary-nav { display: flex; align-items: center; gap: 32px; }
.primary-nav a { position: relative; color: var(--ame-text-sub); font-size: 14px; font-weight: 500; }
.primary-nav a:hover, .primary-nav a[aria-current="page"] { color: var(--ame-text); }
.primary-nav a[aria-current="page"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -23px; height: 2px; background: var(--ame-accent); }

.menu-button {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--ame-border-hi);
  border-radius: var(--ame-radius-button);
  background: transparent;
  color: var(--ame-text);
  cursor: pointer;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 16px; font-size: 26px; font-weight: 700; line-height: 1.45; letter-spacing: 0.01em; }
h2 { margin-bottom: 14px; font-size: 22px; font-weight: 700; line-height: 1.5; }
h3 { margin-bottom: 12px; font-size: 18px; font-weight: 700; line-height: 1.55; }

.eyebrow {
  margin-bottom: 9px;
  color: var(--ame-accent);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dashboard-shell { width: min(calc(100% - 40px), var(--ame-grid)); margin: 0 auto; padding: 64px 0 96px; }
.dashboard-hero { margin-bottom: 32px; }
.dashboard-hero__heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; }
.dashboard-hero h1 { margin-bottom: 8px; }
.dashboard-hero__heading > div > p { max-width: 680px; margin-bottom: 0; color: var(--ame-text-sub); }
.dashboard-hero__count { flex: 0 0 auto; margin-bottom: 3px; color: var(--ame-text); font-size: 26px; font-weight: 700; line-height: 1.2; }
.dashboard-hero__count small { color: var(--ame-text-sub); font-size: 12px; letter-spacing: 0.08em; }

.continue-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 26px;
  border: 1px solid var(--ame-border-hi);
  border-radius: var(--ame-radius-card);
  background: var(--ame-surface);
}

.continue-card__icon { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid #2b775e; border-radius: 50%; color: var(--ame-accent); background: var(--ame-accent-bg); }
.continue-card__body { min-width: 0; }
.continue-card h2 { margin-bottom: 7px; font-size: 20px; }
.continue-card__meta { display: flex; gap: 18px; margin-bottom: 12px; color: var(--ame-text-sub); font-size: 13px; }

.progress { width: 100%; height: 4px; overflow: hidden; border-radius: 999px; background: var(--ame-border); }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--ame-accent); transition: width 180ms ease; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--ame-radius-button);
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
}
.button--accent { background: var(--ame-accent); color: var(--ame-on-accent); }
.button--accent:hover { background: var(--ame-accent-hi); }
.button--secondary { border-color: var(--ame-border-hi); background: var(--ame-surface-2); color: var(--ame-text); }
.button--secondary:hover { border-color: var(--ame-accent); color: var(--ame-accent-hi); }

.dashboard-section { margin-top: 64px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.section-heading h2, .section-heading p { margin-bottom: 0; }
.section-heading__note { color: var(--ame-text-sub); font-size: 13px; }
.text-link { min-height: 44px; padding-top: 9px; color: var(--ame-accent-hi); font-size: 14px; font-weight: 500; }

.update-list { border-top: 1px solid var(--ame-border); }
.update-row { display: grid; grid-template-columns: 112px 82px minmax(0, 1fr) auto; align-items: center; gap: 16px; min-height: 64px; border-bottom: 1px solid var(--ame-border); }
.update-row:hover strong { color: var(--ame-accent-hi); }
.update-row time { color: var(--ame-text-sub); font-size: 13px; font-variant-numeric: tabular-nums; }
.update-row strong { font-size: 14px; font-weight: 500; }
.update-row svg { color: var(--ame-text-muted); }
.badge { display: inline-flex; justify-content: center; padding: 3px 8px; border: 1px solid var(--ame-border-hi); border-radius: 999px; color: var(--ame-text-sub); font-size: 11px; font-weight: 500; }
.empty-state { padding: 22px; border: 1px dashed var(--ame-border-hi); border-radius: var(--ame-radius-card); color: var(--ame-text-sub); text-align: center; }

.step-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.step-card { display: flex; flex-direction: column; min-height: 248px; padding: 24px; border: 1px solid var(--ame-border); border-radius: var(--ame-radius-card); background: var(--ame-surface); transition: border-color 160ms ease, background-color 160ms ease; }
.step-card:hover { border-color: var(--ame-border-hi); background: var(--ame-surface-2); }
.step-card--featured { border-color: #2b775e; }
.step-card__topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.step-card__topline .eyebrow { margin: 0; }
.step-card h3 { font-size: 20px; }
.step-card > p { margin-bottom: 24px; color: var(--ame-text-sub); font-size: 14px; line-height: 1.8; }
.status-pill { padding: 3px 9px; border-radius: 999px; background: var(--ame-surface-2); color: var(--ame-text-sub); font-size: 11px; }
.status-pill[data-status="active"] { background: var(--ame-accent-bg); color: var(--ame-accent-hi); }
.status-pill[data-status="done"] { background: var(--ame-accent); color: var(--ame-on-accent); }
.step-card__footer { display: flex; justify-content: space-between; margin-top: auto; margin-bottom: 10px; color: var(--ame-text-sub); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; }

.page-shell { width: min(calc(100% - 40px), var(--ame-content)); margin: 0 auto; padding: 44px 0 96px; }
.page-shell--wide { width: min(calc(100% - 40px), 920px); }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-bottom: 38px; color: var(--ame-text-sub); font-size: 13px; }
.breadcrumbs a:hover { color: var(--ame-accent-hi); }
.breadcrumbs span[aria-hidden] { color: var(--ame-text-muted); }

.step-header { display: grid; grid-template-columns: minmax(0, 1fr) 180px; align-items: end; gap: 48px; padding-bottom: 34px; border-bottom: 1px solid var(--ame-border); }
.step-header h1 { margin-bottom: 10px; }
.step-header > div:first-child > p:last-child { margin: 0; color: var(--ame-text-sub); }
.step-summary strong { display: block; font-size: 20px; }
.step-summary > span { display: block; margin-bottom: 12px; color: var(--ame-text-sub); font-size: 12px; }
.lesson-index { padding: 0; margin: 32px 0 0; list-style: none; border-top: 1px solid var(--ame-border); }
.lesson-index li { border-bottom: 1px solid var(--ame-border); }
.lesson-index a { display: grid; grid-template-columns: 52px minmax(0, 1fr) 56px 56px 18px; align-items: center; gap: 16px; min-height: 88px; padding: 12px 4px; }
.lesson-index a:hover strong { color: var(--ame-accent-hi); }
.lesson-index__number { color: var(--ame-accent); font-size: 13px; font-weight: 700; letter-spacing: 0.08em; }
.lesson-index__copy { min-width: 0; }
.lesson-index__copy strong, .lesson-index__copy small { display: block; }
.lesson-index__copy strong { font-size: 15px; }
.lesson-index__copy small { margin-top: 3px; overflow: hidden; color: var(--ame-text-sub); font-size: 12px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.lesson-index__duration, .lesson-index__state { color: var(--ame-text-sub); font-size: 12px; text-align: right; }
.lesson-index a[data-complete="true"] .lesson-index__state { color: var(--ame-accent-hi); }
.lesson-index svg { color: var(--ame-text-muted); }

.lesson-header { padding-bottom: 32px; }
.lesson-header__meta { display: flex; flex-wrap: wrap; gap: 20px; color: var(--ame-text-sub); font-size: 13px; }
.lesson-header__meta span { display: inline-flex; align-items: center; gap: 7px; }
.lesson-goal { margin-top: 30px; padding: 20px 22px; border-left: 2px solid var(--ame-accent); background: var(--ame-surface); }
.lesson-goal p { margin-bottom: 4px; }
.lesson-goal p:last-child { margin-bottom: 0; color: var(--ame-text-sub); }
.lesson-goal .eyebrow { margin-bottom: 10px; }

.video-frame { position: relative; aspect-ratio: 16 / 9; overflow: hidden; margin-bottom: 50px; border: 1px solid var(--ame-border-hi); border-radius: var(--ame-radius-card); background: #090c10; }
.video-frame iframe { width: 100%; height: 100%; border: 0; }
.video-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 100%; color: var(--ame-text-sub); text-align: center; }
.video-placeholder svg { margin-bottom: 12px; color: var(--ame-text-muted); }
.video-placeholder strong { color: var(--ame-text); font-size: 15px; }
.video-placeholder span { margin-top: 4px; font-size: 12px; }

.prose { color: var(--ame-text); }
.prose h2 { margin-top: 48px; padding-top: 8px; }
.prose h3 { margin-top: 34px; }
.prose p, .prose ul, .prose ol { margin-bottom: 22px; }
.prose a { color: var(--ame-accent-hi); text-decoration: underline; text-underline-offset: 3px; }
.prose code { padding: 2px 6px; border: 1px solid var(--ame-border); border-radius: 4px; background: var(--ame-surface); color: var(--ame-accent-hi); font-size: 0.9em; }
.prose pre { max-width: 100%; overflow-x: auto; margin: 26px 0; padding: 18px; border: 1px solid var(--ame-border); border-radius: var(--ame-radius-card); background: #090c10; line-height: 1.7; }
.prose pre code { padding: 0; border: 0; background: transparent; color: var(--ame-text); }
.prose hr { margin: 44px 0; border: 0; border-top: 1px solid var(--ame-border); }
.prose blockquote { margin: 28px 0; padding: 0 0 0 18px; border-left: 2px solid var(--ame-border-hi); color: var(--ame-text-sub); }

.lesson-box { margin: 30px 0; padding: 22px; border: 1px solid var(--ame-border); border-radius: var(--ame-radius-card); background: var(--ame-surface); }
.lesson-box__eyebrow { margin-bottom: 16px; color: var(--ame-accent); font-size: 11px; font-weight: 700; letter-spacing: 0.12em; }
.lesson-box__content > :last-child { margin-bottom: 0; }
.procedure-list { padding: 0; margin: 0; list-style: none; counter-reset: procedure; }
.procedure-list li { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 2px 12px; padding: 14px 0; border-bottom: 1px solid var(--ame-border); counter-increment: procedure; }
.procedure-list li:last-child { border-bottom: 0; }
.procedure-list li::before { grid-row: 1 / span 2; content: counter(procedure, decimal-leading-zero); color: var(--ame-accent); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; }
.procedure-list strong, .procedure-list span { display: block; }
.procedure-list span { color: var(--ame-text-sub); font-size: 14px; }

.callout { margin: 30px 0; padding: 20px 22px; border: 1px solid var(--ame-border-hi); border-radius: var(--ame-radius-card); background: var(--ame-surface); }
.callout--point { border-left: 3px solid var(--ame-accent); }
.callout--notice { border-left: 3px solid var(--ame-warn); }
.callout--mistake { border-left: 3px solid var(--ame-danger); }
.callout__title { margin-bottom: 8px; color: var(--ame-text); font-weight: 700; }
.callout__body { color: var(--ame-text-sub); }
.callout__body > :last-child { margin-bottom: 0; }

.checklist { padding: 0; margin: 0; list-style: none; }
.checklist li { position: relative; padding: 10px 0 10px 30px; border-bottom: 1px solid var(--ame-border); }
.checklist li:last-child { border-bottom: 0; }
.checklist li::before { position: absolute; top: 16px; left: 2px; width: 16px; height: 16px; border: 1px solid var(--ame-border-hi); border-radius: 3px; content: ""; }

.completion-panel { display: flex; align-items: center; justify-content: space-between; gap: 28px; margin-top: 56px; padding: 26px; border: 1px solid #2b775e; border-radius: var(--ame-radius-card); background: var(--ame-accent-bg); }
.completion-panel h2 { margin-bottom: 5px; font-size: 18px; }
.completion-panel p { margin-bottom: 0; color: var(--ame-text-sub); font-size: 13px; }
.completion-panel .eyebrow { margin-bottom: 7px; color: var(--ame-accent-hi); }
.button--complete { flex: 0 0 auto; border-color: var(--ame-accent); background: var(--ame-accent); color: var(--ame-on-accent); }
.button--complete[data-complete="true"] { border-color: var(--ame-border-hi); background: var(--ame-surface-2); color: var(--ame-accent-hi); }

.lesson-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 28px; }
.lesson-nav a { min-height: 92px; padding: 18px; border: 1px solid var(--ame-border); border-radius: var(--ame-radius-card); background: var(--ame-surface); }
.lesson-nav a:hover { border-color: var(--ame-border-hi); }
.lesson-nav span, .lesson-nav strong { display: block; }
.lesson-nav span { margin-bottom: 5px; color: var(--ame-text-sub); font-size: 12px; }
.lesson-nav strong { font-size: 14px; }
.lesson-nav__next { text-align: right; }

.standard-page__header { margin-bottom: 38px; padding-bottom: 30px; border-bottom: 1px solid var(--ame-border); }
.standard-page__header > p:last-child { margin-bottom: 0; color: var(--ame-text-sub); }

.update-archive { border-top: 1px solid var(--ame-border); }
.archive-item { padding: 30px 0; border-bottom: 1px solid var(--ame-border); scroll-margin-top: 92px; }
.archive-item__meta { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.archive-item__meta time { color: var(--ame-text-sub); font-size: 13px; font-variant-numeric: tabular-nums; }
.archive-item h2 { margin-bottom: 8px; font-size: 18px; }
.archive-item p { margin-bottom: 0; color: var(--ame-text-sub); }

.tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tool-card { display: flex; flex-direction: column; min-height: 270px; padding: 22px; border: 1px solid var(--ame-border); border-radius: var(--ame-radius-card); background: var(--ame-surface); }
.tool-card__icon { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 24px; border: 1px solid var(--ame-border-hi); border-radius: var(--ame-radius-button); color: var(--ame-accent); background: var(--ame-surface-2); }
.tool-card .eyebrow { margin-bottom: 7px; }
.tool-card h2 { margin-bottom: 8px; font-size: 17px; }
.tool-card p { color: var(--ame-text-sub); font-size: 14px; }
.tool-card .button, .tool-card__pending { margin-top: auto; }
.tool-card__pending { display: inline-flex; align-self: flex-start; padding: 7px 10px; border: 1px solid var(--ame-border); border-radius: 6px; color: var(--ame-text-sub); font-size: 12px; }

.faq-list { border-top: 1px solid var(--ame-border); }
.faq-list details { border-bottom: 1px solid var(--ame-border); }
.faq-list summary { position: relative; min-height: 64px; padding: 17px 42px 17px 0; color: var(--ame-text); font-weight: 500; cursor: pointer; list-style: none; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::before, .faq-list summary::after { position: absolute; top: 31px; right: 5px; width: 14px; height: 1px; background: var(--ame-accent); content: ""; }
.faq-list summary::after { transform: rotate(90deg); transition: transform 160ms ease; }
.faq-list details[open] summary::after { transform: rotate(0); }
.faq-list details > div { padding: 0 36px 18px 0; color: var(--ame-text-sub); }
.faq-list details p { margin-bottom: 0; }

.site-footer { border-top: 1px solid var(--ame-border); }
.site-footer__inner { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 20px; width: min(calc(100% - 40px), var(--ame-grid)); margin: 0 auto; padding: 40px 0; }
.site-footer img { width: 130px; height: 28px; }
.site-footer nav { display: flex; gap: 24px; color: var(--ame-text-sub); font-size: 13px; }
.site-footer nav a:hover { color: var(--ame-text); }
.site-footer p { grid-column: 1 / -1; margin: 0; color: var(--ame-text-sub); font-size: 11px; }

@media (max-width: 720px) {
  .site-header__inner { position: relative; width: min(calc(100% - 32px), var(--ame-grid)); min-height: 64px; }
  .brand img { width: 130px; height: auto; }
  .menu-button { display: inline-flex; }
  .primary-nav { position: absolute; top: calc(100% + 1px); right: -16px; left: -16px; display: none; flex-direction: column; align-items: stretch; gap: 0; padding: 10px 16px 16px; border-bottom: 1px solid var(--ame-border); background: var(--ame-bg); }
  .primary-nav[data-open="true"] { display: flex; }
  .primary-nav a { min-height: 48px; padding: 10px 8px; border-bottom: 1px solid var(--ame-border); }
  .primary-nav a[aria-current="page"]::after { display: none; }

  .dashboard-shell { width: min(calc(100% - 32px), var(--ame-grid)); padding: 44px 0 72px; }
  .dashboard-hero__heading { display: block; }
  .dashboard-hero__count { margin-top: 18px; }
  .continue-card { grid-template-columns: auto minmax(0, 1fr); padding: 20px; }
  .continue-card__icon { width: 42px; height: 42px; }
  .continue-card__action { grid-column: 1 / -1; width: 100%; }
  .dashboard-section { margin-top: 52px; }
  .section-heading { align-items: flex-start; }
  .section-heading__note { display: none; }
  .update-row { grid-template-columns: 100px 1fr auto; gap: 10px; padding: 12px 0; }
  .update-row .badge { display: none; }
  .update-row strong { grid-column: 1 / 3; }
  .update-row svg { grid-column: 3; grid-row: 1 / 3; }
  .step-grid { grid-template-columns: 1fr; }
  .step-card { min-height: 226px; padding: 21px; }

  .page-shell, .page-shell--wide { width: min(calc(100% - 32px), var(--ame-content)); padding: 30px 0 72px; }
  .breadcrumbs { margin-bottom: 28px; }
  .step-header { grid-template-columns: 1fr; gap: 24px; }
  .step-summary { max-width: 220px; }
  .lesson-index a { grid-template-columns: 42px minmax(0, 1fr) 18px; gap: 10px; min-height: 84px; }
  .lesson-index__duration { grid-column: 2; grid-row: 2; text-align: left; }
  .lesson-index__state { grid-column: 3; grid-row: 1 / 3; font-size: 0; }
  .lesson-index__state::after { content: "○"; font-size: 14px; }
  .lesson-index a[data-complete="true"] .lesson-index__state::after { content: "✓"; }
  .lesson-index svg { display: none; }
  .lesson-index__copy small { display: none; }

  .lesson-header { padding-bottom: 26px; }
  .lesson-goal { padding: 18px; }
  .video-frame { margin-bottom: 38px; }
  .video-placeholder span { padding: 0 24px; }
  .prose h2 { margin-top: 40px; }
  .completion-panel { align-items: stretch; flex-direction: column; padding: 21px; }
  .button--complete { width: 100%; }
  .lesson-nav { grid-template-columns: 1fr; }
  .lesson-nav > span:empty { display: none; }

  .tool-grid { grid-template-columns: 1fr; }
  .tool-card { min-height: 250px; }
  .faq-list summary { padding-right: 36px; }
  .faq-list details > div { padding-right: 0; }

  .site-footer__inner { grid-template-columns: 1fr; width: min(calc(100% - 32px), var(--ame-grid)); }
  .site-footer nav { flex-wrap: wrap; gap: 8px 20px; }
  .site-footer p { grid-column: auto; }
}

@media (max-width: 390px) {
  .dashboard-hero__count { font-size: 22px; }
  .continue-card { grid-template-columns: 1fr; }
  .continue-card__icon { display: none; }
  .continue-card__meta { flex-direction: column; gap: 1px; }
  .section-heading { gap: 12px; }
  .text-link { flex: 0 0 auto; font-size: 12px; }
  .step-card { min-height: auto; }
  .update-row { grid-template-columns: 90px 1fr auto; }
  .lesson-box, .callout { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
