:root {
  color-scheme: light;
  --green-950: #08271f;
  --green-900: #0d3b2e;
  --green-800: #145440;
  --green-700: #1b6b50;
  --green-100: #dcebe4;
  --cream-50: #fdfbf5;
  --cream-100: #f5f0e4;
  --cream-200: #e9e0ce;
  --gold-500: #b7903c;
  --gold-300: #d6bc78;
  --ink: #17221d;
  --ink-soft: #53615a;
  --surface: #fffdf8;
  --surface-raised: #ffffff;
  --line: #d9dfda;
  --danger: #a22b32;
  --danger-soft: #f8e7e7;
  --success: #176a49;
  --shadow: 0 10px 30px rgba(18, 52, 40, 0.09);
  --radius-lg: 22px;
  --radius-md: 15px;
  --radius-sm: 10px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --cream-50: #0d1713;
  --cream-100: #111e19;
  --cream-200: #21312a;
  --ink: #f2f3ed;
  --ink-soft: #b7c3bb;
  --surface: #14241d;
  --surface-raised: #192b23;
  --line: #33463d;
  --green-100: #234b3b;
  --gold-300: #d7bd79;
  --danger: #ff9ca0;
  --danger-soft: #45252a;
  --success: #69d1a2;
  --shadow: 0 12px 36px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--cream-100);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 92% 2%, rgba(183, 144, 60, 0.12), transparent 26rem),
    var(--cream-100);
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  max-width: 100%;
  color: inherit;
  font: inherit;
}

button,
select,
input[type="checkbox"],
input[type="file"] {
  touch-action: manipulation;
}

button,
a,
summary,
select,
input {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--gold-500);
  outline-offset: 3px;
}

a {
  color: var(--green-700);
  text-underline-offset: 3px;
}

:root[data-theme="dark"] a {
  color: #8ed6b6;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.025em;
  line-height: 1.16;
}

h1 {
  font-family: ui-serif, Georgia, serif;
  font-size: clamp(1.15rem, 5vw, 1.45rem);
}

h2 {
  font-family: ui-serif, Georgia, serif;
  font-size: clamp(1.75rem, 8vw, 2.6rem);
}

h3 {
  font-size: 1.08rem;
}

p {
  margin: 0.55rem 0;
}

ol,
ul {
  padding-left: 1.25rem;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: calc(var(--safe-top) + 0.5rem);
  left: 0.5rem;
  padding: 0.75rem 1rem;
  transform: translateY(-180%);
  border-radius: 8px;
  background: var(--green-900);
  color: white;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-header {
  position: sticky;
  z-index: 50;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(68px + var(--safe-top));
  padding: calc(0.6rem + var(--safe-top)) calc(1rem + var(--safe-right)) 0.6rem calc(1rem + var(--safe-left));
  border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  background: color-mix(in srgb, var(--cream-100) 88%, transparent);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.brand,
.header-actions,
.section-heading,
.panel-heading,
.button-row,
.hero-meta,
.metric-row,
.exercise-card > summary,
.switch-row {
  display: flex;
  align-items: center;
}

.brand {
  min-width: 0;
  gap: 0.65rem;
}

.brand h1 {
  white-space: nowrap;
}

.brand-mark {
  position: relative;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--green-900);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.12);
}

.brand-mark::before {
  position: absolute;
  top: 7px;
  left: 10px;
  width: 14px;
  height: 14px;
  border: 2px solid var(--gold-300);
  border-radius: 50%;
  content: "";
}

.brand-mark::after {
  position: absolute;
  bottom: -8px;
  left: -4px;
  width: 47px;
  height: 25px;
  transform: rotate(-7deg);
  border-radius: 50%;
  background: var(--green-700);
  content: "";
}

.brand-mark span {
  position: absolute;
  z-index: 1;
  top: 6px;
  left: 26px;
  width: 2px;
  height: 25px;
  background: var(--cream-50);
}

.header-actions {
  flex-shrink: 0;
  gap: 0.4rem;
}

