:root {
  --bg: #0b0b0d;
  --row-bg: #1a1a1d;
  --row-bg-2: #202024;
  --text: #f5f2ee;
  --text-dim: #9a9296;
  --text-faint: #6c666a;
  --coral: #ff5a52;
  --coral-dim: #7a3430;
  --amber: #e0b34d;
  --blue: #4fc3f7;
  --gray: #7a7a7e;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body {
  overflow: hidden;
}

#app {
  height: 100vh;
  height: 100dvh;
  width: 100%;
  position: relative;
}

.view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding-top: calc(var(--safe-top) + 8px);
  padding-bottom: calc(var(--safe-bottom) + 12px);
}

.view[hidden] {
  display: none;
}

/* ---------- topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
}

.brand {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 3px;
  margin: 0;
  color: var(--text);
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  -webkit-user-select: none;
  user-select: none;
}

.icon-btn:active {
  background: rgba(255,255,255,0.06);
}

.icon-btn[aria-pressed="true"] {
  color: var(--coral);
}

.advanced-info {
  margin: 0 16px 4px;
  padding: 10px 14px;
  background: var(--row-bg);
  border-radius: 12px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-dim);
}

/* ---------- editor ---------- */
.total-time-block {
  text-align: center;
  margin: 8px 0 18px;
}

.total-label {
  display: block;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 6px;
}

.total-time {
  display: block;
  font-size: 56px;
  font-weight: 800;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.rows {
  overflow-y: auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.row {
  background: var(--row-bg);
  border-radius: 16px;
  display: flex;
  align-items: center;
  padding: 14px 16px;
  gap: 12px;
}

.row .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.row .label {
  flex: 1;
  font-size: 16px;
  color: var(--text);
}

.stepper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stepper button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--row-bg-2);
  color: var(--text);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.stepper button:active {
  background: #2a2a2e;
}

.stepper .value {
  min-width: 62px;
  text-align: center;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.spacer {
  flex: 0 0 8px;
}

.btn-start {
  margin: 8px 16px 0;
  background: var(--coral);
  color: #17100f;
  border: none;
  border-radius: 20px;
  padding: 18px;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-start:active {
  filter: brightness(0.92);
}

/* ---------- running ---------- */
#view-running {
  padding: 0;
  overflow: hidden;
}

.fill-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--bg);
}

.fill-layer .fill-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0%;
  height: 0%;
  background: var(--coral);
  will-change: height, width;
}

.fill-layer.tint .fill-bar {
  opacity: 0.14;
}

.fill-layer.solid .fill-bar {
  opacity: 0.55;
}

.running-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding-top: calc(var(--safe-top) + 8px);
  padding-bottom: calc(var(--safe-bottom) + 20px);
}

.topbar--running .brand {
  color: var(--text);
  opacity: 0.9;
}

.phase-pill-wrap {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.phase-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text);
}

.phase-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.countdown-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.countdown {
  font-size: 88px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-shadow: 0 2px 24px rgba(0,0,0,0.35);
}

.round-info {
  text-align: center;
  color: var(--text-dim);
  font-size: 15px;
  margin-bottom: 18px;
}

.round-info b {
  color: var(--text);
  font-weight: 700;
}

.btn-pause {
  margin: 0 16px;
}

/* ---------- done ---------- */
.done-content {
  margin: auto;
  text-align: center;
  padding: 24px;
}

.done-content h2 {
  font-size: 28px;
  margin-bottom: 6px;
}

.done-content p {
  color: var(--text-dim);
  margin-bottom: 24px;
}

.done-content .btn-start {
  margin: 0 auto;
  max-width: 220px;
}

/* ---------- landscape running layout ---------- */
@media (orientation: landscape) {
  .running-content {
    flex-direction: column;
    justify-content: space-between;
  }
  .countdown {
    font-size: 22vw;
    line-height: 1;
  }
  .phase-pill-wrap {
    margin-top: 8px;
  }
  .round-info {
    margin-bottom: 8px;
  }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .fill-bar {
    transition: none !important;
  }
}

.fill-bar {
  transition: height 220ms linear, width 220ms linear;
}

/* ---------- desktop two-column (basic, optional) ---------- */
@media (min-width: 820px) and (orientation: landscape) {
  #view-editor.view {
    max-width: 480px;
    margin: 0 auto;
  }
}
