:root {
  color-scheme: dark;

  --ink: #ffffff;
  --bg-fill: #2a2a2a;
  --line: rgba(255, 255, 255, 0.15);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: #2a2a2a;
}

body {
  font-family: 'Lilex', monospace;
  font-weight: 400;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------------- background layers ---------------- */
#bg-wrap {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
#bg-base {
  position: absolute;
  inset: 0;
  background: #2a2a2a;
}
#bg-image {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 0.2s ease;
}

body.has-bg .table-wrap::after { display: none; }

/* ---------------- settings button ---------------- */
#settings-btn {
  position: fixed;
  top: 18px;
  left: 24px;
  z-index: 30;

  font-family: inherit;
  font-size: 1rem;
  letter-spacing: 0.01em;
  line-height: 1;
  color: var(--ink);
  background: transparent;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 0.5rem 1.15rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
#settings-btn:hover { background: var(--ink); color: var(--bg-fill); }

/* ---------------- top right: Level display ---------------- */
#topright {
  position: fixed;
  top: 18px;
  right: 24px;
  z-index: 30;

  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

#level-display {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  width: 12rem;
}

#level-name {
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  opacity: 0.8;
  text-align: right;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#level-row {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 0.35rem;
  width: 100%;
}

#level-symbol { font-size: 1.1rem; line-height: 1; }
#level-number { font-size: 1.1rem; font-variant-numeric: tabular-nums; }

#xp-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  overflow: hidden;
}

#xp-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--ink);
  border-radius: 999px;
  transition: width 0.3s ease;
}

#xp-text {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--ink);
  opacity: 0.65;
  text-align: right;
  width: 100%;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------------- bottom left: lifetime stats ---------------- */
#bottomleft {
  position: fixed;
  left: 24px;
  bottom: 18px;
  z-index: 30;

  display: flex;
  flex-direction: column;
  gap: 0.15rem;

  user-select: none;
  pointer-events: none;
}

#lifetime,
#lifetime-tasks {
  font-size: 1.2rem;
  color: var(--ink);
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------------- clock ---------------- */
#clock {
  position: fixed;
  right: 24px;
  bottom: 18px;
  z-index: 30;

  font-size: 32px;
  color: var(--ink);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;

  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s ease;
}
#clock:hover { opacity: 0.55; }

/* ---------------- app shell ---------------- */
#app {
  position: relative;
  z-index: 1;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 1.5rem 2.5rem;
}

.divider {
  flex: 0 0 1px;
  height: 1px;
  background: var(--line);
}

.panel-title {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
}

/* ================= TOP: timer ================= */
#timer-panel {
  flex: 0 0 46%;
  min-height: 0;
  overflow: hidden;
  align-items: center;
  justify-content: flex-start;
  gap: 1.1rem;
  padding-top: 1.1rem;
  padding-bottom: 3.5rem;
}

#session-label {
  flex: 0 0 auto;
  font-size: 0.95rem;
  color: var(--ink);
  letter-spacing: 0.02em;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#session-label:empty { display: none; }

#timer-block {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

#timer {
  font-size: clamp(2.5rem, 9vh, 6rem);
  line-height: 1;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  user-select: none;
}

#start-btn, #controls { flex: 0 0 auto; }

#controls { display: flex; gap: 0.7rem; }
#controls[hidden], #start-btn[hidden] { display: none; }

/* ================= BOTTOM: to-do ================= */
#todo-panel {
  flex: 1 1 auto;
  min-height: 0;
  gap: 1rem;
  padding-bottom: 5rem;
}

#todo-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

#todo-head-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  flex-wrap: wrap;
}

#imp-filter { display: flex; gap: 0.4rem; }

#imp-filter button {
  font-family: inherit;
  width: 1.8rem;
  height: 1.8rem;
  padding: 0;
  font-size: 0.75rem;
  line-height: 1;

  color: var(--ink);
  background: transparent;
  border: 2px solid var(--ink);
  border-radius: 50%;
  cursor: pointer;

  transition: background 0.15s ease, color 0.15s ease;
}
#imp-filter button:hover { background: var(--ink); color: var(--bg-fill); }
#imp-filter button.on    { background: var(--ink); color: var(--bg-fill); }

/* ---------------- search bar ---------------- */
#search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

#task-search {
  font-family: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 0.3rem 1.3rem 0.3rem 0.1rem;
  outline: none;
  width: 11rem;
  transition: border-color 0.15s ease;
}
#task-search:focus { border-bottom-color: var(--ink); }
#task-search::placeholder { color: var(--ink); opacity: 0.35; }

