:root {
  --ink: #16211d;
  --muted: #65716b;
  --paper: #f4f1e8;
  --paper-2: #ebe7db;
  --card: #fffdf7;
  --baize: #123b31;
  --baize-2: #1d5748;
  --lime: #c9df77;
  --gold: #d6a954;
  --red: #b64035;
  --line: #dcd7ca;
  --shadow: 0 12px 36px rgba(20, 43, 35, 0.1);
  --radius: 20px;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  letter-spacing: -0.035em;
  line-height: 1.08;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.45rem, 12vw, 4.8rem);
  font-weight: 500;
  margin-bottom: 1rem;
}

h2 {
  font-size: 1.65rem;
  margin-bottom: 0;
}

h3 {
  font-size: 1.12rem;
  margin-bottom: 0.55rem;
}

em {
  color: var(--lime);
  font-weight: 400;
}

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.topbar {
  align-items: center;
  background: rgba(244, 241, 232, 0.92);
  border-bottom: 1px solid rgba(22, 33, 29, 0.08);
  display: flex;
  height: 64px;
  justify-content: space-between;
  padding: env(safe-area-inset-top) 20px 0;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
}

.brand {
  align-items: center;
  display: flex;
  font-size: 0.94rem;
  font-weight: 800;
  gap: 9px;
  letter-spacing: -0.02em;
}

.brand-mark {
  align-items: center;
  background: var(--baize);
  border-radius: 50%;
  color: var(--red);
  display: flex;
  font-size: 1.1rem;
  height: 28px;
  justify-content: center;
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  width: 28px;
}

.offline-pill {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 0.72rem;
  font-weight: 650;
  gap: 6px;
}

.offline-pill span {
  background: #4d976b;
  border-radius: 50%;
  height: 7px;
  width: 7px;
}

.page {
  margin: 0 auto;
  max-width: 1100px;
  min-height: calc(100vh - 64px);
  padding-bottom: 124px;
}