.eyebrow {
  margin: 0 0 0.15rem;
  color: var(--green-700);
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  line-height: 1.2;
  text-transform: uppercase;
}

:root[data-theme="dark"] .eyebrow {
  color: #8ed6b6;
}

.status-pill,
.privacy-badge,
.tag {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--green-100);
  color: var(--green-900);
  font-size: 0.73rem;
  font-weight: 750;
}

:root[data-theme="dark"] .status-pill,
:root[data-theme="dark"] .privacy-badge,
:root[data-theme="dark"] .tag {
  color: #dff8ea;
}

.status-pill.is-offline {
  background: var(--danger-soft);
  color: var(--danger);
}

.icon-button {
  display: inline-grid;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-size: 1.35rem;
}

.icon-button:hover {
  background: var(--cream-200);
}

.app-main {
  width: 100%;
  max-width: 1120px;
  min-height: calc(100dvh - 150px);
  margin: 0 auto;
  padding: 1.1rem calc(1rem + var(--safe-right)) calc(7rem + var(--safe-bottom)) calc(1rem + var(--safe-left));
}

.view[hidden] {
  display: none !important;
}

.view.is-active {
  animation: reveal 180ms ease-out;
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-heading {
  justify-content: space-between;
  gap: 1rem;
  margin: 0.4rem 0 1.2rem;
}

.today-hero {
  position: relative;
  overflow: hidden;
  padding: 1.25rem;
  border-radius: 28px;
  background:
    linear-gradient(138deg, rgba(255, 255, 255, 0.08), transparent 52%),
    var(--green-900);
  box-shadow: var(--shadow);
  color: #fffdf8;
}

.today-hero::after {
  position: absolute;
  right: -32px;
  bottom: -64px;
  width: 180px;
  height: 180px;
  border: 1px solid rgba(214, 188, 120, 0.35);
  border-radius: 50%;
  box-shadow: 0 0 0 28px rgba(214, 188, 120, 0.06), 0 0 0 58px rgba(214, 188, 120, 0.04);
  content: "";
  pointer-events: none;
}

.today-hero .eyebrow {
  color: var(--gold-300);
}

.today-hero h2 {
  max-width: 15ch;
  margin-top: 0.25rem;
  color: #fffdf8;
}

.hero-goal {
  position: relative;
  z-index: 1;
  max-width: 44rem;
  margin: 0.7rem 0 1rem;
  color: #dcebe4;
}

.hero-meta {
  position: relative;
  z-index: 1;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  color: #edf4ef;
  font-size: 0.9rem;
}

.hero-meta strong {
  color: white;
}

.progress-block {
  position: relative;
  z-index: 1;
  margin-top: 1.2rem;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.4rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.progress-track > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--gold-300);
  transition: width 220ms ease;
}

.next-step {
  position: relative;
  z-index: 1;
  margin: 0.9rem 0 0;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 0.88rem;
}

.day-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.35rem;
  margin: 1rem 0;
}

.day-picker button {
  min-width: 0;
  min-height: 48px;
  padding: 0.35rem 0.15rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 800;
}

.day-picker button span {
  display: block;
  font-size: 0.63rem;
  font-weight: 600;
}

.day-picker button.is-selected {
  border-color: var(--green-800);
  background: var(--green-900);
  color: white;
}

.training-alert {
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  border-left: 4px solid var(--gold-500);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: color-mix(in srgb, var(--gold-300) 14%, var(--surface));
  color: var(--ink);
  font-size: 0.9rem;
}

.exercise-list {
  display: grid;
  gap: 0.75rem;
}

.exercise-card {
  overflow: clip;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 3px 14px rgba(16, 52, 39, 0.035);
}

.exercise-card > summary {
  min-height: 68px;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.85rem 0.9rem;
  cursor: pointer;
  list-style: none;
}

.exercise-card > summary::-webkit-details-marker {
  display: none;
}

.exercise-summary-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.7rem;
}

.exercise-check {
  position: relative;
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  place-items: center;
}

.exercise-check input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.exercise-check span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--surface-raised);
}

.exercise-check input:focus-visible + span {
  outline: 3px solid var(--gold-500);
  outline-offset: 3px;
}

