:root {
  color-scheme: dark;
  --bg: #09070b;
  --surface: rgba(27, 21, 25, 0.88);
  --surface-solid: #1b1519;
  --surface-soft: rgba(42, 31, 34, 0.78);
  --ink: #f6e9cb;
  --muted: #a89477;
  --line: rgba(246, 213, 142, 0.17);
  --accent: #2fb9a5;
  --accent-strong: #46d6bf;
  --done: #4fbf7a;
  --danger: #e24b37;
  --focus-red: #c93626;
  --focus-gold: #d8a23a;
  --focus-violet: #7554c9;
  --focus-teal: #2fb9a5;
  --focus-ember: #f05a28;
  --focus-hot: #ff4b32;
  --focus-life: #64d98a;
  --glass: rgba(29, 22, 28, 0.82);
  --glass-strong: rgba(37, 28, 32, 0.92);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.44);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(145deg, rgba(201, 54, 38, 0.16), transparent 34%),
    linear-gradient(105deg, #09070b 0%, #141018 46%, #241415 100%);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(216, 162, 58, 0.08), rgba(9, 7, 11, 0) 32%),
    linear-gradient(90deg, rgba(47, 185, 165, 0.06), rgba(201, 54, 38, 0.08) 55%, rgba(117, 84, 201, 0.07));
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1180px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px calc(34px + env(safe-area-inset-bottom));
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.auth-view {
  min-height: calc(100vh - 42px);
  display: grid;
  place-items: center;
}

.login-panel {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--glass-strong);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 22px;
  font-size: 42px;
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.25;
}

.stack {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  padding: 0 13px;
  color: var(--ink);
  background: rgba(10, 8, 12, 0.74);
}

.field input:focus,
.title-input:focus,
.markdown-editor:focus {
  border-color: rgba(13, 127, 138, 0.66);
  box-shadow: 0 0 0 3px rgba(13, 127, 138, 0.14);
}

.primary-button,
.secondary-button,
.icon-button,
.todo-card,
.new-todo-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--glass);
}

.primary-button {
  min-height: 44px;
  border-color: rgba(216, 162, 58, 0.62);
  border-radius: 6px;
  padding: 0 18px;
  color: #140c08;
  font-weight: 760;
  background: linear-gradient(135deg, var(--focus-gold), var(--focus-ember));
}

.primary-button:hover {
  background: linear-gradient(135deg, #efc15d, #ff6a32);
}

.primary-button:disabled,
.secondary-button:disabled,
.icon-button:disabled {
  cursor: default;
  opacity: 0.62;
  transform: none;
}

.secondary-button {
  min-height: 40px;
  border-radius: 6px;
  padding: 0 14px;
  font-weight: 720;
}

.danger-button {
  color: var(--danger);
  border-color: rgba(226, 75, 55, 0.32);
}

.icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 6px;
}

