
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  --bg: var(--tk-bg, #f6f7fb);
  --surface: var(--tk-surface, #fff);
  --card: var(--surface);
  --fg: var(--tk-fg, #161b3d);
  --muted: var(--tk-muted, #51587a);
  --border: var(--tk-border, #d6d9e6);
  --accent: var(--tk-accent, #3a44c0);
  --accent-fg: var(--tk-accent-fg, #fff);
  --danger: var(--tk-danger, #b42318);
  --ring: var(--tk-ring, #3a44c0);
  --radius: var(--tk-radius, 14px);
  --font: var(--tk-font, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif);
  --stage-focus: #2c357d;
  --stage-short: #115e59;
  --stage-long: #4a3894;
  --glass: rgb(255 255 255 / .12);
  --glass-2: rgb(255 255 255 / .2);
  --on-stage: #fff;
  --on-stage-muted: rgb(255 255 255 / .86);
  --shadow: 0 10px 30px rgb(10 14 40 / .18);
  --stage: var(--stage-focus);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --stage-focus: #1d2456; --stage-short: #0f3b39; --stage-long: #2c2160;
    --glass: rgb(255 255 255 / .08); --glass-2: rgb(255 255 255 / .15); --card: #262d63;
    --shadow: 0 10px 30px rgb(0 0 0 / .45);
  }
}
:root[data-theme="dark"] {
  --stage-focus: #1d2456; --stage-short: #0f3b39; --stage-long: #2c2160;
  --glass: rgb(255 255 255 / .08); --glass-2: rgb(255 255 255 / .15); --card: #262d63;
  --shadow: 0 10px 30px rgb(0 0 0 / .45);
}
:root[data-mode="short"] { --stage: var(--stage-short); }
:root[data-mode="long"] { --stage: var(--stage-long); }

html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100vh;
  background: var(--stage); color: var(--fg);
  font: 16px/1.6 var(--font);
  transition: background-color .6s ease;
}
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.25; }
button { -webkit-tap-highlight-color: transparent; }

.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;
}
/* Logical offset: RTL must not turn left:-9999px into horizontal scroll. */
.skip-link { position: absolute; inset-inline-start: -9999px; top: 0; }
.skip-link:focus { inset-inline-start: 8px; top: 8px; z-index: 50; background: var(--surface); color: var(--fg); padding: 8px 12px; border-radius: 8px; }

.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.i-fill { fill: currentColor; stroke: none; }
.i-more { stroke-width: 3.5; }

.btn {
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--fg);
  padding: 8px 16px; min-height: 40px;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { border-color: var(--accent); filter: brightness(1.08); }
.btn-danger { color: var(--danger); border-color: currentColor; }
.btn-quiet { background: transparent; border-color: transparent; }
.btn-quiet:hover { background: var(--bg); border-color: transparent; }
.btn-small { min-height: 34px; padding: 4px 12px; font-size: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 14px; font-weight: 600; color: var(--muted); }
input[type="text"], input[type="number"], select {
  font: inherit; color: var(--fg); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; min-height: 42px; width: 100%;
}
input[type="text"]:hover, input[type="number"]:hover, select:hover { border-color: var(--muted); }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.hint { color: var(--muted); font-size: 14px; }
.error { color: var(--danger); font-weight: 600; margin: 8px 0 0; }
.status { color: var(--muted); font-size: 14px; }

.pill, .icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 38px; height: 38px; padding: 0 10px; border: 0; border-radius: 999px;
  background: var(--glass); color: var(--on-stage);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background-color .15s ease;
}
.pill { padding: 0 14px 0 12px; }
.pill:hover, .icon-btn:hover, .icon-btn[aria-expanded="true"] { background: var(--glass-2); }
.icon-btn-lg { width: 48px; height: 48px; }

.site-header {
  position: relative; max-width: 1400px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 8px 16px; color: var(--on-stage); --ring: var(--on-stage);
}
.brand { display: inline-flex; align-items: center; gap: 8px; min-height: 24px; color: inherit; font-weight: 700; text-decoration: none; flex: none; }
.brand img { display: block; }
.logo { height: 30px; width: auto; }
.site-menu { display: contents; }
.site-nav { order: 1; flex: 1; display: flex; justify-content: center; gap: 2px; }
.site-nav a {
  display: inline-flex; align-items: center; min-height: 36px; min-width: 24px; padding: 0 12px;
  border-radius: 999px; color: var(--on-stage-muted); text-decoration: none; font-weight: 600; white-space: nowrap;
}
.site-nav a:hover { color: var(--on-stage); background: var(--glass); }
.site-nav a[aria-current="page"] { color: var(--on-stage); background: var(--glass-2); }
.header-tools { order: 2; display: flex; align-items: center; gap: 6px; }
.lang-menu { order: 3; position: relative; flex: none; }
.lang-menu__btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px;
  font-size: 14px; font-weight: 600; color: var(--on-stage); white-space: nowrap; cursor: pointer;
  background: var(--glass); border: 0; border-radius: 999px; list-style: none; user-select: none;
  transition: background-color .15s ease;
}
.lang-menu__btn::-webkit-details-marker { display: none; }
.lang-menu__btn:hover, .lang-menu[open] .lang-menu__btn { background: var(--glass-2); }
.lang-menu__short { display: none; }
.lang-menu__caret { transition: transform .2s; }
.lang-menu[open] .lang-menu__caret { transform: rotate(180deg); }
.lang-menu__list {
  position: absolute; z-index: 30; top: calc(100% + 8px); inset-inline-end: 0; width: max-content;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; margin: 0; padding: 8px;
  list-style: none; background: var(--card); color: var(--fg); border-radius: 12px; box-shadow: var(--shadow);
  --ring: var(--tk-ring, #3a44c0);
}
.lang-menu__list a {
  display: block; padding: 10px 14px; border-radius: 8px; color: var(--fg); text-decoration: none; white-space: nowrap;
}
.lang-menu__list a:hover { background: var(--bg); }
.lang-menu__list a[aria-current="true"] { font-weight: 700; color: var(--accent); background: var(--bg); }
.menu-toggle { display: none; }

.menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 190px;
  display: flex; flex-direction: column; gap: 2px; padding: 6px;
  background: var(--card); color: var(--fg); border-radius: 12px; box-shadow: var(--shadow);
  --ring: var(--tk-ring, #3a44c0);
}
.menu-pop:not([data-open="true"]) { display: none; }
.menu-pop a, .menu-item {
  display: flex; align-items: center; min-height: 40px; min-width: 24px; padding: 0 12px; border: 0; border-radius: 8px;
  background: none; color: var(--fg); font: inherit; font-size: 15px; text-align: left; text-decoration: none;
  white-space: nowrap; cursor: pointer;
}
.menu-pop a:hover, .menu-item:hover { background: var(--bg); }

main { display: block; }
.tool { max-width: 600px; margin: 0 auto; padding: 4px 16px 48px; color: var(--on-stage); --ring: var(--on-stage); }
.timer-card { background: var(--glass); border-radius: 20px; padding: 14px 20px 22px; text-align: center; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 38px; margin-bottom: 10px; }
.tool-title { margin: 0; font-size: 15px; font-weight: 600; color: var(--on-stage-muted); text-align: left; }
.mode-tabs { display: inline-flex; max-width: 100%; gap: 2px; padding: 4px; border-radius: 999px; background: rgb(0 0 0 / .18); }
.mode-tab {
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; border: 0; border-radius: 999px;
  min-height: 36px; padding: 0 16px; background: transparent; color: var(--on-stage-muted); white-space: nowrap;
}
.mode-tab:hover { color: var(--on-stage); }
.mode-tab[aria-selected="true"] { background: var(--glass-2); color: var(--on-stage); }
.time {
  margin: 18px 0 16px; font-size: clamp(80px, 22vw, 128px); font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.progress {
  appearance: none; -webkit-appearance: none; display: block; width: 100%; height: 4px; border: 0;
  border-radius: 999px; overflow: hidden; background: rgb(255 255 255 / .2); color: var(--on-stage);
}
.progress::-webkit-progress-bar { background: rgb(255 255 255 / .2); border-radius: 999px; }
.progress::-webkit-progress-value { background: var(--on-stage); border-radius: 999px; }
.progress::-moz-progress-bar { background: var(--on-stage); border-radius: 999px; }
.controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; margin-top: 24px; }
.controls #reset { justify-self: end; }
.controls #skip { justify-self: start; }
.btn-start {
  min-width: 200px; min-height: 60px; padding: 0 28px; margin-bottom: 6px; border: 0; border-radius: 14px;
  background: #fff; color: var(--stage); box-shadow: 0 6px 0 rgb(0 0 0 / .2);
  font: inherit; font-size: 22px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease, color .6s ease;
}
.btn-start:active, .btn-start[aria-pressed="true"] { transform: translateY(6px); box-shadow: 0 0 0 rgb(0 0 0 / 0); }
.fs-btn { font-size: 0; }
.fs-btn::before {
  content: ""; width: 20px; height: 20px; background: currentColor;
  -webkit-mask: var(--fs-icon) center / contain no-repeat; mask: var(--fs-icon) center / contain no-repeat;
}
.timer-card { --fs-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5'/%3E%3C/svg%3E"); }
.timer-card:fullscreen { --fs-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 4v5H4M15 4v5h5M9 20v-5H4M15 20v-5h5'/%3E%3C/svg%3E"); }
.presets { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin-top: 18px; }
.presets-label { font-size: 13px; font-weight: 600; color: var(--on-stage-muted); }
.presets .btn-chip {
  min-height: 32px; padding: 0 14px; border-radius: 999px; font-size: 14px;
  border: 1px solid rgb(255 255 255 / .35); background: transparent; color: var(--on-stage);
}
.presets .btn-chip:hover { background: var(--glass); border-color: rgb(255 255 255 / .6); }
.notice { margin: 16px 0 0; padding: 10px 12px; border-radius: 10px; font-size: 14px; text-align: left; background: rgb(0 0 0 / .2); }
.notice p { margin: 0 0 6px; }
.notice p:last-child { margin: 0; }
.notice-missed, .notice-sound { font-weight: 700; }
.notice-bg {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 0 12px;
  padding: 0; background: none; font-size: 13px; line-height: 1.5; text-align: center; color: var(--on-stage-muted);
}
.notice-bg p { margin: 0; }
.notice-actions { display: inline-flex; gap: 12px; }
.link-btn {
  min-height: 28px; padding: 0 2px; border: 0; background: none; color: var(--on-stage); cursor: pointer;
  font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px;
}
.session-line { margin: 18px 0 22px; text-align: center; }
.session-line p { margin: 0; }
.round { font-size: 17px; font-weight: 700; }
.current-task, .tk-next { margin-top: 2px; font-size: 15px; color: var(--on-stage-muted); overflow-wrap: anywhere; }
.tk-next { font-size: 14px; }
.tk-next:empty { display: none; }
.tool:has(.task-list:empty) .current-task { display: none; } /* the empty task list already guides */

.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding-bottom: 10px; margin-bottom: 14px; border-bottom: 2px solid rgb(255 255 255 / .45);
}
.panel-head h2 { margin: 0; font-size: 18px; }
.task-menu { position: relative; }
.task-menu:not(:has(#clear-done:not([hidden]))) { display: none; }
.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.task-list:not(:empty) { margin-bottom: 12px; }
.task-list:not(:empty) + .tasks-empty { display: none; }
.tasks-empty { margin: 0 0 14px; text-align: center; font-size: 15px; color: var(--on-stage-muted); }
.task {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px;
  padding: 10px 10px 10px 14px; border-radius: 12px; border-left: 6px solid transparent;
  background: var(--card); color: var(--fg); box-shadow: 0 1px 3px rgb(0 0 0 / .15); --ring: var(--tk-ring, #3a44c0);
}
.task[aria-current="true"] { border-left-color: var(--accent); }
.task-main { flex: 1 1 240px; min-width: 0; display: flex; align-items: center; gap: 10px; }
.task input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; display: grid; place-items: center; margin: 0; cursor: pointer;
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--muted); background: var(--card);
}
.task input[type="checkbox"]:hover { border-color: var(--accent); }
.task input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
.task input[type="checkbox"]:checked::before {
  content: ""; width: 11px; height: 6px; margin-top: -3px;
  border: solid var(--accent-fg); border-width: 0 0 2.5px 2.5px; transform: rotate(-45deg);
}
.task-title { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.task[data-checked="true"] .task-title { text-decoration: line-through; color: var(--muted); }
.task-count { color: var(--muted); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.task-badge {
  flex: none; padding: 1px 8px; border-radius: 999px; background: var(--accent); color: var(--accent-fg);
  font-size: 12px; font-weight: 700; line-height: 1.5; white-space: nowrap;
}
.task-actions { display: flex; gap: 2px; margin-left: auto; }
.task-icon {
  display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px;
  background: none; color: var(--muted); cursor: pointer;
}
.task-icon .i { width: 18px; height: 18px; }
.task-icon:hover:not(:disabled) { background: var(--bg); color: var(--fg); }
.task-icon:disabled { opacity: .35; cursor: default; }
.task-icon[aria-pressed="true"] { color: var(--accent); }
.btn-task { min-height: 34px; font-size: 14px; }
.task-edit { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; }
.task-edit-title { flex: 1 1 200px; }
.task-edit-est { width: 80px; flex: none; }
.add-task {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 56px;
  border: 2px dashed rgb(255 255 255 / .45); border-radius: 12px; background: rgb(0 0 0 / .12);
  color: var(--on-stage-muted); font: inherit; font-weight: 700; cursor: pointer;
}
.add-task:hover { color: var(--on-stage); border-color: rgb(255 255 255 / .75); background: rgb(0 0 0 / .2); }
.task-form {
  display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 12px; padding: 16px;
  border-radius: 12px; background: var(--card); color: var(--fg); box-shadow: var(--shadow); --ring: var(--tk-ring, #3a44c0);
}
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
.tasks-panel .error { padding: 8px 12px; border-radius: 10px; background: var(--card); }
.finish {
  margin: 14px 0 0; padding: 12px 14px; border-radius: 12px; background: rgb(0 0 0 / .2);
  font-size: 15px; font-weight: 600; text-align: center;
}
:root[data-focus-view="on"] .tasks-panel { display: none; }

@media (max-width: 1400px) {
  :root:lang(es) .pill { padding: 0 10px; }
  :root:lang(es) .pill-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
@media (max-width: 1240px) {
  .pill { padding: 0 10px; }
  .pill-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
.lang-switch { margin: 0; font-size: 14px; }
.lang-switch summary {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 14px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--fg);
  font-weight: 600; cursor: pointer; list-style: none;
}
.lang-switch summary::-webkit-details-marker { display: none; }
.lang-switch summary::marker { content: ""; }
.lang-switch[open] summary { border-color: var(--muted); }
.lang-globe { flex: none; }
.lang-list { display: flex; flex-wrap: wrap; gap: 4px 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.lang-list a {
  display: inline-flex; align-items: center; min-height: 34px; padding: 4px 10px;
  color: var(--muted); text-decoration: none; border-radius: 8px;
}
.lang-list a:hover { color: var(--fg); background: var(--bg); }
.lang-list a[aria-current="true"] { color: var(--fg); font-weight: 700; }

@media (max-width: 1060px) {
  .header-tools { margin-left: auto; gap: 4px; }
  .menu-toggle { display: inline-flex; }
  .site-menu {
    display: none; position: absolute; right: 12px; top: 100%; z-index: 40; width: min(360px, calc(100vw - 24px));
    flex-direction: column; padding: 8px; border-radius: 14px;
    background: var(--card); color: var(--fg); box-shadow: var(--shadow); --ring: var(--tk-ring, #3a44c0);
  }
  .site-menu[data-open="true"] { display: flex; }
  .site-nav { flex-direction: column; gap: 2px; }
  .site-nav a { min-height: 44px; border-radius: 10px; color: var(--fg); }
  .site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--fg); background: var(--bg); }
  .lang-menu { position: static; }
  .lang-menu__btn { gap: 5px; padding: 0 10px; }
  .lang-menu__name { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  .lang-menu__short { display: inline; }
  .lang-menu__list { top: 100%; inset-inline: 0; width: auto; border-radius: 0 0 var(--radius) var(--radius); }
}
@media (max-width: 520px) {
  .site-header { padding: 10px 12px; gap: 8px; }
  .logo { height: 22px; }
  .header-tools .pill, .header-tools .icon-btn { min-width: 36px; height: 36px; padding: 0 8px; }
  .lang-menu__caret { display: none; }
  .tool { padding: 0 12px 40px; }
  .timer-card { padding: 10px 12px 18px; border-radius: 16px; }
  .card-top { margin-bottom: 8px; }
  .tool-title { font-size: 14px; }
  .mode-tab { padding: 0 9px; font-size: 14px; }
  .time { margin: 14px 0 14px; }
  .controls { gap: 12px; margin-top: 20px; }
  .btn-start { min-width: 150px; min-height: 56px; font-size: 20px; }
  .task-form { grid-template-columns: minmax(0, 1fr) 96px; }
}
@media (max-width: 420px) {
  .site-header { padding: 8px; gap: 4px; }
  .logo { height: 18px; }
  .header-tools { gap: 2px; }
  .lang-menu__short { display: none; }
  .mode-tab { min-width: 0; padding: 0 7px; font-size: 13px; line-height: 1.2; white-space: normal; }
}