.hero {
  background:
    radial-gradient(circle at 86% 16%, rgba(201, 223, 119, 0.12), transparent 25%),
    linear-gradient(145deg, var(--baize), #0d2d25);
  color: white;
  min-height: 480px;
  overflow: hidden;
  padding: 54px 24px 30px;
  position: relative;
}

.hero::after {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  content: "";
  height: 230px;
  position: absolute;
  right: -110px;
  top: 65px;
  width: 230px;
}

.eyebrow {
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 700px;
}

.hero-copy {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.94rem;
  max-width: 580px;
}

.hero-stats {
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 40px;
  padding-top: 23px;
}

.hero-stats div,
.metric-row div,
.stat-grid > div {
  display: flex;
  flex-direction: column;
}

.hero-stats strong {
  font-family: Georgia, serif;
  font-size: 1.7rem;
  font-weight: 400;
}

.hero-stats span {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.66rem;
  line-height: 1.25;
}

.section,
.feedback-review {
  padding: 34px 20px 6px;
}

.section-heading {
  align-items: flex-end;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-heading .eyebrow {
  margin-bottom: 5px;
}

.text-button {
  background: none;
  border: 0;
  color: var(--baize-2);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 10px 0;
}

.plan-list,
.routine-grid {
  display: grid;
  gap: 12px;
}

.routine-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 4px 14px rgba(20, 43, 35, 0.035);
  overflow: hidden;
  position: relative;
}

.routine-link {
  display: block;
  padding: 20px;
}

.setup-preview {
  align-items: center;
  background: #e8ede1;
  border-radius: 12px;
  color: var(--baize);
  display: flex;
  font-size: 0.75rem;
  font-weight: 800;
  gap: 8px;
  margin: 0 0 15px;
  padding: 10px 12px;
}

.setup-preview svg {
  height: 19px;
  width: 19px;
}

.routine-card.compact {
  align-items: stretch;
  display: grid;
  grid-template-columns: 50px 1fr;
}

.routine-card.compact .routine-link {
  padding-left: 6px;
}

.plan-number {
  align-items: center;
  color: var(--gold);
  display: flex;
  font-family: Georgia, serif;
  font-size: 1.65rem;
  justify-content: center;
}

.routine-topline {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 0.69rem;
  font-weight: 700;
  justify-content: space-between;
  margin-bottom: 13px;
}

.area-tag {
  background: #e2ead1;
  border-radius: 99px;
  color: #35513d;
  display: inline-block;
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 5px 9px;
  text-transform: uppercase;
}

.routine-card h3 {
  margin-bottom: 8px;
}

.routine-card p {
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 15px;
}

.routine-meta {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 0.68rem;
  justify-content: space-between;
}

.difficulty {
  color: var(--gold);
  letter-spacing: 0.08em;
}

.card-actions {
  border-top: 1px solid var(--line);
  display: flex;
}

.card-actions button {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  min-height: 46px;
  padding: 8px 16px;
}

.card-actions button + button {
  border-left: 1px solid var(--line);
}

.card-actions button.selected {
  color: var(--red);
}

.coach-card {
  align-items: flex-start;
  background: #e4ead7;
  border-radius: var(--radius);
  display: flex;
  gap: 16px;
  margin: 34px 20px 8px;
  padding: 22px;
}

.coach-card p:last-child {
  color: #58675e;
  font-size: 0.8rem;
  margin: 0;
}

.coach-orb {
  align-items: center;
  background: var(--baize);
  border-radius: 50%;
  color: var(--lime);
  display: flex;
  flex: 0 0 42px;
  font-family: Georgia, serif;
  font-size: 0.75rem;
  height: 42px;
  justify-content: center;
}

.quick-actions {
  display: grid;
  gap: 10px;
  padding: 22px 20px;
}

.button {
  align-items: center;
  border: 0;
  border-radius: 13px;
  display: flex;
  font-size: 0.83rem;
  font-weight: 800;
  justify-content: center;
  min-height: 52px;
  padding: 13px 18px;
}

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

.button-primary span {
  color: var(--lime);
  margin-left: 9px;
}

.button-secondary {
  background: transparent;
  border: 1px solid #b9b8ae;
  color: var(--baize);
}

.page-intro {
  background: var(--baize);
  color: white;
  padding: 47px 22px 38px;
}

.page-intro h1 {
  font-size: clamp(2.4rem, 11vw, 4rem);
}

.page-intro > p:last-child {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.9rem;
  margin-bottom: 0;
  max-width: 620px;
}

.session-builder {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 27px 20px;
}

.segmented {
  background: var(--paper-2);
  border-radius: 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 18px;
  padding: 4px;
}

.segmented button {
  background: transparent;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  min-height: 40px;
}

.segmented button.active {
  background: var(--card);
  box-shadow: 0 3px 9px rgba(22, 33, 29, 0.08);
  color: var(--baize);
}

.session-strip {
  display: grid;
  gap: 5px;
}

.session-strip a {
  align-items: center;
  border-radius: 10px;
  display: flex;
  gap: 13px;
  padding: 8px;
}

.session-strip a:hover {
  background: var(--paper);
}

.session-strip > a > span {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--gold);
  display: flex;
  flex: 0 0 30px;
  font-family: Georgia, serif;
  height: 30px;
  justify-content: center;
}

.session-strip div {
  display: flex;
  flex-direction: column;
}

.session-strip strong {
  font-size: 0.78rem;
}

.session-strip small {
  color: var(--muted);
  font-size: 0.65rem;
}

.filter-row {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 10px;
}

.filter-row select:last-child {
  grid-column: 1 / -1;
}

select,
input,
textarea {
  background: var(--card);
  border: 1px solid #c9c5b8;
  border-radius: 10px;
  min-height: 46px;
  padding: 10px 11px;
  width: 100%;
}

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

.random-button {
  background: #e4ead7;
  border: 0;
  border-radius: 11px;
  color: var(--baize);
  font-size: 0.75rem;
  font-weight: 800;
  margin-bottom: 16px;
  min-height: 46px;
  width: 100%;
}

.back-link {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 20px 20px 12px;
}

