/* ============================================================
   GYM LOGGER · Stylesheet
   Direction: technical instrument · brutalist-precise · dark mode
   Type: Bricolage Grotesque (text) + JetBrains Mono (numbers)
   ============================================================ */

:root {
  /* Tonal scale — warm off-blacks */
  --bg-0: #0a0a0a;
  --bg-1: #121212;
  --bg-2: #1a1a1a;
  --bg-3: #232323;
  --border: #2a2a2a;
  --border-strong: #3a3a3a;

  --fg-0: #fafafa;
  --fg-1: #d4d4d4;
  --fg-2: #8a8a8a;
  --fg-3: #525252;

  /* Amber — the single accent */
  --accent: #eab308;
  --accent-dim: #ca8a04;
  --accent-soft: #eab30814;

  /* Semantic */
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #f87171;

  /* Layout */
  --header-h: 56px;
  --radius: 10px;
  --radius-lg: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* Ensure HTML `hidden` attribute wins over our display:flex utility rules */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--fg-0);
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: contain;
  user-select: none;
  -webkit-user-select: none;
}

/* Allow text selection where it actually matters */
input,
textarea,
[data-selectable] {
  user-select: text;
  -webkit-user-select: text;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
}

input,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: transparent;
  border: none;
  outline: none;
}

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

/* ============================================================
   Header
   ============================================================ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  height: calc(var(--header-h) + var(--safe-top));
  padding: var(--safe-top) 16px 0;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.app-title {
  flex: 1;
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-left: -8px;
  border-radius: 10px;
  color: var(--fg-1);
  transition: background 0.15s;
}
.back-btn:active {
  background: var(--bg-2);
}

.app-nav {
  display: flex;
  gap: 4px;
}
.app-nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--fg-2);
  transition: background 0.15s, color 0.15s;
}
.app-nav a:active {
  background: var(--bg-2);
  color: var(--fg-0);
}

/* ============================================================
   Main view container
   ============================================================ */
main {
  padding: 16px 16px calc(120px + var(--safe-bottom));
  max-width: 720px;
  margin: 0 auto;
}

/* Section headings */
.section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-2);
  margin: 24px 0 10px;
}
.section-title:first-child {
  margin-top: 8px;
}

/* ============================================================
   Home view — day cards
   ============================================================ */
.hero {
  margin: 8px 0 28px;
}
.hero-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.hero-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0;
}
.hero-sub {
  margin-top: 6px;
  color: var(--fg-2);
  font-size: 13px;
}

.day-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.day-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
  text-align: left;
  width: 100%;
}
.day-card:active {
  transform: scale(0.99);
  background: var(--bg-2);
}
.day-card.suggested {
  border-color: var(--accent);
  background: linear-gradient(180deg, var(--accent-soft) 0%, transparent 100%), var(--bg-1);
}

.day-badge {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--bg-2);
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.05em;
  color: var(--fg-1);
}
.day-card.suggested .day-badge {
  background: var(--accent);
  color: var(--bg-0);
}

.day-info {
  flex: 1;
  min-width: 0;
}
.day-info-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.day-info-meta {
  font-size: 12px;
  color: var(--fg-2);
  margin-top: 3px;
}

.day-arrow {
  flex-shrink: 0;
  color: var(--fg-3);
}
.day-card:active .day-arrow,
.day-card.suggested .day-arrow {
  color: var(--accent);
}

/* ============================================================
   Session view
   ============================================================ */
.session-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 20px;
}
.session-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}
.session-elapsed {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  color: var(--fg-2);
  font-variant-numeric: tabular-nums;
}

.exercise-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
  overflow: hidden;
}

.exercise-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
}
.exercise-head:active {
  background: var(--bg-2);
}
.exercise-head-main {
  flex: 1;
  min-width: 0;
}
.exercise-pattern {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--fg-2);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.exercise-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.25;
}
.exercise-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 6px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--fg-2);
  letter-spacing: 0.02em;
}
.exercise-meta strong {
  color: var(--fg-1);
  font-weight: 500;
}

.exercise-completion {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 14px;
  background: var(--bg-3);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-2);
}
.exercise-completion.complete {
  background: var(--accent);
  color: var(--bg-0);
}

.exercise-body {
  padding: 0 16px 14px;
  border-top: 1px solid var(--border);
  margin-top: 0;
}
.exercise-body[hidden] {
  display: none;
}

/* Suggestion line above the sets table */
.suggestion {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  margin: 12px 0;
  background: var(--bg-2);
  border-left: 2px solid var(--accent);
  border-radius: 4px;
  font-size: 12px;
}
.suggestion-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.suggestion-content {
  color: var(--fg-1);
  font-family: "JetBrains Mono", monospace;
}
.suggestion-last {
  color: var(--fg-2);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
}

