:root {
  --bg: #0b0f0d;
  --bg2: #141a16;
  --bg3: #1c2420;
  --text: #f4f7f2;
  --muted: #8b9a90;
  --accent: #b8f255;
  --accent-dim: rgba(184, 242, 85, 0.14);
  --accent-press: #9fd63a;
  --warn: #ffb020;
  --danger: #ff5c5c;
  --line: rgba(255, 255, 255, 0.08);
  --radius: 20px;
  --font: "Outfit", "SF Pro Display", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(900px 500px at 80% -10%, rgba(184, 242, 85, 0.12), transparent 55%),
    radial-gradient(700px 400px at 0% 20%, rgba(60, 120, 90, 0.18), transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
}

body {
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body.resting,
body.go-flash {
  overflow: hidden;
}

body.resting #app,
body.go-flash #app {
  visibility: hidden;
  pointer-events: none;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-family: inherit;
}

.icon-btn:active {
  background: var(--bg3);
}

.accent-text {
  color: var(--accent) !important;
  border-color: rgba(184, 242, 85, 0.35) !important;
}

.danger-text {
  color: var(--danger) !important;
}

#app {
  max-width: 440px;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px
    max(24px, env(safe-area-inset-bottom));
}

.view[hidden] {
  display: none !important;
}

