/* Quest Log — "paper journal" theme.
   All colors live in custom properties: a future dark mode is a palette
   swap under [data-theme="dark"], nothing else to touch. */

:root {
  --bg: #f6f1e7;
  --card: #fffdf9;
  --ink: #45403a;
  --muted: #8f8676;
  --faint: #b3a893;
  --line: #e9dfcd;
  --line-strong: #e2d8c4;
  --accent: #b5654a;
  --accent-ink: #fff8f0;
  --hover-wash: rgba(181, 101, 74, 0.07);
  --st-queued: #b3a68d;
  --st-progress: #d99c3d;
  --st-done: #7d9b76;
  --st-dropped: #c98a8a;
  --tile-bg: #e7ddcb;
  --note-bg: #efe8d8;
  color-scheme: light;
}

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

html { scrollbar-color: var(--line-strong) var(--bg); }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 640px; margin: 0 auto; padding: 0 20px; }

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

/* ---------------------------------------------------------------- nav --- */

nav {
  display: flex; align-items: baseline; gap: 18px;
  padding: 26px 0 14px;
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: "Fraunces", Georgia, serif; font-style: italic; font-weight: 600;
  font-size: 21px; color: var(--ink); text-decoration: none;
}
.tabs { margin-left: auto; display: flex; gap: 16px; }
.tab {
  text-decoration: none; color: var(--muted); font-size: 14.5px;
  padding-bottom: 2px; border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-logout { margin-left: 6px; }
.tab-logout:hover { color: var(--st-dropped); }

/* --------------------------------------------------------------- head --- */

.page-head { padding: 34px 0 4px; }
h1 {
  font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 30px;
  letter-spacing: -0.01em;
}
.sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.sub a { color: inherit; }
.sortlink { text-decoration: none; border-bottom: 1px dotted var(--faint); }
.sortlink:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------------------------------------------------------- add form --- */

form.add { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 4px; }
.add-title {
  flex: 1; min-width: 12rem; border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--card); padding: 11px 18px; font-size: 15px;
  color: var(--ink); outline: none;
}
.add-title::placeholder { color: var(--faint); }
.add-title:focus { border-color: var(--accent); }
.add-kind select {
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--card);
  padding: 11px 12px; font-size: 14px; color: var(--muted); outline: none; cursor: pointer;
}
.btn-add {
  border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-weight: 600; font-size: 15px; padding: 11px 22px; cursor: pointer;
  transition: background 0.15s;
}
.btn-add:hover { background: #a2553c; }
.btn-add:active { transform: translateY(1px); }
.btn-ghost {
  border: 0; background: transparent; color: var(--muted); font-size: 13px;
  cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px;
}
.btn-ghost:hover { color: var(--ink); }
.linkish {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: inherit;
}
.linkish:hover { color: var(--st-dropped); }

details.add-more { width: 100%; margin-top: 2px; }
details.add-more summary {
  list-style: none; cursor: pointer; color: var(--faint); font-size: 13px;
  width: max-content; padding: 4px 2px;
}
details.add-more summary::-webkit-details-marker { display: none; }
details.add-more summary:hover { color: var(--accent); }
.add-more-grid {
  display: flex; flex-wrap: wrap; gap: 10px; padding: 10px 2px 4px;
}
.add-more-grid label {
  display: flex; flex-direction: column; gap: 3px; font-size: 12px;
  color: var(--muted); flex: 1; min-width: 9rem;
}
.add-more-grid label.add-prio {
  flex: 0 0 auto; flex-direction: row; align-items: center; gap: 6px;
  font-size: 13.5px; align-self: end; padding-bottom: 9px; cursor: pointer;
}
.lbl { letter-spacing: 0.04em; }
.add-more-grid input, .add-more-grid select {
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--card);
  padding: 8px 12px; font-size: 14px; color: var(--ink); outline: none;
  font-family: inherit;
}
.add-more-grid input:focus, .add-more-grid select:focus { border-color: var(--accent); }
.emoji-input { max-width: 5.5rem; }

