/* Jitsuka Timer — cronómetro de asaltos
   Identidad visual basada en la web de Jitsuka:
   papel, tinta, rojo Jitsuka, Archivo + Instrument Serif. */

/* Fonts */
@font-face {
  font-family: "Archivo";
  src: url("assets/fonts/archivo-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 75% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("assets/fonts/instrument-serif-italic-latin.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

/* Tokens */
:root {
  --paper: #f3eee6;
  --paper-deep: #e8dfd2;
  --paper-soft: #faf7f1;
  --ink: #13110e;
  --ink-soft: #1b1814;
  --dark: #0f0d0b;
  --cream: #f6f0e7;
  --muted: #6b6258;
  --muted-dim: #75695d;
  --red: #ec2625;
  --red-deep: #b7191b;
  --red-dark: #8f1215;
  --red-soft: #f6d2ce;
  --green: #1b6b3f;
  --line: rgba(19, 17, 14, 0.14);
  --line-strong: rgba(19, 17, 14, 0.25);
  --line-light: rgba(246, 240, 231, 0.16);
  --line-light-strong: rgba(246, 240, 231, 0.28);
  --accent: var(--red);
  --accent-text: var(--red-deep);
  --accent-light: #ff8a82;
  --font-sans: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --font-mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --radius: 3px;
  --ring-length: 1369.73;
  color-scheme: light;
}

/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-width: 300px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(1000px 700px at 88% -8%, rgba(236, 38, 37, 0.07), transparent 64%),
    radial-gradient(900px 700px at 0% 106%, rgba(19, 17, 14, 0.045), transparent 62%),
    var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  position: fixed;
  right: clamp(-220px, -10vw, -70px);
  bottom: -27vh;
  z-index: 0;
  width: min(54vw, 690px);
  aspect-ratio: 1;
  background: url("assets/brand/jitsuka-mark.webp") center / contain no-repeat;
  opacity: 0.026;
  transform: rotate(-8deg);
  pointer-events: none;
  content: "";
}

body[data-phase="idle"],
body[data-phase="prep"],
body[data-phase="round"],
body[data-phase="done"] {
  --accent: var(--red);
  --accent-text: var(--red-deep);
  --accent-light: #ff8a82;
}
body[data-phase="rest"] {
  --accent: var(--green);
  --accent-text: var(--green);
  --accent-light: #a9d9c0;
}

button,
select {
  color: inherit;
  font: inherit;
}

button {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

select {
  cursor: pointer;
}

svg {
  display: block;
}

img {
  display: block;
  max-width: 100%;
}

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

:focus-visible {
  outline: 2px solid var(--red-deep);
  outline-offset: 3px;
}

::selection {
  background: var(--red);
  color: var(--cream);
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--cream);
  font-size: 12px;
  font-weight: 600;
  transform: translateY(-160%);
  transition: transform 0.2s ease;
}
.skip-link:focus {
  transform: translateY(0);
}

.grain {
  position: fixed;
  z-index: 60;
  inset: 0;
  opacity: 0.032;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  mix-blend-mode: multiply;
  pointer-events: none;
}

.app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1600px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 58px);
}

/* Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  min-height: 82px;
  border-bottom: 1px solid var(--line);
  background: rgba(243, 238, 230, 0.92);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
  backdrop-filter: blur(16px) saturate(130%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  width: max-content;
  flex: none;
}
.brand__logo {
  width: 118px;
  height: auto;
}
.brand__product {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 14px;
  border-left: 1px solid var(--line-strong);
  line-height: 1;
}
.brand__product strong {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.brand__product span {
  color: var(--muted);
  font-family: var(--font-serif);
  font-size: 14px;
  font-style: italic;
  line-height: 1;
}

.topbar__note {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
}
.live-dot {
  width: 5px;
  height: 5px;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(236, 38, 37, 0.08);
  transition: background 0.4s ease;
}
body[data-running="true"][data-phase="round"] .live-dot {
  animation: livePulse 2s ease-in-out infinite;
  box-shadow: 0 0 0 4px rgba(236, 38, 37, 0.1);
}

.topbar__actions {
  display: flex;
  justify-self: end;
  gap: 6px;
}
.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  transition:
    color 0.2s var(--ease),
    background 0.2s var(--ease),
    border-color 0.2s var(--ease);
}
.icon-button:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--cream);
}
.icon-button__icon {
  position: relative;
  width: 17px;
  height: 17px;
  flex: none;
}
.icon-button__icon svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}
.icon-button__label {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}
.icon-sound-off,
.icon-exit-fullscreen {
  opacity: 0;
  transform: scale(0.72);
}
.icon-button.is-muted {
  border-color: rgba(183, 25, 27, 0.28);
  background: rgba(236, 38, 37, 0.055);
  color: var(--red-deep);
}
.icon-button.is-muted:hover {
  border-color: var(--red-deep);
  background: var(--red-deep);
  color: var(--cream);
}
.icon-button.is-muted .icon-sound-on {
  opacity: 0;
  transform: scale(0.72);
}
.icon-button.is-muted .icon-sound-off {
  opacity: 1;
  transform: scale(1);
}
.icon-button.is-fullscreen .icon-enter-fullscreen {
  opacity: 0;
  transform: scale(0.72);
}
.icon-button.is-fullscreen .icon-exit-fullscreen {
  opacity: 1;
  transform: scale(1);
}

/* Layout */
.app-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 388px;
  align-items: center;
  gap: clamp(34px, 5vw, 82px);
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: clamp(24px, 4vh, 44px) 0;
  flex: 1;
}

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}
.stage__heading {
  width: 100%;
  max-width: 620px;
  margin-bottom: clamp(6px, 1.4vh, 14px);
  text-align: center;
}
.eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 0 10px;
  color: var(--red-deep);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  line-height: 1.3;
  text-transform: uppercase;
}
.eyebrow__line {
  width: 25px;
  height: 1px;
  flex: none;
  background: currentColor;
  opacity: 0.8;
}
.stage .eyebrow {
  color: var(--accent-text);
  transition: color 0.45s ease;
}
.phase-title {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: clamp(42px, 4.2vw, 58px);
  font-style: italic;
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.015em;
}
.phase-hint {
  max-width: 480px;
  margin: 8px auto 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}

