:root {
  --bg: #161616;
  --card: #2a2a2a;
  --card-deep: #222222;
  --text: #f4f4f4;
  --muted: #9a9a9a;
  --faint: #6d6d6d;
  --blue: #4ea3e6;
  --blue-bright: #5bb0f0;
  --green: #3ddc84;
  --input: #3ec4d6;
  --danger: #ff6b4a;
  --chip: #3a3a3a;
  --sheet: #1d1d1d;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  background: #0c0c0c;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
}

.phone {
  max-width: 430px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  padding-bottom: 32px;
  overflow-x: hidden;
  overflow-y: visible;
}

.date-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 12px 6px;
}

.date-label {
  margin: 0;
  color: var(--blue);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.chevron {
  min-width: 48px;
  min-height: 48px;
  color: var(--blue-bright);
  font-size: 1.8rem;
  line-height: 1;
}

.app {
  padding: 4px 0 24px;
  overflow: visible;
}

.session-head {
  padding: 8px 20px 6px;
  position: relative;
}

.session-title {
  margin: 0 36px 8px 0;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.1;
  text-transform: uppercase;
}

.menu-dots {
  position: absolute;
  top: 10px;
  right: 16px;
  width: 36px;
  height: 36px;
  color: #d0d0d0;
  font-size: 1.4rem;
  letter-spacing: 0;
  line-height: 36px;
  text-align: center;
}

.program {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.warmup {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.dot-rule {
  width: 6px;
  height: 6px;
  margin: 8px auto 18px;
  border-radius: 50%;
  background: #f2f2f2;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 12px;
  max-width: 100%;
  overflow-x: hidden;
}

.lift-card {
  display: flex;
  align-items: stretch;
  background: var(--card);
  border-radius: var(--radius);
  overflow-x: hidden;
  min-height: 76px;
  text-align: left;
  width: 100%;
  max-width: 100%;
}

.card-stack {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.card-top {
  display: flex;
  align-items: stretch;
}

.card-header {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 4px 16px 16px;
  text-align: left;
  min-height: 76px;
  cursor: pointer;
}

.expand-caret {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 1.05rem;
  padding: 0 6px;
}

.card-expand {
  padding: 0 8px 16px 10px;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.expand-hint {
  color: var(--faint);
  font-size: 0.78rem;
  font-weight: 600;
}

.card-tempo {
  align-self: center;
  margin-right: 12px;
}

.accent {
  width: 6px;
  flex: 0 0 6px;
}

.card-body {
  flex: 1;
  padding: 16px 8px 16px 16px;
}

.lift-name {
  margin: 0 0 6px;
  font-size: 1.12rem;
  font-weight: 800;
}

.lift-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.card-menu {
  width: 44px;
  color: #c8c8c8;
  font-size: 1.25rem;
  align-self: center;
}

.empty {
  margin: 12px 16px 0;
  padding: 28px 20px;
  background: var(--card);
  border-radius: var(--radius);
  text-align: center;
}

.empty h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
}

.empty p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.note {
  margin: 14px 0 0;
  color: #c5c5c5;
  font-size: 0.95rem;
  line-height: 1.4;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.back-link {
  min-height: 44px;
  color: var(--blue);
  font-weight: 600;
}

.unit-toggle {
  display: flex;
  background: #1a1a1a;
  border-radius: 999px;
  padding: 4px;
}

.unit-toggle button {
  min-width: 52px;
  min-height: 36px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 700;
}

.unit-toggle button.active {
  background: #f3f3f3;
  color: #111;
}

.set-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
  min-width: 0;
  max-width: 100%;
}

.set-row {
  display: grid;
  grid-template-columns: 22px minmax(52px, 0.7fr) minmax(0, 1fr) 48px;
  align-items: center;
  gap: 4px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.comment-btn {
  grid-column: 1 / -1;
  justify-self: start;
  min-height: 40px;
  margin-top: 0;
  padding: 0 4px;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 700;
}

.comment-btn.has {
  color: #f3f3f3;
}

.set-num {
  min-height: 48px;
  color: #d0d0d0;
  font-size: 1.15rem;
  font-weight: 700;
}

.set-num.done {
  color: var(--green);
}

.field {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 0 2px;
  border: 1.5px solid var(--input);
  border-radius: 10px;
  background: transparent;
}

.field legend {
  padding: 0 5px;
  margin-left: 6px;
  color: #b8b8b8;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
}

.field input {
  width: 100%;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: center;
  font-size: 1.05rem;
  font-weight: 600;
  outline: none;
  appearance: none;
}

.weight-box {
  display: flex;
  align-items: center;
  padding: 0 6px 0 2px;
}

.weight-box input {
  flex: 1;
  width: 0;
  min-width: 0;
}

.unit-suffix {
  flex: 0 0 auto;
  padding-right: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.rpe-btn {
  width: 48px;
  height: 48px;
  margin: 0;
  justify-self: end;
  border-radius: 50%;
  background: #0a0a0a;
  box-shadow: inset 0 0 0 2px #2f2f2f;
  font-size: 1.05rem;
  font-weight: 800;
}

.rpe-btn.set {
  box-shadow: inset 0 0 0 2px #f0f0f0;
}

.rpe-btn.hard {
  color: #ffb4a2;
}

.meta-block {
  margin: 28px 16px 0;
}

.meta-block h3 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
}

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

.chip {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--chip);
  color: #d8d8d8;
  font-weight: 600;
}

.chip.active {
  background: var(--blue);
  color: #081018;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.sheet.hidden {
  display: none;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.sheet-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  max-width: 430px;
  margin: 0 auto;
  padding: 22px 18px 28px;
  background: var(--sheet);
  border-radius: 20px 20px 0 0;
}

.sheet-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
}

.sheet-sub {
  margin: 6px 0 16px;
  color: var(--muted);
}

.rpe-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.rpe-choice {
  min-height: 56px;
  border-radius: 12px;
  background: #2c2c2c;
  font-size: 1.15rem;
  font-weight: 800;
}

.rpe-choice.active {
  background: #f3f3f3;
  color: #111;
}

.sheet-clear {
  width: 100%;
  min-height: 48px;
  margin-top: 14px;
  color: var(--muted);
  font-weight: 700;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%);
  max-width: 360px;
  padding: 12px 16px;
  border-radius: 10px;
  background: #3a1f1f;
  color: #ffd4d4;
  z-index: 40;
}

.phone {
  padding-bottom: 0;
}

.tab-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  background: #111;
  border-top: 1px solid #2c2c2c;
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
}

.tab {
  flex: 1;
  min-height: 48px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tab.active {
  color: var(--blue);
}

.tempo-btn {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  background: #1f3d32;
  color: var(--green);
  font-weight: 800;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.overlay.hidden {
  display: none;
}

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

.overlay-card {
  position: relative;
  z-index: 1;
  width: min(400px, calc(100% - 24px));
  margin: 0 0 calc(72px + env(safe-area-inset-bottom));
  padding: 16px 16px 18px;
  background: #242424;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.overlay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.overlay-label {
  margin: 0;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.overlay-x {
  width: 44px;
  height: 44px;
  color: var(--muted);
  font-size: 1.1rem;
}

.overlay-sub {
  margin: 4px 0 0;
  color: var(--muted);
  text-align: center;
}

.overlay-time {
  margin: 8px 0 12px;
  font-size: 3rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.04em;
}

.overlay-btns {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}

.overlay-btns button,
.overlay-btns span {
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  background: #333;
  font-weight: 700;
  line-height: 44px;
}

.stats {
  padding: 0 16px 24px;
}

.stats h2 {
  margin: 0 0 6px;
  font-size: 1.15rem;
}

.stats .muted {
  color: var(--muted);
  margin: 0 0 16px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #2a2a2a;
}

.chart {
  width: 100%;
  height: 180px;
  margin: 8px 0 18px;
}

.delta.up {
  color: var(--green);
}

.delta.down {
  color: var(--danger);
}
