:root {
  /* Default to a clear light theme; dark is opt-in via media/query or data-theme. */
  color-scheme: light;

  --radius: 18px;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.18);

  /* Light mode (new) */
  --accent: #137a587c;
  --danger: #bf2f2f;

  --bg0: #fbf6ee;
  --bg1: #e8f1ff;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: rgba(255, 255, 255, 0.97);
  --text: #0b1220;
  --muted: rgba(11, 18, 32, 0.64);
  --line: rgba(11, 18, 32, 0.16);
  --card-item: rgba(11, 18, 32, 0.045);
  --card-item-line: rgba(11, 18, 32, 0.14);
  --control-bg: rgba(255, 255, 255, 0.98);
  --control-line: rgba(11, 18, 32, 0.24);
  --control-ph: rgba(11, 18, 32, 0.5);

  --track-bg: rgba(11, 18, 32, 0.075);
  --track-line: rgba(11, 18, 32, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.35);

    --accent: #48d597;
    --danger: #ff6b6b;

    --bg0: #0b1220;
    --bg1: #06122b;
    --panel: rgba(255, 255, 255, 0.08);
    --panel-strong: rgba(255, 255, 255, 0.12);
    --text: #f4f7ff;
    --muted: rgba(244, 247, 255, 0.72);
    --line: rgba(255, 255, 255, 0.18);
    --card-item: rgba(0, 0, 0, 0.12);
    --card-item-line: rgba(255, 255, 255, 0.1);
    --control-bg: rgba(0, 0, 0, 0.18);
    --control-line: rgba(255, 255, 255, 0.18);
    --control-ph: rgba(244, 247, 255, 0.55);

    --track-bg: rgba(255, 255, 255, 0.1);
    --track-line: rgba(255, 255, 255, 0.1);
  }
}

html[data-theme="light"] {
  color-scheme: light;

  --shadow: 0 18px 45px rgba(0, 0, 0, 0.18);
  --accent: #3fd17c;
  --danger: #bf2f2f;

  --bg0: #cdffde79;
  --bg1: #e8f1ff;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: rgba(255, 255, 255, 0.97);
  --text: #0b1220;
  --muted: rgba(11, 18, 32, 0.64);
  --line: rgba(11, 18, 32, 0.16);
  --card-item: rgba(11, 18, 32, 0.045);
  --card-item-line: rgba(11, 18, 32, 0.14);
  --control-bg: rgba(255, 255, 255, 0.98);
  --control-line: rgba(11, 18, 32, 0.24);
  --control-ph: rgba(11, 18, 32, 0.5);

  --track-bg: rgba(11, 18, 32, 0.075);
  --track-line: rgba(11, 18, 32, 0.12);
}

html[data-theme="dark"] {
  color-scheme: dark;

  --shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
  --accent: #48d597;
  --danger: #ff6b6b;

  --bg0: #0b1220;
  --bg1: #06122b;
  --panel: rgba(255, 255, 255, 0.08);
  --panel-strong: rgba(255, 255, 255, 0.12);
  --text: #f4f7ff;
  --muted: rgba(244, 247, 255, 0.72);
  --line: rgba(255, 255, 255, 0.18);
  --card-item: rgba(0, 0, 0, 0.12);
  --card-item-line: rgba(255, 255, 255, 0.1);
  --control-bg: rgba(0, 0, 0, 0.18);
  --control-line: rgba(255, 255, 255, 0.18);
  --control-ph: rgba(244, 247, 255, 0.55);

  --track-bg: rgba(255, 255, 255, 0.1);
  --track-line: rgba(255, 255, 255, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family:
    ui-rounded,
    "Segoe UI",
    system-ui,
    -apple-system,
    Arial,
    sans-serif;
  color: var(--text);
  background:
    radial-gradient(1000px 700px at 20% 10%, rgba(72, 213, 151, 0.18), transparent 55%),
    radial-gradient(900px 600px at 80% 30%, rgba(90, 180, 255, 0.14), transparent 55%),
    radial-gradient(900px 700px at 50% 90%, rgba(255, 180, 90, 0.1), transparent 60%),
    radial-gradient(1100px 780px at 50% 50%, var(--bg1), transparent 60%), var(--bg0);
}

button,
input {
  font: inherit;
}

button,
select {
  touch-action: manipulation;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 22px 16px 26px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topRight {
  display: flex;
  align-items: center;
  gap: 10px;
}

.themeSwitch {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--control-line);
  background: var(--control-bg);
}

.themeLabel {
  font-size: 14px;
  color: var(--muted);
  user-select: none;
}

.switch {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.switchTrack {
  width: 54px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--control-line);
  background: var(--track-bg);
  position: relative;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  padding: 3px;
  flex: 0 0 auto;
}

.switchThumb {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.78));
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.18);
  transform: translateX(0);
  transition: transform 180ms ease;
}

