* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #0b0b0f; color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { transition: background .3s; }
body[data-phase="work"] { background: #7a0f1a; }
body[data-phase="rest"] { background: #0f3d5c; }
button { font: inherit; color: inherit; border: 0; cursor: pointer; }
.screen { display: none; min-height: 100%; padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom)); max-width: 520px; margin: 0 auto; }
.screen.active { display: flex; flex-direction: column; }

header h1 { font-size: 44px; letter-spacing: 3px; margin: 20px 0 0; }
header h1 span { color: #ff3b4e; }
header p { color: #9a9aa5; margin: 4px 0 24px; }

.card { display: grid; text-align: left; background: #17171e; border-radius: 16px; padding: 18px; margin-bottom: 12px; gap: 4px; position: relative; }
.card strong { font-size: 20px; }
.card small { color: #9a9aa5; padding-right: 60px; }
.card em { position: absolute; right: 16px; top: 18px; font-style: normal; color: #ff3b4e; font-weight: 700; }

.back { background: none; color: #9a9aa5; text-align: left; padding: 8px 0; align-self: flex-start; font-size: 16px; }
#detail h2 { font-size: 30px; margin: 8px 0 0; }
#detail > p { color: #9a9aa5; margin: 4px 0 16px; }
#dBlocks section { background: #17171e; border-radius: 14px; padding: 14px 16px; margin-bottom: 10px; }
#dBlocks h3 { margin: 0; display: flex; justify-content: space-between; font-size: 17px; }
#dBlocks h3 span { color: #ff3b4e; }
.meta { color: #9a9aa5; font-size: 13px; margin: 2px 0 6px; }
#dBlocks ul { margin: 0; padding-left: 18px; color: #d0d0d8; font-size: 15px; line-height: 1.5; }
.cta { background: #ff3b4e; font-weight: 800; letter-spacing: 1px; padding: 18px; border-radius: 14px; font-size: 17px; margin-top: auto; position: sticky; bottom: 16px; }

#player .top { display: flex; justify-content: space-between; font-weight: 600; opacity: .9; }
.bar { height: 6px; background: rgba(255,255,255,.2); border-radius: 3px; margin: 12px 0; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: #fff; }
.center { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 8px; }
#phase { letter-spacing: 6px; font-weight: 800; font-size: 18px; opacity: .85; }
#move { font-size: 34px; font-weight: 800; line-height: 1.1; }
#cue { opacity: .8; min-height: 22px; }
#time { font-size: 150px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.1; }
#next { opacity: .8; }
.controls { display: flex; justify-content: center; gap: 20px; margin: 12px 0; }
.controls button { width: 72px; height: 72px; border-radius: 50%; background: rgba(255,255,255,.15); font-size: 24px; }
.controls #pause { background: #fff; color: #000; }
.quit { background: none; opacity: .7; padding: 10px; }

#done { justify-content: center; align-items: center; text-align: center; }
#done h2 { font-size: 56px; margin: 0; }
#done .cta { position: static; margin-top: 30px; width: 100%; }

.tag { background: #ff3b4e; color: #fff; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; padding: 1px 6px; border-radius: 8px; margin-left: 4px; }

#logbox { background: rgba(0,0,0,.35); border-radius: 14px; padding: 12px 16px; margin-top: 10px; width: 100%; max-width: 320px; }
#logbox[hidden], #summaryWrap[hidden] { display: none; }
#logbox label { display: block; font-weight: 600; margin-bottom: 8px; }
#logbox .row { display: flex; align-items: center; justify-content: center; gap: 10px; }
#logInput { width: 140px; font: inherit; font-size: 32px; font-weight: 800; text-align: center; padding: 6px; border-radius: 10px; border: 2px solid #fff; background: #fff; color: #000; }
#logUnit { font-size: 20px; font-weight: 700; }
#logBest { display: block; margin-top: 6px; opacity: .8; }

#results h2 { font-size: 30px; margin: 8px 0 16px; }
#results h3 { margin: 20px 0 8px; color: #9a9aa5; }
.res { display: flex; justify-content: space-between; gap: 10px; background: #17171e; border-radius: 12px; padding: 14px 16px; margin-bottom: 8px; }
.res span { color: #ff3b4e; font-weight: 700; text-align: right; }
#summary { list-style: none; padding: 0; text-align: left; line-height: 1.8; }