.brand {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  font-size: clamp(1.85rem, 7vw, 2.35rem);
  line-height: 1.05;
  margin: 0 0 6px;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.sub,
.target,
.status {
  color: var(--muted);
  margin: 0 0 16px;
  font-size: 0.98rem;
}

.sticky-now {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: -18px -18px 14px;
  padding: max(14px, env(safe-area-inset-top)) 18px 14px;
  background: linear-gradient(180deg, rgba(11, 15, 13, 0.98), rgba(11, 15, 13, 0.92));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.sticky-now-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.sticky-now h1 {
  font-size: clamp(1.55rem, 6.5vw, 2rem);
  margin-bottom: 4px;
}

.now-target {
  margin: 0;
  color: var(--accent);
  font-weight: 700;
  font-size: 1.05rem;
}

.now-set {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 650;
  font-size: 0.95rem;
}

.row-inline {
  flex-direction: row !important;
  align-items: center;
}

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

.top-actions,
.ex-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

.ex-nav {
  flex-direction: row;
  justify-content: space-between;
  margin-bottom: 14px;
}

.list {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  display: grid;
  gap: 10px;
}

.list li {
  background: linear-gradient(180deg, var(--bg3), var(--bg2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.list .ex-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.list .ex-name {
  font-weight: 700;
}

.list .meta {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 14px 18px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  color: var(--text);
  background: var(--bg3);
}

.btn.sm {
  padding: 10px 14px;
  font-size: 0.88rem;
}

.btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: #10140c;
}

.btn.primary:active {
  background: var(--accent-press);
}

.btn.huge {
  width: 100%;
  min-height: 74px;
  font-size: 1.28rem;
  border-radius: 22px;
  margin-top: 10px;
}

.btn.ghost {
  background: transparent;
}

.btn.wide {
  width: 100%;
  margin-top: 10px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

#login-form {
  display: grid;
  gap: 12px;
}

input,
textarea {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text);
  padding: 16px;
  font-size: 1.1rem;
  font-family: inherit;
  user-select: text;
}

.rep-input {
  font-size: 3.6rem;
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.02em;
  min-height: 104px;
  margin-bottom: 4px;
  border-radius: 24px;
  background: var(--bg3);
}

.hold-display {
  font-variant-numeric: tabular-nums;
  font-size: clamp(3.2rem, 18vw, 4.6rem);
  font-weight: 800;
  text-align: center;
  letter-spacing: -0.04em;
  margin: 4px 0 8px;
}

.field-label {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.set-block {
  margin-bottom: 14px;
}

.set-rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.set-chip {
  flex: 0 0 auto;
  min-width: 72px;
  min-height: 72px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text);
  font-family: inherit;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
}

.set-chip .n {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 700;
}

.set-chip .v {
  font-size: 1.35rem;
  font-weight: 800;
}

.set-chip.active {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 0 1px rgba(184, 242, 85, 0.35);
}

.set-chip.done .v {
  color: var(--accent);
}

.panel {
  margin-top: 4px;
}

.work-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 16px;
}

.row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.row .btn {
  flex: 1;
}

.timer-row .btn {
  min-height: 52px;
}

.overview {
  margin-top: 18px;
  display: grid;
  gap: 8px;
}

.overview-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  background: var(--bg2);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  text-align: left;
  width: 100%;
}

.overview-card.current {
  border-color: rgba(184, 242, 85, 0.45);
  background: var(--accent-dim);
}

.overview-card .name {
  font-weight: 700;
}

.overview-card .meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.finish-summary {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.finish-summary .row-item {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}

.finish-summary strong {
  display: block;
  margin-bottom: 4px;
}

.finish-summary span {
  color: var(--muted);
  font-size: 0.95rem;
}

.error {
  color: var(--danger);
  margin-top: 14px;
}

textarea {
  min-height: 120px;
  resize: vertical;
  margin-bottom: 8px;
}

/* Full-screen rest */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  width: 100%;
  min-height: 100%;
  min-height: 100dvh;
  background: #0b0f0d;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) 20px
    max(28px, env(safe-area-inset-bottom));
}

.overlay[hidden] {
  display: none !important;
}

.overlay-inner {
  width: min(440px, 100%);
}

.overlay .rest-label {
  text-align: center;
  color: var(--muted);
  margin: 8px 0 0;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.overlay .rest-next {
  text-align: center;
  margin: 8px 0 0;
  color: var(--text);
  font-weight: 650;
  font-size: 1.05rem;
}

.overlay .brand {
  text-align: center;
}

.timer {
  font-variant-numeric: tabular-nums;
  font-size: clamp(4.2rem, 24vw, 6.2rem);
  font-weight: 800;
  text-align: center;
  margin: 18px 0 14px;
  letter-spacing: -0.04em;
  line-height: 1;
}

.timer-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-bottom: 18px;
}

.timer-fill {
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform-origin: left center;
  transition: transform 0.08s linear;
}

.overlay.urgent {
  background: #120e08;
}

.overlay.urgent .timer {
  color: var(--warn);
  animation: pulse-urgent 0.7s ease-in-out infinite;
}

.overlay.urgent .timer-fill {
  background: var(--warn);
}

@keyframes pulse-urgent {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.03);
  }
}

/* GO flash */
.go-overlay {
  background: #0b0f0d;
  z-index: 110;
}

.go-burst {
  text-align: center;
  animation: go-pop 0.45s cubic-bezier(0.2, 1.4, 0.3, 1);
}

.go-kicker {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.95rem;
}

.go-word {
  margin: 8px 0;
  font-size: clamp(5rem, 28vw, 8rem);
  font-weight: 800;
  letter-spacing: -0.05em;
  color: var(--accent);
  line-height: 0.9;
}

.go-exercise {
  margin: 4px 0 8px;
  font-size: clamp(1.6rem, 7vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.go-detail {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 650;
}

.go-hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.go-burst .btn.huge {
  margin-top: 22px;
}

.exit-overlay {
  z-index: 120;
  background: rgba(11, 15, 13, 0.92);
  align-items: flex-end;
}

.exit-sheet {
  width: min(440px, 100%);
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 28px 28px 0 0;
  padding: 22px 18px max(22px, env(safe-area-inset-bottom));
}

.exit-sheet h2 {
  margin: 0 0 8px;
  font-size: 1.45rem;
}

.exit-sheet .sub {
  margin-bottom: 14px;
  line-height: 1.45;
}

@keyframes go-pop {
  from {
    transform: scale(0.7);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
