:root {
  --paper: #fff8ef;
  --paper-strong: #fffdf8;
  --ink: #241512;
  --ink-soft: rgba(36, 21, 18, 0.72);
  --line: rgba(72, 43, 36, 0.12);
  --tomato: #e25235;
  --tomato-deep: #c33f25;
  --sage: #587a63;
  --sun: #f3c46b;
  --rose: #f5a18d;
  --shadow-soft: 0 30px 90px rgba(117, 63, 39, 0.16);
  --shadow-panel: 0 18px 48px rgba(81, 43, 29, 0.12);
  --radius-panel: 32px;
  --radius-pill: 999px;
  --transition: 180ms ease-out;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 18%, rgba(243, 196, 107, 0.5), transparent 30%),
    radial-gradient(circle at 82% 14%, rgba(245, 161, 141, 0.42), transparent 26%),
    radial-gradient(circle at 74% 82%, rgba(88, 122, 99, 0.15), transparent 20%),
    linear-gradient(180deg, #fffdf8 0%, #fff7ec 55%, #fff1e6 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(226, 82, 53, 0.24);
  outline-offset: 2px;
}

.page-aura,
.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
}

.page-aura-left {
  background: radial-gradient(circle at 0% 40%, rgba(226, 82, 53, 0.14), transparent 42%);
}

.page-aura-right {
  background: radial-gradient(circle at 100% 0%, rgba(243, 196, 107, 0.18), transparent 36%);
}

.grain {
  opacity: 0.12;
  background-image:
    linear-gradient(rgba(74, 44, 38, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74, 44, 38, 0.04) 1px, transparent 1px);
  background-size: 18px 18px;
  mask-image: radial-gradient(circle at center, black 55%, transparent 100%);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1200px, calc(100vw - 32px));
  margin: 0 auto;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 420px);
  gap: 22px;
  padding: 28px 0;
  align-items: stretch;
}

.panel {
  position: relative;
  overflow: hidden;
  background: rgba(255, 251, 244, 0.78);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-panel);
}

.hero-panel {
  padding: 30px 30px 26px;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto auto;
  gap: 22px;
  min-height: calc(100vh - 56px);
}

.hero-panel::after,
.config-panel::after,
.stats-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.28), transparent 44%);
  pointer-events: none;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(88, 122, 99, 0.96);
}

.eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: currentColor;
}

.hero-copy h1,
.panel-heading h2 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-weight: 700;
  line-height: 1;
}

.hero-copy h1 {
  max-width: 11ch;
  font-size: clamp(2.8rem, 5vw, 4.6rem);
  letter-spacing: -0.05em;
}

.hero-copy p {
  max-width: 56ch;
  margin: 16px 0 0;
  color: var(--ink-soft);
  font-size: 1.03rem;
  line-height: 1.72;
}

.timer-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 430px;
  padding: 24px;
}

.timer-orbit {
  position: absolute;
  width: min(72vw, 420px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.88) 0 30%, transparent 31%),
    radial-gradient(circle at center, rgba(243, 196, 107, 0.22), transparent 62%);
  filter: blur(0.5px);
  animation: floatOrbit 9s ease-in-out infinite;
}

.progress-ring {
  width: min(68vw, 360px);
  height: auto;
  transform: rotate(-90deg);
}

.ring-base {
  fill: none;
  stroke: rgba(120, 84, 61, 0.08);
  stroke-width: 14;
}

