*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #FFF5F5; --panel: #FFFFFF; --panel2: #FEF2F2;
  --border: #FCA5A5; --text: #1C1917; --text-muted: #78716C;
  --focus: #EF4444; --focus-light: #FEE2E2; --focus-dark: #DC2626;
  --short: #059669; --short-light: #D1FAE5;
  --long: #2563eb; --long-light: #DBEAFE;
  --radius: 12px; --shadow: 0 4px 20px rgba(239,68,68,.12);
  --current: var(--focus); --current-light: var(--focus-light);
}
body.mode-short { --current: var(--short); --current-light: var(--short-light); --bg: #F0FDF4; --panel2: #DCFCE7; --border: #86EFAC; }
body.mode-long  { --current: var(--long);  --current-light: var(--long-light);  --bg: #EFF6FF; --panel2: #DBEAFE; --border: #93C5FD; }

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; min-height: 100vh; transition: background .4s; }
.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; }

/* HEADER */
.site-header { background: var(--panel); border-bottom: 2px solid var(--current); box-shadow: var(--shadow); transition: border-color .4s; }
.header-inner { max-width: 1000px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; color: var(--current); transition: color .4s; }
.btn-settings { padding: 7px 14px; border: 1px solid var(--border); border-radius: 8px; background: none; color: var(--text-muted); font-size: 13px; cursor: pointer; font-family: inherit; transition: all .12s; }
.btn-settings:hover { border-color: var(--current); color: var(--current); }

/* SETTINGS */
.settings-panel { background: var(--panel); border-bottom: 2px solid var(--border); padding: 20px; }
.settings-inner { max-width: 600px; margin: 0 auto; }
.settings-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; }
.settings-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
@media (max-width: 600px) { .settings-grid { grid-template-columns: 1fr 1fr; } }
.sfield label { display: block; font-size: 11px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; text-transform: uppercase; }
.sfield input { width: 100%; padding: 8px 10px; border: 2px solid var(--border); border-radius: 8px; font-size: 16px; font-weight: 700; text-align: center; outline: none; font-family: inherit; }
.sfield input:focus { border-color: var(--current); }
.settings-checks { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.check-label { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.check-label input { accent-color: var(--current); width: 15px; height: 15px; }
.settings-actions { display: flex; gap: 8px; }
.btn-save-settings { padding: 8px 20px; background: var(--current); border: none; border-radius: 8px; color: white; font-weight: 700; cursor: pointer; font-family: inherit; font-size: 13px; }
.btn-cancel-settings { padding: 8px 16px; border: 1px solid var(--border); border-radius: 8px; background: none; color: var(--text-muted); cursor: pointer; font-family: inherit; font-size: 13px; }

/* MAIN */
.app-main { max-width: 1000px; margin: 0 auto; padding: 24px 20px; display: grid; grid-template-columns: 380px 1fr; gap: 20px; align-items: start; }
@media (max-width: 780px) { .app-main { grid-template-columns: 1fr; } }

/* TIMER CARD */
.timer-card { background: var(--panel); border: 2px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); text-align: center; margin-bottom: 16px; }
.mode-tabs { display: flex; gap: 4px; margin-bottom: 20px; background: var(--panel2); border-radius: 10px; padding: 4px; }
.mode-tab { flex: 1; padding: 7px 6px; border: none; border-radius: 8px; font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit; color: var(--text-muted); background: none; transition: all .15s; }
.mode-tab.active { background: var(--current); color: white; box-shadow: 0 2px 8px rgba(0,0,0,.15); }

/* RING */
.timer-ring-wrap { position: relative; width: 220px; height: 220px; margin: 0 auto 20px; }
.ring-svg { transform: rotate(-90deg); width: 220px; height: 220px; }
.ring-bg { fill: none; stroke: var(--panel2); stroke-width: 10; }
.ring-progress { fill: none; stroke: var(--current); stroke-width: 10; stroke-linecap: round;
  stroke-dasharray: 628; stroke-dashoffset: 0; transition: stroke-dashoffset .5s linear, stroke .4s; }
.timer-display { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); text-align: center; }
.timer-time { font-size: 52px; font-weight: 900; color: var(--text); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.timer-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--current); margin-top: 4px; transition: color .4s; }