/* Dial */
.dial-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
}
.dial {
  position: relative;
  display: grid;
  width: min(100%, 490px);
  aspect-ratio: 1;
  place-items: center;
  isolation: isolate;
}
.dial::before {
  position: absolute;
  z-index: -1;
  inset: 8.5%;
  border: 1px solid rgba(19, 17, 14, 0.55);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 34%, rgba(255, 255, 255, 0.05), transparent 42%),
    radial-gradient(circle at 50% 38%, #24201b 0%, #15120f 58%, #080706 100%);
  box-shadow:
    0 38px 72px -42px rgba(19, 17, 14, 0.6),
    inset 0 0 90px rgba(0, 0, 0, 0.45);
  content: "";
}

.dial__halo {
  position: absolute;
  z-index: -2;
  inset: 4%;
  border-radius: 50%;
  background: radial-gradient(circle, transparent 56%, rgba(236, 38, 37, 0.09) 58%, transparent 74%);
  filter: blur(18px);
  opacity: 0.8;
  transition:
    background 0.6s ease,
    opacity 0.25s ease;
}
body[data-phase="rest"] .dial__halo {
  background: radial-gradient(circle, transparent 56%, rgba(27, 107, 63, 0.12) 58%, transparent 74%);
}

.dial__svg {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.ring-track {
  fill: none;
  stroke: rgba(19, 17, 14, 0.18);
  stroke-width: 1.5;
}
.ring-progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: var(--ring-length);
  stroke-dashoffset: 0;
  filter: drop-shadow(0 0 7px rgba(236, 38, 37, 0.24));
  transition:
    stroke 0.5s ease,
    filter 0.5s ease,
    opacity 0.25s ease;
}
body[data-phase="rest"] .ring-progress {
  filter: drop-shadow(0 0 7px rgba(27, 107, 63, 0.25));
}
.ring-inner {
  fill: none;
  stroke: rgba(246, 240, 231, 0.1);
  stroke-width: 1;
  stroke-dasharray: 1 7;
  stroke-linecap: round;
}
.ring-ticks line {
  stroke: rgba(19, 17, 14, 0.21);
  stroke-width: 1;
}
.ring-ticks line.is-major {
  stroke: rgba(19, 17, 14, 0.37);
  stroke-width: 1.2;
}
.ring-head {
  fill: var(--accent);
  filter: drop-shadow(0 0 5px rgba(236, 38, 37, 0.65));
  transition:
    fill 0.5s ease,
    filter 0.5s ease,
    opacity 0.3s ease;
}
body[data-phase="idle"] .ring-head,
body[data-phase="done"] .ring-head {
  opacity: 0;
}

.dial__core {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 73%;
  aspect-ratio: 1;
  text-align: center;
}
.dial__core.is-swapping {
  animation: coreSwap 0.5s var(--ease-out) both;
}
.round-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  height: 27px;
  margin: 0;
  padding: 0 11px;
  overflow: hidden;
  border: 1px solid var(--line-light-strong);
  border-radius: 999px;
  background: rgba(246, 240, 231, 0.045);
  color: rgba(246, 240, 231, 0.7);
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-weight: 500;
  letter-spacing: 0.13em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}
.round-badge__dot {
  width: 4px;
  height: 4px;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(236, 38, 37, 0.65);
  transition: background 0.4s ease;
}
.timer {
  margin: 12px 0 7px;
  color: var(--cream);
  font-family: var(--font-sans);
  font-size: clamp(92px, 11.4vw, 150px);
  font-stretch: 82%;
  font-variant-numeric: tabular-nums lining-nums;
  font-weight: 800;
  line-height: 0.8;
  letter-spacing: -0.045em;
  text-shadow: 0 0 60px rgba(246, 240, 231, 0.05);
  transition:
    color 0.35s ease,
    opacity 0.25s ease;
  white-space: nowrap;
}
.timer.is-word {
  font-family: var(--font-serif);
  font-size: clamp(82px, 9.5vw, 124px);
  font-style: italic;
  font-stretch: normal;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1;
}
.timer.is-urgent {
  color: var(--accent-light);
  animation: timerUrgent 1s ease-in-out infinite;
}
.timer.is-beat {
  animation: timerBeat 0.26s var(--ease-out);
}
body[data-paused="true"] .timer {
  opacity: 0.72;
}
body[data-paused="true"] .ring-progress {
  opacity: 0.4;
}
body[data-paused="true"] .dial__halo {
  opacity: 0.28;
}
.time-caption {
  margin: 0;
  color: rgba(246, 240, 231, 0.62);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.16em;
  line-height: 1.3;
  text-transform: uppercase;
}

