@import url("https://fonts.googleapis.com/css2?family=Hammersmith+One&family=Sora:wght@300;400;600&display=swap");

:root {
  /* Polar Night */
  --darkest1: #2e3440;
  --darkest2: #3b4252;
  --darkest3: #434c5e;
  --darkest4: #4c566a;

  /* Snow Storm */
  --lightest1: #eceff4;
  --lightest2: #e5e9f0;
  --lightest3: #d8dee9;

  /* Aurora */
  --red: #bf616a;
  --orange: #d08770;
  --yellow: #ebcb8b;
  --green: #a3be8c;
  --purple: #b48ead;

  /* Frost */
  --blue1: #b5d2d9;
  --blue2: #81a1c1;
  --blue3: #5e81ac;

  /* Fonts */
  --headerFont: 'Hammersmith One', Roboto, Helvetica, Arial, sans-serif;
  --primaryFont: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
  --ease: cubic-bezier(0, 0.6, 0.3, 1);

  /* semantic */
  --bg: var(--darkest1);
  --fg: var(--lightest1);
  --muted: var(--lightest3);
  --surface: var(--darkest2);
  --border: var(--darkest3);
  --accent: var(--blue1);
  --danger: var(--red);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--primaryFont);
  font-size: 21px;
  overflow: hidden;
}

input:focus,
textarea:focus,
.list-name input,
.entry input {
  outline: none;
}

input,
button,
textarea {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0.2rem solid var(--border);
  padding: 6px 8px;
}

button {
  cursor: pointer;
}

dialog {
  background: var(--surface);
  color: var(--fg);
  border: 0.2rem solid var(--border);
  padding: 16px;
  min-width: 280px;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

/* topbar — always visible, shows the active plan name centered */
#topbar {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 16px;
  height: 56px;
  position: relative;
  background: var(--surface);
  border-bottom: 0.2rem solid var(--border);
}

#topbar button {
  background: transparent;
  border: none;
  padding: 0;
  font-family: var(--headerFont);
  font-size: 28px;
  letter-spacing: 0.5px;
  cursor: default;
  color: var(--blue2);
}

#m-view {
  display: none;
}

body.touch #m-view {
  position: absolute;
  right: 16px;
  color: var(--lightest1);
}

@media (max-width: 400px) {
  #topbar {
    justify-content: flex-start;
  }
}

body.touch #m-palette {
  border: none;
  padding: 4px 10px;
  cursor: pointer;
}

body.touch #m-view {
  display: inline-block;
  border: 0.2rem solid var(--border);
  padding: 4px 10px;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--headerFont) !important;
}

/* board */
#board {
  height: calc(100vh - 56px);
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  outline: none;
}

body.dragging-scroll #board,
body.dragging-scroll .entries {
  cursor: grabbing;
  user-select: none;
}

.list {
  flex: 0 0 350px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 0.2rem solid var(--border);
  max-height: calc(100vh - 88px);
  overflow: hidden;
}

.list[data-selected] {
  border-color: var(--accent);
}

.list[data-list-selected] .list-name {
  background: var(--darkest3);
}

.list-name {
  padding: 10px 14px;
  border-bottom: 0.2rem solid var(--border);
  font-family: var(--headerFont);
  font-size: 22px;
  letter-spacing: 0.5px;
}

.list-name input {
  width: 100%;
}

.list-name:empty::after {
  content: "—";
  color: var(--muted);
}

.entries {
  list-style: none;
  margin: 0;
  padding: 0;
  min-height: 4px;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.entry {
  padding: 10px 10px;
  word-break: break-word;
  white-space: pre-wrap;
  cursor: pointer;
}

.entry[data-todo] {
  background: var(--blue3);
  color: var(--lightest1);
}

.entry+.entry {
  border-top: 0.2rem solid var(--border);
}

.entry[data-sep] {
  font-style: italic;
  text-align: center;
  color: var(--muted);
  opacity: 0.55;
}

.entry[data-sep]+.entry {
  border-top: none;
}

.entry[data-selected] {
  background: var(--darkest3);
  outline: 0.2rem solid var(--accent);
}

/* The divider that sits at the top of a selected/todo entry should match that
   entry's own background, otherwise the gray separator bleeds into the color. */
.entry[data-selected] {
  border-top-color: var(--darkest3);
}

body[data-mode="insert"] .entry[data-selected] {
  border-top-color: var(--darkest4);
}

.entry[data-todo] {
  border-top-color: var(--blue3);
}

body[data-mode="insert"] .entry[data-selected][data-todo] {
  border-top-color: var(--blue2);
}

/* todo overrides the selection background so it stays blue while hovered/selected */
.entry[data-todo][data-selected] {
  background: var(--blue3);
}

/* editing — lighten the background of the entry being edited */
body[data-mode="insert"] .entry[data-selected] {
  background: var(--darkest4);
}

body[data-mode="insert"] .entry[data-selected][data-todo] {
  background: var(--blue2);
}

.entry input,
.entry textarea {
  width: 100%;
  resize: none;
  overflow: hidden;
  font: inherit;
  border: none;
  padding: 0;
  background: transparent;
  color: inherit;
}

/* hide list scrollbars while dragging entries between lists */
body.dragging .entries {
  scrollbar-width: none;
}

body.dragging .entries::-webkit-scrollbar {
  display: none;
}

/* single-list view: center, keep the normal column width */
body[data-view="single"] #board {
  justify-content: center;
  overflow-x: hidden;
}

body[data-view="single"] #board>.list {
  display: none;
}

body[data-view="single"] #board>.list[data-active] {
  display: flex;
}

body[data-view="single"] #dots {
  display: flex;
}

#dots {
  position: fixed;
  bottom: 12px;
  left: 0;
  right: 0;
  justify-content: center;
  gap: 6px;
}

#dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--darkest3);
}

#dots span[data-active] {
  background: var(--accent);
}

/* default (desktop): hide mobile-only chrome */
#actions,
.confirm-btn {
  display: none;
}

/* mobile (body.touch is set by JS using matchMedia OR a mobile UA) */
body.touch #board {
  height: calc(100vh - 200px);
  padding: 8px;
}

body.touch #actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  gap: 6px;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px;
  border-top: 0.2rem solid var(--border);
  background: var(--surface);
}

body.touch #actions button {
  flex: 1 1 90px;
  max-width: 180px;
  font-size: 12px;
  padding: 6px 10px;
  text-align: center;
}

body.touch #dots {
  bottom: 160px;
}

body.touch .list {
  flex-basis: 90vw;
  max-width: 90vw;
  max-height: calc(100vh - 230px);
}

body.touch .confirm-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  background: var(--blue3);
  border-color: var(--blue3);
  color: var(--lightest1);
  padding: 10px;
}

body.touch #palette-input {
  display: none;
}

/* palette */
#palette {
  max-height: 60vh;
}

#palette-input,
#new-plan-input {
  width: 100%;
  margin-bottom: 8px;
}

#palette-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 40vh;
  overflow-y: auto;
}

#palette-list li {
  padding: 6px 8px;
  cursor: pointer;
}

#palette-list li[data-active] {
  background: var(--darkest3);
}

#palette-list li[data-default]::after {
  content: " ★";
  color: var(--muted);
}

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

#auth-error {
  color: var(--danger);
  margin: 8px 0 0;
}

.sortable-ghost {
  opacity: 0.4;
}

.sortable-drag {
  background: var(--darkest3);
}

h1,
h2,
h3 {
  font-family: var(--headerFont);
}