:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #2d3748;
  background: #f8f9fa;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  --lavender: #7c6ee6;
  --lavender-dark: #6152cd;
  --lavender-wash: #f0edff;
  --mint: #38b2ac;
  --ink: #2d3748;
  --muted: #687386;
  --line: #e4e7ee;
  --surface: #fff;
  --canvas: #f8f9fa;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--canvas); }
body { min-width: 320px; min-height: 100vh; margin: 0; }
button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #9f94f5; outline-offset: 2px; }
.choice-card:focus-within { outline: 3px solid #9f94f5; outline-offset: 2px; }
button:disabled { cursor: not-allowed; opacity: .56; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; background: var(--canvas); transition: background-color .18s ease, color .18s ease; }
.app-header { width: min(100%, 900px); min-height: 64px; margin: 0 auto; padding: 12px 22px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 9px; font-size: 1.02rem; font-weight: 500; letter-spacing: -.035em; }
.brand strong { color: var(--lavender-dark); font-weight: 760; }
.brand-mark { width: 29px; height: 29px; display: flex; align-items: center; justify-content: center; gap: 3px; border-radius: 10px; background: var(--lavender); }
.brand-mark span { width: 8px; height: 12px; border-radius: 50%; background: #fff; }
.brand-mark span + span { height: 12px; background: #b9f0e6; }
.local-label { color: var(--muted); font-size: .75rem; display: inline-flex; align-items: center; gap: 6px; }
.local-label span { color: var(--mint); font-size: .55rem; }

.screen { width: min(100%, 900px); margin: 0 auto; padding: 18px 22px 24px; flex: 1 0 auto; }
.config-screen { width: min(100%, 540px); padding-top: clamp(22px, 5vh, 52px); padding-bottom: 34px; }
.access-badge, .rule-badge { display: inline-flex; align-items: center; gap: 8px; width: fit-content; color: #4e427f; background: #efedff; border: 1px solid #e3dfff; border-radius: 999px; padding: 7px 11px; font-size: .75rem; font-weight: 690; }
.access-badge { margin-bottom: 22px; }
.access-badge span { color: #aaa1de; }
.eyebrow { margin: 0 0 7px; color: var(--lavender-dark); font-size: .75rem; font-weight: 760; letter-spacing: .11em; }
.config-heading h1, .return-heading h1, .summary-heading h1 { margin: 0; color: var(--ink); letter-spacing: -.045em; line-height: 1.12; }
.config-heading h1 { max-width: 14ch; font-size: clamp(1.75rem, 7vw, 2.65rem); }
.config-heading > p:last-child { max-width: 43ch; margin: 12px 0 0; color: var(--muted); font-size: .99rem; line-height: 1.55; }
.config-form { margin-top: 26px; }
.name-fields { display: grid; gap: 15px; }
.field-label { display: grid; gap: 8px; color: #414b5d; font-size: .84rem; font-weight: 680; }
.field-label input { width: 100%; min-height: 52px; padding: 0 15px; border: 1px solid #d9dce5; border-radius: 14px; color: var(--ink); background: #fff; font-size: 1rem; font-weight: 480; }
.field-label input::placeholder { color: #9ca4b1; }
.field-label input[aria-invalid="true"] { border-color: #dcad58; background: #fffdf7; box-shadow: 0 0 0 2px #f9ecd3; }
.validation-message { margin: 11px 0 0; color: #92601e; font-size: .82rem; line-height: 1.45; }
.start-side-fieldset { display: grid; gap: 9px; margin: 24px 0 22px; padding: 0; border: 0; }
.start-side-fieldset legend { margin-bottom: 11px; padding: 0; color: var(--ink); font-size: .9rem; font-weight: 730; }
.choice-card { min-height: 65px; display: flex; align-items: center; gap: 12px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; }
.choice-card.selected { border-color: #aaa0f3; background: #f7f5ff; box-shadow: 0 0 0 1px #aaa0f3; }
.choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.choice-dot { width: 19px; height: 19px; flex: 0 0 auto; border: 1.5px solid #aeb4c0; border-radius: 50%; background: #fff; }
.choice-card.selected .choice-dot { border: 5px solid var(--lavender); }
.choice-card strong, .choice-card small { display: block; }
.choice-card strong { color: var(--ink); font-size: .86rem; font-weight: 700; }
.choice-card small { margin-top: 2px; color: var(--muted); font-size: .76rem; }

.button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 10px 15px; border: 1px solid transparent; border-radius: 14px; font-size: .88rem; font-weight: 720; line-height: 1.2; cursor: pointer; transition: transform .12s ease, background-color .12s ease, border-color .12s ease; }
.button:active:not(:disabled) { transform: scale(.985); }
.button-primary { color: #fff; background: var(--lavender-dark); box-shadow: 0 6px 15px #7c6ee626; }
.button-primary:hover:not(:disabled) { filter: brightness(.92); }
.config-submit { width: 100%; min-height: 54px; font-size: .94rem; }
.back-link { min-height: 45px; margin: -7px 0 15px; padding: 0; border: 0; color: var(--lavender-dark); background: none; font-size: .83rem; font-weight: 680; cursor: pointer; }

.panel-screen { max-width: 760px; display: flex; flex-direction: column; gap: 12px; padding-top: 9px; padding-bottom: 12px; }
.return-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.return-heading .eyebrow { margin-bottom: 5px; }
.return-heading h1 { font-size: clamp(1.13rem, 3.6vw, 1.48rem); }
.return-heading p:last-child { margin: 5px 0 0; color: var(--muted); font-size: .77rem; line-height: 1.35; }
.rule-badge { flex: 0 0 auto; padding: 7px 9px; color: #236d67; background: #e7f7f3; border-color: #c9ede3; font-size: .75rem; }
.rule-badge span { color: var(--mint); font-size: .55rem; }
.rule-explanation { margin: -4px 0 0; color: #6e6a85; font-size: .75rem; line-height: 1.4; }
.panel-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel-controls .button { min-height: 48px; padding: 8px 12px; border-radius: 12px; font-size: .78rem; }
.button-night { color: #57479f; background: #f0edff; border-color: #e2ddff; }
.button-swap { color: #246d68; background: #e7f7f3; border-color: #d3f0e9; }
.button-lock { margin-left: auto; color: #7d5122; background: #fff7e9; border-color: #f0e0c2; }
.timer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.timer-card { min-width: 0; min-height: 209px; padding: 14px 13px 12px; display: flex; flex-direction: column; align-items: center; border: 1px solid #e2e5ec; border-radius: 19px; background: var(--surface); text-align: center; box-shadow: 0 6px 17px #20294107; }
.timer-card.is-running { border-color: #9bded1; box-shadow: 0 0 0 2px #e1f6f0, 0 7px 18px #20294108; }
.breast-label { display: flex; align-items: center; gap: 6px; color: #687386; font-size: .75rem; font-weight: 770; letter-spacing: .06em; }
.side-dot { width: 7px; height: 7px; border-radius: 50%; background: #b7b9c4; }
.side-dot.left { background: #9b8cf1; }
.side-dot.right { background: #65c7b6; }
.timer-card h2 { width: 100%; margin: 9px 0 4px; overflow: hidden; color: var(--ink); font-size: clamp(1.02rem, 4.4vw, 1.26rem); text-overflow: ellipsis; white-space: nowrap; }
.timer-readout { color: #424c60; font-variant-numeric: tabular-nums; font-size: clamp(1.85rem, 8vw, 2.42rem); font-weight: 690; letter-spacing: -.055em; line-height: 1.15; }
.timer-card.is-running .timer-readout { color: #25877b; animation: gentle-pulse 2.4s ease-in-out infinite; }
.timer-card.is-paused .timer-readout { color: #8992a0; }
.timer-button { width: 100%; min-height: 48px; margin-top: 9px; color: #123d3a; background: var(--mint); border-radius: 12px; }
.timer-card.is-paused .timer-button { color: #33404f; background: #edf0f4; }
.timer-state { margin-top: 6px; color: #687386; font-size: .75rem; line-height: 1.2; }
.one-hand-hint { margin: -3px 0 0; color: #586270; font-size: .75rem; text-align: center; }
.button-together { width: 100%; min-height: 48px; color: #246d68; background: #e3f5ef; border-color: #c8ece3; }
.button-finish { width: 100%; min-height: 53px; color: #fff; background: var(--lavender-dark); font-size: .91rem; }
.bonus-card { padding: 9px 12px; border: 1px solid #ece9f8; border-radius: 13px; background: #f7f5ff; }
.bonus-card p { margin: 0; color: #665c84; font-size: .75rem; line-height: 1.48; }
.bonus-card strong { color: #55488a; font-weight: 730; }
.app-footer { width: min(100%, 900px); margin: 0 auto; padding: 12px 22px max(15px, env(safe-area-inset-bottom)); color: #586270; font-size: .75rem; line-height: 1.48; }
.app-footer p { margin: 0; }
.app-footer p + p { margin-top: 5px; }

.summary-screen { max-width: 720px; padding-top: 16px; padding-bottom: 28px; }
.summary-heading { position: relative; min-height: 64px; padding-left: 52px; display: flex; flex-direction: column; justify-content: center; }
.summary-heading .eyebrow { margin-bottom: 3px; }
.summary-heading h1 { font-size: clamp(1.3rem, 5vw, 1.8rem); }
.success-icon { position: absolute; left: 0; top: 50%; width: 39px; height: 39px; display: grid; place-items: center; transform: translateY(-50%); border-radius: 50%; color: #19776d; background: #dff5ee; font-size: 1.1rem; font-weight: 800; }
.summary-card { margin-top: 13px; padding: 16px 17px; border: 1px solid var(--line); border-radius: 17px; background: #fff; }
.summary-card h2, .calendar-card h2 { margin: 0 0 11px; color: var(--ink); font-size: .94rem; }
.summary-card p { margin: 5px 0 0; color: #546072; font-size: .84rem; line-height: 1.45; }
.summary-card p strong { color: var(--ink); }
.completed-card { border-left: 4px solid var(--mint); }
.next-round-card { border-color: #e4e0fb; background: #f8f7ff; }
.next-round-card .eyebrow { margin-bottom: 5px; }
.next-round-card h2 { margin-bottom: 8px; }
.history-section { margin-top: 22px; }
.section-heading-row { margin-bottom: 9px; display: flex; justify-content: space-between; align-items: flex-end; }
.section-heading-row .eyebrow { margin-bottom: 3px; }
.section-heading-row h2 { margin: 0; color: var(--ink); font-size: 1.08rem; letter-spacing: -.025em; }
.history-count { color: var(--muted); font-size: .75rem; }
.history-table-wrap { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.history-table { width: 100%; border-collapse: collapse; text-align: left; font-size: .75rem; }
.history-table thead { color: #626d7c; background: #f5f6f9; font-size: .75rem; }
.history-table th, .history-table td { padding: 9px 11px; vertical-align: top; }
.history-table th { font-weight: 720; }
.history-table tbody tr + tr { border-top: 1px solid #eff0f4; }
.history-table td:first-child { width: 34%; color: #586270; }
.history-table td:last-child span { display: block; color: #4d596b; line-height: 1.45; }
.swap-history-label { display: inline-block; margin-top: 4px !important; color: #6254a4 !important; font-size: .75rem !important; }
.empty-history { margin: 0; padding: 14px; color: var(--muted); border: 1px solid var(--line); border-radius: 13px; background: #fff; font-size: .8rem; }
.summary-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 15px; }
.new-feeding-button { grid-column: 1 / -1; min-height: 51px; }
.button-secondary { color: #57499a; background: #f0edff; border-color: #e2ddff; }
.calendar-card { margin-top: 16px; padding: 13px; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 9px; border: 1px solid #e8e5f4; border-radius: 15px; background: #fff; }
.calendar-card > div { min-width: 0; display: flex; align-items: center; gap: 8px; }
.calendar-card h2 { margin: 0; font-size: .79rem; line-height: 1.3; }
.calendar-icon { color: var(--lavender); font-size: 1.1rem; }
.calendar-card label { display: grid; gap: 3px; color: var(--muted); font-size: .75rem; }
.calendar-card select { max-width: 83px; min-height: 48px; padding: 0 6px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; font-size: .75rem; }
.button-tertiary { min-height: 48px; padding: 8px 10px; color: #594c9b; background: #f3f1ff; font-size: .75rem; }
.secondary-links { margin-top: 13px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 14px; }
.text-button { min-height: 48px; padding: 4px 0; border: 0; color: #594c9b; background: none; font-size: .75rem; font-weight: 650; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.text-button:disabled { color: #a4a9b2; cursor: default; }
.reset-link { color: #7a6262; }
.organizing-screen { width: min(100%, 520px); min-height: 50vh; margin: 0 auto; padding: 25px; display: grid; place-content: center; justify-items: center; color: var(--lavender-dark); text-align: center; }
.organizing-screen p { font-size: 1.05rem; font-weight: 650; }
.organizing-mark { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 16px; background: var(--lavender-wash); font-size: 1.4rem; animation: gentle-pulse 1.1s ease-in-out infinite; }
.storage-warning { position: fixed; z-index: 20; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); left: 12px; width: min(520px, calc(100% - 24px)); margin-inline: auto; padding: 12px 14px; border: 1px solid #e4be7d; border-radius: 12px; color: #744f1f; background: #fff8e8; box-shadow: 0 6px 24px #2222; font-size: .78rem; }
.toast { position: fixed; z-index: 25; right: 14px; bottom: max(16px, env(safe-area-inset-bottom)); left: 14px; width: fit-content; max-width: min(500px, calc(100% - 28px)); margin-inline: auto; padding: 12px 16px; border: 1px solid #dcd6fb; border-radius: 14px; color: #41377c; background: #fff; box-shadow: 0 8px 30px #2223; font-size: .81rem; line-height: 1.42; text-align: center; }
.touch-lock-overlay { position: fixed; z-index: 30; inset: 0; padding: 24px 24px max(28px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; color: #f1dbbd; background: rgb(0 0 0 / 24%); text-align: center; text-shadow: 0 1px 5px #000; }
.lock-icon { font-size: 2rem; }
.touch-lock-overlay h2 { margin: 14px 0 0; color: #e08a3c; font-size: 1.3rem; }
.touch-lock-overlay p { margin: 8px 0 20px; color: #c6b7a1; font-size: .9rem; }
.unlock-button { position: relative; width: min(330px, 100%); min-height: 58px; overflow: hidden; border: 1px solid #8e5b30; border-radius: 16px; color: #f5d6b0; background: #17100b; font-weight: 720; touch-action: none; }
.unlock-progress { position: absolute; inset: 0 auto 0 0; background: #b35e24; opacity: .5; transition: width .12s linear; }
.unlock-button > span:last-child { position: relative; z-index: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }

.night-mode { --ink: #cbd5e0; --muted: #aa9b89; --line: #2e241a; --surface: #090705; --canvas: #000; --lavender: #dd6b20; --lavender-dark: #e08a3c; color: #cbd5e0; background: #000; }
.night-mode .app-header, .night-mode .app-footer, .night-mode .screen { color: #cbd5e0; }
.night-mode .brand, .night-mode .config-heading h1, .night-mode .return-heading h1, .night-mode .summary-heading h1, .night-mode .timer-card h2, .night-mode .summary-card h2, .night-mode .calendar-card h2, .night-mode .section-heading-row h2 { color: #dfc8ad; }
.night-mode .brand strong, .night-mode .eyebrow { color: #e08a3c; }
.night-mode .brand-mark { background: #633b1f; }
.night-mode .access-badge, .night-mode .rule-badge, .night-mode .choice-card, .night-mode .field-label input, .night-mode .timer-card, .night-mode .summary-card, .night-mode .history-table-wrap, .night-mode .empty-history, .night-mode .calendar-card { color: #d3c3af; border-color: #3a2a1c; background: #0b0806; }
.night-mode .access-badge, .night-mode .rule-badge { background: #1a110b; color: #e08a3c; }
.night-mode .field-label, .night-mode .start-side-fieldset legend, .night-mode .choice-card strong, .night-mode .summary-card p, .night-mode .history-table td:last-child span { color: #d6c7b5; }
.night-mode .field-label input { color: #edddca; }
.night-mode .choice-card.selected, .night-mode .next-round-card, .night-mode .bonus-card { border-color: #593c22; background: #100b07; }
.night-mode .timer-readout, .night-mode .timer-card.is-paused .timer-readout { color: #c26132; }
.night-mode .timer-card.is-running .timer-readout { color: #e08a3c; }
.night-mode .timer-button, .night-mode .button-together, .night-mode .button-secondary, .night-mode .button-tertiary, .night-mode .button-night, .night-mode .button-swap, .night-mode .button-lock { color: #f1cfaa; border-color: #54351e; background: #211309; }
.night-mode .timer-card.is-paused .timer-button { color: #f1cfaa; border-color: #54351e; background: #211309; }
.night-mode .choice-card:focus-within { outline-color: #e08a3c; }
.night-mode .button-primary, .night-mode .button-finish { color: #170d06; background: #dd6b20; }
.night-mode .bonus-card p, .night-mode .bonus-card strong { color: #d8ad84; }
.night-mode .history-table thead { color: #d5b999; background: #17100b; }
.night-mode .history-table tbody tr + tr { border-color: #281d14; }
.night-mode .history-table td:first-child, .night-mode .history-table th { color: #c3a98d; }
.night-mode .calendar-card select { color: #dfc8ad; border-color: #3a2a1c; background: #100b07; }
.night-mode .text-button, .night-mode .back-link { color: #e08a3c; }
.night-mode .app-footer { color: #978875; }
.night-mode .rule-explanation { color: #b2a18d; }
.night-mode .breast-label, .night-mode .timer-state, .night-mode .one-hand-hint { color: #b2a18d; }

@keyframes gentle-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .78; } }

@media (max-width: 600px) {
  .app-header { min-height: 55px; padding: 9px 16px; }
  .local-label { font-size: .75rem; }
  .screen { padding-right: 16px; padding-left: 16px; }
  .config-screen { padding-top: 25px; }
  .panel-screen { gap: 10px; padding-top: 6px; }
  .return-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .rule-badge { font-size: .75rem; }
  .panel-controls { gap: 7px; }
  .panel-controls .button { flex: 1 1 auto; min-height: 48px; padding: 8px 9px; font-size: .75rem; }
  .button-lock { margin-left: 0; }
  .timer-grid { gap: 9px; }
  .timer-card { min-height: 198px; padding: 12px 9px 10px; border-radius: 16px; }
  .timer-card h2 { margin-top: 8px; }
  .timer-button { padding-inline: 7px; }
  .one-hand-hint { font-size: .75rem; }
  .bonus-card { padding: 8px 10px; }
  .bonus-card p { font-size: .75rem; }
  .app-footer { padding: 11px 16px max(14px, env(safe-area-inset-bottom)); font-size: .75rem; }
  .summary-screen { padding-top: 12px; }
  .summary-card { padding: 14px; }
  .calendar-card { grid-template-columns: 1fr auto; }
  .calendar-card > div { grid-column: 1 / -1; }
  .calendar-card .button-tertiary { justify-self: stretch; }
  .secondary-links { justify-content: flex-start; column-gap: 16px; }
}
@media (max-width: 380px) {
  .local-label { max-width: 128px; font-size: .75rem; }
  .screen { padding-right: 12px; padding-left: 12px; }
  .timer-grid { gap: 7px; }
  .timer-card { min-height: 190px; padding-right: 7px; padding-left: 7px; }
  .breast-label { font-size: .75rem; }
  .timer-readout { font-size: 1.85rem; }
  .panel-controls .button { font-size: .75rem; }
  .history-table th, .history-table td { padding: 8px; }
  .history-table { font-size: .75rem; }
  .summary-actions { grid-template-columns: 1fr; }
  .new-feeding-button { grid-column: auto; }
}
@media (min-width: 601px) {
  .timer-card { min-height: 238px; padding-top: 19px; }
  .timer-readout { font-size: 3rem; }
  .timer-button { max-width: 240px; margin-top: 13px; }
  .panel-screen { gap: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