.routine-hero {
  background: var(--baize);
  color: white;
  padding: 28px 22px;
}

.routine-hero h1 {
  font-size: clamp(2.25rem, 10.5vw, 4.5rem);
  max-width: 100%;
  overflow-wrap: break-word;
  text-wrap: balance;
}

.routine-hero > p {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.9rem;
  max-width: 100%;
  overflow-wrap: break-word;
  text-wrap: pretty;
}

.metric-row {
  border-top: 1px solid rgba(255, 255, 255, 0.13);
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 27px;
  padding-top: 20px;
}

.metric-row strong {
  font-family: Georgia, serif;
  font-size: 1.55rem;
  font-weight: 400;
}

.metric-row span {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.62rem;
}

.instruction-grid {
  display: grid;
  gap: 10px;
  padding: 18px 20px 8px;
}

.instruction {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
}

.instruction h3 {
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.instruction p {
  color: var(--muted);
  font-size: 0.78rem;
  margin: 0;
}

.instruction.coach {
  background: #e4ead7;
  border-color: transparent;
}

.log-card,
.settings-card,
.chart-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 24px 20px 8px;
  padding: 22px;
}

form {
  display: grid;
  gap: 17px;
}

form label,
.tag-field > span {
  color: #47534e;
  display: grid;
  font-size: 0.69rem;
  font-weight: 750;
  gap: 6px;
}

.form-row {
  display: grid;
  gap: 11px;
  grid-template-columns: 1fr 1fr;
}

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

.optional {
  color: var(--muted);
  font-size: 0.61rem;
  font-weight: 500;
}

.rating {
  border: 0;
  margin: 0;
  padding: 0;
}

.rating legend {
  color: #47534e;
  font-size: 0.69rem;
  font-weight: 750;
  margin-bottom: 8px;
}

.rating > div {
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(5, 1fr);
}

.rating label {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: center;
}

.rating input,
.tag-field input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.rating label span {
  align-items: center;
  background: var(--paper-2);
  border: 2px solid transparent;
  border-radius: 50%;
  display: flex;
  height: 39px;
  justify-content: center;
  width: 39px;
}

.rating input:checked + span {
  background: var(--baize);
  border-color: var(--lime);
  color: white;
}

.rating input:focus-visible + span,
.tag-field input:focus-visible + span {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.rating small {
  color: var(--muted);
  font-size: 0.52rem;
  font-weight: 500;
}

.tag-field > div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 7px;
}

.tag-field label {
  display: block;
}

.tag-field label span {
  background: var(--paper-2);
  border: 1px solid transparent;
  border-radius: 99px;
  display: block;
  font-size: 0.68rem;
  padding: 8px 11px;
}

.tag-field input:checked + span {
  background: #dbe6ca;
  border-color: #91a768;
  color: var(--baize);
}

.history-list > div {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  font-size: 0.73rem;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 13px 4px;
}

.history-list span,
.history-list time {
  color: var(--muted);
}

.match-list,
.journal-list,
.feedback-list {
  display: grid;
  gap: 10px;
}

.match-card {
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  gap: 14px;
  padding: 16px;
}

.match-result {
  align-items: center;
  background: var(--baize);
  border-radius: 50%;
  color: white;
  display: flex;
  flex: 0 0 38px;
  font-family: Georgia, serif;
  height: 38px;
  justify-content: center;
}

.match-result.loss {
  background: var(--red);
}

.match-result.draw {
  background: var(--gold);
}

.match-card p {
  color: var(--muted);
  font-size: 0.62rem;
  margin-bottom: 4px;
}

.match-card h3 {
  margin-bottom: 4px;
}

.match-card span,
.match-card small {
  color: var(--muted);
  display: block;
  font-size: 0.68rem;
}

.match-card small {
  color: var(--baize-2);
  font-weight: 750;
  margin-top: 5px;
}

.stat-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
  padding: 22px 20px 0;
}

.stat-grid > div {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 17px;
}

.stat-grid strong {
  color: var(--baize);
  font-family: Georgia, serif;
  font-size: 1.55rem;
  font-weight: 400;
}