.steam-hint {
  width: 100%; font-size: 13px; color: var(--st-done);
  background: var(--note-bg); border-radius: 8px; padding: 5px 10px; margin-top: 6px;
}
.hidden { display: none; }

#steam-results {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--card); overflow: hidden; margin-top: 8px;
  transition: opacity 0.2s;
}
#steam-results.searching { opacity: 0.55; }
.steam-msg { padding: 8px 12px; font-size: 13px; color: var(--muted); }
.steam-note {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 12px; font-size: 12px; color: var(--faint);
  border-bottom: 1px solid var(--line);
}
.spin {
  display: inline-block; width: 11px; height: 11px; flex-shrink: 0;
  border: 2px solid var(--line-strong); border-top-color: var(--accent);
  border-radius: 50%; animation: ql-spin 0.8s linear infinite;
}
@keyframes ql-spin { to { transform: rotate(360deg); } }
.steam-result {
  display: flex; width: 100%; align-items: center; gap: 10px;
  padding: 7px 12px; font-size: 14px; color: var(--ink); text-align: left;
  cursor: pointer; background: transparent; border: 0;
  border-bottom: 1px solid var(--line);
  font-family: inherit;
}
.steam-result:last-child { border-bottom: 0; }
.steam-result:hover { background: var(--hover-wash); }
.steam-result img { height: 2.4rem; width: auto; border-radius: 4px; flex-shrink: 0; }

/* --------------------------------------------------------------- list --- */

ul.list { list-style: none; margin-top: 12px; }
li.row {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 14px;
  align-items: center; padding: 14px 6px;
  border-bottom: 1px solid var(--line);
  transition: background 0.15s;
}
li.row:first-child { border-top: 1px solid var(--line); }
li.row:hover { background: var(--hover-wash); }

li.row.manual { grid-template-columns: 14px 44px 1fr auto; }
.moves {
  display: flex; flex-direction: column; gap: 2px;
  opacity: 0; transition: opacity 0.15s;
}
li.row.manual:hover .moves, .moves:focus-within { opacity: 1; }
.move-btn {
  border: 0; background: none; color: var(--faint); font-size: 9px;
  line-height: 1; cursor: pointer; padding: 1px 2px;
}
.move-btn:hover { color: var(--accent); }
@media (hover: none) {
  .moves { opacity: 1; }
}

.tile {
  width: 44px; height: 44px; border-radius: 9px;
  display: grid; place-items: center; font-size: 20px;
  background: var(--tile-bg);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
  overflow: hidden; flex-shrink: 0;
}
.tile-img { object-fit: cover; }

.row-body { min-width: 0; }
.title { font-weight: 600; font-size: 15.5px; display: block; }
.title a {
  color: var(--ink); text-decoration: none;
  border-bottom: 1px dotted #c9bda4;
}
.title a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.flame { font-size: 0.85em; }