/* Round progress */
.round-progress {
  width: min(100%, 480px);
  margin-top: clamp(7px, 1.3vh, 13px);
}
.round-progress__head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 9px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.11em;
  line-height: 1.4;
  text-transform: uppercase;
}
.round-progress__head span:last-child {
  letter-spacing: 0.05em;
}
.round-pips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.round-pips li {
  display: grid;
  min-width: 29px;
  height: 27px;
  padding: 0 7px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(250, 247, 241, 0.34);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  line-height: 1;
  transition:
    color 0.3s ease,
    background 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}
.round-pips li.is-done {
  border-color: rgba(183, 25, 27, 0.26);
  background: rgba(236, 38, 37, 0.055);
  color: var(--red-deep);
}
body[data-phase="rest"] .round-pips li.is-done {
  border-color: rgba(27, 107, 63, 0.28);
  background: rgba(27, 107, 63, 0.055);
  color: var(--green);
}
.round-pips li.is-current {
  border-color: var(--ink);
  background: var(--ink);
  box-shadow: inset 0 -2px 0 var(--red);
  color: var(--cream);
}
.round-pips li.is-upcoming {
  border-style: dashed;
  background: transparent;
  color: var(--muted);
}

/* Controls */
.stage-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 430px;
  gap: 9px;
  margin-top: clamp(16px, 2.4vh, 24px);
}
.button-start {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 208px;
  height: 56px;
  padding: 0 15px 0 8px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--cream);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.005em;
  transition:
    background 0.22s var(--ease),
    border-color 0.22s var(--ease),
    transform 0.22s var(--ease);
}
.button-start:hover {
  border-color: var(--red-deep);
  background: var(--red-deep);
  transform: translateY(-1px);
}
.button-start:active {
  transform: translateY(0);
}
.button-start__icon {
  display: grid;
  width: 40px;
  height: 40px;
  flex: none;
  place-items: center;
  border-radius: 2px;
  background: var(--red);
  color: var(--cream);
  transition:
    background 0.2s var(--ease),
    color 0.2s var(--ease);
}
.button-start:hover .button-start__icon {
  background: var(--cream);
  color: var(--red-deep);
}
.button-start__icon svg {
  display: none;
  width: 17px;
  height: 17px;
}
.button-start__icon .icon-play {
  display: block;
  margin-left: 2px;
}
body[data-running="true"] .button-start__icon .icon-play {
  display: none;
}
body[data-running="true"] .button-start__icon .icon-pause {
  display: block;
}
body[data-phase="done"] .button-start__icon .icon-play,
body[data-phase="done"] .button-start__icon .icon-pause {
  display: none;
}
body[data-phase="done"] .button-start__icon .icon-repeat {
  display: block;
}
body[data-phase="done"] .button-start {
  border-color: var(--red-deep);
  background: var(--red-deep);
}
body[data-phase="done"] .button-start:hover {
  border-color: var(--ink);
  background: var(--ink);
}
.keycap {
  margin-left: auto;
  padding: 3px 6px;
  border: 1px solid rgba(246, 240, 231, 0.22);
  border-radius: 2px;
  color: rgba(246, 240, 231, 0.56);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
}
.round-button {
  display: grid;
  width: 52px;
  height: 52px;
  flex: none;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  transition:
    color 0.2s var(--ease),
    border-color 0.2s var(--ease),
    background 0.2s var(--ease),
    transform 0.2s var(--ease);
}
.round-button:hover:not(:disabled) {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--cream);
  transform: translateY(-1px);
}
.round-button:active:not(:disabled) {
  transform: translateY(0);
}
.round-button:disabled {
  opacity: 0.27;
}
.round-button svg {
  width: 18px;
  height: 18px;
}
.stage-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  max-width: 470px;
  margin: 15px auto 0;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.55;
  text-align: left;
}
.stage-note svg {
  width: 13px;
  height: 13px;
  flex: none;
  margin-top: 1px;
  opacity: 0.8;
}

/* Settings panel */
.settings-panel {
  position: relative;
  padding: clamp(22px, 2.2vw, 29px);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper-soft);
  box-shadow: 0 26px 60px -46px rgba(19, 17, 14, 0.45);
}
.settings-panel::before {
  position: absolute;
  top: -1px;
  left: -1px;
  width: 64px;
  height: 2px;
  background: var(--red);
  content: "";
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.panel-head .eyebrow {
  justify-content: flex-start;
  margin-bottom: 7px;
  color: var(--red-deep);
  font-size: 7.5px;
  letter-spacing: 0.13em;
}
.panel-head h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 36px;
  font-stretch: 82%;
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.05em;
  text-transform: uppercase;
}
.session-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 25px;
  margin-top: 2px;
  padding: 0 8px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
  transition:
    color 0.3s ease,
    background 0.3s ease,
    border-color 0.3s ease;
}
.session-state > span:first-child {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}
.session-state.is-running {
  border-color: rgba(183, 25, 27, 0.26);
  background: rgba(236, 38, 37, 0.07);
  color: var(--red-deep);
}
.session-state.is-running > span:first-child {
  animation: livePulse 1.8s ease-in-out infinite;
}
.session-state.is-paused {
  border-color: var(--line-strong);
  background: var(--paper-deep);
  color: var(--ink);
}
.session-state.is-done {
  border-color: rgba(27, 107, 63, 0.28);
  background: rgba(27, 107, 63, 0.065);
  color: var(--green);
}
.panel-intro {
  margin: 9px 0 14px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.55;
}