#search-clear {
  position: absolute;
  right: 0.15rem;
  top: 50%;
  transform: translateY(-50%);

  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1;
  color: var(--ink);
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
#search-wrap.has-query #search-clear {
  opacity: 0.5;
  pointer-events: auto;
}
#search-wrap.has-query #search-clear:hover { opacity: 1; }

#task-count {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.7;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   TABLE STRUCTURE
   ============================================================ */
.table-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
}

.table-x {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
}

.table-wrap::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 34px;
  background: linear-gradient(to top, var(--bg-fill) 12%, transparent);
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.25s ease;
  z-index: 2;
}
.table-wrap.at-end::after { opacity: 0; }

.head-table,
.body-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.head-table { flex: 0 0 auto; }

.scroller {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scroll-snap-type: y proximity;
  scroll-behavior: smooth;

  scrollbar-width: none;
  -ms-overflow-style: none;
}
.scroller::-webkit-scrollbar { display: none; }

.body-table tr {
  scroll-snap-align: start;
  scroll-snap-stop: normal;
}

.head-table th {
  background: transparent;

  text-align: left;
  color: var(--ink);
  white-space: nowrap;

  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0 0.7rem 0.55rem 0;
  border-bottom: 2px solid var(--ink);

  overflow: hidden;
}
.head-table th:not(:first-child) { padding-left: 0.7rem; }

.body-table td {
  padding: 0.75rem 0.7rem 0.75rem 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  color: var(--ink);
}
.body-table td:not(:first-child) { padding-left: 0.7rem; }

.head-table th:not(:last-child),
.body-table td:not(:last-child) {
  border-right: 1px solid var(--line);
}

/* ================= history table ================= */
#history-wrap {
  flex: 0 0 auto;
  width: 100%;
  max-width: 520px;
  align-self: center;
  margin-bottom: 0.75rem;
}

#history-wrap .scroller { max-height: 8.5rem; }

#history-head-table,
#history-body-table { font-size: 0.95rem; }

#history-body-table td.name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#history-body-table td:last-child {
  font-variant-numeric: tabular-nums;
  text-align: left;
}
#history-head-table th:last-child { text-align: left; }

/* ================= task table ================= */
#task-wrap {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
}

#task-head-table,
#task-body-table { font-size: 0.95rem; }

#task-body-table td.c-name {
  font-size: 1.05em;
  line-height: 1.4;
  word-break: break-word;
}

#task-body-table td.c-imp {
  font-size: 1em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.due-date { display: block; white-space: nowrap; }
.due-time {
  display: block;
  font-size: 0.85em;
  margin-top: 1px;
  white-space: nowrap;
  opacity: 0.7;
}
#task-body-table td.c-due.overdue .due-date,
#task-body-table td.c-due.overdue .due-time {
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
}

