:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #08111f;
  color: #f8fafc;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100svh;
  background:
    radial-gradient(circle at 50% -10%, rgba(43, 183, 255, .22), transparent 38%),
    #08111f;
}

button, input { font: inherit; }

.app-shell {
  width: min(100% - 32px, 520px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 0 max(28px, env(safe-area-inset-bottom));
  display: grid;
  align-content: center;
  gap: 24px;
}

.app-header { text-align: center; }
.brand {
  color: #2bb7ff;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.app-header h1 { margin: 8px 0 0; font-size: clamp(1.7rem, 7vw, 2.4rem); }

.panel {
  padding: 24px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 28px;
  background: rgba(15, 29, 49, .88);
  box-shadow: 0 24px 70px rgba(0,0,0,.28);
  backdrop-filter: blur(18px);
}

.panel h2 { margin: 0 0 28px; font-size: 1.1rem; }
.setting-block { margin: 0 0 28px; padding: 0; border: 0; }
.setting-heading, .switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.setting-heading label, legend, .switch-row > div > label { font-weight: 700; }
.setting-heading output { color: #2bb7ff; font-size: 1.25rem; font-weight: 800; }
.range-labels { display: flex; justify-content: space-between; margin-top: 7px; color: #8290a4; font-size: .72rem; }

input[type="range"] {
  width: 100%;
  height: 5px;
  margin: 20px 0 0;
  accent-color: #2bb7ff;
}

legend { margin-bottom: 12px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 14px; background: #08111f; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label { padding: 12px 8px; border-radius: 11px; color: #8290a4; text-align: center; font-size: .82rem; font-weight: 700; cursor: pointer; }
.segmented input:checked + label { color: #08111f; background: #f8fafc; }
.segmented input:focus-visible + label { outline: 2px solid #2bb7ff; }

.switch-row { margin-bottom: 30px; }
.switch-row p { margin: 5px 0 0; color: #8290a4; font-size: .76rem; }
.switch { position: relative; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; }
.switch span { display: block; width: 52px; height: 30px; padding: 3px; border-radius: 999px; background: #445065; transition: .2s; }
.switch span::after { content: ""; display: block; width: 24px; height: 24px; border-radius: 50%; background: white; transition: .2s; }
.switch input:checked + span { background: #2bb7ff; }
.switch input:checked + span::after { transform: translateX(22px); }
.switch input:focus-visible + span { outline: 2px solid white; outline-offset: 3px; }

.icon-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.icon-options input { position: absolute; opacity: 0; pointer-events: none; }
.icon-options label {
  display: grid;
  justify-items: center;
  gap: 7px;
  padding: 8px 5px;
  border: 2px solid transparent;
  border-radius: 15px;
  color: #8290a4;
  font-size: .68rem;
  font-weight: 700;
  cursor: pointer;
}
.icon-options img { width: 52px; height: 52px; border-radius: 13px; }
.icon-options input:checked + label { border-color: #2bb7ff; color: #f8fafc; background: rgba(43,183,255,.09); }
.icon-options input:focus-visible + label { outline: 2px solid white; outline-offset: 2px; }

.primary-button, .secondary-button {
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 16px 20px;
  font-weight: 800;
  cursor: pointer;
}
.primary-button { color: #06101d; background: #2bb7ff; box-shadow: 0 10px 30px rgba(43,183,255,.25); }
.secondary-button { max-width: 240px; color: #06101d; background: #f8fafc; }
.url-note { margin: 14px 0 0; color: #8290a4; text-align: center; font-size: .72rem; }

.timer-view { text-align: center; }
.timer-mode { margin: 0 0 24px; color: #8fa0b7; font-weight: 700; }
.timer-display {
  font-size: clamp(5rem, 25vw, 9rem);
  font-weight: 200;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.07em;
  line-height: .9;
  white-space: nowrap;
}
.timer-display.seconds-only { font-size: clamp(8rem, 42vw, 13rem); }
.timer-status { min-height: 1.5em; margin: 24px 0 28px; color: #2bb7ff; font-weight: 800; }
.timer-actions { display: grid; justify-items: center; gap: 18px; }
.text-button { padding: 8px 16px; border: 0; color: #8fa0b7; background: transparent; cursor: pointer; }

body.finished { animation: finish-flash .7s ease-in-out 4 alternate; }
body.finished .timer-display, body.finished .timer-status { color: #55e6a5; }
@keyframes finish-flash { to { background-color: #123f38; } }

[hidden] { display: none !important; }

@media (max-height: 680px) {
  .app-shell { align-content: start; }
  .app-header { display: none; }
  .panel { padding: 20px; }
  .setting-block { margin-bottom: 20px; }
}