.icon-button svg,
.new-todo-button svg,
.sort-handle svg,
.todo-arrow svg,
.todo-card-copy-button svg,
.todo-focus-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.error {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.app-view {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  min-height: 68px;
  padding: 4px 2px 14px;
  border-bottom: 1px solid rgba(246, 213, 142, 0.14);
  background: transparent;
}

.topbar h1 {
  min-width: 0;
  margin-bottom: 0;
  color: #fff3d6;
  font-size: 34px;
  line-height: 1.04;
  font-weight: 830;
  overflow-wrap: anywhere;
}

.app-title {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.title-stack {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.title-stack .eyebrow {
  margin: 0;
}

.app-title::before {
  content: "";
  width: 4px;
  flex: 0 0 auto;
  height: 38px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--focus-gold), var(--focus-ember) 54%, var(--accent));
  box-shadow: 0 0 22px rgba(216, 162, 58, 0.2);
}

.new-todo-button {
  width: 36px;
  flex: 0 0 auto;
  height: 36px;
  border-radius: 6px;
  border-color: rgba(216, 162, 58, 0.32);
  color: #140c08;
  background: linear-gradient(135deg, var(--focus-gold), var(--focus-ember));
  box-shadow: 0 10px 24px rgba(201, 54, 38, 0.16);
}

.new-todo-button:hover {
  border-color: rgba(246, 213, 142, 0.52);
  background: linear-gradient(135deg, #efc15d, #ff6a32);
}

.new-todo-button svg {
  width: 16px;
  height: 16px;
}

.topbar-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-actions > .icon-button {
  flex: 0 0 auto;
  color: var(--muted);
  border-color: rgba(246, 213, 142, 0.2);
  background: rgba(246, 233, 203, 0.055);
}

.topbar-actions > .icon-button:hover,
.topbar-actions > .icon-button:focus-visible {
  color: var(--ink);
  border-color: rgba(47, 185, 165, 0.34);
  background: rgba(47, 185, 165, 0.12);
}

.status-filter-control {
  flex: 0 0 auto;
  position: relative;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(246, 213, 142, 0.18);
  border-radius: 6px;
  color: var(--muted);
  background: rgba(246, 233, 203, 0.055);
  cursor: pointer;
}

.status-filter-control:hover,
.status-filter-control:focus-within {
  color: var(--ink);
  border-color: rgba(47, 185, 165, 0.34);
  background: rgba(47, 185, 165, 0.12);
}

.status-filter-control svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.status-filter-control select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.game-dashboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stat-tile {
  min-width: 0;
  min-height: 78px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 14px;
  border: 1px solid rgba(246, 213, 142, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(246, 233, 203, 0.04), rgba(47, 185, 165, 0.035)),
    rgba(27, 21, 25, 0.7);
}

.stat-tile span:first-child {
  color: #fff3d6;
  font-size: 28px;
  line-height: 1;
  font-weight: 860;
  font-variant-numeric: tabular-nums;
}

.stat-tile span:last-child {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.1;
  font-weight: 780;
  text-transform: uppercase;
}

.game-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 4px 0;
}

.game-nav-button {
  min-width: 0;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid rgba(246, 213, 142, 0.18);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(246, 233, 203, 0.055);
  font-weight: 780;
}

.game-nav-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.game-nav-button:hover,
.game-nav-button:focus-visible,
.game-nav-button.active {
  color: var(--ink);
  border-color: rgba(47, 185, 165, 0.4);
  background: rgba(47, 185, 165, 0.12);
}

.game-nav-button.active {
  border-color: rgba(216, 162, 58, 0.42);
  box-shadow: inset 0 1px 0 rgba(246, 233, 203, 0.08);
}

.section-heading {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 2px 2px 0;
}

.section-heading h2 {
  color: #fff3d6;
  font-size: 24px;
  line-height: 1.08;
}

.focus-panel {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-width: 0;
  border: 1px solid rgba(240, 90, 40, 0.38);
  border-radius: 8px;
  padding: 16px;
  background:
    repeating-linear-gradient(90deg, rgba(246, 233, 203, 0.045) 0 1px, transparent 1px 36px),
    linear-gradient(135deg, rgba(201, 54, 38, 0.2), rgba(216, 162, 58, 0.12) 38%, rgba(47, 185, 165, 0.09) 68%, rgba(117, 84, 201, 0.12)),
    rgba(20, 16, 24, 0.88);
  box-shadow: 0 20px 62px rgba(0, 0, 0, 0.38), 0 0 0 1px rgba(216, 162, 58, 0.08), inset 0 1px 0 rgba(246, 233, 203, 0.08);
}

.focus-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(201, 54, 38, 0.16), transparent 45%, rgba(47, 185, 165, 0.13)),
    linear-gradient(180deg, rgba(246, 233, 203, 0.08), transparent);
  opacity: 1;
}

.focus-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, rgba(255, 75, 50, 0.18), transparent);
  opacity: 0;
}

.focus-panel.has-focus {
  border-color: rgba(255, 75, 50, 0.66);
  box-shadow: 0 24px 74px rgba(201, 54, 38, 0.24), 0 0 0 1px rgba(216, 162, 58, 0.14), inset 0 1px 0 rgba(246, 233, 203, 0.1);
}

.focus-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}

.focus-heading {
  min-width: 0;
}

.focus-heading h2 {
  margin: 0;
  color: #fff3d6;
  font-size: 24px;
  line-height: 1.05;
}

