:root {
  --canvas: #eef4f2;
  --surface: #ffffff;
  --ink: #102420;
  --muted: #63746f;
  --line: #c8d8d3;
  --green: #00786d;
  --green-dark: #064d47;
  --green-soft: #dceee8;
  --shadow: 0 16px 38px rgba(16, 36, 32, 0.09);
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body { min-width: 320px; margin: 0; background: var(--canvas); color: var(--ink); font-family: Inter, "Noto Sans JP", "Yu Gothic UI", sans-serif; font-size: 15px; line-height: 1.5; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #8ed3c4; outline-offset: 3px; }

.auth-panel { position: fixed; z-index: 3; inset: 0; display: grid; place-items: center; padding: 20px; background: var(--green-soft); }
.auth-panel[hidden] { display: none; }
.auth-card { width: min(420px, 100%); display: grid; gap: 14px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); padding: clamp(24px, 6vw, 40px); }
.auth-card[hidden] { display: none; }
.auth-mark, .brand-mark { display: grid; place-items: center; border: 2px solid var(--green); color: var(--green-dark); font-weight: 900; }
.auth-mark { width: 42px; height: 42px; font-size: 20px; }
.auth-card > span, .module-intro span, .build-order > span { color: var(--green); font-size: 11px; font-weight: 900; letter-spacing: 0.09em; }
h1, h2, p { margin: 0; }
.auth-card h1 { font-size: 26px; line-height: 1.15; }
.auth-card p, .auth-card small { color: var(--muted); font-size: 13px; font-weight: 700; }
.auth-card label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 800; }
input { width: 100%; border: 1px solid var(--line); border-radius: 4px; background: #ffffff; color: var(--ink); padding: 11px 12px; }
.auth-secret { white-space: pre-wrap; overflow-wrap: anywhere; border-left: 3px solid var(--green); background: var(--green-soft); padding: 12px; }
.primary-button, .module-open { min-height: 46px; border: 1px solid var(--green-dark); border-radius: 4px; background: var(--green-dark); color: #ffffff; font-weight: 900; text-align: center; text-decoration: none; }
.primary-button { padding: 0 16px; }
.module-open { display: grid; place-items: center; }
.primary-button:hover, .module-open:hover { background: var(--green); }

.module-app { min-height: 100dvh; }
.topbar { min-height: 76px; display: grid; grid-template-columns: minmax(130px, 1fr) minmax(0, 1fr) minmax(130px, 1fr); align-items: center; gap: 16px; border-bottom: 1px solid var(--line); background: var(--surface); padding: 14px clamp(18px, 5vw, 72px); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 900; text-decoration: none; }
.brand-mark { width: 32px; height: 32px; }
.top-title { min-width: 0; text-align: center; }
.top-title span { display: block; color: var(--green); font-size: 11px; font-weight: 900; letter-spacing: 0.09em; }
.top-title strong { font-size: 17px; }
.top-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; color: var(--green-dark); font-size: 12px; font-weight: 900; }
.icon-button { min-height: 36px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--ink); padding: 0 11px; font-weight: 800; }
.icon-button:hover { border-color: var(--green); background: var(--green-soft); }

.module-intro, .module-grid, .build-order { width: min(1100px, calc(100% - 36px)); margin-inline: auto; }
.module-intro { display: flex; justify-content: space-between; align-items: end; gap: 24px; padding: clamp(42px, 9vw, 92px) 0 30px; }
.module-intro h1 { margin-top: 5px; font-size: clamp(32px, 5vw, 52px); line-height: 1; }
.module-intro p { max-width: 230px; color: var(--muted); font-weight: 800; text-align: right; }
.module-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.module-card { min-height: 230px; display: flex; flex-direction: column; gap: 22px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); padding: 22px; }
.module-card-active { grid-row: span 2; min-height: 474px; border-color: var(--green); background: #f5faf8; }
.module-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.module-number { color: var(--green); font-size: 13px; font-weight: 900; letter-spacing: 0.08em; }
.module-state { border: 1px solid var(--line); color: var(--muted); padding: 3px 7px; font-size: 11px; font-weight: 900; }
.module-state.is-active { border-color: var(--green); background: var(--green-soft); color: var(--green-dark); }
.module-card-body { display: grid; gap: 8px; }
.module-card h2 { font-size: 24px; line-height: 1.15; }
.module-card p { color: var(--muted); font-weight: 700; }
.module-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.module-tags span { border: 1px solid var(--line); background: #f7faf9; color: var(--muted); padding: 4px 7px; font-size: 11px; font-weight: 800; }
.module-card-active .module-open { margin-top: auto; }
.build-order { display: grid; gap: 13px; padding: 34px 0 56px; }
.build-order ol { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); background: var(--surface); }
.build-order li { min-height: 58px; display: grid; place-items: center; border-right: 1px solid var(--line); color: var(--muted); padding: 10px; font-size: 12px; font-weight: 800; text-align: center; }
.build-order li:last-child { border-right: 0; }
.build-order li.is-current { background: var(--green-dark); color: #ffffff; }

@media (max-width: 720px) {
  .topbar { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; padding: 13px 16px; }
  .top-title { grid-column: 1 / 3; grid-row: 2; text-align: left; }
  .top-actions { grid-column: 2; grid-row: 1; }
  .module-intro, .module-grid, .build-order { width: min(100% - 28px, 560px); }
  .module-intro { display: grid; gap: 12px; padding: 42px 0 26px; }
  .module-intro h1 { font-size: 36px; }
  .module-intro p { text-align: left; }
  .module-grid { grid-template-columns: 1fr; }
  .module-card, .module-card-active { min-height: 0; }
  .module-card-active { min-height: 300px; }
  .build-order ol { grid-template-columns: 1fr; }
  .build-order li { min-height: 46px; border-right: 0; border-bottom: 1px solid var(--line); }
  .build-order li:last-child { border-bottom: 0; }
}