.stat-grid span {
  color: var(--muted);
  font-size: 0.66rem;
}

.bar-chart {
  display: grid;
  gap: 14px;
}

.bar-chart > div {
  align-items: center;
  display: grid;
  font-size: 0.69rem;
  gap: 8px;
  grid-template-columns: 86px 1fr 35px;
}

.bar-chart > div > div {
  background: var(--paper-2);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
}

.bar-chart i {
  background: var(--baize-2);
  border-radius: inherit;
  display: block;
  height: 100%;
}

.bar-chart strong {
  font-size: 0.68rem;
  text-align: right;
}

.spark-bars {
  align-items: end;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(8, 1fr);
  height: 150px;
}

.spark-bars > div {
  align-items: center;
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: flex-end;
}

.spark-bars i {
  background: linear-gradient(var(--lime), var(--baize-2));
  border-radius: 5px 5px 0 0;
  display: block;
  min-height: 10px;
  width: 72%;
}

.spark-bars small {
  color: var(--muted);
  font-size: 0.58rem;
  padding: 5px 0;
}

.spark-bars > div.unavailable i {
  background: var(--muted);
  opacity: 0.55;
}

.chart-note {
  color: var(--muted);
  font-size: 0.72rem;
  margin-top: 8px;
}

.pb-list {
  display: grid;
}

.pb-list a {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 7px;
  grid-template-columns: 68px 1fr 30px;
  min-height: 58px;
}

.pb-list span {
  color: var(--muted);
  font-size: 0.62rem;
}

.pb-list strong {
  font-size: 0.76rem;
}

.pb-list b {
  color: var(--baize);
  font-family: Georgia, serif;
  font-size: 1.25rem;
}

.journal-list article,
.feedback-list article {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}

.journal-list time,
.feedback-list time {
  color: var(--muted);
  font-size: 0.63rem;
}

.journal-list p,
.feedback-list p {
  font-size: 0.79rem;
  margin: 8px 0;
}

.journal-list small,
.feedback-list small {
  color: var(--baize-2);
  font-size: 0.68rem;
}

.resource-list {
  display: grid;
  gap: 8px;
}

.resource-list a {
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  min-height: 64px;
  padding: 13px 16px;
}

.resource-list a div {
  display: flex;
  flex-direction: column;
}

.resource-list strong {
  font-size: 0.76rem;
}

.resource-list span {
  color: var(--muted);
  font-size: 0.65rem;
}

.add-resource {
  font-size: 0.74rem;
  margin-top: 12px;
}

.add-resource summary {
  color: var(--baize);
  cursor: pointer;
  font-weight: 800;
  padding: 10px 0;
}

.add-resource form {
  padding-top: 10px;
}

.settings-card {
  display: grid;
  gap: 10px;
}

.settings-card p {
  color: var(--muted);
  font-size: 0.74rem;
}

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

.file-button {
  position: relative;
}