.focus-meter {
  min-width: 82px;
  display: grid;
  justify-items: end;
  gap: 2px;
  padding: 7px 10px;
  border: 1px solid rgba(216, 162, 58, 0.26);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(9, 7, 11, 0.44);
  box-shadow: inset 0 1px 0 rgba(246, 233, 203, 0.08);
}

.focus-meter span:first-child {
  font-size: 22px;
  line-height: 1;
  font-weight: 840;
}

.focus-meter span:last-child {
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  font-weight: 760;
  text-transform: uppercase;
}

.focus-timer-hud {
  min-width: 0;
  display: block;
  padding: 8px 0 16px;
}

.focus-timer-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.focus-timer-label {
  color: #f3bd58;
  font-size: 11px;
  font-weight: 820;
  letter-spacing: 0;
  text-transform: uppercase;
}

.focus-timer {
  display: block;
  width: 100%;
  color: #fff1c9;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", ui-monospace, monospace;
  font-size: 76px;
  font-weight: 860;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  line-height: 0.92;
  overflow-wrap: anywhere;
  text-shadow: 0 0 18px rgba(216, 162, 58, 0.24), 0 0 34px rgba(255, 75, 50, 0.2);
}

.focus-timer-hint {
  min-height: 18px;
  color: #d6c39f;
  font-size: 13px;
  font-weight: 720;
  overflow-wrap: anywhere;
}

.focus-panel.has-focus .focus-timer {
  color: #fff5d9;
}

.focus-drop-zone {
  position: relative;
  min-height: 104px;
  border: 1px solid rgba(246, 213, 142, 0.16);
  border-radius: 8px;
  padding: 8px;
  background:
    linear-gradient(180deg, rgba(9, 7, 11, 0.36), rgba(9, 7, 11, 0.2)),
    rgba(9, 7, 11, 0.26);
  box-shadow: inset 0 1px 24px rgba(0, 0, 0, 0.2);
}

.focus-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.focus-empty {
  position: absolute;
  inset: 8px;
  display: grid;
  place-items: center;
  gap: 8px;
  color: rgba(246, 233, 203, 0.58);
  font-size: 13px;
  font-weight: 760;
  text-align: center;
}

.focus-empty-mark {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(240, 185, 78, 0.56);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(216, 162, 58, 0.7), rgba(201, 54, 38, 0.42)),
    rgba(9, 7, 11, 0.28);
  box-shadow: inset 0 0 0 8px rgba(9, 7, 11, 0.18), 0 10px 28px rgba(0, 0, 0, 0.2);
  transform: rotate(45deg);
}

.focus-panel.drag-ready {
  border-color: rgba(240, 185, 78, 0.62);
}

.focus-panel.drop-target {
  border-color: rgba(223, 63, 50, 0.72);
  box-shadow: 0 22px 72px rgba(201, 54, 38, 0.22), 0 0 0 2px rgba(216, 162, 58, 0.22);
}

.focus-panel.drop-target .focus-drop-zone {
  border-color: rgba(240, 185, 78, 0.78);
  background:
    linear-gradient(135deg, rgba(216, 162, 58, 0.17), rgba(47, 185, 165, 0.12)),
    rgba(9, 7, 11, 0.34);
}

.list-panel {
  min-width: 0;
  min-height: 430px;
  border-radius: 8px;
}

.list-panel.drag-ready {
  outline: 1px solid rgba(47, 185, 165, 0.24);
  outline-offset: 8px;
}

.list-panel.drop-target {
  outline-color: rgba(216, 162, 58, 0.58);
  background: rgba(47, 185, 165, 0.04);
}

.todo-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.todo-item {
  position: relative;
}

.todo-item.done {
  opacity: 0.72;
}

.sort-handle {
  width: 28px;
  min-height: 42px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.sort-handle:active {
  cursor: grabbing;
}

.sort-handle:hover {
  color: var(--accent);
  background: rgba(47, 185, 165, 0.11);
}

.sort-handle:focus-visible {
  color: var(--accent);
  outline: 2px solid rgba(13, 127, 138, 0.44);
  outline-offset: 2px;
}

.entry-badge {
  cursor: default;
}

.entry-badge:hover {
  color: var(--focus-gold);
  background: rgba(216, 162, 58, 0.1);
}

.sort-handle svg {
  width: 16px;
  height: 16px;
}

.todo-item.dragging .todo-card {
  opacity: 0.32;
  transform: scale(0.985);
}

.todo-item.drop-before .todo-card,
.todo-item.drop-after .todo-card {
  border-color: rgba(13, 127, 138, 0.58);
  box-shadow: 0 0 0 3px rgba(13, 127, 138, 0.11);
}

.todo-item.drop-before::before,
.todo-item.drop-after::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--focus-teal), var(--focus-gold));
}

