:root {
  --bg: #f4f1ec;
  --bg2: #ede9e2;
  --card: #ffffff;
  --teal: #0a8f9c;
  --teal-dark: #077380;
  --teal-soft: #d6f2f5;
  --coral: #e8534a;
  --coral-soft: #fdf0ef;
  --yellow: #e8a020;
  --yellow-soft: #fef8ec;
  --green: #2a8a5a;
  --green-soft: #eaf6f0;
  --navy: #1a2236;
  --navy2: #2d3a52;
  --gray: #6b7280;
  --gray-light: #9ca3af;
  --light: #ede9e2;
  --line: #e8e3db;
  --shadow-sm: 0 1px 4px rgba(26, 34, 54, .07);
  --shadow: 0 2px 16px rgba(26, 34, 54, .10);
  --shadow-lg: 0 8px 32px rgba(26, 34, 54, .14);
  --r-sm: 8px;
  --r: 14px;
  --r-lg: 20px;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "DM Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--navy);
  font-family: var(--font);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
input, select, textarea {
  width: 100%;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  color: var(--navy);
  padding: 10px 12px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); outline-offset: 1px; }
textarea { min-height: 76px; resize: vertical; }

.app {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  padding-bottom: 92px;
  position: relative;
}
.view { display: none; padding: 16px; }
.view.active { display: block; }
.hero {
  background: linear-gradient(135deg, var(--teal), #0891a0);
  color: #fff;
  padding: 20px 20px 28px;
  border-radius: 0 0 24px 24px;
  margin-bottom: 18px;
}
.eyebrow { font-size: 13px; opacity: .82; margin-bottom: 3px; }
.hero h1 {
  font-size: 28px;
  line-height: 1.05;
  margin: 0 0 16px;
  font-weight: 900;
  letter-spacing: 0;
}
.hero-actions, .grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.card, .boulder-card {
  background: var(--card);
  border: 1px solid #f0f0f0;
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}
.boulder-card {
  border-color: var(--line);
  box-shadow: none;
  display: grid;
  gap: 8px;
}
.section-title {
  font-size: 20px;
  font-weight: 900;
  margin: 0 0 14px;
  color: var(--navy);
}
.sub-title {
  font-size: 14px;
  font-weight: 800;
  margin: 0 0 10px;
  color: var(--navy);
}
.muted, .tiny {
  color: var(--gray);
  line-height: 1.4;
}
.muted { font-size: 13px; }
.tiny { font-size: 11px; }
.btn {
  border: 0;
  border-radius: 12px;
  padding: 11px 16px;
  background: var(--teal);
  color: #fff;
  font-weight: 900;
  transition: transform .14s ease, background .14s ease;
}
.btn:hover { background: var(--teal-dark); transform: translateY(-1px); }
.btn.coral { background: var(--coral); }
.btn.navy { background: var(--navy); }
.btn.ghost { background: transparent; color: var(--teal); border: 1.5px solid var(--teal); }
.btn.subtle { background: var(--light); color: var(--navy); }
.btn.danger { background: var(--coral-soft); color: var(--coral); border: 1.5px solid var(--coral); }
.stat-card { text-align: center; padding: 12px 8px; }
.stat-icon { font-size: 22px; line-height: 1; margin-bottom: 5px; }
.stat-value { font-size: 22px; line-height: 1.05; font-weight: 900; color: var(--teal); }
.stat-label { color: var(--gray); font-size: 10px; line-height: 1.2; margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  border: 1.5px solid #e5e7eb;
  border-radius: 999px;
  background: #f9fafb;
  color: var(--gray);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 800;
}
.chip.active { background: var(--teal); border-color: var(--teal); color: #fff; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice {
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
  color: var(--gray);
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 900;
}
.choice.active.flash { border-color: var(--yellow); color: #9a6b00; background: #fff8dc; }
.choice.active.top { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.choice.active.project { border-color: var(--teal); color: var(--teal); background: var(--teal-soft); }
.choice.active.fail { border-color: var(--coral); color: var(--coral); background: var(--coral-soft); }
.field { margin-bottom: 14px; }
.field label, .field-title {
  display: block;
  margin-bottom: 7px;
  color: var(--gray);
  font-size: 12px;
  font-weight: 800;
}
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper button {
  width: 36px; height: 36px; border-radius: 10px; border: 1.5px solid #e5e7eb;
  background: #f9fafb; color: var(--navy); font-size: 20px; font-weight: 900;
}
.stepper strong { min-width: 32px; text-align: center; font-size: 24px; font-weight: 900; }
.stars { display: flex; gap: 3px; }
.star { border: 0; background: transparent; color: #d1d5db; font-size: 22px; line-height: 1; padding: 0 1px; }
.star.active { color: var(--yellow); }
.boulder-list { display: grid; gap: 10px; margin: 12px 0; }
.grade-badge {
  min-width: 48px;
  border-radius: 10px;
  padding: 7px 10px;
  background: var(--teal);
  color: #fff;
  text-align: center;
  font-weight: 900;
  font-size: 16px;
}
.result-text { color: var(--teal); font-weight: 900; font-size: 13px; }
.progress-row {
  display: grid;
  grid-template-columns: 34px 1fr 64px;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid #f3f4f6;
}
.bar { height: 8px; background: #f0f0f0; border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--teal); border-radius: inherit; }
.set-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdf8;
  margin-bottom: 10px;
}
.set-row .field { margin-bottom: 0; }
.strength-name-field { position: relative; width: 100%; margin-bottom: 0; }
.suggestions {
  display: none;
  gap: 4px;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 15;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}
.suggestion-btn {
  border: 0;
  border-radius: 8px;
  background: var(--light);
  color: var(--navy);
  padding: 8px 10px;
  text-align: left;
  font-size: 13px;
  font-weight: 800;
}
.strength-picker { align-items: flex-start; }
#strengthView input { min-width: 0; max-width: 100%; }
.set-pill {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  border-radius: 999px;
  background: var(--light);
  color: var(--navy);
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 800;
  margin: 3px 4px 3px 0;
}
.export-box {
  min-height: 260px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, 480px);
  display: flex;
  background: var(--card);
  border-top: 1px solid #f0f0f0;
  box-shadow: 0 -2px 12px rgba(31, 42, 68, .08);
  padding: 8px 0 16px;
  z-index: 20;
}
.bottom-nav.is-hidden { display: none; }
.nav-btn {
  flex: 1;
  display: grid;
  gap: 3px;
  place-items: center;
  border: 0;
  background: transparent;
  color: #9ca3af;
  font-size: 10px;
  font-weight: 800;
  padding: 4px 0;
}
.nav-btn span { font-size: 19px; line-height: 1; }
.nav-btn.active { color: var(--teal); }
.empty { padding: 32px 16px; text-align: center; color: var(--gray); font-size: 13px; }
.auth-message {
  min-height: 20px;
  margin: 10px 0 0;
  border-radius: 10px;
  padding: 9px 10px;
  display: none;
  font-weight: 800;
}
.auth-message.is-visible { display: block; }
.auth-message.is-error { background: var(--coral-soft); color: var(--coral); }
.auth-message.is-success { background: var(--green-soft); color: var(--green); }
.auth-message.is-info { background: var(--teal-soft); color: var(--teal-dark); }
.logout-row { margin-top: 12px; }
.logout-row .btn { width: 100%; color: #fff; border-color: rgba(255, 255, 255, .72); }
dialog {
  border: 0;
  border-radius: 18px;
  padding: 0;
  background: transparent;
  max-width: min(94vw, 450px);
}
dialog::backdrop { background: rgba(31, 42, 68, .35); }
@media (max-width: 420px) {
  .grid-3, .hero-actions, .grid-2, .choice-grid, .set-row { grid-template-columns: 1fr; }
  .between { display: grid; }
}

/* Visual redesign inspired by home-playground.html. Logic and selectors used by JS stay intact. */
input, select, textarea {
  border-color: var(--line);
  border-radius: var(--r-sm);
  background: var(--card);
  padding: 11px 13px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(10, 143, 156, .12);
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
textarea { min-height: 80px; }

.app {
  background: var(--bg);
  padding-bottom: 96px;
}
.view { padding: 16px; }
.home-view { padding: 0 0 8px; }

.hero,
.screen-hero {
  position: relative;
  overflow: hidden;
  background: var(--navy);
  color: #fff;
  border-radius: 0 0 28px 28px;
}
.hero::before,
.screen-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 140% 90% at 110% -20%, rgba(10, 143, 156, .45) 0%, transparent 65%),
    radial-gradient(ellipse 80% 60% at -20% 120%, rgba(232, 83, 74, .2) 0%, transparent 60%);
  pointer-events: none;
}
.hero > *,
.screen-hero > * {
  position: relative;
  z-index: 1;
}
.hero {
  padding: 24px 20px 32px;
  margin: -16px -16px 20px;
}
.auth-view .hero { margin-top: -16px; }
.eyebrow,
.screen-eyebrow {
  margin: 0 0 5px;
  color: rgba(255, 255, 255, .62);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: 1;
}
.hero h1 {
  margin: 0 0 20px;
  font-size: 32px;
  line-height: 1;
  font-weight: 800;
}
.screen-hero {
  padding: 22px 18px 26px;
  margin: -16px -16px 18px;
}
.screen-hero .section-title {
  margin: 0;
  color: #fff;
  font-size: 26px;
  line-height: 1.05;
}

.card,
.boulder-card {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  margin-bottom: 12px;
}
.boulder-card {
  border-radius: var(--r);
  gap: 10px;
}
.section-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0;
}
.sub-title {
  color: var(--gray);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.muted { color: var(--gray); line-height: 1.5; }
.tiny { color: var(--gray); line-height: 1.4; }

.btn {
  border-radius: var(--r-sm);
  padding: 12px 16px;
  background: var(--teal);
  font-size: 14px;
  font-weight: 700;
  transition: transform .12s, opacity .12s, background .12s;
}
.btn:hover { opacity: .88; transform: translateY(-1px); background: var(--teal); }
.btn:active { transform: translateY(0) scale(.98); }
.btn.coral { background: var(--coral); }
.btn.navy { background: var(--navy2); }
.btn.ghost {
  background: transparent;
  border: 1.5px solid var(--teal);
  color: var(--teal);
}
.btn.subtle { background: var(--bg2); color: var(--navy); }
.btn.danger {
  background: var(--coral-soft);
  border-color: rgba(232, 83, 74, .3);
  color: var(--coral);
}

.chip {
  border-color: var(--line);
  background: var(--bg2);
  color: var(--gray);
  font-weight: 600;
  transition: all .12s;
}
.chip.active {
  background: var(--navy);
  border-color: var(--navy);
}
.choice {
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg2);
  font-weight: 700;
}
.choice.active.flash { border-color: var(--yellow); color: #7a5000; background: var(--yellow-soft); }
.choice.active.project { background: var(--teal-soft); }

.field label,
.field-title {
  color: var(--gray);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.stepper button {
  border-color: var(--line);
  border-radius: var(--r-sm);
  background: var(--bg2);
}
.grade-badge {
  border-radius: var(--r-sm);
  background: var(--navy);
}
.set-row {
  gap: 10px;
  padding: 12px;
  border-radius: var(--r);
  background: var(--bg2);
}
.suggestions {
  border-radius: var(--r-sm);
  background: var(--card);
  box-shadow: var(--shadow);
}
.suggestion-btn {
  border-radius: 6px;
  background: var(--bg2);
  font-weight: 600;
}
.set-pill {
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--navy2);
  font-weight: 600;
}
.export-box {
  min-height: 280px;
  background: var(--bg2);
  color: var(--navy2);
  font-family: var(--mono);
}

.bottom-nav {
  background: rgba(255, 255, 255, .92);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 20px rgba(26, 34, 54, .07);
  padding: 8px 0 18px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.nav-btn {
  color: var(--gray-light);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  transition: color .15s;
}
.nav-btn span { transition: transform .15s; }
.nav-btn.active { color: var(--teal); }
.nav-btn.active span { transform: scale(1.1); }

.auth-card {
  margin-top: 0;
}
.auth-message {
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
}
.auth-message.is-error { border: 1px solid rgba(232, 83, 74, .2); }
.auth-message.is-success { border: 1px solid rgba(42, 138, 90, .2); }
.auth-message.is-info { border: 1px solid rgba(10, 143, 156, .2); }

.home-hero {
  position: relative;
  overflow: hidden;
  padding: 24px 20px 28px;
  border-radius: 0 0 28px 28px;
  background: var(--navy);
  color: #fff;
}
.home-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 140% 90% at 110% -20%, rgba(10, 143, 156, .45) 0%, transparent 65%),
    radial-gradient(ellipse 80% 60% at -20% 120%, rgba(232, 83, 74, .2) 0%, transparent 60%);
  pointer-events: none;
}
.home-hero-content {
  position: relative;
  z-index: 1;
}
.home-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.home-eyebrow {
  margin: 0 0 5px;
  color: rgba(255, 255, 255, .62);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.home-title {
  margin: 0;
  color: #fff;
  font-size: 34px;
  line-height: 1;
  font-weight: 800;
}
.home-logout {
  flex: 0 0 auto;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  background: rgba(255, 255, 255, .10);
  padding: 8px 12px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.home-hero-grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 10px;
}
.home-hero-card {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, .10);
  padding: 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .12);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.home-hero-card.home-wide {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}
.home-label {
  margin: 0 0 5px;
  color: var(--gray);
  font-size: 10px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.home-hero-card .home-label { color: rgba(255, 255, 255, .62); }
.home-value {
  margin: 0;
  color: var(--navy);
  font-size: 24px;
  line-height: 1;
  font-weight: 800;
}
.home-hero-card .home-value { color: #fff; }
.home-value-small {
  font-size: 16px;
  line-height: 1.25;
}
.home-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border-radius: 999px;
  padding: 7px 11px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.home-hero-card .home-pill {
  background: rgba(214, 242, 245, .18);
  color: #fff;
}
.home-section {
  padding: 0 16px;
  margin-top: 18px;
}
.home-actions {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 16px;
  margin-top: -12px;
}
.home-action {
  min-width: 0;
  min-height: 108px;
  border-radius: var(--r-lg);
  padding: 15px;
  text-align: left;
  color: #fff;
  box-shadow: var(--shadow-lg);
}
.home-action:active { transform: scale(.98); }
.home-action-primary { background: linear-gradient(145deg, var(--teal), var(--teal-dark)); }
.home-action-secondary { background: linear-gradient(145deg, var(--coral), #c83f38); }
.home-action-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  margin-bottom: 13px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .18);
  font-family: var(--mono);
  font-size: 18px;
}
.home-action-title {
  display: block;
  margin-bottom: 5px;
  font-size: 15px;
  line-height: 1.15;
  font-weight: 800;
}
.home-action-copy {
  display: block;
  color: rgba(255, 255, 255, .78);
  font-size: 12px;
  line-height: 1.3;
  font-weight: 500;
}
.home-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.home-section-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 800;
}
.home-section-note {
  color: var(--gray-light);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.home-card {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.home-range-card,
.home-insight {
  padding: 15px;
}
.home-range-card #customRange {
  margin-top: 12px;
}
.home-week-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.home-week-stat {
  min-width: 0;
  border-radius: var(--r);
  padding: 12px 10px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.home-week-stat strong {
  display: block;
  margin-bottom: 4px;
  color: var(--teal);
  font-size: 22px;
  line-height: 1;
  font-weight: 800;
}
.home-week-stat span {
  display: block;
  color: var(--gray);
  font-size: 10px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.home-list {
  display: grid;
  gap: 10px;
}
.home-entry {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.home-entry-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
}
.home-entry-mark-strength {
  background: var(--coral-soft);
  color: var(--coral);
}
.home-entry-main { min-width: 0; }
.home-entry-title {
  margin: 0 0 3px;
  overflow-wrap: anywhere;
  color: var(--navy);
  font-size: 14px;
  line-height: 1.25;
  font-weight: 800;
}
.home-entry-meta {
  margin: 0;
  color: var(--gray);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 500;
}
.home-entry-score {
  color: var(--green);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.home-insight {
  margin-bottom: 18px;
  background: linear-gradient(180deg, rgba(253, 240, 239, .86), rgba(255, 255, 255, .96)), var(--card);
}
.home-insight-top {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: flex-start;
}
.home-insight-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--r);
  background: var(--coral);
  color: #fff;
  font-family: var(--mono);
  font-size: 18px;
}
.home-insight-title {
  margin: 0 0 4px;
  color: var(--navy);
  font-size: 15px;
  line-height: 1.25;
  font-weight: 800;
}
.home-muted {
  margin: 0;
  color: var(--gray);
  font-size: 13px;
  line-height: 1.45;
  font-weight: 500;
}
.strength-summary {
  display: grid;
  gap: 10px;
}
.strength-summary .grid-2 {
  gap: 8px;
}

dialog {
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}
dialog .card {
  margin: 0;
  border-radius: var(--r-lg);
}
dialog::backdrop {
  background: rgba(26, 34, 54, .4);
  backdrop-filter: blur(4px);
}

@media (max-width: 420px) {
  .home-hero-grid,
  .home-actions {
    grid-template-columns: 1fr 1fr;
  }
  .home-week-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .home-hero-card.home-wide {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 360px) {
  .view { padding-left: 12px; padding-right: 12px; }
  .hero,
  .screen-hero {
    margin-left: -12px;
    margin-right: -12px;
  }
  .home-hero { padding-inline: 16px; }
  .home-title { font-size: 30px; }
  .home-actions,
  .home-hero-grid,
  .home-week-grid {
    grid-template-columns: 1fr;
  }
  .home-action { min-height: 94px; }
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  position: relative;
  overscroll-behavior-x: none;
}

.app,
.view,
.card,
.boulder-card,
.home-view,
.home-section,
.home-hero,
.home-actions,
.screen-hero,
.bottom-nav,
dialog,
form {
  max-width: 100%;
}

.app {
  width: 100%;
  overflow-x: hidden;
  padding-bottom: calc(118px + env(safe-area-inset-bottom));
}

.view {
  overflow-x: hidden;
  padding-bottom: calc(112px + env(safe-area-inset-bottom));
}

.home-view {
  padding-bottom: calc(112px + env(safe-area-inset-bottom));
}

.grid-2,
.grid-3,
.choice-grid,
.set-row,
.home-hero-grid,
.home-actions,
.home-week-grid,
.home-entry,
.between,
.row,
.strength-picker,
.chips {
  min-width: 0;
}

.card,
.boulder-card,
.home-card,
.home-entry,
.home-hero-card,
.set-row,
.suggestions,
.field,
.strength-name-field {
  min-width: 0;
  overflow-wrap: anywhere;
}

.row {
  flex-wrap: wrap;
}

.between {
  min-width: 0;
}

.between > *,
.row > *,
.home-entry-main {
  min-width: 0;
}

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

input,
select,
textarea {
  scroll-margin-bottom: calc(150px + env(safe-area-inset-bottom));
}

#sessionForm,
#strengthForm,
#boulderForm,
.export-view .card,
.auth-card {
  padding-bottom: 20px;
}

#strengthExercises,
#bouldersPreview,
#historyList,
#strengthHistoryList,
#recentSessions,
#strengthDashboard {
  max-width: 100%;
  overflow-x: hidden;
}

.bottom-nav {
  width: min(100%, 480px);
  max-width: 100%;
  left: 50%;
  right: auto;
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
}

body:has(input:focus),
body:has(textarea:focus),
body:has(select:focus) {
  --keyboard-nav-offset: calc(100% + env(safe-area-inset-bottom));
}

body:has(input:focus) .bottom-nav,
body:has(textarea:focus) .bottom-nav,
body:has(select:focus) .bottom-nav {
  transform: translate(-50%, var(--keyboard-nav-offset));
}