.file-button:focus-within {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.danger-button {
  background: transparent;
  border: 0;
  color: var(--red);
  font-size: 0.7rem;
  font-weight: 750;
  min-height: 44px;
}

.empty-state {
  color: var(--muted);
  font-size: 0.77rem;
  padding: 25px 4px;
  text-align: center;
}

.count-badge {
  background: var(--red);
  border-radius: 99px;
  color: white;
  display: inline-block;
  font-family: inherit;
  font-size: 0.65rem;
  margin-left: 5px;
  padding: 4px 7px;
  vertical-align: middle;
}

.feedback-list article > div {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.feedback-export {
  background: #e4ead7;
  border-radius: 14px;
  display: grid;
  gap: 13px;
  margin-bottom: 14px;
  padding: 16px;
}

.feedback-export > div {
  align-items: center;
  display: flex;
  gap: 12px;
}

.feedback-export p {
  display: flex;
  flex-direction: column;
  margin: 0;
}

.feedback-export strong {
  font-size: 0.9rem;
}

.feedback-export small {
  color: var(--muted);
  font-size: 0.76rem;
  margin-top: 2px;
}

.feedback-export button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.feedback-list article > label {
  align-items: center;
  color: var(--muted);
  display: grid;
  font-size: 0.62rem;
  gap: 7px;
  grid-template-columns: auto 1fr;
  margin-top: 12px;
}

.feedback-list select {
  min-height: 38px;
  padding: 6px 9px;
}

.feedback-fab {
  align-items: center;
  background: var(--gold);
  border: 2px solid var(--paper);
  border-radius: 99px;
  bottom: calc(74px + env(safe-area-inset-bottom));
  box-shadow: 0 7px 20px rgba(22, 33, 29, 0.2);
  color: #2b281e;
  display: flex;
  font-size: 0.72rem;
  font-weight: 850;
  gap: 5px;
  min-height: 42px;
  padding: 8px 13px;
  position: fixed;
  right: 14px;
  z-index: 29;
}

.feedback-fab.timer-visible {
  bottom: calc(164px + env(safe-area-inset-bottom));
}

.page.timer-visible {
  padding-bottom: 220px;
}

@media (max-width: 719px) {
  .feedback-fab {
    border-radius: 50%;
    font-size: 1rem;
    height: 50px;
    justify-content: center;
    padding: 0;
    width: 50px;
  }

  .feedback-fab span {
    display: none;
  }
}

.feedback-dialog {
  background: var(--card);
  border: 0;
  border-radius: 22px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.28);
  max-height: 88vh;
  max-width: 520px;
  padding: 22px;
  width: calc(100% - 28px);
}

.feedback-dialog::backdrop,
.action-dialog::backdrop {
  background: rgba(7, 19, 15, 0.68);
  backdrop-filter: blur(3px);
}

.action-dialog {
  background: var(--card);
  border: 0;
  border-radius: 22px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.28);
  max-width: 520px;
  padding: 22px;
  width: calc(100% - 28px);
}

.action-dialog > p {
  color: var(--muted);
  font-size: 0.8rem;
}

.replacement-actions {
  display: grid;
  gap: 9px;
}

.replacement-actions .danger-button {
  border: 1px solid #d7a19b;
  font-size: 0.8rem;
}

.feedback-dialog > form > p {
  color: var(--muted);
  font-size: 0.76rem;
}

.dialog-heading {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
}

.dialog-heading button {
  background: var(--paper-2);
  border: 0;
  border-radius: 50%;
  font-size: 1.3rem;
  height: 38px;
  width: 38px;
}

.persistence-region:empty {
  display: none;
}

.persistence-region {
  left: 50%;
  max-width: 560px;
  position: fixed;
  top: calc(72px + env(safe-area-inset-top));
  transform: translateX(-50%);
  width: calc(100% - 28px);
  z-index: 110;
}

.persistence-error {
  background: #fff7ef;
  border: 2px solid #a94332;
  border-radius: 14px;
  box-shadow: var(--shadow);
  color: var(--ink);
  padding: 16px;
}

.persistence-error strong {
  color: #7d2d22;
  display: block;
  font-size: 1rem;
}

.persistence-error p {
  font-size: 0.86rem;
  line-height: 1.45;
  margin: 6px 0 12px;
}

.persistence-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.persistence-actions .button {
  flex: 1 1 180px;
  min-height: 42px;
  padding: 9px 12px;
}

.toast-region {
  display: grid;
  gap: 8px;
  left: 50%;
  max-width: 420px;
  position: fixed;
  top: 78px;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  z-index: 100;
}

.toast {
  animation: toast-in 0.22s ease-out;
  background: var(--ink);
  border-radius: 11px;
  box-shadow: var(--shadow);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 13px 16px;
  text-align: center;
}

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

.bottom-nav {
  background: rgba(255, 253, 247, 0.96);
  border-top: 1px solid var(--line);
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  left: 0;
  padding: 6px 7px calc(6px + env(safe-area-inset-bottom));
  position: fixed;
  right: 0;
  z-index: 30;
  backdrop-filter: blur(14px);
}