@media (prefers-color-scheme: dark) {
  .switchThumb {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.1));
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.35);
  }
}

html[data-theme="dark"] .switchThumb {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.1));
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.35);
}

.switch:focus-visible + .switchTrack {
  outline: 3px solid rgba(23, 128, 88, 0.22);
  outline-offset: 2px;
}

@media (prefers-color-scheme: dark) {
  .switch:focus-visible + .switchTrack {
    outline-color: rgba(72, 213, 151, 0.26);
  }
}

html[data-theme="dark"] .switch:focus-visible + .switchTrack {
  outline-color: rgba(72, 213, 151, 0.26);
}

.switch:checked + .switchTrack .switchThumb {
  transform: translateX(22px);
}

h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0.2px;
}

.sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.tabs {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tab {
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--text);
  border-radius: 999px;
  padding: 12px 14px;
  font-size: 18px;
  cursor: pointer;
  transition:
    transform 120ms ease,
    background 120ms ease,
    border-color 120ms ease;
}

.tab:active {
  transform: scale(0.99);
}

.tab.is-active {
  border-color: rgba(23, 128, 88, 0.65);
  background: rgba(23, 128, 88, 0.12);
}

@media (prefers-color-scheme: dark) {
  .tab.is-active {
    border-color: rgba(72, 213, 151, 0.7);
    background: rgba(72, 213, 151, 0.14);
  }
}

html[data-theme="dark"] .tab.is-active {
  border-color: rgba(72, 213, 151, 0.7);
  background: rgba(72, 213, 151, 0.14);
}