.exercise-check input:checked + span {
  border-color: var(--green-700);
  background: var(--green-700);
  color: white;
}

.exercise-check input:checked + span::after {
  content: "✓";
  font-size: 0.9rem;
  font-weight: 900;
}

.exercise-title {
  min-width: 0;
}

.exercise-title strong {
  display: block;
  line-height: 1.25;
}

.exercise-title small {
  color: var(--ink-soft);
}

.chevron {
  flex: 0 0 26px;
  width: 26px;
  transform: rotate(0);
  color: var(--ink-soft);
  text-align: center;
  transition: transform 150ms ease;
}

.exercise-card[open] .chevron {
  transform: rotate(180deg);
}

.exercise-card.is-complete {
  border-color: color-mix(in srgb, var(--success) 45%, var(--line));
}

.exercise-card.is-complete .exercise-title strong {
  color: var(--ink-soft);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.exercise-body {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--line);
}

.exercise-purpose {
  color: var(--ink-soft);
  font-size: 0.94rem;
}

.exercise-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0.9rem 0;
}

.exercise-facts div {
  padding: 0.65rem;
  border-radius: 10px;
  background: var(--cream-100);
}

.exercise-facts dt {
  color: var(--ink-soft);
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.exercise-facts dd {
  margin: 0.15rem 0 0;
  font-size: 0.88rem;
  font-weight: 700;
}

.instruction-grid {
  display: grid;
  gap: 0.9rem;
}

.instruction-grid section {
  min-width: 0;
}

.instruction-grid h4 {
  margin: 0 0 0.3rem;
  font-size: 0.83rem;
}

.instruction-grid ol,
.instruction-grid ul {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.correction-box {
  padding: 0.7rem;
  border-radius: 10px;
  background: color-mix(in srgb, var(--gold-300) 13%, var(--surface));
}

.exercise-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.65rem;
  margin-top: 1rem;
}

.timer {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--cream-50);
}

.timer-display {
  min-width: 4.8rem;
  padding: 0 0.5rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  text-align: center;
}

.timer button {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  background: var(--green-100);
  cursor: pointer;
  font-weight: 800;
}

.note-field {
  flex: 1 1 15rem;
}