.settings-list {
  transition: opacity 0.3s ease;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.setting-row:first-child {
  border-top: 0;
}
.setting-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}
.setting-name {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}
.setting-desc {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.015em;
  line-height: 1.35;
}
.stepper {
  display: flex;
  align-items: center;
  flex: none;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper);
  transition:
    opacity 0.3s ease,
    border-color 0.2s ease;
}
.stepper:focus-within {
  border-color: var(--red-deep);
}
.step-button {
  display: grid;
  width: 29px;
  height: 36px;
  flex: none;
  place-items: center;
  border-radius: 1px;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
  transition:
    color 0.18s ease,
    background 0.18s ease;
}
.step-button:hover:not(:disabled) {
  background: rgba(19, 17, 14, 0.06);
  color: var(--ink);
}
.step-button:active:not(:disabled) {
  background: rgba(19, 17, 14, 0.1);
}
.step-button:disabled {
  opacity: 0.27;
}
.stepper__center {
  position: relative;
  width: 96px;
  flex: none;
  padding: 2px 0 3px;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  text-align: center;
}
.stepper__center::after {
  position: absolute;
  top: 14px;
  right: 6px;
  width: 4px;
  height: 4px;
  border-right: 1px solid var(--muted);
  border-bottom: 1px solid var(--muted);
  transform: rotate(45deg);
  content: "";
  pointer-events: none;
}
.stepper__center select {
  width: 100%;
  padding: 0 12px;
  -webkit-appearance: none;
  appearance: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 24px;
  font-stretch: 86%;
  font-variant-numeric: tabular-nums lining-nums;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}
.stepper__center select::-ms-expand {
  display: none;
}
.stepper__center select option {
  background: var(--paper-soft);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
}
.stepper__unit {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}
.stepper.is-disabled {
  opacity: 0.82;
}
.stepper.is-disabled select {
  cursor: not-allowed;
}

.prep-card {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 7px;
  padding: 9px 11px;
  border: 1px solid rgba(183, 25, 27, 0.23);
  border-radius: 2px;
  background: rgba(236, 38, 37, 0.045);
}
.prep-card__number {
  display: grid;
  width: 34px;
  height: 34px;
  flex: none;
  place-items: center;
  border: 1px solid rgba(183, 25, 27, 0.28);
  border-radius: 50%;
  color: var(--red-deep);
  font-family: var(--font-serif);
  font-size: 24px;
  font-style: italic;
  line-height: 1;
}
.prep-card__copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 1px;
}
.prep-card__copy strong {
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.25;
}
.prep-card__copy span {
  color: var(--muted);
  font-size: 8.5px;
  line-height: 1.35;
}
.tag {
  flex: none;
  padding: 3px 6px;
  border: 1px solid rgba(183, 25, 27, 0.22);
  border-radius: 2px;
  color: var(--red-deep);
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.session-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 4px;
  padding: 12px 0 11px;
  border-bottom: 1px solid var(--line);
}
.session-summary__copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.session-summary__copy > span {
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 600;
}
.session-summary__copy small {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.01em;
}
.session-summary strong {
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 28px;
  font-stretch: 84%;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.035em;
  white-space: nowrap;
}

.presets {
  padding-top: 12px;
  transition: opacity 0.3s ease;
}
.presets__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.presets__hint {
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 8px;
  letter-spacing: 0.01em;
  text-transform: none;
}
.presets__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.preset {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 8px 7px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: transparent;
  text-align: left;
  transition:
    border-color 0.2s var(--ease),
    background 0.2s var(--ease),
    transform 0.2s var(--ease);
}
.preset:hover:not(:disabled) {
  border-color: rgba(183, 25, 27, 0.35);
  background: rgba(236, 38, 37, 0.04);
  transform: translateY(-1px);
}
.preset span {
  overflow: hidden;
  max-width: 100%;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.07em;
  line-height: 1.25;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.preset strong {
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  font-stretch: 86%;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}
.preset small {
  overflow: hidden;
  max-width: 100%;
  color: var(--muted);
  font-size: 7px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preset.is-selected {
  border-color: var(--red-deep);
  background: rgba(236, 38, 37, 0.055);
}
.preset.is-selected strong {
  color: var(--red-deep);
}
.preset:disabled {
  opacity: 0.36;
}

.panel-lock {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 11px 0 0;
  padding: 8px 9px;
  border: 1px solid rgba(183, 25, 27, 0.2);
  border-radius: 2px;
  background: rgba(236, 38, 37, 0.045);
  color: var(--red-deep);
  font-size: 8.5px;
  line-height: 1.4;
}
.panel-lock svg {
  width: 13px;
  height: 13px;
  flex: none;
}

.panel-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 11px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}
.text-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  color: var(--red-deep);
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
  transition: color 0.2s ease;
}
.text-button:hover {
  color: var(--ink);
}
.text-button svg {
  width: 14px;
  height: 14px;
}
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.02em;
  line-height: 1;
  cursor: pointer;
  user-select: none;
}
.toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.toggle__track {
  display: flex;
  align-items: center;
  width: 28px;
  height: 16px;
  padding: 2px;
  flex: none;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper-deep);
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}
.toggle__track span {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  transition:
    transform 0.2s var(--ease-out),
    background 0.2s ease;
}
.toggle input:checked + .toggle__track {
  border-color: var(--red-deep);
  background: var(--red);
}
.toggle input:checked + .toggle__track span {
  background: var(--cream);
  transform: translateX(12px);
}
.toggle input:focus-visible + .toggle__track {
  outline: 2px solid var(--red-deep);
  outline-offset: 3px;
}