.card {
  margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.howTo {
  margin-top: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.moreApps {
  margin-top: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.moreAppsHead {
  display: grid;
  gap: 6px;
}

.appsMenu {
  margin-top: 18px;
}

.appsLauncher {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(23, 128, 88, 0.48);
  background: linear-gradient(135deg, rgba(23, 128, 88, 0.14), rgba(90, 180, 255, 0.12));
  color: var(--text);
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 17px;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 200ms ease,
    background 200ms ease;
}

.appsLauncher:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(23, 128, 88, 0.12);
}

.appsLauncherText {
  font-weight: 600;
}

.appsLauncherEmoji {
  font-size: 20px;
  transform-origin: center;
}

.appsLauncherChevron {
  font-size: 16px;
  color: var(--muted);
  transition: transform 220ms ease;
}

.appsMenu.is-open .appsLauncherEmoji {
  animation: appsRocketPop 420ms ease;
}

.appsMenu.is-open .appsLauncherChevron {
  transform: rotate(180deg);
}

.moreAppsTitle {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.2px;
}

.moreAppsText {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
}

.moreAppsGrid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.appsDropdown {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transform: translateY(-8px);
  transition:
    grid-template-rows 260ms ease,
    opacity 220ms ease,
    transform 260ms ease;
}

.appsDropdownInner {
  min-height: 0;
}

.appsMenu.is-open .appsDropdown {
  grid-template-rows: 1fr;
  opacity: 1;
  transform: translateY(0);
}

.appLink {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--control-line);
  background: var(--control-bg);
  color: var(--text);
  border-radius: 14px;
  padding: 14px 16px;
  text-decoration: none;
  font-size: 16px;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition:
    transform 180ms ease,
    opacity 180ms ease,
    background 120ms ease,
    border-color 120ms ease;
}

.appsMenu.is-open .appLink {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.appsMenu.is-open .appLink:nth-child(1) { transition-delay: 20ms; }
.appsMenu.is-open .appLink:nth-child(2) { transition-delay: 40ms; }
.appsMenu.is-open .appLink:nth-child(3) { transition-delay: 60ms; }
.appsMenu.is-open .appLink:nth-child(4) { transition-delay: 80ms; }
.appsMenu.is-open .appLink:nth-child(5) { transition-delay: 100ms; }
.appsMenu.is-open .appLink:nth-child(6) { transition-delay: 120ms; }
.appsMenu.is-open .appLink:nth-child(7) { transition-delay: 140ms; }
.appsMenu.is-open .appLink:nth-child(8) { transition-delay: 160ms; }
.appsMenu.is-open .appLink:nth-child(9) { transition-delay: 180ms; }
.appsMenu.is-open .appLink:nth-child(10) { transition-delay: 200ms; }
.appsMenu.is-open .appLink:nth-child(11) { transition-delay: 220ms; }
.appsMenu.is-open .appLink:nth-child(12) { transition-delay: 240ms; }
.appsMenu.is-open .appLink:nth-child(13) { transition-delay: 260ms; }
.appsMenu.is-open .appLink:nth-child(14) { transition-delay: 280ms; }

.appLink:hover {
  border-color: rgba(23, 128, 88, 0.55);
  background: rgba(23, 128, 88, 0.1);
}

.appLink:active {
  transform: scale(0.99);
}

.appEmoji {
  font-size: 20px;
  line-height: 1;
  transform: translateY(0);
  transition: transform 160ms ease;
}

.appLink:hover .appEmoji {
  transform: translateY(-2px) scale(1.08);
}

@keyframes appsRocketPop {
  0% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.18) rotate(-10deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.adCard {
  margin-top: 14px;
  padding: 8px 10px;
  border: 1px dashed var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  overflow: hidden;
}

.adCard:has(.adSlot:empty) {
  display: none;
}

.adLabel {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.adSlot {
  min-height: 0;
  display: block;
  max-height: 64px;
  overflow: hidden;
}

.adSlot:empty {
  display: none !important;
  max-height: 0;
}

.howToTitle {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.2px;
}

.howToList {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.howToList li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: flex-start;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(11, 18, 32, 0.1);
}

@media (prefers-color-scheme: dark) {
  .howToList li {
    border-bottom-color: rgba(244, 247, 255, 0.15);
  }
}

html[data-theme="dark"] .howToList li {
  border-bottom-color: rgba(244, 247, 255, 0.15);
}

.howToList li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.howToStep {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(23, 128, 88, 0.85), rgba(90, 180, 255, 0.75));
  color: rgba(255, 255, 255, 0.95);
  font-weight: 700;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}

.howToStepTitle {
  margin: 0;
  font-size: 17px;
}

.howToStepText {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
}

.progress {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.progressText {
  font-size: 16px;
  color: var(--muted);
}

.progressBar {
  height: 12px;
  background: var(--track-bg);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--track-line);
}

.progressFill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(23, 128, 88, 0.95), rgba(90, 180, 255, 0.85));
  transition: width 220ms ease;
}

@media (prefers-color-scheme: dark) {
  .progressFill {
    background: linear-gradient(90deg, rgba(72, 213, 151, 0.95), rgba(90, 180, 255, 0.85));
  }
}

html[data-theme="dark"] .progressFill {
  background: linear-gradient(90deg, rgba(72, 213, 151, 0.95), rgba(90, 180, 255, 0.85));
}

.list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--card-item-line);
  background: var(--card-item);
  border-radius: 14px;
  margin-top: 10px;
}

.left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.empty {
  white-space: normal;
  color: var(--muted);
}

.check {
  inline-size: 26px;
  block-size: 26px;
  border-radius: 10px;
  border: 2px solid var(--control-line);
  background: var(--control-bg);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

@media (prefers-color-scheme: dark) {
  .check {
    border-color: rgb(43, 53, 44);
    background: rgba(255, 255, 255, 0.06);
  }
}

html[data-theme="dark"] .check {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.06);
}

.check > span {
  opacity: 0;
  transform: scale(0.8);
  transition:
    opacity 120ms ease,
    transform 120ms ease;
  font-weight: 800;
  color: var(--accent);
}

.item.is-done .check {
  border-color: black;
  background: var(--accent);
}