.todo-item.drop-before::before {
  top: -5px;
}

.todo-item.drop-after::after {
  bottom: -5px;
}

.todo-card {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 74px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 13px 14px 13px 10px;
  border-radius: 8px;
  text-align: left;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(246, 233, 203, 0.045), rgba(47, 185, 165, 0.035)),
    rgba(27, 21, 25, 0.88);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(246, 233, 203, 0.05);
}

.todo-card:hover,
.todo-card:focus-within {
  border-color: rgba(216, 162, 58, 0.28);
}

.todo-card-button {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.todo-card-button:focus-visible {
  border-radius: 6px;
  outline: 2px solid rgba(13, 127, 138, 0.44);
  outline-offset: 4px;
}

.todo-status {
  width: 12px;
  height: 12px;
  border: 2px solid var(--accent);
  border-radius: 50%;
}

.todo-card-tools {
  display: flex;
  justify-content: end;
  gap: 5px;
}

.todo-item.done .todo-status {
  border-color: var(--done);
  background: var(--done);
}

.todo-item[data-kind="world"] .todo-status {
  border-color: var(--focus-gold);
  background: rgba(216, 162, 58, 0.18);
}

.todo-item[data-kind="history"] .todo-status {
  border-color: var(--focus-violet);
  background: rgba(117, 84, 201, 0.2);
}

.todo-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.todo-text {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.35;
  font-weight: 740;
}

.todo-item.done .todo-text {
  text-decoration: line-through;
}

.todo-meta {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.entry-kind {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 2px 7px;
  border: 1px solid rgba(246, 213, 142, 0.24);
  border-radius: 999px;
  color: #f3bd58;
  background: rgba(216, 162, 58, 0.1);
}

.entry-kind:empty {
  display: none;
}

.claim:empty {
  display: none;
}

.todo-arrow {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.todo-card-copy-button,
.todo-focus-button {
  width: 36px;
  height: 36px;
  justify-self: end;
  border-color: transparent;
  color: var(--muted);
  background: transparent;
}

.todo-card-copy-button:hover,
.todo-card-copy-button:focus-visible,
.todo-focus-button:hover,
.todo-focus-button:focus-visible {
  color: var(--accent);
  border-color: rgba(47, 185, 165, 0.36);
  background: rgba(47, 185, 165, 0.1);
}

.todo-card-copy-button.copied {
  border-color: rgba(79, 191, 122, 0.35);
  color: var(--done);
  background: rgba(79, 191, 122, 0.14);
}

.todo-focus-button.active {
  border-color: rgba(240, 185, 78, 0.42);
  color: var(--focus-gold);
  background: rgba(240, 185, 78, 0.18);
}

.todo-item.focused .todo-card {
  border-color: rgba(216, 162, 58, 0.38);
  background:
    linear-gradient(135deg, rgba(216, 162, 58, 0.18), rgba(201, 54, 38, 0.12) 38%, rgba(47, 185, 165, 0.14)),
    rgba(35, 22, 23, 0.96);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(246, 233, 203, 0.08);
}

.todo-item.focused .todo-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: 0;
  background: linear-gradient(90deg, rgba(216, 162, 58, 0.12), transparent 42%, rgba(47, 185, 165, 0.11));
  opacity: 0.9;
  pointer-events: none;
}

.todo-item.focused .todo-card > * {
  position: relative;
  z-index: 1;
}

.todo-item.focused .todo-status {
  border-color: var(--focus-gold);
  background: linear-gradient(135deg, var(--focus-gold), var(--focus-red));
  box-shadow: 0 0 0 4px rgba(240, 185, 78, 0.16);
}

.todo-item.focused .todo-text {
  color: #ffe6a7;
}

.todo-item.non-quest .todo-card {
  min-height: 88px;
}

.focus-badge {
  color: var(--focus-gold);
  cursor: grab;
}

.focus-badge:hover {
  color: #f2c35d;
  background: rgba(216, 162, 58, 0.12);
}

.focus-time {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 2px 7px;
  border: 1px solid rgba(240, 185, 78, 0.36);
  border-radius: 999px;
  color: #f2c35d;
  background: rgba(216, 162, 58, 0.12);
  font-variant-numeric: tabular-nums;
}

.focus-time:empty {
  display: none;
}

.focus-time.live {
  border-color: rgba(223, 63, 50, 0.32);
  color: #ff7a4c;
  background: rgba(201, 54, 38, 0.16);
}

.drag-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 30;
  pointer-events: none;
  opacity: 0.92;
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.42);
  will-change: transform;
}

