@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&family=Space+Mono:wght@400;700&display=swap");

:root {
  color-scheme: dark;
  --bg: #09090f;
  --bg-soft: #0f111a;
  --panel: #141626;
  --border: #25273a;
  --text: #f3f2ff;
  --muted: #a4a4c4;
  --accent: #a36bff;
  --accent-2: #6d3cff;
  --accent-3: #d2b8ff;
  --danger: #ff76c6;
  --shadow: 0 16px 44px rgba(0, 0, 0, 0.4);
  --radius: 16px;
  --glow: none;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f8f7ff;
    --bg-soft: #fafbff;
    --panel: #f0ebff;
    --border: #d9c9ff;
    --text: #1a0a2e;
    --muted: #6b5b95;
    --accent: #ff0080;
    --accent-2: #ff2e7e;
    --accent-3: #00e5ff;
    --danger: #ff1744;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    --glow: 0 0 85px rgba(255, 0, 128, 1), 0 0 168px rgba(0, 229, 255, 1);
  }
}

html.light-mode {
  --bg: #f8f7ff;
  --bg-soft: #fafbff;
  --panel: #f0ebff;
  --border: #d9c9ff;
  --text: #1a0a2e;
  --muted: #6b5b95;
  --accent: #ff0080;
  --accent-2: #ff2e7e;
  --accent-3: #00e5ff;
  --danger: #ff1744;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  --glow: 0 0 85px rgba(255, 0, 128, 1), 0 0 168px rgba(0, 229, 255, 1);
}