.ring-progress {
  fill: none;
  stroke: url(#ringGradient);
  stroke-width: 14;
  stroke-linecap: round;
  stroke-dasharray: 615.752;
  stroke-dashoffset: 615.752;
  transition: stroke-dashoffset 300ms ease-out, stroke 300ms ease-out;
  filter: drop-shadow(0 12px 18px rgba(226, 82, 53, 0.22));
}

.timer-core {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: min(52vw, 290px);
  aspect-ratio: 1;
  border-radius: 50%;
  padding: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 247, 239, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
}

.session-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background: rgba(243, 196, 107, 0.18);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.time-readout {
  margin-top: 16px;
  font-family: "Fraunces", serif;
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.08em;
}

.task-readout {
  margin-top: 10px;
  max-width: 17ch;
  color: var(--ink-soft);
  font-size: 0.98rem;
  line-height: 1.5;
}

.meta-strip,
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.meta-card,
.stat-box {
  padding: 16px 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.meta-label,
.field-label {
  color: rgba(36, 21, 18, 0.58);
  font-size: 0.85rem;
  font-weight: 700;
}

.meta-card strong,
.stat-box strong {
  display: block;
  margin-top: 8px;
  font-size: 1.05rem;
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.action-button,
.preset-button,
.step-button,
.text-button,
.clear-input {
  transition:
    transform var(--transition),
    box-shadow var(--transition),
    background-color var(--transition),
    border-color var(--transition),
    color var(--transition),
    opacity var(--transition);
}

.action-button {
  min-height: 56px;
  padding: 0 22px;
  border-radius: var(--radius-pill);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.action-button:hover,
.preset-button:hover,
.step-button:hover,
.text-button:hover,
.clear-input:hover {
  transform: translateY(-1px);
}

.action-button:active,
.preset-button:active,
.step-button:active,
.text-button:active,
.clear-input:active {
  transform: translateY(1px);
}

.action-button:disabled,
.step-button:disabled,
.clear-input:disabled,
.text-button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  transform: none;
}

.action-primary {
  color: #fffaf4;
  background: linear-gradient(135deg, var(--tomato) 0%, #f16747 100%);
  box-shadow: 0 18px 30px rgba(226, 82, 53, 0.24);
}

.action-secondary {
  color: #fffef7;
  background: linear-gradient(135deg, var(--sage) 0%, #6d977b 100%);
  box-shadow: 0 16px 28px rgba(88, 122, 99, 0.18);
}

.action-ghost {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(36, 21, 18, 0.08);
}

.shortcut-note,
.field-note {
  margin: 0;
  color: rgba(36, 21, 18, 0.56);
  font-size: 0.92rem;
  line-height: 1.55;
}

.field-note.is-error {
  color: #b33c26;
}

.control-panel {
  display: grid;
  grid-template-rows: minmax(0, auto) minmax(0, 1fr);
  gap: 22px;
}

.config-panel,
.stats-panel {
  padding: 24px;
}

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

.panel-heading h2 {
  margin-top: 8px;
  font-size: 2rem;
  letter-spacing: -0.04em;
}

.count-badge {
  flex-shrink: 0;
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  background: rgba(226, 82, 53, 0.1);
  color: var(--tomato-deep);
  font-weight: 800;
}

.input-shell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 12px 14px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.62);
}

.input-shell.is-error {
  border-color: rgba(195, 63, 37, 0.58);
  box-shadow:
    0 0 0 3px rgba(226, 82, 53, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.62);
}

.task-input {
  width: 100%;
  border: 0;
  background: transparent;
  font-size: 1rem;
  color: var(--ink);
}

.task-input::placeholder {
  color: rgba(36, 21, 18, 0.38);
}

.clear-input {
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(36, 21, 18, 0.06);
  color: var(--ink);
  font-weight: 700;
}

.duration-block {
  margin-top: 22px;
  padding: 18px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.82);
}

.duration-header,
.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.duration-value {
  font-weight: 800;
}

.stepper {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  gap: 12px;
  align-items: center;
}

.step-button {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: rgba(36, 21, 18, 0.07);
  color: var(--ink);
  font-size: 1.6rem;
  font-weight: 700;
}

.step-display {
  height: 56px;
  border-radius: 18px;
  background: rgba(255, 248, 239, 0.9);
  border: 1px solid rgba(36, 21, 18, 0.08);
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  font-weight: 800;
}

.preset-row {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.preset-button {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(36, 21, 18, 0.08);
  color: var(--ink);
  font-weight: 700;
}

.preset-button.is-active {
  background: rgba(226, 82, 53, 0.12);
  border-color: rgba(226, 82, 53, 0.36);
  color: var(--tomato-deep);
}

.stats-grid {
  margin-bottom: 18px;
}

.stat-box strong {
  font-family: "Fraunces", serif;
  font-size: 1.8rem;
  letter-spacing: -0.04em;
}

.log-header {
  margin-bottom: 12px;
}

.text-button {
  padding: 0;
  background: transparent;
  color: var(--tomato-deep);
  font-weight: 800;
}

.completed-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  max-height: 280px;
  overflow: auto;
}

.completed-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(36, 21, 18, 0.06);
}

.completed-task {
  min-width: 0;
}

.completed-task strong {
  display: block;
  font-size: 0.98rem;
}

.completed-task span {
  display: block;
  margin-top: 5px;
  color: rgba(36, 21, 18, 0.58);
  font-size: 0.84rem;
}

.log-badge {
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(88, 122, 99, 0.1);
  color: var(--sage);
  font-size: 0.82rem;
  font-weight: 800;
}

.delete-log {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: rgba(36, 21, 18, 0.06);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
}

.empty-state {
  padding: 18px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px dashed rgba(36, 21, 18, 0.16);
  color: rgba(36, 21, 18, 0.58);
  line-height: 1.6;
}

.empty-state.is-hidden {
  display: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translate(-50%, calc(100% + 24px));
  min-width: min(560px, calc(100vw - 28px));
  padding: 16px 20px;
  border-radius: 22px;
  background: rgba(36, 21, 18, 0.9);
  color: #fffdf8;
  box-shadow: 0 20px 40px rgba(36, 21, 18, 0.2);
  transition: transform 240ms ease-out;
  z-index: 3;
}

.toast.is-visible {
  transform: translate(-50%, 0);
}

.is-running .session-pill {
  background: rgba(226, 82, 53, 0.12);
  color: var(--tomato-deep);
}

.is-paused .session-pill {
  background: rgba(88, 122, 99, 0.12);
  color: var(--sage);
}

.is-complete .session-pill {
  background: rgba(243, 196, 107, 0.22);
  color: #8c6721;
}

@keyframes floatOrbit {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(0, -12px, 0) scale(1.03);
  }
}

@media (max-width: 1024px) {
  .app-shell {
    width: min(100vw - 24px, 920px);
    grid-template-columns: 1fr;
  }

  .hero-panel {
    min-height: auto;
  }

  .control-panel {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 18px, 640px);
    padding: 14px 0 22px;
    gap: 14px;
  }

  .hero-panel,
  .config-panel,
  .stats-panel {
    padding: 22px 18px;
    border-radius: 26px;
  }

  .hero-copy h1 {
    font-size: clamp(2.3rem, 12vw, 3.4rem);
  }

  .timer-stage {
    min-height: 350px;
    padding: 16px 0 10px;
  }

  .progress-ring {
    width: min(82vw, 320px);
  }

  .timer-core {
    width: min(62vw, 250px);
    padding: 20px;
  }

  .time-readout {
    font-size: clamp(2.7rem, 16vw, 4.1rem);
  }

  .control-panel,
  .meta-strip,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .control-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .action-primary {
    grid-column: 1 / -1;
  }

  .panel-heading {
    flex-direction: column;
  }
}