body.is-session-active .settings-list {
  opacity: 0.7;
}
body.is-session-active .presets {
  opacity: 0.5;
}
body.is-session-active .prep-card,
body.is-session-active .session-summary {
  opacity: 0.7;
}
body.is-session-active .setting-row {
  pointer-events: none;
}
body.is-session-active .panel-intro {
  color: var(--muted);
}

/* Footer */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 0 max(15px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.04em;
  line-height: 1.5;
}
.footer__signature {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.footer__mark {
  width: 15px;
  height: 15px;
  flex: none;
  opacity: 0.72;
}
.footer__signature span {
  margin: 0 2px;
  color: var(--red);
}
.shortcuts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 14px;
}
.shortcuts span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
kbd {
  display: inline-block;
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-bottom-color: var(--line-strong);
  border-radius: 2px;
  background: rgba(250, 247, 241, 0.5);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7px;
  line-height: 1.2;
}

/* Overlays */
.screen-flash {
  position: fixed;
  z-index: 80;
  inset: 0;
  background: var(--accent);
  opacity: 0;
  pointer-events: none;
}
.screen-flash.is-flashing {
  animation: screenFlash 0.65s ease-out;
}
.toast {
  position: fixed;
  z-index: 140;
  bottom: max(26px, calc(env(safe-area-inset-bottom) + 16px));
  left: 50%;
  max-width: calc(100vw - 32px);
  padding: 10px 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--ink);
  box-shadow: 0 18px 40px -20px rgba(19, 17, 14, 0.6);
  color: var(--cream);
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.3;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition:
    opacity 0.24s ease,
    transform 0.24s var(--ease-out);
}
.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Motion */
@keyframes livePulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}
@keyframes timerUrgent {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.012);
    opacity: 0.86;
  }
}
@keyframes timerBeat {
  0% {
    transform: scale(1);
  }
  34% {
    transform: scale(1.04);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes coreSwap {
  0% {
    opacity: 0.3;
    transform: translateY(7px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes screenFlash {
  0% {
    opacity: 0.09;
  }
  100% {
    opacity: 0;
  }
}

/* Responsive */
@media (max-width: 1180px) {
  .app-main {
    grid-template-columns: minmax(0, 1fr) 356px;
    gap: clamp(26px, 4vw, 52px);
  }
  .dial {
    width: min(100%, 470px);
  }
  .timer {
    font-size: clamp(88px, 11.2vw, 142px);
  }
}

@media (max-width: 980px) {
  .app-main {
    grid-template-columns: minmax(0, 1fr);
    gap: 30px;
    padding-top: 28px;
  }
  .stage {
    width: 100%;
  }
  .settings-panel {
    width: min(100%, 620px);
    margin: 0 auto;
  }
  .dial {
    width: min(100%, 460px);
  }
  .timer {
    font-size: clamp(92px, 16vw, 144px);
  }
  body.is-session-active .settings-panel {
    display: none;
  }
  .topbar {
    grid-template-columns: 1fr auto;
  }
  .topbar__note {
    display: none;
  }
}

@media (max-width: 760px) {
  .app {
    padding: 0 18px;
  }
  .topbar {
    min-height: 66px;
    gap: 12px;
  }
  .brand {
    gap: 10px;
  }
  .brand__logo {
    width: 100px;
  }
  .brand__product {
    gap: 3px;
    padding-left: 10px;
  }
  .brand__product strong {
    font-size: 7.5px;
  }
  .brand__product span {
    display: none;
  }
  .icon-button {
    width: 38px;
    height: 38px;
    justify-content: center;
    padding: 0;
  }
  .icon-button__label {
    display: none;
  }
  .app-main {
    padding: 20px 0 28px;
  }
  .stage__heading {
    margin-bottom: 6px;
  }
  .eyebrow {
    margin-bottom: 8px;
    font-size: 8px;
  }
  .phase-title {
    font-size: clamp(35px, 9.2vw, 46px);
  }
  .phase-hint {
    margin-top: 6px;
    padding: 0 12px;
    font-size: 10.5px;
  }
  .dial {
    width: min(100%, 430px);
  }
  .timer {
    margin-top: 9px;
    font-size: clamp(72px, 21vw, 108px);
  }
  .timer.is-word {
    font-size: clamp(62px, 17vw, 88px);
  }
  .round-badge {
    height: 24px;
    padding: 0 9px;
    font-size: 6.8px;
  }
  .time-caption {
    font-size: 6.8px;
    letter-spacing: 0.12em;
  }
  .round-progress {
    width: min(100%, 380px);
    margin-top: 6px;
  }
  .round-progress__head {
    margin-bottom: 7px;
    font-size: 6.8px;
  }
  .round-pips li {
    min-width: 26px;
    height: 24px;
    padding: 0 6px;
    font-size: 8.5px;
  }
  .stage-controls {
    gap: 8px;
    margin-top: 18px;
  }
  .button-start {
    min-width: 0;
    max-width: 250px;
    height: 54px;
    flex: 1;
    padding-right: 13px;
  }
  .keycap {
    display: none;
  }
  .round-button {
    width: 49px;
    height: 49px;
  }
  .stage-note {
    max-width: 360px;
    margin-top: 13px;
    font-size: 8.8px;
  }
  .settings-panel {
    padding: 21px 18px;
  }
  .panel-head h2 {
    font-size: 33px;
  }
  .setting-row {
    padding: 9px 0;
  }
  .footer {
    justify-content: center;
    padding-top: 13px;
    text-align: center;
  }
  .shortcuts {
    display: none;
  }
}

@media (max-width: 390px) {
  .app {
    padding: 0 14px;
  }
  .brand__logo {
    width: 93px;
  }
  .brand__product strong {
    font-size: 7px;
  }
  .icon-button {
    width: 36px;
    height: 36px;
  }
  .topbar__actions {
    gap: 3px;
  }
  .phase-title {
    font-size: clamp(33px, 9vw, 40px);
  }
  .phase-hint {
    font-size: 10px;
    padding: 0 4px;
  }
  .timer {
    font-size: clamp(68px, 20vw, 92px);
  }
  .dial__core {
    width: 74%;
  }
  .stage-controls {
    gap: 7px;
  }
  .button-start {
    gap: 9px;
    height: 52px;
    font-size: 12px;
  }
  .button-start__icon {
    width: 37px;
    height: 37px;
  }
  .round-button {
    width: 46px;
    height: 46px;
  }
  .settings-panel {
    padding: 19px 15px;
  }
  .setting-name {
    font-size: 11.5px;
  }
  .stepper__center {
    width: 84px;
  }
  .setting-row {
    gap: 7px;
  }
  .preset {
    padding: 7px 6px;
  }
  .preset strong {
    font-size: 15px;
  }
  .panel-options {
    gap: 6px;
  }
  .toggle {
    gap: 5px;
  }
}

/* Short desktop screens */
@media (min-width: 981px) and (max-height: 999px) {
  .topbar {
    min-height: 68px;
  }
  .app-main {
    padding-top: 16px;
    padding-bottom: 16px;
  }
  .stage__heading {
    margin-bottom: 4px;
  }
  .phase-title {
    font-size: 40px;
  }
  .phase-hint {
    margin-top: 5px;
  }
  .dial {
    width: min(100%, 430px, 52vh);
  }
  .timer {
    font-size: clamp(72px, 14.5vh, 124px);
  }
  .round-progress {
    margin-top: 5px;
  }
  .stage-controls {
    margin-top: 14px;
  }
  .stage-note {
    margin-top: 9px;
  }
  .settings-panel {
    padding: 18px 21px;
  }
  .setting-row {
    padding: 7px 0;
  }
  .presets {
    padding-top: 9px;
  }
  .panel-head h2 {
    font-size: 32px;
  }
  .panel-intro {
    margin: 7px 0 11px;
  }
  .prep-card {
    margin-top: 4px;
    padding: 7px 10px;
  }
  .session-summary {
    padding: 9px 0;
  }
  .panel-options {
    margin-top: 8px;
    padding-top: 8px;
  }
  .footer {
    padding-top: 9px;
    padding-bottom: 10px;
  }
}

/* Landscape phones and short tablets */
@media (min-width: 700px) and (max-height: 600px) {
  .app {
    padding: 0 22px;
  }
  .topbar {
    min-height: 52px;
  }
  .brand__logo {
    width: 96px;
  }
  .brand__product {
    padding-left: 10px;
  }
  .brand__product span {
    display: none;
  }
  .icon-button {
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
  }
  .icon-button__label {
    display: none;
  }
  .app-main {
    grid-template-columns: minmax(0, 1fr) 310px;
    gap: 20px;
    padding: 8px 0;
  }
  .stage__heading {
    display: none;
  }
  .dial {
    width: min(61vh, 260px);
  }
  .timer {
    margin-top: 6px;
    font-size: clamp(48px, 13.2vh, 64px);
  }
  .timer.is-word {
    font-size: clamp(40px, 10vh, 54px);
  }
  .round-badge {
    height: 21px;
    font-size: 6.2px;
  }
  .time-caption {
    font-size: 6.2px;
  }
  .round-progress {
    margin-top: 2px;
    max-width: 360px;
  }
  .round-progress__head {
    display: none;
  }
  .round-pips li {
    min-width: 22px;
    height: 20px;
    padding: 0 5px;
    font-size: 7.5px;
  }
  .stage-controls {
    max-width: 380px;
    margin-top: 8px;
  }
  .button-start {
    height: 42px;
    min-width: 0;
    max-width: 200px;
    flex: 1;
    padding-right: 10px;
    gap: 9px;
    font-size: 11px;
  }
  .button-start__icon {
    width: 32px;
    height: 32px;
  }
  .button-start__icon svg {
    width: 15px;
    height: 15px;
  }
  .round-button {
    width: 40px;
    height: 40px;
  }
  .round-button svg {
    width: 16px;
    height: 16px;
  }
  .keycap,
  .stage-note {
    display: none;
  }
  .settings-panel {
    max-height: calc(100vh - 68px);
    padding: 14px 16px;
    overflow-y: auto;
  }
  .panel-head h2 {
    font-size: 27px;
  }
  .panel-intro,
  .prep-card,
  .presets,
  .panel-options {
    display: none;
  }
  .setting-row {
    padding: 7px 0;
  }
  .session-summary {
    padding: 9px 0 3px;
  }
  .session-summary__copy small {
    display: none;
  }
  .session-summary strong {
    font-size: 23px;
  }
  .panel-lock {
    margin-top: 8px;
  }
  .footer {
    display: none;
  }
}

@media (min-width: 700px) and (max-width: 980px) and (max-height: 600px) {
  body.is-session-active .app-main {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------------------
   Layout v2 · temporizador central grande + configuración en panel inferior
   -------------------------------------------------------------------------- */
.app-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: 100%;
  max-width: 1040px;
  padding: clamp(14px, 2.2vh, 24px) 0;
}

.stage {
  width: 100%;
  max-width: 840px;
}

.stage__heading {
  max-width: 700px;
  margin-bottom: clamp(6px, 1.2vh, 12px);
}

.phase-title {
  font-size: clamp(44px, 4.4vw, 64px);
}

.dial {
  width: min(100%, 600px, 53vh);
  container-type: inline-size;
}

.dial__core {
  width: 76%;
}

.timer {
  font-size: clamp(76px, 13.5vw, 190px);
  font-size: clamp(76px, 33cqw, 210px);
}

.timer.is-word {
  font-size: clamp(66px, 9.5vw, 132px);
  font-size: clamp(66px, 24cqw, 150px);
}

.round-progress {
  width: min(100%, 620px);
}

.stage-controls {
  max-width: 470px;
}

.stage-note {
  max-width: 520px;
}

/* Linear progress only used by the landscape scoreboard */
.dial__linear {
  display: none;
}

/* Config summary + trigger */
.session-config {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(100%, 620px);
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(250, 247, 241, 0.45);
  color: var(--ink);
  text-align: left;
  transition:
    border-color 0.2s var(--ease),
    background 0.2s var(--ease),
    transform 0.2s var(--ease);
}

.session-config:hover {
  border-color: var(--line-strong);
  background: var(--paper-soft);
}

.session-config:active {
  transform: translateY(1px);
}

.session-config:disabled {
  opacity: 0.45;
}

.session-config__icon {
  display: grid;
  width: 36px;
  height: 36px;
  flex: none;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--red-deep);
}

.session-config__icon svg {
  width: 18px;
  height: 18px;
}

.session-config__copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}

.session-config__copy small {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.1em;
  line-height: 1.2;
  text-transform: uppercase;
}

.session-config__copy strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-config__action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  color: var(--red-deep);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.session-config__action svg {
  width: 13px;
  height: 13px;
}

body.is-session-active .session-config {
  display: none;
}

body.is-session-active #settingsButton {
  display: none;
}

/* Settings dialog / bottom sheet */
.settings-panel {
  position: fixed;
  inset: auto 0 0;
  z-index: 120;
  width: min(940px, calc(100vw - 32px));
  max-width: none;
  max-height: min(88vh, 820px);
  margin: 0 auto 16px;
  padding: clamp(20px, 2vw, 30px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper-soft);
  box-shadow: 0 36px 100px -32px rgba(19, 17, 14, 0.62);
}

.settings-panel[open] {
  animation: sheetIn 0.28s var(--ease-out) both;
}

.settings-panel::backdrop {
  background: rgba(19, 17, 14, 0.58);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.settings-panel::-webkit-scrollbar {
  width: 8px;
}

.settings-panel::-webkit-scrollbar-thumb {
  border: 2px solid var(--paper-soft);
  border-radius: 4px;
  background: var(--line-strong);
}

body.is-settings-open {
  overflow: hidden;
}

.panel-head__actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: none;
}

.panel-close {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
}

.panel-close:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--cream);
}

.panel-close svg {
  width: 14px;
  height: 14px;
}

.settings-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.settings-list .setting-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
}