.panel,
.feedback-panel {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-heading,
.section-heading {
  align-items: flex-start;
  justify-content: space-between;
}

.panel-heading {
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.muted,
.field-help,
.version-line {
  color: var(--ink-soft);
}

.muted {
  font-size: 0.92rem;
}

.field-label {
  display: block;
  margin: 0.85rem 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 800;
}

.field-help {
  min-height: 1.35rem;
  font-size: 0.8rem;
}

input[type="text"],
input[type="url"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.72rem 0.78rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--cream-50);
  font-size: 16px;
}

textarea {
  min-height: 104px;
  resize: vertical;
}

input:invalid:not(:placeholder-shown) {
  border-color: var(--danger);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 0.75rem;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.stats-fieldset {
  margin: 1rem 0 0;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.stats-fieldset legend {
  padding: 0 0.35rem;
  font-weight: 850;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.stats-grid .field-label {
  margin-top: 0.4rem;
  font-size: 0.73rem;
}

.button-row {
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1rem;
}

.button,
.file-button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 0.67rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.button-primary {
  background: var(--green-900);
  color: white;
}

.button-secondary {
  border-color: var(--line);
  background: var(--surface-raised);
  color: var(--ink);
}

.button-gold {
  background: var(--gold-300);
  color: #251d0c;
}

.button-danger {
  background: var(--danger);
  color: white;
}

.button-danger-outline {
  border-color: var(--danger);
  background: transparent;
  color: var(--danger);
}

.button:hover,
.file-button:hover {
  filter: brightness(0.96);
}

.button[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.feedback-output {
  min-height: 9rem;
  max-height: 32rem;
  margin: 0.8rem 0 0;
  overflow: auto;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--cream-50);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.79rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.week-grid {
  display: grid;
  gap: 0.75rem;
}

.week-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  min-height: 78px;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
}

.week-card:hover {
  border-color: var(--green-700);
}

.day-medallion {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 50%;
  background: var(--cream-200);
  color: var(--green-900);
  font-size: 0.8rem;
  font-weight: 900;
}

:root[data-theme="dark"] .day-medallion {
  color: #dff8ea;
}

.week-card.is-complete .day-medallion {
  background: var(--green-700);
  color: white;
}

.week-card strong,
.week-card small {
  display: block;
}

.week-card small {
  margin-top: 0.2rem;
  color: var(--ink-soft);
}

.mini-progress {
  font-size: 0.75rem;
  font-weight: 800;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.metric-card {
  min-width: 0;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.metric-card .metric-value {
  display: block;
  margin: 0.2rem 0;
  color: var(--green-800);
  font-family: ui-serif, Georgia, serif;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

:root[data-theme="dark"] .metric-card .metric-value {
  color: #8ed6b6;
}

.metric-card small {
  color: var(--ink-soft);
}

.metric-row {
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}

.metric-row:last-child {
  border-bottom: 0;
}

.bar {
  width: 38%;
  min-width: 80px;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--cream-200);
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green-700);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border-radius: 12px;
  background: var(--cream-200);
}

.segmented button {
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.segmented button.is-selected {
  background: var(--surface-raised);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.switch-row {
  min-height: 60px;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  cursor: pointer;
}

.switch-row span,
.switch-row small {
  display: block;
}

.switch-row small {
  margin-top: 0.15rem;
  color: var(--ink-soft);
}

.switch-row input {
  position: relative;
  flex: 0 0 52px;
  width: 52px;
  height: 32px;
  margin: 0;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--cream-200);
  cursor: pointer;
  transition: background 160ms ease;
}

.switch-row input::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.24);
  content: "";
  transition: transform 160ms ease;
}

.switch-row input:checked {
  border-color: var(--green-700);
  background: var(--green-700);
}

.switch-row input:checked::after {
  transform: translateX(20px);
}

.help-details {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 0.5rem;
}

.help-details summary {
  min-height: 44px;
  padding: 0.65rem 0;
  cursor: pointer;
  font-weight: 800;
}

.install-button {
  width: 100%;
  margin-top: 1rem;
}

.danger-panel {
  border-color: color-mix(in srgb, var(--danger) 30%, var(--line));
}

.version-line {
  font-size: 0.76rem;
}

.legal-page {
  width: min(100% - 2rem, 780px);
  margin: 0 auto;
  padding: calc(2rem + var(--safe-top)) 0 calc(3rem + var(--safe-bottom));
}

.legal-page > h1 {
  font-size: clamp(2rem, 10vw, 3.5rem);
}

.legal-page .panel h2 {
  margin-bottom: 0.75rem;
  font-size: 1.35rem;
}

.bottom-nav {
  position: fixed;
  z-index: 80;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  min-height: calc(66px + var(--safe-bottom));
  padding: 0.35rem var(--safe-right) var(--safe-bottom) var(--safe-left);
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 93%, transparent);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.bottom-nav button {
  display: flex;
  min-width: 0;
  min-height: 56px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 750;
}

.bottom-nav button > span:first-child {
  font-size: 1.15rem;
  line-height: 1;
}

.bottom-nav button > span:last-child {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.bottom-nav button.is-active {
  background: var(--green-100);
  color: var(--green-900);
}

:root[data-theme="dark"] .bottom-nav button.is-active {
  color: #dff8ea;
}

.toast-region {
  position: fixed;
  z-index: 200;
  right: calc(1rem + var(--safe-right));
  bottom: calc(5.6rem + var(--safe-bottom));
  left: calc(1rem + var(--safe-left));
  display: grid;
  justify-items: center;
  pointer-events: none;
}

.toast {
  max-width: 36rem;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  background: var(--green-950);
  box-shadow: var(--shadow);
  color: white;
  font-size: 0.88rem;
  font-weight: 700;
  text-align: center;
  animation: toast-in 180ms ease-out;
}

.toast.is-error {
  background: #702128;
}

.automation-card {
  display: grid;
  gap: 0.75rem;
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid color-mix(in srgb, var(--gold-500) 55%, var(--line));
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 88%, var(--gold-300));
  box-shadow: var(--shadow);
}

.automation-card .button-row {
  margin-top: 0;
}

.profile-section {
  margin: 1rem 0 0;
  padding: 0;
  border: 0;
}

.profile-section legend {
  margin-bottom: 0.45rem;
  padding: 0;
  font-size: 0.88rem;
  font-weight: 850;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.55rem;
}

.choice-grid-wrap {
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
}

.choice-card {
  position: relative;
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--cream-50);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 750;
}

.choice-card:has(input:checked) {
  border-color: var(--green-700);
  background: var(--green-100);
}

.choice-card input {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--green-800);
}

.field-error {
  margin: 0.3rem 0;
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 750;
}

[aria-invalid="true"] {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 1px var(--danger);
}

.tag-success {
  background: var(--green-100);
  color: var(--success);
}

.tag-ai {
  background: color-mix(in srgb, var(--gold-300) 55%, var(--surface));
  color: var(--ink);
}

.warning-text {
  color: #8a5a00;
}

:root[data-theme="dark"] .warning-text {
  color: #ffd27a;
}

.exercise-media {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.exercise-media-figure {
  margin: 0.65rem 0 0;
}

.exercise-media-figure img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--cream-100);
  object-fit: cover;
}

.exercise-media-figure figcaption {
  margin-top: 0.35rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.video-consent {
  margin-top: 0.8rem;
  padding: 0.8rem;
  border: 1px dashed var(--line);
  border-radius: 13px;
  background: var(--cream-50);
}

.exercise-video-frame {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 11px;
  background: #000;
}

.preview-day-list {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.8rem;
}

.preview-day-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 0.7rem;
  align-items: start;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--cream-50);
}