.bottom-nav a {
  align-items: center;
  border-radius: 10px;
  color: #7c837f;
  display: flex;
  flex-direction: column;
  font-size: 1.12rem;
  gap: 1px;
  justify-content: center;
  min-height: 50px;
}

.bottom-nav a.active {
  background: #e4ead7;
  color: var(--baize);
}

.bottom-nav small {
  font-size: 0.68rem;
  font-weight: 750;
}

.active-routine-tray {
  align-items: stretch;
  background: var(--baize);
  border: 1px solid rgba(201, 223, 119, 0.45);
  border-radius: 15px;
  bottom: calc(70px + env(safe-area-inset-bottom));
  box-shadow: 0 12px 30px rgba(7, 19, 15, 0.3);
  color: white;
  display: grid;
  gap: 5px;
  grid-template-columns: minmax(0, 1fr) auto;
  left: 10px;
  padding: 6px;
  position: fixed;
  right: 10px;
  z-index: 29;
}

.active-routine-return,
.tray-timer-action {
  border: 0;
  border-radius: 10px;
  min-height: 54px;
}

.active-routine-return {
  align-items: center;
  background: transparent;
  color: white;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
  padding: 7px 9px;
  text-align: left;
}

.active-routine-return span {
  min-width: 0;
}

.active-routine-return small,
.active-routine-return strong {
  display: block;
}

.active-routine-return small {
  color: var(--lime);
  font-size: 0.66rem;
  font-weight: 800;
}

