:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", "Hiragino Sans", Meiryo, sans-serif;
  background: var(--page);
  color: var(--text);
  --surface: #191923;
  --inset: #222230;
  --line: #2c2b3b;
  --muted: #a19fb4;
  --accent: #b3a2ff;
  --page: #101018;
  --text: #f5f3fc;
  --topbar: #14141e;
  --status: #2a2342;
  --track: #303041;
  --primary-text: #19132c;
  --primary: #b5a0ff;
  --primary-hover: #c8b8ff;
  --section-icon: #2b2442;
  --stepper: #181823;
  --input: #171721;
  --input-line: #343346;
  --button-hover: #302941;
  --add-line: #554875;
  --add: #221d32;
  --brand: #ab95fb;
  --brand-text: #19122c;
}
:root[data-theme="light"] {
  color-scheme: light;
  --page: #f7f6fc;
  --text: #242036;
  --surface: #fff;
  --inset: #f2f0f9;
  --line: #ded9eb;
  --muted: #595470;
  --accent: #59409e;
  --topbar: #fff;
  --status: #ede6fb;
  --track: #e7e2f1;
  --primary-text: #fff;
  --primary: #6548ad;
  --primary-hover: #50378f;
  --section-icon: #ede6fb;
  --stepper: #fff;
  --input: #fff;
  --input-line: #9e95b0;
  --button-hover: #e8dff7;
  --add-line: #9e8dbd;
  --add: #f5effc;
  --brand: #6548ad;
  --brand-text: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .42; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
svg { display: block; }
[data-icon] svg, button svg { width: 19px; height: 19px; flex: none; }
.topbar { border-bottom: 1px solid var(--line); background: var(--topbar); }
.top-inner { max-width: 1200px; margin: auto; padding: 0 32px; min-height: 69px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 11px; font-weight: 750; letter-spacing: .025em; }
.brand-icon { background: var(--brand); color: var(--brand-text); border-radius: 10px; width: 36px; height: 36px; display: grid; place-items: center; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.header-button, .icon-button, .save, .stepper, .timer-action { border: 1px solid var(--line); background: var(--inset); color: var(--muted); border-radius: 9px; }
.header-button { display: flex; align-items: center; gap: 8px; padding: 8px 12px; white-space: nowrap; font-size: .78rem; }
.header-button svg { width: 16px; height: 16px; color: var(--accent); }
main { max-width: 1136px; margin: auto; padding: 45px 24px 54px; }
.intro { margin-bottom: 30px; }
h1 { font-size: clamp(1.65rem, 4vw, 2.35rem); margin: 0 0 9px; letter-spacing: .025em; }
p { margin: 0; }
.intro p { color: var(--muted); font-size: .9rem; line-height: 1.6; }
.dashboard { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.settings { display: grid; gap: 18px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 19px; padding: 24px; }
.player { padding: 25px 28px; }
.player-top, .progress-label, .repeat { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.status { display: inline-flex; align-items: center; gap: 7px; color: var(--accent); background: var(--status); border-radius: 99px; padding: 6px 11px; font-size: .75rem; font-weight: 700; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.round { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.dial { --timer-color: #ad97ff; width: min(100%, 274px); aspect-ratio: 1; margin: 28px auto 24px; display: grid; place-items: center; position: relative; }
.ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); fill: none; stroke-width: 8; }
.track { stroke: var(--track); }
.arc { stroke: var(--timer-color); stroke-linecap: round; }
:root[data-theme="light"] .arc { stroke: color-mix(in srgb, var(--timer-color), #242036 35%); }
:root[data-theme="light"] #current { color: color-mix(in srgb, var(--timer-color), #242036 75%); }
.dial-text { position: relative; width: 79%; text-align: center; }
#current { color: var(--timer-color); font-size: 1rem; font-weight: 700; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#remaining { font-size: clamp(3.05rem, 7vw, 4.4rem); font-weight: 720; line-height: 1.25; letter-spacing: -.065em; font-variant-numeric: tabular-nums; }
#remaining.long { font-size: clamp(2.25rem, 6vw, 3.15rem); }
#next { color: var(--muted); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.controls { display: flex; justify-content: center; align-items: center; gap: 10px; }
.icon-button { width: 45px; height: 45px; display: grid; place-items: center; }
.primary { color: var(--primary-text); background: var(--primary); border: 0; height: 46px; border-radius: 10px; min-width: 150px; font-weight: 750; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 12px; }
.primary:hover:not(:disabled) { background: var(--primary-hover); }
.progress-section { margin-top: 25px; border-top: 1px solid var(--line); padding-top: 18px; }
.progress-label { font-size: .8rem; }
.progress-label strong { color: var(--accent); }
progress { margin: 10px 0 6px; width: 100%; height: 7px; display: block; border: 0; border-radius: 10px; background: var(--track); overflow: hidden; accent-color: var(--accent); }
progress::-webkit-progress-bar { background: var(--track); }
progress::-webkit-progress-value { background: var(--accent); border-radius: 10px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 10px; }
.foot { color: var(--muted); margin-top: 8px; font-variant-numeric: tabular-nums; font-size: .76rem; }
.section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 17px; }
h2 { margin: 0; font-size: 1rem; letter-spacing: .025em; }
.section-icon { color: var(--accent); display: grid; place-items: center; background: var(--section-icon); width: 34px; height: 34px; border-radius: 9px; }
.repeat { background: var(--inset); border: 1px solid var(--line); padding: 9px 12px; border-radius: 10px; font-size: .82rem; font-weight: 650; }
.stepper { display: flex; align-items: center; background: var(--stepper); overflow: hidden; }
.stepper button { padding: 0; min-width: 33px; height: 32px; background: transparent; color: var(--accent); border: 0; font-size: 1.05rem; }
input { background: var(--input); color: inherit; border: 1px solid var(--input-line); border-radius: 7px; padding: 7px 8px; min-width: 0; }
input::placeholder { color: var(--muted); }
input[type=number] { appearance: textfield; }
input::-webkit-inner-spin-button, input::-webkit-outer-spin-button { appearance: none; }
.stepper input { width: 36px; text-align: center; border: 0; background: transparent; padding: 4px 0; }
.list-title { display: flex; gap: 8px; align-items: center; margin: 19px 0 9px; font-size: .82rem; font-weight: 650; }
#count { color: var(--muted); font-size: .72rem; font-weight: 400; }
#timers { display: grid; gap: 8px; }
.timer-row { display: grid; align-items: center; gap: 7px; grid-template-columns: auto minmax(50px, 1fr) auto auto; padding: 8px; background: var(--inset); border: 1px solid var(--line); border-radius: 9px; }
.timer-row.active { border-color: color-mix(in srgb, var(--row-color), var(--line) 45%); }
.timer-name { width: 100%; font-size: .78rem; }
.color { width: 23px; height: 28px; border: 0; padding: 3px; background: transparent; cursor: pointer; }
.color::-webkit-color-swatch-wrapper { padding: 0; }
.color::-webkit-color-swatch { border: 0; border-radius: 5px; }
.color::-moz-color-swatch { border: 0; border-radius: 5px; }
.duration { display: flex; align-items: center; gap: 3px; color: var(--muted); font-size: .7rem; }
.duration input { width: 33px; padding-inline: 2px; text-align: center; font-size: .78rem; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; gap: 2px; }
.timer-action { display: grid; place-items: center; padding: 0; width: 25px; height: 31px; border: 0; }
.timer-action svg { width: 15px; height: 15px; }
button:hover:not(:disabled):not(.primary) { color: var(--text); background-color: var(--button-hover); }
.add { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; margin-top: 11px; min-height: 39px; border: 1px dashed var(--add-line); background: var(--add); color: var(--accent); border-radius: 9px; font-size: .8rem; font-weight: 650; }
.add svg, .save svg { width: 16px; height: 16px; }
#save-form { display: flex; gap: 8px; }
#program-name { flex: 1; font-size: .8rem; }
.save { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--accent); padding: 0 11px; font-size: .8rem; }
#saved { margin-top: 12px; display: grid; gap: 7px; }
.empty, #message { color: var(--muted); font-size: .76rem; }
.saved-row { display: flex; gap: 6px; align-items: center; }
.saved-row .save { flex: 1; justify-content: flex-start; min-width: 0; overflow-wrap: anywhere; text-align: left; }
#message { margin-top: 10px; }
@media (max-width: 850px) {
  .card { padding: 19px; }
  .dashboard { gap: 14px; }
}
@media (max-width: 720px) {
  main { max-width: 550px; padding: 28px 15px 38px; }
  .top-inner { padding: 0 15px; min-height: 60px; }
  .brand { font-size: .88rem; }
  .intro { margin-bottom: 19px; }
  .dashboard { grid-template-columns: minmax(0, 1fr); }
  .settings { gap: 14px; }
  #remaining { font-size: clamp(3.3rem, 13vw, 4.4rem); }
  #remaining.long { font-size: clamp(2.45rem, 9vw, 3.15rem); }
}
@media (max-width: 420px) {
  #theme-label { display: none; }
}
@media (max-width: 365px) {
  .card { padding: 14px; }
  .timer-row { padding: 5px; gap: 4px; }
  .timer-action { width: 23px; }
}