/* CONTROLS */
.timer-controls { display: flex; gap: 10px; justify-content: center; margin-bottom: 16px; }
.btn-ctrl { padding: 11px 24px; border: none; border-radius: 10px; font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit; transition: all .15s; background: var(--current); color: white; }
.btn-ctrl:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-ctrl.secondary { background: var(--panel2); color: var(--current); border: 2px solid var(--border); }
.btn-ctrl.secondary:hover { background: var(--current-light); }

/* SESSION DOTS */
.session-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 14px; flex-wrap: wrap; }
.sdot { width: 14px; height: 14px; border-radius: 50%; background: var(--panel2); border: 2px solid var(--border); transition: all .3s; }
.sdot.done { background: var(--current); border-color: var(--current); }

/* CURRENT TASK DISPLAY */
.current-task-display { display: flex; align-items: center; gap: 6px; background: var(--current-light); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.ct-label { color: var(--text-muted); font-weight: 600; flex-shrink: 0; }
.ct-name { font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* STATS CARD */
.stats-card { background: var(--panel); border: 2px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card-title { font-size: 14px; font-weight: 700; margin-bottom: 14px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .07em; }
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 400px) { .stats-row { grid-template-columns: 1fr 1fr; } }
.stat-item { text-align: center; background: var(--panel2); border-radius: 8px; padding: 10px 6px; }
.stat-val { font-size: 24px; font-weight: 900; color: var(--current); }
.stat-lbl { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-top: 2px; }

/* TASKS CARD */
.tasks-card { background: var(--panel); border: 2px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.tasks-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.btn-clear-done { padding: 4px 10px; border: 1px solid var(--border); border-radius: 6px; background: none; font-size: 11px; font-weight: 600; cursor: pointer; color: var(--text-muted); font-family: inherit; transition: all .12s; }
.btn-clear-done:hover { border-color: var(--focus); color: var(--focus); }

.task-form { display: flex; gap: 8px; margin-bottom: 14px; }
.task-input { flex: 1; padding: 10px 14px; border: 2px solid var(--border); border-radius: 8px; font-size: 14px; outline: none; font-family: inherit; transition: border .15s; }
.task-input:focus { border-color: var(--current); }
.btn-add-task { width: 40px; height: 40px; border: none; border-radius: 8px; background: var(--current); color: white; font-size: 22px; cursor: pointer; transition: filter .12s; flex-shrink: 0; }
.btn-add-task:hover { filter: brightness(1.1); }

.task-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.task-item { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); cursor: pointer; transition: all .12s; }
.task-item:hover { border-color: var(--current); background: var(--current-light); }
.task-item.active { border-color: var(--current); background: var(--current-light); box-shadow: 0 0 0 2px var(--current); }
.task-item.done .task-text { text-decoration: line-through; color: var(--text-muted); }
.task-check { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border); flex-shrink: 0; display: flex; align-items: center; justify-content: center; transition: all .15s; }
.task-item.done .task-check { background: var(--short); border-color: var(--short); }
.task-check-mark { color: white; font-size: 11px; font-weight: 900; display: none; }
.task-item.done .task-check-mark { display: block; }
.task-text { flex: 1; font-size: 13px; font-weight: 500; }
.task-pomodoros { font-size: 11px; color: var(--text-muted); background: var(--panel2); padding: 2px 7px; border-radius: 10px; font-weight: 600; white-space: nowrap; }
.task-del { padding: 2px 6px; border: none; border-radius: 4px; background: none; color: var(--text-muted); cursor: pointer; font-size: 14px; opacity: 0; transition: opacity .12s; }
.task-item:hover .task-del { opacity: 1; }
.task-del:hover { color: var(--focus); }

.task-empty { text-align: center; padding: 24px; color: var(--text-muted); font-size: 13px; }

/* FOOTER */
.site-footer { border-top: 1px solid var(--border); text-align: center; padding: 14px; color: var(--text-muted); font-size: 12px; margin-top: 16px; }
