:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  --border: 1px solid rgba(0, 0, 0, 0.08);
  --border-dark: 1px solid rgba(255, 255, 255, 0.2);
  --panel-bg: rgba(30, 41, 59, 0.82);
  --panel-bg-dark: rgba(15, 23, 42, 0.92);
  --accent: #2563eb;
  --accent-dark: #93c5fd;
}

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

/* Prevent mobile "painted rectangle" / tap highlight on interactive elements
   while preserving keyboard focus styles via :focus-visible. */
button,
a,
input,
textarea,
select,
label,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none; /* disable iOS callout on long press */
  touch-action: manipulation;  /* hint to browser to optimize touch handling */
}

body {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
  background: radial-gradient(circle at top, #0f172a 0%, #1e293b 42%, #0b162d 100%);
  background-attachment: fixed;
  color: #f9fafb;
  overflow-y: scroll;
  scroll-behavior: smooth;
}

.app {
  width: min(600px, 100%);
  display: grid;
  gap: 1.5rem;
}

body[data-app-loading] {
  visibility: hidden;
}

.panel {
  background-color: var(--panel-bg-dark);
  border-radius: 14px;
  border: var(--border-dark);
  padding: 1.5rem;
  box-shadow: 0 18px 40px rgba(2, 6, 23, 0.45);
  backdrop-filter: blur(18px);
}

.app__header {
  text-align: center;
  padding: 0.5rem 0 0;
}

.app__header h1 {
  text-shadow: 0 6px 24px rgba(8, 47, 73, 0.45);
}

.app__tagline {
  margin: 0.5rem 0 0;
  color: rgba(226, 232, 240, 0.8);
  letter-spacing: 0.02em;
}

.todo-form {
  display: grid;
  gap: 0.75rem;
}

.todo-form__input-row {
  display: flex;
  gap: 0.75rem;
  min-width: 0;
}

.todo-form input {
  flex: 1 1 0;
  min-width: 0;
  width: 0;
  max-width: 100%;
  padding: 0.65rem 0.8rem;
  border-radius: 999px;
  font-size: 1rem;
  background: rgba(15, 23, 42, 0.75);
  border: var(--border-dark);
  color: inherit;
}

.todo-form input::placeholder {
  color: rgba(203, 213, 225, 0.7);
}

.todo-form input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.button {
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: white;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
  .button:hover,
  .button:focus-visible {
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.35);
  }

  .button:focus-visible {
    outline: 2px solid var(--accent-dark);
    outline-offset: 3px;
  }
}

.filters {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.filters__button {
  border: none;
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
  background: rgba(148, 163, 184, 0.18);
  color: inherit;
  transition: background 0.2s ease, transform 0.15s ease;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.filters__button[aria-pressed="true"] {
  background: rgba(37, 99, 235, 0.24);
  color: var(--accent);
  transform: translateY(-1px);
}

.filters__button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.todo-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: grid;
  gap: 0.75rem;
}

.todo-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.75);
  border: var(--border-dark);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .todo-item__text:hover {
    opacity: 1;
  }
}

.todo-item__text {
  margin: 0;
  display: block;
  font-size: 1rem;
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.todo-item__text--done {
  text-decoration: line-through;
  opacity: 0.6;
}

.todo-item__remove {
  border: none;
  background: none;
  cursor: pointer;
  color: rgba(239, 68, 68, 0.85);
  font-weight: 600;
}

@media (hover: hover) and (pointer: fine) {
  .todo-item__remove:hover,
  .todo-item__remove:focus-visible {
    color: rgba(239, 68, 68, 1);
    text-decoration: underline;
    outline: none;
  }
}

.todo-empty {
  margin: 1.25rem 0 0;
  text-align: center;
  font-style: italic;
  color: rgba(203, 213, 225, 0.75);
}

.summary {
  margin: 0;
  text-align: center;
  font-weight: 600;
}

.app__status .summary {
  display: inline-block;
  margin-top: 0.25rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
}

.app__status {
  text-align: center;
}

.notifications {
  position: fixed;
  right: 0.75rem;
  bottom: calc(0.75rem + env(safe-area-inset-bottom));
  width: 13rem;
  max-height: 80vh;
  overflow-y: hidden;
  background: rgba(30, 41, 59, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.15);
  z-index: 10;
  backdrop-filter: blur(12px);
}

.notifications hr {
  margin-top: 15px;
  margin-bottom: 15px;
}

.notifications__toolbar {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.notifications__button {
  font: inherit;
  cursor: pointer;
  border: 1px solid currentColor;
  background: transparent;
  padding: 0.2rem 0.7rem;
  border-radius: 12px;
  outline: 1px solid currentColor;
  transition: background 0.2s ease, color 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .notifications__button:hover,
  .notifications__button:focus-visible {
    background: rgba(148, 163, 184, 0.22);
    color: var(--accent-dark);
  }
}

.notifications__show {
  position: fixed;
  right: 0px;
  bottom: calc(0.75rem + env(safe-area-inset-bottom));
  font: inherit;
  cursor: pointer;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.85);
  color: inherit;
  box-shadow: 0 0.5rem 1.5rem rgba(15, 23, 42, 0.35);
  z-index: 11;
  background: var(--panel-bg);
}

.notifications__show:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

#notifications-title {
  font-size: 1.2rem;
  padding: 0 0 0.3rem;
  text-align: center;
}

h2 {
  margin-bottom: 0.8rem;
}

.eye-btn {
  font-size: 2rem;
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.95);
  transform-origin: center;
}

@media (hover: hover) and (pointer: fine) {
  .eye-btn:hover,
  .eye-btn:focus-visible {
    filter: brightness(1.1);
  }
}

@keyframes blink {
  /* 0%→32%: fast ease-in close (~80ms) */
  0% {
    transform: scaleY(1);
    filter: brightness(1);
    animation-timing-function: cubic-bezier(0.4, 0, 1, 1); /* ease-in */
  }

  32% { /* fully closed */
    transform: scaleY(0.2);
    filter: brightness(0.25);
  }

  /* 32%→40%: brief hold closed (~20ms) */
  40% {
    transform: scaleY(0.2);
    filter: brightness(0.25);
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1); /* ease-out */
  }

  /* 40%→100%: slower ease-out open (~150ms) */
  100% {
    transform: scaleY(1);
    filter: brightness(1);
  }
}

.eye-btn.blink {
  animation: blink 250ms both;
}

/* Respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .eye-btn.blink { animation: none; }
}

/* Improve checkbox affordance */
input[type="checkbox"] {
  inline-size: 1.1rem;
  block-size: 1.1rem;
  accent-color: var(--accent);
  cursor: pointer;
}

input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Button disabled state */
.button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}