.preview-day-card small {
  display: block;
  margin-top: 0.15rem;
  color: var(--ink-soft);
}

.preview-day-card p {
  margin-bottom: 0;
  font-size: 0.84rem;
}

.budget-line {
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  background: var(--green-100);
}

.sticky-preview-actions {
  position: sticky;
  z-index: 10;
  bottom: calc(78px + var(--safe-bottom));
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.history-list {
  display: grid;
  gap: 0.4rem;
}

.history-row {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}

.history-row:last-child {
  border-bottom: 0;
}

.history-row small {
  display: block;
  color: var(--ink-soft);
}

.profile-panel .form-grid {
  grid-template-columns: 1fr;
}

.coach-tabs {
  display: flex;
  gap: 0.35rem;
  max-width: 100%;
  margin: 0 0 1rem;
  padding: 0.3rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.coach-tabs button {
  flex: 1 0 auto;
  min-width: 92px;
  min-height: 44px;
  padding: 0.65rem 1rem;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 800;
  cursor: pointer;
}

.coach-tabs button[aria-selected="true"] {
  background: var(--green-900);
  color: #fff;
  box-shadow: 0 4px 14px rgba(8, 39, 31, 0.18);
}

.coach-tab-panel[hidden] {
  display: none;
}

.capture-guidance {
  display: grid;
  gap: 0.2rem;
  min-height: 44px;
  padding: 0.7rem 0.8rem;
  border-left: 3px solid var(--gold-500);
  border-radius: var(--radius-sm);
  background: var(--cream-50);
  font-size: 0.9rem;
}

.consent-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 0.65rem;
  align-items: start;
  margin: 1rem 0;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--cream-50);
  cursor: pointer;
}

.consent-row input {
  width: 22px;
  height: 22px;
  margin: 0.1rem 0 0;
}

.file-button:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.55;
}

.record-timer {
  margin: 0.5rem 0;
  color: var(--green-800);
  font-variant-numeric: tabular-nums;
  font-weight: 850;
}

:root[data-theme="dark"] .record-timer {
  color: #8ed6b6;
}

.swing-video-stage {
  display: grid;
  place-items: center;
  min-height: 11rem;
  margin: 0.8rem 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #050807;
}

