:root {
  --bg: #0b1020;
  --panel: rgba(18, 24, 48, 0.82);
  --panel-strong: #141e3d;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f4f7ff;
  --muted: #9aa6cf;
  --accent: #73f0cf;
  --accent-strong: #42d5b2;
  --accent-warm: #ff9f68;
  --danger: #ff6d8d;
  --shadow: 0 24px 60px rgba(3, 8, 26, 0.4);
  --radius: 2rem;
  --ring-size: 22rem;
  --font-size-base: 10px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: var(--font-size-base);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(80, 119, 255, 0.35), transparent 20%),
    radial-gradient(circle at bottom right, rgba(27, 187, 151, 0.28), transparent 28%),
    var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(120rem, calc(100vw - 3.2rem));
  margin: 0 auto;
  padding: 3.2rem 0 4rem;
}

.app-header,
.panel,
.timer-card {
  backdrop-filter: blur(1.5rem);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.6rem;
  padding: 2rem 2.4rem;
  border-radius: var(--radius);
}

.header-select {
  min-width: 18rem;
}

.header-select__control {
  width: 100%;
  padding: 1rem 1.2rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(10, 14, 32, 0.9);
  color: var(--text);
}

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

.app-header h1,
.timer-card h2,
.panel h3 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 0.4rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.16rem;
  font-weight: 700;
  font-size: 1.1rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(30rem, 0.9fr);
  gap: 2.4rem;
  margin-top: 2.4rem;
}

.timer-card,
.panel {
  border-radius: var(--radius);
}

.timer-card {
  padding: 2.4rem;
}

.timer-card__top,
.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
}

.badge {
  background: rgba(115, 240, 207, 0.15);
  color: var(--accent);
  border: 1px solid rgba(115, 240, 207, 0.28);
  padding: 0.6rem 1rem;
  border-radius: 999px;
  font-weight: 700;
}

.timer-wrapper {
  display: grid;
  place-items: center;
  margin: 2.8rem 0;
}

.timer-ring {
  position: relative;
  width: var(--ring-size);
  height: var(--ring-size);
}

.timer-ring__svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-ring__track,
.timer-ring__progress {
  fill: none;
  stroke-width: 1.5rem;
}

.timer-ring__track {
  stroke: rgba(255, 255, 255, 0.07);
}

.timer-ring__progress {
  stroke: url(#ring-gradient);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.15s linear;
}

.timer-ring__content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-align: center;
}

.timer-ring__label {
  font-size: 4.4rem;
  font-weight: 800;
  line-height: 1;
}

.timer-ring__hint {
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1.2;
}

.field {
  display: grid;
  gap: 0.8rem;
}

.field__label {
  color: var(--muted);
  font-size: 1.3rem;
}

.field__input {
  width: 100%;
  padding: 1.1rem 1.2rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(10, 14, 32, 0.9);
  color: var(--text);
}

.mode-selector {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 2.2rem 0;
}

.mode-button,
.button {
  border: none;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.2rem;
}

.mode-button {
  padding: 1rem 1.2rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-weight: 700;
}

.mode-button.is-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #082118;
}

.button {
  padding: 1.1rem 1.8rem;
  border-radius: 1rem;
  font-weight: 700;
}

.button:hover,
.mode-button:hover {
  transform: translateY(-1px);
}

#start-button {
  background: linear-gradient(135deg, #72f0cc, #32c7a1);
  color: #071821;
}

#pause-button {
  background: linear-gradient(135deg, #ffc36d, #ff9f68);
  color: #2b1201;
}

#reset-button {
  background: linear-gradient(135deg, #8f9cff, #6d7cf7);
  color: #f6f7ff;
}

.button--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #071821;
}

.button--secondary {
  background: rgba(255, 159, 104, 0.15);
  color: #ffd1ac;
}

.button--ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.button--full {
  width: 100%;
}

.sidebar {
  display: grid;
  gap: 2rem;
}

.panel {
  padding: 2rem;
}

.panel__header span {
  color: var(--muted);
  font-size: 1.2rem;
}

.config-panel {
  display: grid;
  gap: 1.8rem;
}

.setting-grid {
  display: grid;
  gap: 1.4rem;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text);
  margin-bottom: 1rem;
}

.checkbox-row input {
  accent-color: var(--accent);
}

.history-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: grid;
  gap: 1rem;
  max-height: 30rem;
  overflow: auto;
}

.history-item {
  padding: 1.2rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: grid;
  gap: 0.4rem;
}

.history-item__meta {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  font-size: 1.2rem;
  color: var(--muted);
}

.history-item__name {
  font-weight: 700;
  font-size: 1.4rem;
}

.empty-state {
  padding: 1.4rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  text-align: center;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.6rem;
  background: rgba(2, 6, 16, 0.72);
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  width: min(44rem, 100%);
  border-radius: 2.4rem;
  padding: 3rem 2.4rem;
  text-align: center;
  background: linear-gradient(160deg, rgba(24, 35, 78, 0.96), rgba(10, 15, 35, 0.98));
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.modal__icon {
  width: 7rem;
  height: 7rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 1.3rem;
  font-size: 3rem;
  background: rgba(115, 240, 207, 0.16);
  color: var(--accent);
}

.hidden {
  display: none;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100vw - 1.6rem, 100%);
    padding-top: 1.2rem;
  }

  .app-header,
  .timer-card,
  .panel {
    padding: 1.6rem;
  }

  .app-header,
  .timer-card__top,
  .panel__header {
    flex-direction: column;
    align-items: stretch;
  }

  .mode-selector {
    grid-template-columns: 1fr;
  }

  .controls {
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

  .timer-ring {
    width: 18rem;
    height: 18rem;
  }

  .timer-ring__label {
    font-size: 3.6rem;
  }
}