/* Sets grid */
.sets-grid {
  display: grid;
  grid-template-columns: 28px 1fr 1fr 36px;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
}
.sets-grid-header {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-3);
  text-align: center;
}
.sets-grid-header.align-start {
  text-align: left;
  padding-left: 4px;
}

.set-num {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-2);
  text-align: center;
}
.set-row.complete .set-num {
  color: var(--accent);
}

.set-input {
  display: flex;
  align-items: center;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  height: 44px;
  transition: border-color 0.1s;
}
.set-input:focus-within {
  border-color: var(--accent);
}
.set-input.complete {
  background: var(--bg-1);
  border-color: var(--border);
}
.set-input input {
  width: 100%;
  height: 100%;
  padding: 0 4px 0 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: 16px;
  font-weight: 500;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.set-input input::placeholder {
  color: var(--fg-3);
  font-weight: 400;
}
.set-input .unit {
  padding-right: 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--fg-3);
}

.set-check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--fg-3);
  border: 1px solid var(--border);
  transition: all 0.1s;
}
.set-check:active {
  transform: scale(0.92);
}
.set-row.complete .set-check {
  background: var(--accent);
  color: var(--bg-0);
  border-color: var(--accent);
}

/* Optional note row */
.set-note {
  grid-column: 2 / 5;
  padding-left: 0;
  margin-top: -2px;
  margin-bottom: 4px;
}
.set-note input {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
  background: transparent;
  border-bottom: 1px dashed var(--border);
  color: var(--fg-2);
}
.set-note input::placeholder {
  color: var(--fg-3);
  font-style: italic;
}

/* Action row below the sets */
.exercise-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.btn-ghost {
  flex: 1;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg-2);
  font-size: 12px;
  font-weight: 500;
  transition: all 0.1s;
}
.btn-ghost:active {
  background: var(--bg-2);
  color: var(--fg-0);
}

/* Superset visual link */
.superset-wrapper {
  position: relative;
  padding-left: 14px;
  margin-bottom: 12px;
}
.superset-wrapper::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  background: var(--accent);
  border-radius: 2px;
}
.superset-wrapper .exercise-card {
  margin-bottom: 8px;
}
.superset-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--accent);
  text-transform: uppercase;
  padding: 0 0 4px 0;
}

/* Finish session bar */
.finish-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 8px;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  background: linear-gradient(0deg, var(--bg-0) 60%, transparent);
  z-index: 40;
}
.btn-finish {
  flex: 1;
  height: 52px;
  background: var(--accent);
  color: var(--bg-0);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: transform 0.05s;
}
.btn-finish:active {
  transform: scale(0.98);
}
.btn-finish:disabled {
  background: var(--bg-3);
  color: var(--fg-3);
}
.btn-abort {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  color: var(--danger);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.05s;
}
.btn-abort:active {
  background: var(--bg-3);
  transform: scale(0.96);
}

/* History detail delete action */
.detail-actions {
  margin-top: 24px;
  padding-bottom: 8px;
}
.btn-danger-full {
  width: 100%;
  height: 48px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--danger);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s, border-color 0.15s;
}
.btn-danger-full:active {
  background: var(--bg-2);
  border-color: var(--danger);
}

/* ============================================================
   Timer bar (floating, persistent during session)
   ============================================================ */
.timer-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(76px + var(--safe-bottom));
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.2s ease-out;
}
@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.timer-bar.expired {
  background: var(--accent);
  border-color: var(--accent);
  animation: pulse 0.6s ease-in-out infinite alternate;
}
@keyframes pulse {
  from {
    box-shadow: 0 8px 32px rgba(234, 179, 8, 0.3);
  }
  to {
    box-shadow: 0 8px 48px rgba(234, 179, 8, 0.7);
  }
}
.timer-bar.expired .timer-label,
.timer-bar.expired .timer-display,
.timer-bar.expired .timer-btn {
  color: var(--bg-0);
}
.timer-bar.expired .timer-dot {
  background: var(--bg-0);
}

.timer-label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--fg-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.timer-dot {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: var(--accent);
  animation: blink 1s ease-in-out infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.timer-display {
  font-family: "JetBrains Mono", monospace;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  min-width: 64px;
  text-align: center;
}
.timer-actions {
  display: flex;
  gap: 4px;
}
.timer-btn {
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--bg-3);
  color: var(--fg-1);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  transition: background 0.1s;
}
.timer-btn:active {
  background: var(--bg-0);
}
.timer-skip {
  background: var(--bg-0);
}

/* ============================================================
   History view
   ============================================================ */