* {
  box-sizing: border-box;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

*::-webkit-scrollbar {
  display: none;
}

body {
  margin: 0;
  min-height: 100vh;
  width: 100vw;
  overflow-x: hidden;
  font-family: "DM Sans", "Segoe UI", sans-serif;
  background: radial-gradient(circle at 12% 8%, rgba(111, 55, 255, 0.25), transparent 45%),
    radial-gradient(circle at 85% 12%, rgba(163, 107, 255, 0.22), transparent 50%),
    linear-gradient(150deg, var(--bg), #0b0b15 60%);
  color: var(--text);
}

@media (prefers-color-scheme: light) {
  body {
    background: radial-gradient(circle at 12% 8%, rgba(255, 0, 110, 0.15), transparent 45%),
      radial-gradient(circle at 85% 12%, rgba(0, 217, 255, 0.12), transparent 50%),
      linear-gradient(150deg, var(--bg), #ffffff 60%);
  }
}

html.light-mode body {
  background: radial-gradient(circle at 12% 8%, rgba(255, 0, 128, 0.42), transparent 45%),
    radial-gradient(circle at 85% 12%, rgba(0, 229, 255, 0.33), transparent 50%),
    linear-gradient(150deg, var(--bg), #ffffff 60%);
}

.app {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 18px 40px;
  display: grid;
  gap: 20px;
}

@media (max-width: 480px) {
  .app {
    padding: 16px 12px 32px;
    gap: 16px;
  }
}

@media (max-width: 360px) {
  .app {
    padding: 12px 8px 24px;
    gap: 12px;
  }
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  background: var(--panel);
  border-radius: var(--radius);
  padding: 10px 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

@media (prefers-color-scheme: light) {
  .topbar {
    border-color: rgba(255, 0, 110, 0.2);
    box-shadow: 0 0 16px rgba(255, 0, 110, 0.15), 0 8px 24px rgba(0, 0, 0, 0.08);
  }
}

@media (max-width: 480px) {
  .topbar {
    gap: 12px;
    padding: 8px 10px;
  }
}

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

.nav {
  display: flex;
  justify-content: center;
  gap: 10px;
}

@media (max-width: 480px) {
  .nav {
    gap: 6px;
  }

  .nav-btn {
    padding: 8px 10px;
    font-size: 0.85rem;
  }
}

@media (max-width: 360px) {
  .nav {
    gap: 4px;
  }

  .nav-btn {
    padding: 6px 8px;
    font-size: 0.75rem;
  }
}

button,
input,
select {
  font-family: inherit;
  font-size: 0.95rem;
}

.view {
  background: var(--bg-soft);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  min-height: 320px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

@media (prefers-color-scheme: light) {
  .view {
    border-color: rgba(0, 217, 255, 0.15);
    box-shadow: 0 0 16px rgba(0, 217, 255, 0.1), 0 16px 44px rgba(0, 0, 0, 0.08);
  }
}

#focusView {
  min-height: 0;
}

.hidden {
  display: none;
}

.list {
  display: grid;
  gap: 12px;
}


.focus-shell {
  background: var(--panel);
  border-radius: 20px;
  border: 1px solid var(--border);
  padding: 22px;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr) minmax(0, 1fr);
  box-shadow: var(--shadow);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

@media (prefers-color-scheme: light) {
  .focus-shell {
    border-color: rgba(255, 0, 110, 0.25);
    box-shadow: 0 0 24px rgba(255, 0, 110, 0.2), 0 0 48px rgba(0, 217, 255, 0.1), 0 16px 44px rgba(0, 0, 0, 0.08);
  }
}

@media (max-width: 480px) {
  .focus-shell {
    padding: 18px;
    gap: 14px;
  }
}

@media (max-width: 360px) {
  .focus-shell {
    padding: 14px;
    gap: 12px;
  }
}

.focus-label {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  font-size: 0.72rem;
}

.focus-task {
  display: grid;
  gap: 10px;
}

.focus-task-title {
  font-size: 1.6rem;
  font-weight: 700;
}

@media (max-width: 360px) {
  .focus-task-title {
    font-size: 1.3rem;
  }
}

.focus-task-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.focus-task-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.focus-complete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  overflow: visible;
}

.focus-complete-btn .btn-text {
  display: inline;
}

.focus-complete-btn .btn-icon {
  display: none;
  width: 20px;
  height: 20px;
  margin: 0;
}

@media (max-width: 360px) {
  .focus-complete-btn {
    width: 42px;
    padding: 10px !important;
    border-radius: 12px;
  }

  .focus-complete-btn .btn-text {
    display: none;
  }

  .focus-complete-btn .btn-icon {
    display: block;
  }
}

.focus-notes-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.focus-timer {
  display: grid;
  gap: 12px;
  align-content: center;
  justify-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(15, 17, 26, 0.6);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

@media (prefers-color-scheme: light) {
  .focus-timer {
    background: rgba(250, 251, 255, 0.7);
    border-color: rgba(0, 217, 255, 0.4);
    box-shadow: 0 0 16px rgba(0, 217, 255, 0.2);
  }
}

.focus-timer-display {
  font-size: 2.8rem;
  font-weight: 700;
  font-family: "Space Mono", "DM Sans", sans-serif;
}

.focus-timer-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.focus-panel {
  display: grid;
  gap: 12px;
  align-content: start;
}

.focus-break-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.focus-break-actions {
  display: grid;
  gap: 10px;
  align-items: start;
}

.focus-break-actions .pill-btn,
.focus-break-actions .secondary-btn {
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.9rem;
}

.focus-notes-panel {
  grid-column: 1 / -1;
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
  gap: 0 !important;
}

.focus-notes-input {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0b0b14;
  color: var(--text);
  padding: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.2s ease, background-color 0.2s ease;
  width: 100%;
}

.focus-notes-input:focus {
  outline: none;
  border-color: rgba(163, 107, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(163, 107, 255, 0.2);
}

.focus-notes-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.focus-quote {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(163, 107, 255, 0.18);
  background: rgba(15, 17, 26, 0.55);
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
  display: grid;
  gap: 6px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

@media (prefers-color-scheme: light) {
  .focus-quote {
    background: rgba(250, 251, 255, 0.7);
    border-color: rgba(0, 217, 255, 0.3);
    box-shadow: 0 0 12px rgba(0, 217, 255, 0.15);
    color: var(--text);
  }
}

.focus-quote.hidden {
  display: none;
}

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

.focus-quote-text {
  flex: 1;
  min-width: 0;
}

.focus-quote-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.quote-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1;
  padding: 2px 0;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  cursor: pointer;
}

.quote-btn:hover {
  color: var(--text);
}

.focus-quote strong {
  color: var(--text);
  font-weight: 600;
}

.focus-quote-source {
  font-size: 0.78rem;
  color: var(--muted);
}

.focus-quote-source a {
  color: var(--accent-3);
  text-decoration: none;
}

.focus-quote-source a:hover {
  text-decoration: underline;
}

.schedule-scroll {
  background: var(--panel);
  border-radius: 20px;
  border: 1px solid var(--border);
  padding: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  padding-bottom: 6px;
}

.schedule-nav-card {
  background: var(--panel);
  border-radius: 20px;
  border: 1px solid var(--border);
  padding: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 10px;
}

.schedule-header {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}

.schedule-nav-btn {
  --schedule-header-height: 38px;
  width: 36px;
  height: var(--schedule-header-height);
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(20, 22, 38, 0.8);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.schedule-nav-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(163, 107, 255, 0.45);
}

.schedule-week-label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
  min-width: 120px;
}

.schedule-days {
  display: grid;
  grid-template-columns: repeat(var(--schedule-days, 7), minmax(0, 1fr));
  gap: 10px;
}

.schedule-day-label {
  min-height: var(--schedule-header-height, 38px);
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(20, 22, 38, 0.7);
  border: 1px solid var(--border);
  font-weight: 600;
  text-align: center;
  font-size: 0.9rem;
}

.schedule-day-label.today {
  border-color: rgba(163, 107, 255, 0.6);
  color: rgba(163, 107, 255, 1);
  font-weight: 700;
}

@media (max-width: 480px) {
  .schedule-day-label {
    min-height: 32px;
    padding: 6px 4px;
    font-size: 0.85rem;
    border-radius: 8px;
  }
}

.schedule-body {
  display: grid;
}

.schedule-grid {
  display: grid;
  gap: 10px;
}

.schedule-grid.animate-week {
  animation: scheduleShift 0.45s ease;
}

.schedule-grid.animate-left {
  animation-name: scheduleShiftLeft;
}

.schedule-grid.animate-right {
  animation-name: scheduleShiftRight;
}

@keyframes scheduleShift {
  from {
    opacity: 0.2;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scheduleShiftLeft {
  from {
    opacity: 0.15;
    transform: translateX(28px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes scheduleShiftRight {
  from {
    opacity: 0.15;
    transform: translateX(-28px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.schedule-grid.animate-left .schedule-row,
.schedule-grid.animate-right .schedule-row {
  animation-duration: 0.45s;
  animation-timing-function: ease;
  animation-fill-mode: both;
  animation-delay: calc(var(--row-index, 0) * 30ms);
}

.schedule-grid.animate-left .schedule-row {
  animation-name: scheduleRowInLeft;
}

.schedule-grid.animate-right .schedule-row {
  animation-name: scheduleRowInRight;
}

@keyframes scheduleRowInLeft {
  from {
    opacity: 0;
    transform: translateX(26px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scheduleRowInRight {
  from {
    opacity: 0;
    transform: translateX(-26px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.schedule-row {
  display: grid;
  grid-template-columns: repeat(var(--schedule-days, 7), minmax(0, 1fr));
  gap: 10px;
}

.schedule-span {
  border-radius: 12px;
  padding: 8px 16px;
  background: rgba(90, 196, 255, 0.16);
  display: grid;
  gap: 2px;
  position: relative;
  --priority-color: rgba(90, 196, 255, 0.9);
  --priority-fill: rgba(90, 196, 255, 0.16);
}

.schedule-span.priority-high {
  background: rgba(255, 156, 245, 0.18);
  --priority-color: rgba(255, 156, 245, 0.95);
  --priority-fill: rgba(255, 156, 245, 0.18);
}

.schedule-span.priority-medium {
  background: rgba(195, 165, 255, 0.18);
  --priority-color: rgba(195, 165, 255, 0.95);
  --priority-fill: rgba(195, 165, 255, 0.18);
}

.schedule-span.priority-low {
  background: rgba(154, 165, 255, 0.18);
  --priority-color: rgba(154, 165, 255, 0.95);
  --priority-fill: rgba(154, 165, 255, 0.18);
}

.schedule-span-title {
  font-weight: 600;
}

.schedule-span-meta {
  color: var(--muted);
  font-size: 0.75rem;
}

.schedule-span.extends-left {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.schedule-span.extends-right {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.schedule-span.extends-left::before,
.schedule-span.extends-right::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 32px;
  pointer-events: none;
  background: var(--priority-fill);
}

.schedule-span.extends-left::before {
  left: -32px;
  background: linear-gradient(90deg, transparent, var(--priority-fill));
}

.schedule-span.extends-right::after {
  right: -32px;
  background: linear-gradient(270deg, transparent, var(--priority-fill));
}

.schedule-item {
  border-radius: 10px;
  padding: 6px 8px;
  border: 1px solid transparent;
  font-size: 0.82rem;
  display: grid;
  gap: 2px;
}

.schedule-item-title {
  font-weight: 600;
}

.schedule-item-meta {
  color: var(--muted);
  font-size: 0.75rem;
}

.schedule-item.start {
  background: rgba(163, 107, 255, 0.18);
  border-color: rgba(163, 107, 255, 0.45);
}

.schedule-item.due {
  background: rgba(255, 118, 198, 0.16);
  border-color: rgba(255, 118, 198, 0.45);
}

.schedule-item.range {
  background: rgba(90, 196, 255, 0.16);
  border-color: rgba(90, 196, 255, 0.45);
}

.schedule-undated {
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px dashed var(--border);
  background: rgba(20, 22, 38, 0.45);
  display: grid;
  gap: 8px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  .topbar {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
  }

  .topbar .primary-btn {
    grid-column: 1 / -1;
  }

  .nav {
    justify-content: flex-start;
  }

  .panel {
    left: 12px;
    right: 12px;
    max-width: calc(100vw - 24px);
  }

  .schedule-days,
  .schedule-grid {
    gap: 8px;
  }

  .focus-shell {
    padding: 18px;
    grid-template-columns: 1fr;
  }

  .focus-timer {
    order: 1;
  }
}

@media (max-width: 480px) {
  .view {
    padding: 12px;
    border-radius: 12px;
    min-height: 240px;
  }

  .list {
    gap: 10px;
  }

  .focus-shell {
    padding: 14px;
    gap: 12px;
    border-radius: 16px;
  }

  .focus-timer-display {
    font-size: 2.2rem;
  }

  .schedule-days,
  .schedule-grid {
    gap: 6px;
  }

  .schedule-day-label {
    padding: 6px 8px;
    font-size: 0.8rem;
  }

  .schedule-span {
    padding: 6px 10px;
    font-size: 0.75rem;
  }

  .schedule-span-title {
    font-size: 0.8rem;
  }

  .schedule-span-meta {
    font-size: 0.65rem;
  }

  .focus-notes {
    margin-top: 14px;
    padding: 12px;
  }

  .focus-notes-input {
    font-size: 0.9rem;
    padding: 8px;
  }
}

/* Light mode overrides */
html.light-mode {
  .topbar {
    border-color: rgba(255, 0, 128, 0.5);
    box-shadow: 0 0 54px rgba(255, 0, 128, 0.85), 0 8px 24px rgba(0, 0, 0, 0.08);
  }

  .view {
    border-color: rgba(0, 229, 255, 0.4);
    box-shadow: 0 0 54px rgba(0, 229, 255, 0.67), 0 16px 44px rgba(0, 0, 0, 0.08);
  }

  .focus-shell {
    border-color: rgba(255, 0, 128, 0.5);
    box-shadow: 0 0 67px rgba(255, 0, 128, 0.76), 0 0 135px rgba(0, 229, 255, 0.59), 0 16px 44px rgba(0, 0, 0, 0.08);
  }

  .focus-timer {
    background: rgba(250, 251, 255, 0.7);
    border-color: rgba(0, 229, 255, 0.6);
    box-shadow: 0 0 54px rgba(0, 229, 255, 0.92);
  }

  .focus-quote {
    background: rgba(250, 251, 255, 0.7);
    border-color: rgba(0, 229, 255, 0.5);
    box-shadow: 0 0 47px rgba(0, 229, 255, 0.76);
    color: var(--text);
  }

  .focus-notes-input {
    background: #ffffff;
    border-color: rgba(0, 229, 255, 1);
  }

  .focus-notes-input:focus {
    border-color: rgba(255, 0, 128, 1);
    box-shadow: 0 0 0 3px rgba(255, 0, 128, 0.67);
  }

  .schedule-nav-btn {
    background: rgba(255, 255, 255, 0.88);
    border-color: rgba(0, 229, 255, 0.55);
    box-shadow: 0 0 18px rgba(0, 229, 255, 0.3);
  }

  .schedule-nav-btn:hover {
    border-color: rgba(255, 0, 128, 0.6);
  }

  .schedule-day-label {
    background: rgba(255, 255, 255, 0.88);
    border-color: rgba(0, 229, 255, 0.45);
    box-shadow: 0 0 16px rgba(0, 229, 255, 0.22);
  }

  .schedule-undated {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(255, 0, 128, 0.45);
  }
}