.active-routine-return strong {
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-routine-return time {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 1rem;
  font-weight: 800;
}

.tray-timer-action {
  background: var(--lime);
  color: var(--baize);
  font-size: 0.76rem;
  font-weight: 850;
  padding: 8px 12px;
}

/* First-use accessibility pass: legible at arm's length in a dark snooker hall. */

html {
  font-size: 18px;
}

body {
  letter-spacing: 0.002em;
}

.eyebrow,
.routine-topline,
.routine-meta,
.offline-pill {
  font-size: 0.76rem;
}

.hero-copy,
.page-intro > p:last-child,
.routine-hero > p {
  font-size: 1rem;
  line-height: 1.65;
}

.routine-card p,
.instruction p,
.coach-card p:last-child,
.settings-card p,
.match-card span,
.match-card small,
.resource-list span,
.empty-state {
  font-size: 0.84rem;
  line-height: 1.55;
}

.routine-card h3 {
  align-items: center;
  display: flex;
  font-size: 1.08rem;
  gap: 9px;
}

.routine-icon,
.control-icon,
.instruction-icon {
  align-items: center;
  background: var(--baize);
  border-radius: 50%;
  color: var(--lime);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0.92rem;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.area-tag {
  align-items: center;
  display: inline-flex;
  font-size: 0.7rem;
  gap: 5px;
}

.area-tag b {
  color: var(--baize);
  font-size: 0.86rem;
}

form label,
.tag-field > span,
.rating legend {
  font-size: 0.8rem;
}

input,
select,
textarea {
  font-size: 1rem;
  min-height: 52px;
}

.button {
  font-size: 0.94rem;
  min-height: 56px;
}

.rating label span {
  font-size: 0.9rem;
  height: 44px;
  width: 44px;
}

.rating small {
  font-size: 0.64rem;
}

.tag-field label span {
  font-size: 0.78rem;
  padding: 10px 13px;
}

.metric-row span,
.hero-stats span,
.stat-grid span,
.session-strip small,
.match-card p,
.journal-list time,
.feedback-list time {
  font-size: 0.72rem;
}

.table-diagram {
  margin: 0 auto;
  max-width: 410px;
  width: 100%;
}

.table-diagram svg {
  display: block;
  filter: drop-shadow(0 15px 20px rgba(6, 23, 17, 0.18));
  height: auto;
  margin: 0 auto;
  width: 100%;
}

.table-wood {
  fill: #70422a;
}

.table-cushion {
  fill: #16362d;
}

.table-cloth {
  fill: #267258;
}

.pockets circle {
  fill: #0a100d;
}

.baulk-line {
  stroke: rgba(255, 255, 255, 0.46);
  stroke-width: 1.4;
}

.diagram-path {
  opacity: 0.78;
  stroke: #f9e2a5;
  stroke-dasharray: 6 5;
  stroke-linecap: round;
  stroke-width: 1.5;
}

.diagram-path.object {
  stroke: #ffffff;
}

.diagram-path.cue-control {
  stroke: #b9e7ff;
  stroke-dasharray: 3 4;
}

.diagram-path.cue-return {
  stroke: #d9ef8b;
  stroke-dasharray: none;
}

.table-diagram marker path {
  fill: #f9e2a5;
}

.diagram-zone rect {
  fill: rgba(201, 223, 119, 0.2);
  stroke: rgba(229, 242, 176, 0.8);
  stroke-dasharray: 5 4;
  stroke-width: 1.5;
}

.diagram-zone text {
  fill: #f3f7e6;
  font-size: 10px;
  font-weight: 750;
}

.diagram-ball .ball-label {
  fill: #f5f1e7;
  font-size: 10px;
  font-weight: 900;
  paint-order: stroke;
  stroke: #123b31;
  stroke-width: 2px;
}

.diagram-ball.ghost {
  opacity: 0.72;
}

.rest-icon path {
  fill: none;
  stroke: #d3a45c;
  stroke-linecap: round;
  stroke-width: 5;
}

.table-diagram figcaption {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 0.85rem;
  gap: 10px;
  line-height: 1.5;
  margin: 14px auto 0;
  max-width: 390px;
}

.table-diagram figcaption span {
  color: var(--baize-2);
  font-size: 1.2rem;
}

.table-diagram figcaption div {
  display: flex;
  flex-direction: column;
}

.table-diagram figcaption small {
  color: var(--baize);
  font-size: 0.72rem;
  font-weight: 800;
  margin-top: 4px;
}

.diagram-stage {
  background: #dfe6d5;
  padding: 24px 28px;
}

.table-diagram.compact {
  background: #dfe6d5;
  border-radius: 14px;
  margin-bottom: 17px;
  overflow: hidden;
  padding: 11px;
}

.table-diagram.compact svg {
  height: auto;
}

.routine-controls {
  align-items: stretch;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 14px;
  padding: 20px;
}

.routine-controls > div {
  align-items: center;
  display: flex;
  gap: 13px;
}

.routine-controls h2 {
  font-size: 1.12rem;
  margin-bottom: 4px;
}

.routine-controls p {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0;
}

.routine-controls.active {
  background: #e4ead7;
}

.routine-timer-actions {
  display: grid !important;
  gap: 8px !important;
  grid-template-columns: 1fr 1.5fr;
}

.active-timer small {
  color: var(--muted);
  display: block;
  font-size: 0.72rem;
  font-weight: 750;
}

.active-timer strong {
  color: var(--baize);
  display: block;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 1.8rem;
  letter-spacing: 0.04em;
}

.pulse-dot {
  animation: pulse 1.8s infinite;
  background: var(--red);
  border: 4px solid #f0c9c5;
  border-radius: 50%;
  height: 22px;
  width: 22px;
}

.pulse-dot.paused {
  animation: none;
  background: var(--gold);
  border-color: #ead9b9;
}

@keyframes pulse {
  50% {
    box-shadow: 0 0 0 8px rgba(182, 64, 53, 0.08);
  }
}

.instruction {
  align-items: flex-start;
  display: flex;
  gap: 13px;
}

.instruction-icon {
  background: #e4ead7;
  color: var(--baize);
}

.instruction.coach .instruction-icon {
  background: var(--baize);
  color: var(--lime);
}

.source-note {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 0.78rem;
  gap: 10px;
  padding: 12px 22px 0;
}

.source-note > span {
  color: var(--baize-2);
  font-size: 1.2rem;
}

.source-note div {
  display: flex;
  flex-direction: column;
}

.source-note small {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.source-note a {
  color: var(--baize);
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.completion-screen {
  background:
    radial-gradient(circle at 75% 15%, rgba(201, 223, 119, 0.15), transparent 22%),
    var(--baize);
  color: white;
  min-height: calc(100vh - 64px);
  padding: 50px 22px 120px;
  text-align: center;
}

.completion-mark {
  align-items: center;
  background: var(--lime);
  border-radius: 50%;
  color: var(--baize);
  display: flex;
  font-size: 2rem;
  height: 68px;
  justify-content: center;
  margin: 0 auto 20px;
  width: 68px;
}

.completion-screen > p:not(.eyebrow) {
  color: rgba(255, 255, 255, 0.7);
}

.completion-stats {
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 30px 0;
  padding: 20px 0;
}

.completion-stats div {
  display: flex;
  flex-direction: column;
}

.completion-stats strong {
  font-family: Georgia, serif;
  font-size: 1.5rem;
  font-weight: 400;
}

.completion-stats span {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.68rem;
}

.next-routine {
  background: var(--card);
  border-radius: var(--radius);
  color: var(--ink);
  margin: 0 auto;
  max-width: 560px;
  padding: 20px;
  text-align: left;
}

.next-routine > div {
  align-items: center;
  display: flex;
  gap: 14px;
  margin-bottom: 18px;
}

.next-routine .eyebrow {
  margin-bottom: 4px;
}

.next-routine h2 {
  margin-bottom: 5px;
}

.next-routine span:not(.control-icon) {
  color: var(--muted);
  font-size: 0.78rem;
}

.completion-actions {
  display: grid;
  gap: 8px;
  margin: 16px auto 0;
  max-width: 560px;
}

.completion-actions .button-secondary,
.completion-actions .text-button {
  border-color: rgba(255, 255, 255, 0.35);
  color: white;
}

.reset-zone {
  align-items: center;
  border: 2px solid #d7a19b;
  border-radius: 14px;
  display: grid;
  gap: 12px;
  grid-template-columns: auto 1fr;
  margin-top: 14px;
  padding: 16px;
}

.reset-zone strong {
  font-size: 0.9rem;
}

.reset-zone p {
  margin: 3px 0 0;
}

.reset-zone .control-icon {
  background: #f3d8d4;
  color: var(--red);
}

.reset-zone .danger-button {
  border: 1px solid var(--red);
  border-radius: 10px;
  font-size: 0.8rem;
  grid-column: 1 / -1;
}

@media (min-width: 720px) {
  .table-diagram svg {
    max-height: 620px;
  }

  .topbar {
    padding-left: max(32px, calc((100vw - 1100px) / 2));
    padding-right: max(32px, calc((100vw - 1100px) / 2));
  }

  .hero,
  .page-intro,
  .routine-hero {
    border-radius: 0 0 28px 28px;
    padding-left: 52px;
    padding-right: 52px;
  }

  .hero {
    min-height: 450px;
  }

  .hero-stats {
    max-width: 600px;
  }

  .plan-list,
  .routine-grid,
  .instruction-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .quick-actions {
    grid-template-columns: 1fr 1fr;
  }

  .filter-row {
    grid-template-columns: repeat(3, 1fr);
  }

  .filter-row select:last-child {
    grid-column: auto;
  }

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

  .bottom-nav {
    border: 1px solid var(--line);
    border-radius: 18px;
    bottom: 16px;
    box-shadow: var(--shadow);
    left: 50%;
    max-width: 560px;
    padding: 5px;
    right: auto;
    transform: translateX(-50%);
    width: 560px;
  }

  .active-routine-tray {
    bottom: 88px;
    left: 50%;
    max-width: 560px;
    right: auto;
    transform: translateX(-50%);
    width: calc(100% - 32px);
  }

  .feedback-fab {
    bottom: 24px;
    right: 24px;
  }
}

@media (min-width: 980px) {
  .plan-list,
  .routine-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .coach-card,
  .log-card,
  .settings-card,
  .chart-card {
    margin-left: auto;
    margin-right: auto;
    max-width: 760px;
  }
}

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

  .pulse-dot,
  .toast {
    animation: none;
  }
}