.settings-list .setting-row:first-child {
  border-top: 1px solid var(--line);
}

.settings-list .stepper {
  width: 100%;
}

.settings-list .stepper__center {
  width: auto;
  flex: 1;
}

.settings-panel .prep-card {
  margin-top: 12px;
}

.settings-panel .panel-options {
  margin-top: 14px;
}

@keyframes sheetIn {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile / tablet */
@media (max-width: 980px) {
  .app-main {
    max-width: 820px;
  }

  .stage {
    max-width: 760px;
  }

  .dial {
    width: min(100%, 590px, 60vh);
  }

  .timer {
    font-size: clamp(76px, 32cqw, 188px);
  }
}

@media (max-width: 760px) {
  .app-main {
    padding: 18px 0 22px;
  }

  .stage {
    max-width: none;
  }

  .stage__heading {
    max-width: 540px;
    margin-bottom: 6px;
  }

  .phase-title {
    font-size: clamp(36px, 9.2vw, 48px);
  }

  .dial {
    width: min(100%, 520px, 58vh);
  }

  .timer {
    font-size: clamp(76px, 33cqw, 150px);
  }

  .round-progress {
    width: min(100%, 480px);
  }

  .session-config {
    width: min(100%, 480px);
    margin-top: 12px;
    padding: 9px 10px;
  }

  .session-config__copy strong {
    font-size: 9.5px;
  }

  .settings-panel {
    inset: auto 0 0;
    width: 100%;
    max-width: none;
    max-height: 90vh;
    max-height: 90dvh;
    margin: 0;
    padding: 18px 16px max(18px, env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 3px 3px 0 0;
  }

  .settings-list {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .settings-list .setting-row {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-width: 0 0 1px;
  }

  .settings-list .setting-row:first-child {
    border-top: 0;
  }

  .settings-list .stepper {
    width: auto;
    flex: none;
  }

  .settings-list .stepper__center {
    width: 96px;
    flex: none;
  }

  .panel-head h2 {
    font-size: 33px;
  }

  .panel-head__actions {
    gap: 6px;
  }
}

@media (max-width: 390px) {
  .app-main {
    padding-top: 14px;
  }

  .phase-title {
    font-size: clamp(33px, 9vw, 40px);
  }

  .stage-controls {
    gap: 7px;
    margin-top: 14px;
  }

  .session-config {
    gap: 8px;
    padding: 8px;
  }

  .session-config__icon {
    width: 32px;
    height: 32px;
  }

  .session-config__copy small {
    font-size: 6px;
  }

  .session-config__copy strong {
    font-size: 8.5px;
  }

  .session-config__action > span {
    display: none;
  }

  .settings-list .stepper__center {
    width: 84px;
  }
}

/* --------------------------------------------------------------------------
   Mobile landscape · full-width scoreboard
   -------------------------------------------------------------------------- */
@media (max-width: 980px) and (max-height: 600px) and (orientation: landscape) {
  .app-main {
    display: flex;
    justify-content: center;
    padding: 4px 0;
  }

  .stage {
    width: 100%;
    max-width: none;
  }

  .stage__heading {
    display: none;
  }

  .dial {
    width: 100%;
    max-width: none;
    height: min(50vh, 220px);
    min-height: 150px;
    aspect-ratio: auto;
    border: 1px solid rgba(19, 17, 14, 0.55);
    border-radius: 4px;
    background:
      radial-gradient(circle at 50% 36%, rgba(255, 255, 255, 0.05), transparent 50%),
      radial-gradient(circle at 50% 40%, #24201b 0%, #15120f 62%, #080706 100%);
    box-shadow:
      0 24px 50px -30px rgba(19, 17, 14, 0.6),
      inset 0 0 80px rgba(0, 0, 0, 0.4);
    container-type: normal;
  }

  .dial::before {
    display: none;
  }

  .dial__halo,
  .dial__svg {
    display: none;
  }

  .dial__core {
    width: 100%;
    aspect-ratio: auto;
    padding: 12px 24px 26px;
  }

  .dial__linear {
    position: absolute;
    right: 24px;
    bottom: 16px;
    left: 24px;
    z-index: 3;
    display: block;
    height: 4px;
    overflow: hidden;
    border-radius: 2px;
    background: rgba(246, 240, 231, 0.17);
  }

  .dial__linear span {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transform-origin: left center;
    transition:
      background 0.5s ease,
      transform 0.16s linear;
  }

  .round-badge {
    height: 23px;
    font-size: 6.5px;
  }

  .timer {
    margin: 6px 0 3px;
    font-size: clamp(72px, 27vh, 150px);
    line-height: 0.8;
  }

  .timer.is-word {
    font-size: clamp(52px, 19vh, 108px);
  }

  .time-caption {
    font-size: 6.5px;
  }

  .round-progress {
    width: 100%;
    max-width: none;
    margin-top: 6px;
  }

  .round-progress__head {
    display: none;
  }

  .round-pips li {
    min-width: 24px;
    height: 21px;
    font-size: 8px;
  }

  .stage-controls {
    max-width: 500px;
    margin-top: 8px;
  }

  .button-start {
    height: 42px;
    min-width: 0;
    max-width: 260px;
    flex: 1;
    padding-right: 10px;
    gap: 9px;
    font-size: 11px;
  }

  .button-start__icon {
    width: 32px;
    height: 32px;
  }

  .button-start__icon svg {
    width: 15px;
    height: 15px;
  }

  .round-button {
    width: 40px;
    height: 40px;
  }

  .round-button svg {
    width: 16px;
    height: 16px;
  }

  .stage-note,
  .footer {
    display: none;
  }

  .session-config {
    width: 100%;
    max-width: none;
    margin-top: 8px;
    padding: 7px 10px;
  }

  .session-config__icon {
    width: 30px;
    height: 30px;
  }

  .session-config__copy small {
    display: none;
  }

  .session-config__copy strong {
    font-size: 9px;
  }

  .settings-panel {
    width: min(760px, calc(100vw - 24px));
    max-width: none;
    max-height: 92vh;
    margin: 0 auto 10px;
    border: 1px solid var(--line-strong);
    border-radius: 3px;
  }
}

/* Portátiles y tablets con poca altura: prioriza que se vean controles y configuración */
@media (min-width: 761px) and (min-height: 601px) and (max-height: 999px) {
  .app-main {
    padding-top: clamp(10px, 1.8vh, 18px);
    padding-bottom: clamp(8px, 1.2vh, 14px);
  }

  .stage__heading {
    margin-bottom: 5px;
  }

  .dial {
    width: min(100%, 600px, 51vh);
  }

  .stage-note {
    display: none;
  }

  .session-config {
    margin-top: 10px;
  }
}

@media (max-width: 980px) and (max-height: 600px) and (orientation: landscape) {
  .app {
    padding-right: max(22px, env(safe-area-inset-right));
    padding-left: max(22px, env(safe-area-inset-left));
  }
}