@media (prefers-color-scheme: dark) {
  .item.is-done .check {
    border-color: var(--accent);
    border-color: black;
  }
}

html[data-theme="dark"] .item.is-done .check {
  border-color: var(--accent);
  background: var(--accent);
}

.item.is-done .check > span {
  opacity: 1;
  transform: scale(1);
  /* Dark checkmark on accent background */
  color: rgba(11, 18, 32, 0.92);
}

.label {
  font-size: 18px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item.is-done .label {
  /* Keep completed items readable in light theme */
  color: rgba(11, 18, 32, 0.82);
  text-decoration-line: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: rgba(11, 18, 32, 0.22);
}

@media (prefers-color-scheme: dark) {
  .item.is-done .label {
    color: var(--muted);
    text-decoration-color: rgba(244, 247, 255, 0.28);
  }
}

html[data-theme="dark"] .item.is-done .label {
  color: var(--muted);
  text-decoration-color: rgba(244, 247, 255, 0.28);
}

.btn {
  border: 1px solid rgba(23, 128, 88, 0.48);
  background: rgba(23, 128, 88, 0.1);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 16px;
  cursor: pointer;
  transition:
    transform 120ms ease,
    background 120ms ease,
    border-color 120ms ease;
}

@media (prefers-color-scheme: dark) {
  .btn {
    border-color: rgba(72, 213, 151, 0.55);
    background: rgba(72, 213, 151, 0.16);
  }
}

html[data-theme="dark"] .btn {
  border-color: rgba(72, 213, 151, 0.55);
  background: rgba(72, 213, 151, 0.16);
}

.btn:active {
  transform: scale(0.99);
}

.btn-ghost {
  border-color: var(--control-line);
  background: var(--control-bg);
}

.btn-danger {
  border-color: rgba(200, 60, 60, 0.55);
  background: rgba(200, 60, 60, 0.1);
}

@media (prefers-color-scheme: dark) {
  .btn-danger {
    border-color: rgba(255, 107, 107, 0.6);
    background: rgba(255, 107, 107, 0.12);
  }
}

html[data-theme="dark"] .btn-danger {
  border-color: rgba(255, 107, 107, 0.6);
  background: rgba(255, 107, 107, 0.12);
}

.add {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 14px;
}

.input {
  width: 100%;
  border: 1px solid var(--control-line);
  background: var(--control-bg);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 16px;
  outline: none;
}

.input::placeholder {
  color: var(--control-ph);
}

.input:focus,
.btn:focus,
.tab:focus,
.appLink:focus,
.appsLauncher:focus {
  outline: 3px solid rgba(23, 128, 88, 0.22);
  outline-offset: 2px;
}

@media (prefers-color-scheme: dark) {
  .input:focus,
  .btn:focus,
  .tab:focus,
  .appLink:focus,
  .appsLauncher:focus {
    outline-color: rgba(72, 213, 151, 0.26);
  }
}

html[data-theme="dark"] .input:focus,
html[data-theme="dark"] .btn:focus,
html[data-theme="dark"] .tab:focus,
html[data-theme="dark"] .appLink:focus,
html[data-theme="dark"] .appsLauncher:focus {
  outline-color: rgba(72, 213, 151, 0.26);
}

.actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

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

.foot {
  margin-top: 14px;
  text-align: center;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 420px) {
  h1 {
    font-size: 24px;
  }
  .tab {
    font-size: 16px;
  }
  .label {
    font-size: 17px;
  }
  .themeSwitch {
    padding: 10px 10px;
    gap: 8px;
  }
  .themeLabel {
    font-size: 13px;
  }
  .howTo {
    padding: 16px;
  }
  .moreApps {
    padding: 16px;
  }
  .howToTitle {
    font-size: 20px;
  }
  .moreAppsTitle {
    font-size: 20px;
  }
  .appsLauncher {
    font-size: 16px;
    padding: 13px 14px;
  }
  .howToStep {
    width: 34px;
    height: 34px;
    font-size: 15px;
  }
}

@media (min-width: 900px) {
  h1 {
    font-size: 32px;
  }
  .card {
    padding: 22px;
  }
  .tab {
    padding: 14px 16px;
  }
  .btn,
  .input {
    font-size: 17px;
  }
}