.meta { font-size: 12.5px; color: var(--muted); margin-top: 1px; display: block; overflow-wrap: anywhere; }
.meta a {
  color: inherit; text-decoration: none;
  border-bottom: 1px dotted #cfc4ab;
}
.meta a:hover { color: var(--accent); }
.dotsep { margin: 0 4px; color: #cfc4ab; }

details.notes { display: inline; }
details.notes summary {
  list-style: none; cursor: pointer; display: inline;
  text-decoration: underline dotted; text-decoration-color: #cfc4ab; text-underline-offset: 2px;
}
details.notes summary::-webkit-details-marker { display: none; }
details.notes[open] summary { display: none; }
.note-pop {
  margin-top: 6px; font-size: 13px; color: #6d6555;
  background: var(--note-bg); border-radius: 8px; padding: 7px 10px; max-width: 420px;
  white-space: pre-wrap;
}

/* actions: appear on row hover, keep the row calm otherwise */
.row-right { display: flex; align-items: center; gap: 10px; }
.acts { display: flex; gap: 2px; opacity: 0; transition: opacity 0.15s; }
li.row:hover .acts, .acts:focus-within { opacity: 1; }
@media (hover: none) {
  .acts { opacity: 1; }
}
.act {
  border: 0; background: transparent; border-radius: 8px;
  width: 28px; height: 28px; font-size: 13px; cursor: pointer; color: var(--muted);
}
.act:hover { background: var(--note-bg); color: var(--ink); }
.act-danger:hover { color: var(--st-dropped); }

.status { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.status i {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 6px; background: var(--st-queued);
}
.st-in-progress { color: var(--st-progress); }
.st-in-progress i { background: var(--st-progress); }
.st-done { color: #71855f; }
.st-done i { background: var(--st-done); }
.st-dropped { color: #b99a9a; }
.st-dropped i { background: var(--st-dropped); }
.st-dropped { text-decoration: line-through; text-decoration-thickness: 1px; }

li.done-row .title {
  color: var(--muted); text-decoration: line-through;
  text-decoration-color: #c9bda4; text-decoration-thickness: 1px;
}

/* edit form: renders as its own card, escaping the row grid entirely
   (li.row-edit needed to out-specific the base li.row display:grid) */
li.row-edit {
  display: block; grid-template-columns: none; gap: 0;
  border: 1px solid var(--line-strong); background: var(--card);
  border-radius: 12px; padding: 12px; margin-top: 8px;
}
.edit-form { width: 100%; }
.edit-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.edit-grid label {
  display: flex; flex-direction: column; gap: 3px;
  font-size: 12px; color: var(--muted);
}
.edit-grid .span2 { grid-column: span 2; }
.edit-grid input, .edit-grid select {
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg);
  padding: 8px 12px; font-size: 14px; color: var(--ink); outline: none;
  font-family: inherit; width: 100%;
}
.edit-grid input:focus, .edit-grid select:focus { border-color: var(--accent); }
.edit-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 12px; align-items: center; }

/* empty + cleared pile */
.empty {
  border: 1px dashed var(--line-strong); border-radius: 14px;
  padding: 40px 20px; text-align: center; color: var(--muted); font-size: 14px;
  margin-top: 12px; list-style: none;
}
.cleared { margin-top: 26px; }
.cleared > summary {
  list-style: none; cursor: pointer; color: var(--muted); font-size: 14px;
  width: max-content;
}
.cleared > summary::-webkit-details-marker { display: none; }
.cleared > summary:hover { color: var(--accent); }
.count-badge {
  display: inline-block; margin-left: 6px; font-size: 11.5px;
  background: var(--note-bg); border-radius: 999px; padding: 0 8px;
}

/* -------------------------------------------------------------- login --- */

.login { display: grid; place-items: center; min-height: 60vh; }
.login-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 40px 44px; text-align: center; max-width: 340px; width: 100%;
  box-shadow: 0 12px 40px rgba(69, 64, 58, 0.08);
}
.login-mark { font-size: 38px; margin-bottom: 6px; }
.login-title {
  font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 26px;
}
.login-sub { color: var(--muted); font-size: 13px; margin: 4px 0 22px; }
.login-error {
  color: var(--st-dropped); font-size: 13.5px; background: rgba(201, 138, 138, 0.12);
  border-radius: 8px; padding: 7px 10px; margin-bottom: 14px;
}
.login-form { display: flex; flex-direction: column; gap: 10px; }
.login-input {
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--bg);
  padding: 11px 16px; font-size: 15px; text-align: center; outline: none;
}
.login-input:focus { border-color: var(--accent); }

/* ------------------------------------------------------------- footer --- */

footer {
  text-align: center; color: var(--faint); font-size: 12px; padding: 44px 0 34px;
}

/* ----------------------------------------------------------- mobile --- */

@media (max-width: 520px) {
  li.row { grid-template-columns: 38px 1fr auto; gap: 10px; }
  li.row.manual { grid-template-columns: 14px 38px 1fr auto; }
  .tile { width: 38px; height: 38px; font-size: 17px; }
  .edit-grid { grid-template-columns: 1fr; }
  .edit-grid .span2 { grid-column: span 1; }
  h1 { font-size: 25px; }
}
