:root{
  --radius:16px;
  --shadow: 0 10px 30px rgba(17,24,39,0.08);
  --glass: rgba(255,255,255,0.7);
  --text:#112;
  --muted:#6b7280;

  /* tomato theme (default) */
  --accent-1: #ff9a76;
  --accent-2: #ff5a5f;
  --bg: linear-gradient(180deg,#fff7f4,#ffe6e2);
  --card-bg: #ffffff;
}

/* forest theme */
:root.theme-forest{
  --accent-1:#89c997; --accent-2:#2f9e6b; --bg: linear-gradient(180deg,#f3fff7,#e8fff0); --card-bg:#ffffff;
}

/* midnight theme */
:root.theme-midnight{
  --accent-1:#6ea8ff; --accent-2:#4b6ff8; --bg: linear-gradient(180deg,#081226,#07101b); --card-bg:#07101b; --text:#e6eef8; --muted:#9aa8c7;
}

*{box-sizing:border-box}
html,body{height:100%;margin:0;font-family:Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial}

html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  background: var(--bg);
  overscroll-behavior: none;
}

#app {
  height: 100dvh; /* dynamically fits full viewport */
}

body{background:var(--bg);color:var(--text);-webkit-font-smoothing:antialiased}
.app{max-width:980px;margin:16px auto;padding:12px}
.topbar{display:flex;justify-content:space-between;align-items:center;padding:8px 4px;margin-bottom:8px}
.brand{display:flex;align-items:center;gap:10px}
.logo{width:48px;height:48px;border-radius:12px;background:linear-gradient(180deg,var(--accent-1),var(--accent-2));display:flex;align-items:center;justify-content:center;font-size:22px;color:white;box-shadow:var(--shadow)}
.brand h1{margin:0;font-size:1.15rem}
.tag{font-size:12px;color:var(--muted)}
.top-actions{display:flex;gap:6px}
.icon{padding:8px;border-radius:10px;border:0;background:transparent;cursor:pointer}
.ghost{background:transparent;border:1px solid rgba(0,0,0,0.06);color:inherit}
.main{display:grid;grid-template-columns:1fr 360px;gap:12px}
.left,.right{display:flex;flex-direction:column;gap:12px}

/* cards */
.card{background:var(--card-bg);border-radius:var(--radius);padding:12px;box-shadow:var(--shadow)}
.timer-card{display:flex;flex-direction:column;align-items:center;gap:10px;padding:18px;text-align:center}
.timer-header{display:flex;justify-content:space-between;width:100%;align-items:center}
.session-type{font-weight:700;color:var(--muted);font-size:13px}
.rounds{font-size:13px;color:var(--muted)}
.ring-wrap{width:220px;height:220px;display:flex;align-items:center;justify-content:center;margin:6px auto}
.ring{transform:rotate(-90deg)}
.ring-bg{fill:none;stroke:#f0f0f0;stroke-width:8}
.ring-fg{fill:none;stroke-width:8;stroke-dasharray:283;stroke-dashoffset:0;transition:stroke-dashoffset 0.5s linear}
.time-text{font-size:14px;fill:currentColor;transform:rotate(90deg);font-weight:700;fill:var(--text)}
.controls{display:flex;gap:8px;margin-top:6px}
.btn{padding:10px 14px;border-radius:12px;border:0;background:linear-gradient(180deg,var(--accent-1),var(--accent-2));color:white;font-weight:600;cursor:pointer;box-shadow:0 6px 18px rgba(0,0,0,0.08)}
.btn.ghost{background:transparent;color:var(--text);border:1px solid rgba(0,0,0,0.06)}
.btn.small{padding:6px 10px;font-size:13px}
.primary{background:linear-gradient(180deg,var(--accent-1),var(--accent-2))}
.secondary{background:#333;color:#fff}

/* preset list */
.preset-list{display:flex;gap:8px;flex-wrap:wrap;justify-content:center;margin-top:8px}
.preset{padding:8px 10px;border-radius:10px;background:rgba(255,255,255,0.85);border:1px solid rgba(0,0,0,0.04);cursor:pointer;font-weight:600}

/* quick controls and settings */
.quick-controls{display:flex;justify-content:space-between;align-items:center;padding:10px}
.qc-left{display:flex;gap:6px}
.qc-right{display:flex;gap:8px}
.settings-card h3{margin:0 0 6px 0}
.row{display:flex;gap:10px;flex-wrap:wrap}
label{font-size:13px;color:var(--muted)}

/* tasks & stats */
.tasks-card .tasks-header{display:flex;justify-content:space-between;align-items:center}
.add-task input{width:100%;padding:10px;border-radius:10px;border:1px solid #e6eef3}
.task-list{margin-top:8px;max-height:320px;overflow:auto}
.task{display:flex;justify-content:space-between;align-items:center;padding:8px;border-radius:10px;border:1px solid rgba(0,0,0,0.04);margin-bottom:8px}
.task .title{font-weight:600}
.task .meta{font-size:12px;color:var(--muted)}
.task .task-actions button{margin-left:6px}

.stats-card .stat{display:flex;justify-content:space-between;padding:8px;border-radius:10px;border:1px dashed rgba(0,0,0,0.04);margin-bottom:8px}
.history{max-height:160px;overflow:auto;font-size:13px;color:var(--muted)}

.footer{text-align:center;margin-top:10px;color:var(--muted);font-size:13px}

/* responsive */
@media (max-width:920px){
  .main{grid-template-columns:1fr}
  .right{order:2}
  .ring-wrap{width:180px;height:180px}
}