.swing-video-stage:has(video[hidden]) {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.04), transparent),
    #050807;
}

.swing-video-stage video {
  display: block;
  width: min(100%, 405px);
  max-height: 72vh;
  aspect-ratio: 9 / 16;
  background: #000;
  object-fit: contain;
}

.swing-video-stage video[hidden] {
  display: none;
}

.keyframe-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.keyframe-grid figure {
  min-width: 0;
  margin: 0;
}

.keyframe-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #050807;
  object-fit: contain;
}

.keyframe-grid figcaption {
  margin-top: 0.25rem;
  color: var(--ink-soft);
  font-size: 0.78rem;
  text-align: center;
}

.analysis-result {
  display: grid;
  gap: 0.75rem;
}

.analysis-result ul,
.formula-list {
  margin: 0;
}

.analysis-meta,
.shot-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.analysis-meta > div,
.shot-stat-grid > div {
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--cream-50);
}

.analysis-meta small,
.shot-stat-grid small {
  display: block;
  color: var(--ink-soft);
}

.coach-launch-grid {
  display: grid;
  gap: 1rem;
}

.status-label {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 0.3rem 0.65rem;
  border: 2px solid currentColor;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 900;
}

.status-documented {
  color: var(--ink);
  background: var(--cream-200);
}

.status-perfect {
  color: #075331;
  background: #d8f4e5;
}

.status-good {
  color: #674800;
  background: #fff0bd;
}

.status-focus {
  color: #8b1d24;
  background: var(--danger-soft);
}

:root[data-theme="dark"] .status-perfect {
  color: #a8f1cb;
  background: #123e2d;
}

:root[data-theme="dark"] .status-good {
  color: #ffe29a;
  background: #49390d;
}

:root[data-theme="dark"] .status-focus {
  color: #ffb4b8;
  background: #45252a;
}

.formula-box {
  margin-top: 0.8rem;
  padding: 0.8rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  background: var(--cream-50);
}

.shot-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.shot-history-table th,
.shot-history-table td {
  padding: 0.6rem 0.35rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.shot-history-table th {
  color: var(--ink-soft);
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.shot-history-scroll {
  max-width: 100%;
  overflow-x: auto;
}

.button-full-mobile {
  width: 100%;
}

.device-feedback-card .button-row {
  align-items: stretch;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 620px) {
  .app-main {
    padding-right: calc(1.5rem + var(--safe-right));
    padding-left: calc(1.5rem + var(--safe-left));
  }

  .today-hero,
  .panel,
  .feedback-panel {
    padding: 1.35rem;
  }

  .exercise-facts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .instruction-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .week-grid,
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .profile-panel .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .automation-card {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .button-full-mobile {
    width: auto;
  }
}

@media (min-width: 720px) {
  .coach-launch-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .keyframe-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 430px) {
  .day-picker {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .app-header {
    padding-right: max(2rem, calc((100vw - 1080px) / 2));
    padding-left: max(2rem, calc((100vw - 1080px) / 2));
  }

  .bottom-nav {
    top: 50%;
    right: auto;
    bottom: auto;
    left: 1rem;
    width: 86px;
    min-height: auto;
    grid-template-columns: 1fr;
    padding: 0.5rem;
    transform: translateY(-50%);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
  }

  .bottom-nav button {
    min-height: 62px;
  }

  .app-main {
    padding-bottom: 3rem;
  }

  .week-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metric-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sticky-preview-actions {
    bottom: 1rem;
  }
}

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

@media (prefers-contrast: more) {
  :root {
    --line: #657168;
  }

  .button,
  input,
  select,
  textarea,
  .panel,
  .exercise-card {
    border-width: 2px;
  }
}

@media print {
  .app-header,
  .bottom-nav,
  .button-row,
  .day-picker {
    display: none !important;
  }

  .app-main {
    max-width: none;
    padding: 0;
  }

  .view[hidden] {
    display: none !important;
  }

  .feedback-output {
    max-height: none;
    overflow: visible;
    border: 0;
  }
}