.empty {
  min-height: 360px;
  display: grid;
  place-items: center;
  color: var(--muted);
  padding: 28px;
}

.empty-copy {
  max-width: 620px;
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
}

.empty.error-state h2,
.empty-detail {
  color: var(--danger);
}

.empty-detail {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.45;
  font-weight: 650;
}

.editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: end center;
  padding: 18px;
  background: rgba(3, 2, 4, 0.62);
}

.editor-panel {
  width: min(940px, 100%);
  max-height: min(860px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: auto minmax(280px, 1fr) auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(20, 16, 24, 0.98);
  box-shadow: var(--shadow);
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.editor-heading {
  min-width: 0;
  display: grid;
  gap: 8px;
  flex: 1;
}

.editor-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.editor-controls {
  display: flex;
  gap: 8px;
}

.copy-markdown-button.copied {
  border-color: rgba(79, 191, 122, 0.35);
  color: var(--done);
  background: rgba(79, 191, 122, 0.14);
}

.status-chip {
  width: max-content;
  margin: 0;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--accent);
  background: rgba(47, 185, 165, 0.12);
  font-size: 12px;
  font-weight: 780;
}

.status-chip.done {
  color: var(--done);
  background: rgba(79, 191, 122, 0.14);
}

.kind-select-control {
  position: relative;
  width: max-content;
  min-width: 96px;
  min-height: 26px;
  display: inline-grid;
  align-items: center;
}

.kind-select-control::after {
  content: "";
  position: absolute;
  right: 9px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

.kind-select-control select {
  width: 100%;
  min-height: 26px;
  appearance: none;
  border: 1px solid rgba(246, 213, 142, 0.24);
  border-radius: 999px;
  outline: none;
  padding: 3px 26px 3px 9px;
  color: #f3bd58;
  background: rgba(216, 162, 58, 0.1);
  font-size: 12px;
  font-weight: 780;
}

.kind-select-control select:focus {
  border-color: rgba(47, 185, 165, 0.52);
  box-shadow: 0 0 0 3px rgba(47, 185, 165, 0.13);
}

.title-input {
  width: min(640px, 100%);
  border: 1px solid transparent;
  border-radius: 6px;
  outline: none;
  padding: 7px 9px;
  color: var(--ink);
  background: transparent;
  font-size: 24px;
  line-height: 1.18;
  font-weight: 780;
}

.title-input::placeholder {
  color: #7f7365;
}

.markdown-editor {
  width: 100%;
  min-height: 320px;
  border: 0;
  outline: none;
  overflow: auto;
  padding: 20px 22px 28px;
  color: var(--ink);
  background: rgba(9, 7, 11, 0.42);
  font-size: 16px;
  line-height: 1.58;
}

.markdown-editor:empty::before {
  content: attr(data-placeholder);
  color: #7f7365;
  pointer-events: none;
}

.markdown-editor h1,
.markdown-editor h2,
.markdown-editor h3,
.markdown-editor p,
.markdown-editor ul {
  margin: 0 0 14px;
}

.markdown-editor h1 {
  font-size: 28px;
  line-height: 1.15;
}

.markdown-editor h2 {
  font-size: 23px;
  line-height: 1.2;
}

.markdown-editor h3 {
  font-size: 19px;
  line-height: 1.25;
}

.markdown-editor p {
  min-height: 25px;
}

.markdown-editor ul {
  padding-left: 24px;
}

.markdown-editor li {
  margin: 4px 0;
}

.save-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 88px;
}

.save-button.saving::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.38);
  border-top-color: white;
  border-radius: 50%;
  animation: save-spin 760ms linear infinite;
}