.history-day-filter {
  display: flex;
  gap: 6px;
  margin: 4px 0 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.history-day-filter::-webkit-scrollbar {
  display: none;
}
.filter-chip {
  flex-shrink: 0;
  height: 32px;
  padding: 0 14px;
  border-radius: 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--fg-1);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.1s;
}
.filter-chip.active {
  background: var(--accent);
  color: var(--bg-0);
  border-color: var(--accent);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.history-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  text-align: left;
}
.history-card:active {
  background: var(--bg-2);
}
.history-date {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 48px;
}
.history-date-day {
  font-family: "JetBrains Mono", monospace;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  color: var(--fg-0);
}
.history-date-month {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-2);
  margin-top: 3px;
}
.history-body {
  flex: 1;
  min-width: 0;
}
.history-body-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-body-meta {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--fg-2);
  margin-top: 2px;
}

/* History detail */
.history-detail-section {
  margin-bottom: 18px;
  padding: 12px 14px;
  background: var(--bg-1);
  border-radius: var(--radius);
}
.history-detail-exercise-name {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 6px;
}
.history-detail-sets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--fg-1);
}
.history-detail-set {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
}
.history-detail-set .reps {
  color: var(--fg-2);
}
.history-detail-note {
  margin-top: 8px;
  padding-left: 8px;
  border-left: 2px solid var(--border);
  font-size: 11px;
  color: var(--fg-2);
  font-style: italic;
}

/* ============================================================
   Analytics view
   ============================================================ */
.analytics-picker {
  margin: 4px 0 18px;
}
.select-styled {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg-0);
  font-size: 14px;
  font-weight: 500;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1l5 5 5-5' stroke='%238a8a8a' stroke-width='1.5' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.chart-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 14px;
}
.chart-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-1);
  margin: 0 0 12px;
  letter-spacing: 0.02em;
}
.chart-canvas-wrap {
  position: relative;
  height: 200px;
}

.pr-table {
  width: 100%;
  margin-top: 12px;
  border-collapse: collapse;
}
.pr-table th,
.pr-table td {
  padding: 10px 0;
  text-align: left;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
}
.pr-table th {
  font-weight: 500;
  color: var(--fg-2);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.pr-table td {
  color: var(--fg-0);
  border-bottom: 1px solid var(--border);
}
.pr-table td.value-cell {
  text-align: right;
  font-weight: 600;
}
.pr-table td.date-cell {
  color: var(--fg-2);
  font-size: 11px;
  text-align: right;
}

/* Empty states */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--fg-2);
}
.empty-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 16px;
  border-radius: 14px;
  background: var(--bg-1);
  color: var(--fg-3);
}
.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg-1);
  margin: 0 0 6px;
}
.empty-state-text {
  font-size: 13px;
  color: var(--fg-2);
}

/* ============================================================
   Settings view
   ============================================================ */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.settings-item {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.settings-item-info {
  flex: 1;
  min-width: 0;
}
.settings-item-label {
  font-size: 14px;
  font-weight: 500;
  margin: 0;
}
.settings-item-desc {
  font-size: 12px;
  color: var(--fg-2);
  margin-top: 3px;
}

.btn-primary {
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--bg-0);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.btn-primary:active {
  transform: scale(0.97);
}
.btn-danger {
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
}

/* Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-track {
  position: absolute;
  inset: 0;
  background: var(--bg-3);
  border-radius: 13px;
  transition: background 0.15s;
}
.switch-track::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  background: var(--fg-1);
  border-radius: 10px;
  transition: transform 0.15s, background 0.15s;
}
.switch input:checked + .switch-track {
  background: var(--accent);
}
.switch input:checked + .switch-track::after {
  background: var(--bg-0);
  transform: translateX(18px);
}

/* ============================================================
   Modal / bottom sheet
   ============================================================ */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  animation: fadeIn 0.15s;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 101;
  max-height: 80vh;
  background: var(--bg-1);
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  padding: 20px 16px calc(20px + var(--safe-bottom));
  animation: slideUp 0.25s ease-out;
  overflow-y: auto;
}
.sheet-handle {
  width: 32px;
  height: 4px;
  background: var(--border-strong);
  border-radius: 2px;
  margin: -8px auto 16px;
}
.sheet-title {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 14px;
}
.sheet-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sheet-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px;
  border-radius: 10px;
  background: var(--bg-2);
  border: none;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  width: 100%;
}
.sheet-option:active {
  background: var(--bg-3);
}
.sheet-option-icon {
  flex-shrink: 0;
  color: var(--fg-3);
}
.sheet-cancel {
  width: 100%;
  margin-top: 12px;
  height: 48px;
  background: var(--bg-2);
  border-radius: 10px;
  font-weight: 500;
  font-size: 14px;
  color: var(--fg-1);
}

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed;
  bottom: calc(20px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  padding: 12px 18px;
  background: var(--fg-0);
  color: var(--bg-0);
  border-radius: 24px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.2s ease-out;
}
@keyframes toastIn {
  from {
    transform: translate(-50%, 20px);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

/* ============================================================
   Helpers
   ============================================================ */
.muted { color: var(--fg-2); }
.mono { font-family: "JetBrains Mono", monospace; font-variant-numeric: tabular-nums; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Reduce timer pulse when user prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