.loc-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.loc-text {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.3rem;
  height: 1.3rem;
  padding: 0;
  margin-top: 0.15rem;
  vertical-align: middle;

  font-family: inherit;
  font-size: 0.7rem;
  line-height: 1;
  color: var(--ink);
  background: transparent;
  border: 2px solid var(--ink);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.check:hover { background: var(--ink); color: var(--bg-fill); }

.del {
  flex: 0 0 auto;
  font-family: inherit;
  font-size: 1.15rem;
  line-height: 1;
  color: var(--ink);
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.task-row:hover .del { opacity: 1; }

.body-table td.empty {
  padding: 1.6rem 0;
  border-bottom: none;
  opacity: 0.5;
}

.sort-btn {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  letter-spacing: inherit;
  text-transform: inherit;

  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  max-width: 100%;
}
.sort-btn:hover { text-decoration: underline; text-decoration-thickness: 1.5px; }

.sort-btn .arrow {
  display: inline-block;
  width: 0.9em;
  text-align: center;
  font-size: 1.1em;
  line-height: 1;
  flex: 0 0 auto;
}

.task-row.new { animation: rowIn 0.3s ease both; }
#history-body tr.new { animation: rowIn 0.3s ease both; }

@keyframes rowIn {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.task-row.removing {
  animation: rowOut 0.34s ease forwards;
  pointer-events: none;
}
@keyframes rowOut {
  0%   { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(-28px); }
}

/* ---------------- pills ---------------- */
.pill {
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: transparent;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 0.55rem 1.5rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}
.pill:hover:not(:disabled) { background: var(--ink); color: var(--bg-fill); }

.pill.ghost { border-color: var(--ink); }

.pill.small { font-size: 0.85rem; padding: 0.4rem 1.1rem; }

.pill:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ---------------- overlays ---------------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;

  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;

  background: rgba(0, 0, 0, 0.65);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  overflow-y: auto;
}
.overlay.open { opacity: 1; pointer-events: auto; }

.modal {
  width: min(92vw, 520px);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin: auto;
}

.overlay-actions { display: flex; gap: 0.75rem; justify-content: center; }

/* ---------------- modal fields ---------------- */
.field { display: flex; flex-direction: column; gap: 0.45rem; }

.field-label {
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  text-align: left;

  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}
.field-label .opt {
  font-size: 0.9em;
  letter-spacing: 0.02em;
  text-transform: none;
  opacity: 0.65;
}
.field-label .val {
  font-size: 0.95em;
  letter-spacing: 0.02em;
  text-transform: none;
  font-variant-numeric: tabular-nums;
}

.field-note {
  font-size: 0.78rem;
  color: var(--ink);
  opacity: 0.75;
  line-height: 1.45;
  word-break: break-all;
}

.field-error {
  font-size: 0.78rem;
  color: var(--ink);
  display: none;
}
.field-error.show { display: block; }

.modal input[type="text"] {
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--ink);
  border-radius: 0;
  padding: 0.3rem 0.1rem 0.4rem;
  outline: none;
  width: 100%;
}

#session-name {
  font-size: clamp(1.15rem, 3vw, 1.6rem);
  text-align: left;
}

#task-name { font-size: 1.2rem; }

.modal input::placeholder { color: var(--ink); opacity: 0.35; }

#task-name.invalid,
#set-name.invalid,
#task-location.invalid {
  animation: shake 0.35s ease;
  border-bottom-width: 3px;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}

/* ---------------- due-date field ---------------- */
.date-field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-bottom: 2px solid var(--ink);
  padding: 0.3rem 0 0.4rem;
  cursor: pointer;
}

.date-text {
  flex: 1 1 auto;
  font-size: 1rem;
  color: var(--ink);
  min-height: 1.5rem;
  line-height: 1.5rem;
}

.cal-icon {
  flex: 0 0 auto;
  width: 1.15rem;
  height: 1.15rem;
  color: var(--ink);
  pointer-events: none;
}

.date-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;

  font-family: inherit;
  font-size: 1rem;
  color: transparent;
  -webkit-text-fill-color: transparent;
  background: transparent;
  border: none;
  outline: none;
  opacity: 0;
  cursor: pointer;

  appearance: none;
  -webkit-appearance: none;
}

.date-native::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}
.date-native::-moz-calendar-picker-indicator { opacity: 0; }

/* ---------------- custom select ---------------- */
.select-wrap { position: relative; display: block; }

#tie-task {
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--ink);
  border-radius: 0;
  padding: 0.3rem 1.8rem 0.4rem 0.1rem;
  outline: none;
  width: 100%;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}
#tie-task option {
  background: #2a2a2a;
  color: #ffffff;
}

.select-arrow {
  position: absolute;
  right: 0.2rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  color: var(--ink);
  pointer-events: none;
}

#imp-picker { display: flex; gap: 0.5rem; }

#imp-picker button {
  font-family: inherit;
  width: 2.6rem;
  height: 2.6rem;
  padding: 0;
  font-size: 0.95rem;
  color: var(--ink);
  background: transparent;
  border: 2px solid var(--ink);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
#imp-picker button:hover { background: var(--ink); color: var(--bg-fill); }
#imp-picker button.sel   { background: var(--ink); color: var(--bg-fill); }

/* ---------------- settings modal ---------------- */
#settings-overlay .modal { gap: 1.3rem; }

/* file picker row */
.bg-picker {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  background: var(--ink);
  outline: none;
  cursor: pointer;
  margin: 0.95rem 0 0.75rem;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: var(--ink);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: var(--ink);
  border: none;
  cursor: pointer;
}

/* ---------------- welcome splash ---------------- */
#splash {
  position: fixed;
  inset: 0;
  z-index: 200;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;

  background: var(--bg-fill);

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}
#splash.show { opacity: 1; pointer-events: auto; }