.editor-footer {
  display: flex;
  justify-content: end;
  gap: 10px;
  align-items: center;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 8px;
}

@media (max-width: 560px) {
  .todo-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  h1 {
    font-size: 36px;
  }

  .login-panel {
    padding: 22px;
  }

  .game-dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .game-nav {
    grid-template-columns: minmax(0, 1fr);
  }

  .editor-overlay {
    padding: 10px;
    place-items: end center;
  }

  .editor-panel {
    max-height: calc(100vh - 20px);
  }

  .editor-actions {
    justify-content: stretch;
    width: 100%;
  }

  .editor-actions button {
    flex: 1 1 110px;
  }

  .focus-timer {
    font-size: 58px;
  }

  .todo-card {
    grid-template-columns: 24px minmax(0, 1fr) auto;
    gap: 8px;
    padding-left: 8px;
    padding-right: 10px;
  }

  .sort-handle {
    width: 24px;
  }

  .todo-card-tools {
    gap: 3px;
  }

  .todo-card-copy-button,
  .todo-focus-button {
    width: 34px;
    height: 34px;
  }
}

@media (max-width: 480px) {
  .topbar {
    align-items: start;
    gap: 8px;
    min-height: 58px;
    padding: 2px 0 12px;
  }

  .topbar h1 {
    font-size: 26px;
  }

  .app-title {
    gap: 8px;
  }

  .app-title::before {
    width: 3px;
    height: 30px;
  }

  .topbar-actions {
    gap: 6px;
  }

  .topbar-actions > .icon-button,
  .status-filter-control {
    width: 36px;
    height: 36px;
  }

  .new-todo-button {
    width: 30px;
    height: 30px;
  }

  .topbar-actions {
    gap: 6px;
  }

  .game-dashboard {
    gap: 8px;
  }

  .stat-tile {
    min-height: 70px;
    padding: 12px;
  }

  .stat-tile span:first-child {
    font-size: 24px;
  }

  .focus-panel {
    padding: 12px;
  }

  .focus-header {
    align-items: center;
  }

  .focus-timer {
    font-size: 42px;
  }

  .todo-card {
    grid-template-columns: 24px minmax(0, 1fr);
    align-items: start;
  }

  .todo-card-button {
    grid-template-columns: 16px minmax(0, 1fr);
    gap: 9px;
  }

  .todo-card-button {
    grid-column: 2;
  }

  .todo-arrow {
    display: none;
  }

  .todo-card-tools {
    grid-column: 2;
    justify-content: start;
    margin-top: -2px;
  }

  .todo-text {
    font-size: 15px;
  }
}

@media (max-width: 360px) {
  .topbar {
    gap: 6px;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .app-title {
    gap: 7px;
  }

  .app-title::before {
    display: none;
  }

  .topbar-actions > .icon-button,
  .status-filter-control {
    width: 34px;
    height: 34px;
  }

  .new-todo-button {
    width: 30px;
    height: 30px;
  }
}

@keyframes save-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes focus-scan {
  0% {
    opacity: 0;
    transform: translateX(-55%);
  }
  30%,
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(55%);
  }
}

@keyframes timer-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.012);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .primary-button,
  .secondary-button,
  .icon-button,
  .status-filter-control,
  .game-nav-button,
  .kind-select-control select,
  .sort-handle,
  .todo-card,
  .new-todo-button,
  .todo-focus-button,
  .focus-panel,
  .focus-drop-zone {
    transition: border-color 140ms ease, opacity 140ms ease, transform 140ms ease;
  }

  button:hover {
    transform: translateY(-1px);
  }

  .todo-card-button:hover {
    transform: none;
  }

  .focus-panel.has-focus::after {
    animation: focus-scan 2800ms linear infinite;
  }

  .focus-panel.has-focus .focus-timer {
    animation: timer-pulse 1200ms ease-in-out infinite;
  }

}

@media (prefers-reduced-motion: reduce) {
  .save-button.saving::before {
    animation: none;
  }

  .focus-panel.has-focus::after,
  .focus-panel.has-focus .focus-timer {
    animation: none;
  }
}
