/* Swim Coach Lab · 共通スタイル */
:root {
  --night: #0b2340;
  --night-2: #123158;
  --blue: #0b5fb0;
  --aqua: #0aa6c9;
  --gold: #c29a45;
  --gold-ink: #7a5c1c;
  --gold-wash: #faf5e9;
  --white: #fff;
  --ink: #0b2340;
  --ink-2: #41546b;
  --ink-3: #5f7186;
  --hair: #dbe4ed;
  --tile: #f3f7fb;
  --tile-2: #e6eff7;
  --danger: #a32e27;
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabbar: 62px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--tile); color: var(--ink); font-family: var(--font);
  font-size: 15px; line-height: 1.7; letter-spacing: .02em; font-feature-settings: "palt";
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
body.has-sheet { overflow: hidden; }
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--blue); text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--aqua); outline-offset: 2px; }
.ic { flex: none; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; letter-spacing: 0; }
.muted { color: var(--ink-2); font-size: 14px; }
.small { font-size: 12.5px; color: var(--ink-3); }
[hidden] { display: none !important; }

/* 骨組み */
.shell { min-height: 100dvh; }
.stage { min-width: 0; padding-bottom: calc(var(--tabbar) + var(--safe-b) + 28px); }
.mast { position: sticky; top: 0; z-index: 30; background: var(--night); color: #fff; padding-top: env(safe-area-inset-top, 0px); }
.mast-in { display: flex; align-items: center; gap: 8px; min-height: 60px; padding: 8px 16px; max-width: 1120px; margin: 0 auto; }
.mast-title { min-width: 0; flex: 1; }
.mast-title h1 { font-size: 19px; font-weight: 600; line-height: 1.35; letter-spacing: .04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mast-title p { font-size: 12px; color: #b9c9db; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mast-actions { display: flex; gap: 4px; flex: none; }
/* コースロープ: このブランドの目印 */
.rope {
  height: 5px;
  background:
    repeating-linear-gradient(90deg, var(--gold) 0 11px, var(--night) 11px 13px, #fff 13px 24px, var(--night) 24px 26px, var(--aqua) 26px 37px, var(--night) 37px 39px, #fff 39px 50px, var(--night) 50px 52px);
}
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; background: rgba(255, 255, 255, .97);
  border-top: 1px solid var(--hair); padding-bottom: var(--safe-b);
}
.tab-link {
  flex: 1; min-width: 0; height: var(--tabbar); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--ink-3); font-size: 10.5px; line-height: 1.2; position: relative; letter-spacing: 0;
}
.tab-link.active { color: var(--night); font-weight: 600; }
.tabbar .tab-link.active::before { content: ""; position: absolute; top: -1px; left: 22%; right: 22%; height: 3px; background: var(--gold); }
.rail { display: none; }
.page { max-width: 1120px; margin: 0 auto; padding: 16px; }
.page.narrow { max-width: 720px; }

/* ボタン */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 46px; padding: 9px 16px;
  border: 1px solid #b9c8d8; border-radius: 10px; background: #fff; color: var(--night); font-weight: 600; font-size: 14.5px;
  line-height: 1.3; cursor: pointer; text-align: center;
}
.btn:hover { border-color: var(--blue); }
.btn:active { background: var(--tile-2); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--night); border-color: var(--night); color: #fff; }
.btn-primary:hover { background: var(--night-2); border-color: var(--night-2); }
.btn-primary:active { background: #06172c; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #0b2340; }
.btn-gold:hover { background: #cfa955; border-color: #cfa955; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-quiet-danger { color: var(--danger); border-color: #e2c3c0; }
.btn-block { width: 100%; }
.btn-lg { min-height: 54px; font-size: 16px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn-row > .btn { flex: 1 1 auto; }
.icon-btn {
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; background: none; border: 0;
  border-radius: 10px; color: var(--ink-2); cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--tile-2); color: var(--night); }
.icon-btn.on-night { color: #fff; margin-left: -10px; }
.icon-btn.on-night:hover { background: var(--night-2); color: #fff; }
.icon-btn[disabled] { opacity: .3; cursor: default; }

/* 入力 */
.field { display: block; margin-top: 14px; }
.field:first-child { margin-top: 0; }
.field > span, .field-label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #bccadA; border-radius: 9px; background: #fff; font-size: 16px; line-height: 1.5;
}
textarea.input { min-height: 84px; resize: vertical; }
.input:focus { outline: 2px solid var(--aqua); outline-offset: 0; border-color: var(--aqua); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.two .field { margin-top: 14px; }
.seg { display: flex; background: var(--tile-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button {
  flex: 1 1 0; min-width: 0; min-height: 40px; padding: 4px 4px; border: 0; border-radius: 8px; background: none; color: var(--ink-2);
  font-size: 13.5px; font-weight: 600; line-height: 1.25; cursor: pointer;
}
.seg button.on { background: var(--night); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; min-height: 38px; padding: 5px 13px; border: 1px solid #c3d0de; border-radius: 19px;
  background: #fff; color: var(--ink-2); font-size: 13.5px; line-height: 1.3; cursor: pointer;
}
.chip.on { background: var(--night); border-color: var(--night); color: #fff; font-weight: 600; }
.chip[disabled] { opacity: .4; cursor: default; }
.chip small { font-size: 11px; opacity: .75; }
.stepper { display: inline-flex; align-items: center; border: 1px solid #bccada; border-radius: 10px; background: #fff; }
.stepper button { width: 46px; height: 46px; border: 0; background: none; display: flex; align-items: center; justify-content: center; color: var(--night); cursor: pointer; }
.stepper output, .stepper input { width: 58px; text-align: center; border: 0; background: none; font-size: 18px; font-weight: 600; padding: 0; }

/* ブロック（カードを乱用せず、コース線で区切る） */
.block { background: #fff; border: 1px solid var(--hair); border-radius: 14px; padding: 16px; margin-top: 14px; }
.block:first-child { margin-top: 0; }
.block-title { font-size: 15.5px; font-weight: 700; letter-spacing: .05em; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.block-title small { font-weight: 400; color: var(--ink-3); font-size: 12.5px; margin-left: auto; letter-spacing: .02em; }
.rows { background: #fff; border: 1px solid var(--hair); border-radius: 14px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: inherit; border-top: 1px solid var(--hair); min-height: 60px; }
.row:first-child { border-top: 0; }
a.row:hover, button.row:hover { background: var(--tile); }
button.row { width: 100%; background: #fff; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; cursor: pointer; }
.row-main { flex: 1; min-width: 0; color: inherit; }
.row-main b { display: block; font-weight: 600; line-height: 1.45; }
.row-main span { display: block; font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }
.empty { text-align: center; padding: 38px 20px; color: var(--ink-2); background: #fff; border: 1px dashed #c3d0de; border-radius: 14px; }
.empty b { display: block; font-size: 16px; color: var(--night); margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--night); color: #fff; border-radius: 14px; }
.stat { padding: 13px 8px; text-align: center; border-left: 1px solid rgba(255, 255, 255, .14); min-width: 0; }
.stat:first-child { border-left: 0; }
.stat b { display: block; font-size: 25px; font-weight: 500; line-height: 1.2; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.stat b small { font-size: 13px; font-weight: 400; margin-left: 2px; color: #d9c083; }
.stat span { display: block; font-size: 11.5px; color: #b9c9db; margin-top: 2px; }
.tag { display: inline-flex; align-items: center; min-height: 22px; padding: 1px 8px; border-radius: 5px; background: var(--tile-2); color: var(--ink-2); font-size: 12px; line-height: 1.4; white-space: nowrap; }
.tag.gold { background: var(--gold-wash); color: var(--gold-ink); }
.tag.night { background: var(--night); color: #fff; }

/* シート */
.sheet-wrap { position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: rgba(6, 20, 38, .55); }
.sheet {
  position: relative; width: 100%; max-width: 560px; max-height: 88dvh; display: flex; flex-direction: column; background: #fff;
  border-radius: 18px 18px 0 0; padding-bottom: var(--safe-b); animation: rise .2s ease-out;
}
@keyframes rise { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet:focus { outline: 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 8px 8px 18px; border-bottom: 1px solid var(--hair); }
.sheet-head h2 { font-size: 16.5px; font-weight: 700; line-height: 1.4; }
.sheet-body { padding: 16px 18px; overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.sheet-foot { display: flex; gap: 8px; padding: 10px 18px 14px; border-top: 1px solid var(--hair); }
.sheet-foot .btn { flex: 1; }
.sheet-text { color: var(--ink-2); }
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(var(--tabbar) + var(--safe-b) + 14px); z-index: 90; max-width: 460px; margin: 0 auto;
  background: var(--night); color: #fff; padding: 12px 16px; border-radius: 10px; border-left: 3px solid var(--gold); font-size: 14px;
  opacity: 0; transform: translateY(8px); transition: opacity .18s, transform .18s; pointer-events: none;
}
.toast.on { opacity: 1; transform: none; }

/* 入場画面 */
.gate { position: relative; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 28px 20px; background: var(--night); overflow: hidden; }
.gate-rope { position: absolute; left: 0; right: 0; top: env(safe-area-inset-top, 0px); }
.gate-rope.low { top: auto; bottom: env(safe-area-inset-bottom, 0px); }
.gate-card { position: relative; width: 100%; max-width: 380px; padding: 8px 6px; color: #fff; text-align: center; }
.gate-icon { margin: 0 auto 14px; border-radius: 16px; }
.gate-brand { font-size: 12.5px; color: #d9c083; letter-spacing: .14em; }
.gate-card h1 { font-size: 27px; font-weight: 600; letter-spacing: .06em; line-height: 1.4; margin-top: 2px; }
.gate-lead { color: #c5d3e2; font-size: 14px; margin: 6px 0 26px; }
.gate-label { display: block; text-align: left; font-size: 13px; color: #c5d3e2; margin-bottom: 6px; }
.gate-input {
  width: 100%; height: 54px; padding: 0 14px; border-radius: 10px; border: 1px solid #47617f; background: #0f2d50; color: #fff;
  font-size: 17px; letter-spacing: .06em; text-align: center;
}
.gate-input::placeholder { color: #8ea3ba; font-size: 14px; letter-spacing: .02em; }
.gate-input:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }
.gate-err { min-height: 22px; margin: 7px 0 7px; color: #ffc9c2; font-size: 13px; line-height: 1.5; text-align: left; }
.gate-btn { width: 100%; height: 54px; border: 0; border-radius: 10px; background: var(--gold); color: #0b2340; font-size: 16px; font-weight: 700; letter-spacing: .08em; cursor: pointer; }
.gate-btn:hover { background: #cfa955; }
.gate-help { color: #9fb2c7; font-size: 12.5px; margin-top: 14px; }

/* 設定 */
.disclaimer { margin-top: 26px; font-size: 12px; color: var(--ink-3); line-height: 1.7; }
.colophon { margin-top: 6px; font-size: 11.5px; color: var(--ink-3); }

/* タブレット以上 */
@media (min-width: 720px) {
  .page { padding: 22px 28px; }
  .mast-in { padding: 10px 28px; }
  .sheet-wrap { align-items: center; padding: 20px; }
  .sheet { border-radius: 16px; }
  .tab-link { font-size: 12px; }
}
@media (min-width: 1024px) {
  .shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); }
  .tabbar { display: none; }
  .stage { padding-bottom: 40px; }
  .rail { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100dvh; background: var(--night); padding: 18px 12px; color: #fff; }
  .rail-brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 20px; }
  .rail-brand img { border-radius: 9px; }
  .rail-brand b { display: block; font-size: 13.5px; line-height: 1.35; font-weight: 600; }
  .rail-brand span { font-size: 11px; color: #d9c083; }
  .rail .tab-link { flex: none; height: 46px; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 12px; color: #c5d3e2; font-size: 14px; border-radius: 9px; }
  .rail .tab-link:hover { background: var(--night-2); color: #fff; }
  .rail .tab-link.active { background: var(--night-2); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
  .toast { bottom: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* 印刷 */
#print-root { display: none; }
#print-root.measure { display: block; position: absolute; left: -9999px; top: 0; width: 186mm; visibility: hidden; font-size: 10.5pt; line-height: 1.5; letter-spacing: .02em; }
.pr-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 8mm; padding-bottom: 2.5mm; border-bottom: .7mm solid #0b2340; position: relative; }
.pr-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1.5mm; height: .4mm; background: #c29a45; }
.pr-head h1 { font-size: 19pt; font-weight: 700; line-height: 1.3; letter-spacing: .03em; }
.pr-head p { font-size: 9.5pt; color: #41546b; }
.pr-brand { font-size: 8.5pt; color: #7a5c1c; text-align: right; white-space: nowrap; }
.pr-foot { margin-top: 5mm; padding-top: 2mm; border-top: .25mm solid #c9d5e2; font-size: 7.5pt; color: #5f7186; }
@media print {
  @page { size: A4 portrait; margin: 11mm 12mm; }
  html, body { background: #fff !important; }
  body { font-size: 10.5pt; line-height: 1.5; color: #0b2340; overflow: visible; }
  #root, #toast, .sheet-wrap { display: none !important; }
  #print-root { display: block; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