#splash-welcome {
  font-size: 1.4rem;
  color: var(--ink);
  letter-spacing: 0.06em;
  opacity: 0.75;
}
#splash-name {
  font-size: clamp(2.5rem, 8vw, 5rem);
  color: var(--ink);
  letter-spacing: -0.01em;
  text-align: center;
  word-break: break-word;
  max-width: 90vw;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-height: 640px) {
  .panel { padding-top: 1rem; padding-bottom: 1rem; }
  #timer { font-size: clamp(2rem, 7vh, 3.6rem); }
  #lifetime, #lifetime-tasks { font-size: 1rem; }
  #clock { font-size: 26px; }
  #history-wrap .scroller { max-height: 7rem; }
  #todo-panel { padding-bottom: 4rem; }
}

@media (max-width: 900px) {
  .panel { padding: 1.25rem 1.5rem; }

  #timer-panel { padding-top: 1rem; padding-bottom: 2.75rem; }
  #timer { font-size: clamp(2.25rem, 13vw, 4.5rem); }

  #todo-panel { padding-bottom: 7rem; }

  #settings-btn { font-size: 0.9rem; padding: 0.45rem 1rem; }
  #level-display { width: 10rem; }
  #level-name { font-size: 0.78rem; }
  #level-symbol, #level-number { font-size: 1rem; }
  #xp-text { font-size: 0.65rem; }

  #lifetime,
  #lifetime-tasks { font-size: 1.05rem; }
  #clock { font-size: 28px; }

  #task-search { width: 9rem; }

  .head-table th {
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    padding-right: 0.5rem;
  }
  .head-table th:not(:first-child) { padding-left: 0.5rem; }
  .body-table td {
    padding-right: 0.5rem;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
  }
  .body-table td:not(:first-child) { padding-left: 0.5rem; }

  #history-wrap { max-width: 100%; }
}

@media (max-width: 640px) {
  .panel { padding: 1rem 1rem; }

  #settings-btn {
    top: 14px; left: 14px;
    font-size: 0.82rem;
    padding: 0.4rem 0.85rem;
    border-width: 2px;
  }
  #topright { top: 14px; right: 14px; }
  #level-display { width: 8.5rem; gap: 0.15rem; }
  #level-name { font-size: 0.7rem; }
  #level-symbol, #level-number { font-size: 0.95rem; }
  #xp-bar-track { height: 5px; }
  #xp-text { font-size: 0.6rem; }

  #bottomleft { left: 14px; bottom: 14px; gap: 0.1rem; }
  #lifetime,
  #lifetime-tasks { font-size: 0.9rem; }

  #clock { right: 14px; bottom: 14px; font-size: 24px; }

  #timer-panel { padding-top: 0.85rem; padding-bottom: 2rem; gap: 0.8rem; }
  #timer { font-size: clamp(2rem, 15vw, 3.5rem); }

  #todo-head {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.65rem;
  }
  #todo-head-left {
    flex-wrap: wrap;
    gap: 0.55rem;
    width: 100%;
  }
  #add-task-btn { align-self: flex-end; }

  #task-search { width: 8rem; font-size: 0.75rem; }

  #task-count  { font-size: 0.66rem; letter-spacing: 0.12em; }

  #imp-filter button { width: 1.6rem; height: 1.6rem; font-size: 0.7rem; }

  .table-x {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .table-x::-webkit-scrollbar { display: none; }

  #task-head-table,
  #task-body-table   { min-width: 520px; }
  #history-head-table,
  #history-body-table { min-width: 340px; }

  #history-wrap .scroller { max-height: 6.5rem; }

  .pill { font-size: 0.88rem; padding: 0.45rem 1.15rem; }
  .pill.small { font-size: 0.78rem; padding: 0.35rem 0.9rem; }

  .modal { width: 100%; gap: 1.15rem; }
  .overlay { padding: 1.25rem; }

  #imp-picker button { width: 2.3rem; height: 2.3rem; font-size: 0.9rem; }

  #splash-welcome { font-size: 1.15rem; }
  #splash-name { font-size: clamp(2rem, 12vw, 3.5rem); }
}

@media (max-width: 400px) {
  #settings-btn { font-size: 0.76rem; padding: 0.35rem 0.75rem; }
  #clock { font-size: 20px; }
  #lifetime,
  #lifetime-tasks { font-size: 0.82rem; }

  #imp-filter button { width: 1.45rem; height: 1.45rem; font-size: 0.65rem; }
  #imp-filter { gap: 0.3rem; }

  #task-head-table,
  #task-body-table { min-width: 480px; }

  #level-display { width: 7.5rem; }
}