:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #102f35;
  background: #eaf4f4;
  --ink: #102f35;
  --muted: #617a80;
  --water: #087f8c;
  --water-dark: #075963;
  --aqua: #dff5f5;
  --card: #ffffff;
  --line: #d3e4e5;
  --success: #177a59;
  --danger: #b42318;
  --shadow: 0 10px 32px rgba(10, 65, 72, .08);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 300px; background: linear-gradient(180deg, #e2f3f3 0, #f7fbfb 420px); }
button, input, textarea { font: inherit; }
button, .button { border: 0; cursor: pointer; text-decoration: none; }
button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid #f2b94b; outline-offset: 2px; }
input, textarea { width: 100%; min-height: 46px; border: 1px solid #bfd3d5; border-radius: 11px; padding: 11px 12px; color: var(--ink); background: #fff; font-size: 16px; }
textarea { resize: vertical; line-height: 1.45; }
label { display: grid; gap: 6px; color: #31535a; font-size: 13px; font-weight: 750; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: clamp(25px, 5vw, 36px); letter-spacing: -.035em; }
h2 { margin-bottom: 8px; font-size: clamp(21px, 4vw, 28px); letter-spacing: -.025em; }
.hidden { display: none !important; }
.sub, .field-help, .autosave-note { color: var(--muted); }

.app-header { position: sticky; z-index: 20; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 62px; padding: 8px max(16px, calc((100vw - 1160px)/2)); background: rgba(248, 252, 252, .92); border-bottom: 1px solid rgba(191, 211, 213, .8); backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 8px; min-height: 44px; color: var(--ink); background: transparent; font-size: 17px; }
.brand span, .auth-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--water); color: white; font-size: 25px; font-weight: 900; }
.desktop-nav { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: #e9f2f2; }
.desktop-nav button { min-height: 40px; padding: 0 15px; border-radius: 9px; color: #49666c; background: transparent; font-weight: 750; }
.desktop-nav button.active { color: white; background: var(--water); }
.save-state { min-width: 76px; text-align: right; color: var(--success); font-size: 12px; font-weight: 750; }
.save-state.saving { color: #8a6200; }
.save-state.failed { color: var(--danger); }
.content { width: min(1160px, 100%); min-height: calc(100vh - 62px); margin: auto; padding: 22px 18px 46px; }
.bottom-nav { display: none; }

.card, .exercise-card, .week-hero, .history-card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.week-hero { display: grid; grid-template-columns: 1fr auto; gap: 10px 20px; padding: 20px 22px; }
.eyebrow { display: block; margin-bottom: 4px; color: var(--water); font-size: 11px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.week-volume { display: flex; align-items: baseline; gap: 5px; text-align: right; }
.week-volume strong { font-size: 28px; }
.week-volume span { color: var(--muted); }
.week-progress { grid-column: 1/-1; height: 11px; overflow: hidden; border-radius: 20px; background: #dceaea; }
.week-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #0a8c97, #42b28b); transition: width .35s ease; }
.week-caption { grid-column: 1/-1; display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.day-tabs { position: sticky; z-index: 10; top: 62px; display: grid; grid-auto-columns: minmax(125px, 1fr); grid-auto-flow: column; gap: 8px; overflow-x: auto; margin: 14px 0 24px; padding: 6px 0; scrollbar-width: none; background: rgba(239, 248, 248, .92); backdrop-filter: blur(10px); }
.day-tabs::-webkit-scrollbar { display: none; }
.day-tabs button { min-height: 60px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 14px; color: #355960; background: white; text-align: left; }
.day-tabs button span, .day-tabs button b { display: block; }
.day-tabs button span { font-size: 13px; }
.day-tabs button b { margin-top: 3px; font-size: 12px; }
.day-tabs button.active { border-color: var(--water); color: white; background: var(--water); box-shadow: 0 8px 18px rgba(8,127,140,.2); }
.session-title { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin: 0 3px 10px; }
.session-title h2 { margin: 0; }
.session-total { display: flex; align-items: baseline; gap: 4px; white-space: nowrap; }
.session-total b { font-size: 25px; }
.session-total span { color: var(--muted); }
.session-tags, .exercise-meta { display: flex; gap: 7px; flex-wrap: wrap; }
.session-tags { margin-bottom: 13px; }
.session-tags span, .exercise-meta span { padding: 5px 9px; border-radius: 999px; color: #27575e; background: #dff1f1; font-size: 12px; font-weight: 750; }
.next-button, .complete-banner { width: 100%; min-height: 48px; margin-bottom: 14px; border-radius: 14px; font-weight: 800; }
.next-button { color: white; background: var(--water-dark); }
.complete-banner { display: grid; place-items: center; padding: 10px; color: var(--success); background: #e3f6ed; }
.exercise-list { display: grid; gap: 14px; }
.exercise-card { position: relative; overflow: hidden; padding: 18px; scroll-margin-top: 140px; }
.exercise-card.current { border: 2px solid var(--water); box-shadow: 0 12px 36px rgba(8,127,140,.17); }
.exercise-card.done { border-color: #9ed4bf; background: linear-gradient(180deg, #fff, #f3fcf8); }
.exercise-card.done::after { content: "✓"; position: absolute; top: 12px; right: 14px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: white; background: var(--success); font-weight: 900; }
.exercise-top { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 16px; align-items: center; }
.exercise-animation { position: relative; height: 112px; overflow: hidden; border-radius: 14px; background: linear-gradient(155deg, #dff8f8, #bce9ed); }
.exercise-animation > span { position: absolute; bottom: 7px; left: 8px; padding: 3px 7px; border-radius: 99px; color: #075963; background: rgba(255,255,255,.9); font-size: 10px; font-weight: 850; }
.tech { width: 100%; height: 100%; }
.tech path, .tech circle, .tech rect, .tech ellipse { fill: none; stroke: #075963; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.tech .head { fill: #075963; }
.tech .water { stroke: #75ccd3; stroke-width: 2; }
.tech .board { fill: #ffd469; stroke: #9c7009; stroke-width: 2; }
.tech .buoy { fill: #ff8a73; stroke: #a83528; stroke-width: 2; }
.tech .pull-arm, .tech .back-arm, .tech .arms { transform-box: fill-box; transform-origin: top; animation: arm-cycle 1.35s ease-in-out infinite alternate; }
.tech .legs, .tech-kick .leg { transform-box: fill-box; transform-origin: right; animation: kick-cycle .55s ease-in-out infinite alternate; }
.tech-kick .b { animation-delay: -.3s; }
.tech-dolphin .wave-body, .tech-dolphin .tail { transform-box: fill-box; transform-origin: center; animation: dolphin-wave .8s ease-in-out infinite alternate; }
.tech-breast .arms { animation: breast-arms 1.5s ease-in-out infinite; }
.tech-breast .legs { animation: breast-legs 1.5s ease-in-out infinite; }
.tech-back .back-arm { animation: back-arm 1.45s linear infinite; }
.tech-crawl.slow * { animation-duration: 2.4s; }
.tech-crawl.pace .pull-arm { animation-duration: .8s; animation-direction: alternate; }
@keyframes arm-cycle { from { transform: rotate(-8deg) translateY(-1px); } to { transform: rotate(13deg) translateY(5px); } }
@keyframes kick-cycle { from { transform: rotate(-6deg); } to { transform: rotate(7deg); } }
@keyframes dolphin-wave { from { transform: rotate(-2deg) translateY(-2px); } to { transform: rotate(3deg) translateY(4px); } }
@keyframes breast-arms { 0%,100% { transform: scaleX(.82); } 45% { transform: scaleX(1.08) translateX(4px); } }
@keyframes breast-legs { 0%,100% { transform: scaleY(.7); } 55% { transform: scaleY(1.25); } }
@keyframes back-arm { to { transform: rotate(360deg); } }
.exercise-heading h3 { margin: 0 34px 8px 0; font-size: clamp(19px, 3vw, 24px); line-height: 1.15; }
.distance-formula { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.distance-formula b { font-size: clamp(22px, 4vw, 30px); color: var(--water-dark); }
.distance-formula span { color: var(--muted); font-size: 13px; }
.plan-note { margin: 13px 0 7px; line-height: 1.45; }
.technique-hint { margin: 10px 0; padding: 10px 12px; border-left: 4px solid #30a5ae; border-radius: 0 10px 10px 0; color: #164c53; background: #edf9f9; line-height: 1.4; }
.pool-controls { display: grid; grid-template-columns: 54px 86px 54px minmax(140px, 1fr); gap: 9px; align-items: stretch; margin-top: 14px; }
.step-button, .done-button { min-height: 56px; border-radius: 14px; color: white; font-weight: 900; }
.step-button { background: var(--water-dark); font-size: 30px; }
.done-button { background: var(--water); font-size: 15px; }
.exercise-card.done .done-button { background: var(--success); }
.set-count { display: grid; place-items: center; align-content: center; border: 1px solid var(--line); border-radius: 13px; background: #f5fafa; line-height: 1; }
.set-count strong { font-size: 25px; }
.set-count span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.exercise-details { margin-top: 12px; border-top: 1px solid var(--line); }
.exercise-details summary { min-height: 45px; padding-top: 13px; color: var(--water-dark); cursor: pointer; font-size: 13px; font-weight: 800; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.form-grid.three { grid-template-columns: 1fr 1fr 2fr; }
.wide-field { grid-column: 1/-1; }
.session-log { margin-top: 18px; }
.card { padding: 22px; }
.card.compact { padding: 19px; }
.help { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-left: 4px; border-radius: 50%; color: white; background: var(--water); font-size: 12px; }
.autosave-note { margin: 10px 0 0; font-size: 12px; }
.page-title { margin: 5px 0 20px; }
.page-title h1 { margin: 0; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.ai-plan-card { border-color: #8bcbd0; background: linear-gradient(155deg, #fff, #edfafa); }
.ai-plan-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.recalc-badge { flex: none; padding: 6px 9px; border-radius: 999px; color: #075963; background: #d8f0f1; font-size: 11px; font-weight: 850; }
.day-picker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 16px 0; }
.day-picker > span { grid-column: 1/-1; font-size: 13px; font-weight: 800; }
.day-picker label { display: block; }
.day-picker input { position: absolute; opacity: 0; pointer-events: none; }
.day-picker label span { display: block; min-height: 44px; padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: #f8fbfb; }
.day-picker input:checked + span { border-color: var(--water); color: white; background: var(--water); }
.primary, .secondary, .danger, .button { display: inline-grid; place-items: center; min-height: 46px; padding: 10px 15px; border-radius: 11px; font-weight: 800; }
.primary { color: white; background: var(--water); }
.secondary { color: var(--ink); border: 1px solid var(--line); background: white; }
.danger { color: white; background: var(--danger); }
.wide { width: 100%; }
.maintenance { display: flex; flex-wrap: wrap; gap: 8px; }
.import-button { position: relative; cursor: pointer; }
.import-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.notice { margin-top: 12px; padding: 12px; border-radius: 10px; background: var(--aqua); line-height: 1.45; }
.error { color: var(--danger); }
.auth { width: min(430px, calc(100% - 28px)); margin: 8vh auto; padding: 28px; border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: var(--shadow); }
.auth-mark { margin-bottom: 15px; }
.auth form { display: grid; gap: 13px; }
.auth .field-help { margin: -7px 0 0; font-size: 12px; }
.chart-card { margin-bottom: 15px; }
.card-title { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.card-title h2 { margin: 0; }
.card-title > div { color: var(--muted); font-size: 12px; }
.legend { display: inline-block; width: 9px; height: 9px; margin: 0 3px 0 8px; border-radius: 3px; }
.legend.plan { background: #b7cdcf; }
.legend.fact { background: var(--water); }
.bar-chart { display: flex; align-items: end; gap: 6px; height: 210px; margin-top: 18px; border-bottom: 1px solid var(--line); }
.bar-chart button { position: relative; flex: 1; height: 100%; min-width: 28px; background: transparent; }
.bar-chart i { position: absolute; bottom: 24px; width: 38%; border-radius: 6px 6px 0 0; }
.bar-chart .planned { left: 10%; background: #b7cdcf; }
.bar-chart .actual { right: 10%; background: var(--water); }
.bar-chart span { position: absolute; bottom: 3px; left: 0; width: 100%; color: var(--muted); font-size: 10px; }
.history-list { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.history-card { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 18px; color: var(--ink); text-align: left; }
.history-card strong { display: block; font-size: 24px; }
.history-card small { color: var(--muted); font-size: 13px; }
.completion-ring { display: grid; place-items: center; width: 58px; height: 58px; border: 6px solid #bfe3da; border-radius: 50%; color: var(--success); font-size: 13px; font-weight: 900; }
.history-meta { grid-column: 1/-1; display: flex; flex-wrap: wrap; gap: 6px; }
.history-meta span { padding: 4px 7px; border-radius: 8px; color: #46676d; background: #edf4f4; font-size: 11px; }
.history-card p { grid-column: 1/-1; margin: 0; color: var(--muted); }
.empty { padding: 30px; text-align: center; }

@media (max-width: 760px) {
  body { background: #eef7f7; padding-bottom: 74px; }
  .app-header { min-height: 56px; padding: 6px 12px; }
  .brand b { display: none; }
  .desktop-nav { display: none; }
  .save-state { font-size: 11px; }
  .content { min-height: calc(100vh - 130px); padding: 12px 10px 26px; }
  .bottom-nav { position: fixed; z-index: 30; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(3, 1fr); padding: 6px max(6px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left)); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(16px); }
  .bottom-nav button { display: grid; place-items: center; gap: 2px; min-height: 51px; border-radius: 10px; color: #617a80; background: transparent; font-size: 10px; font-weight: 800; }
  .bottom-nav button span { font-size: 18px; line-height: 1; }
  .bottom-nav button.active { color: var(--water-dark); background: #e2f3f3; }
  .week-hero { gap: 8px 12px; padding: 14px; border-radius: 16px; }
  .week-hero h1 { font-size: 22px; }
  .week-volume { display: grid; gap: 0; }
  .week-volume strong { font-size: 23px; }
  .week-volume span { font-size: 11px; }
  .week-caption { font-size: 10px; }
  .day-tabs { top: 56px; grid-auto-columns: 105px; margin: 8px -10px 15px; padding: 7px 10px; }
  .day-tabs button { min-height: 55px; padding: 7px 10px; border-radius: 12px; }
  .session-title { align-items: start; }
  .session-title h2 { font-size: 22px; }
  .session-total { display: grid; gap: 0; text-align: right; }
  .session-total b { font-size: 22px; }
  .session-total span { font-size: 11px; }
  .exercise-card { padding: 13px; border-radius: 16px; scroll-margin-top: 126px; }
  .exercise-top { grid-template-columns: 105px minmax(0, 1fr); gap: 11px; }
  .exercise-animation { height: 88px; }
  .exercise-heading h3 { margin-right: 25px; font-size: 18px; }
  .distance-formula { display: grid; gap: 0; }
  .distance-formula b { font-size: 22px; }
  .plan-note, .technique-hint { font-size: 13px; }
  .technique-hint { padding: 8px 9px; }
  .pool-controls { grid-template-columns: 52px 72px 52px 1fr; gap: 6px; }
  .step-button, .done-button { min-height: 58px; border-radius: 12px; }
  .done-button { padding: 5px; font-size: 13px; }
  .set-count strong { font-size: 23px; }
  .form-grid, .form-grid.two, .form-grid.three { grid-template-columns: 1fr; }
  .wide-field { grid-column: auto; }
  .card { padding: 16px; border-radius: 16px; }
  .settings-grid, .history-list { grid-template-columns: 1fr; }
  .day-picker { grid-template-columns: 1fr 1fr; }
  .bar-chart { height: 165px; overflow-x: auto; }
  .bar-chart button { min-width: 38px; }
  .page-title { margin: 3px 3px 14px; }
  .page-title h1 { font-size: 27px; }
  .auth { margin-top: 4vh; padding: 22px; }
}

@media (max-width: 390px) {
  .exercise-top { grid-template-columns: 1fr; }
  .exercise-animation { height: 105px; }
  .pool-controls { grid-template-columns: 50px 1fr 50px; }
  .done-button { grid-column: 1/-1; }
}

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