/* OSRS-flavoured theme: brown wood frame, parchment panels, beveled chrome,
   RuneScape font for chrome. Adapted from the osrspt margins project so the
   two tools feel like a matching set. Row-based card list. */
:root {
  --wood: #28251d;
  --wood-2: #1d1b15;
  --frame-light: #6f6047;
  --frame-dark: #0d0b07;
  --panel: #3a3326;
  --panel-2: #4a4130;
  --parchment: #d8c9a3;
  --parchment-2: #cdbd92;
  --parchment-3: #c3b485;
  --ink: #2b2317;
  --orange: #ff981f;
  --gold: #ffcf5c;

  /* status accents (used for the status label text only) */
  --do: #2faa2f;       /* Complete  */
  --block: #cf3b3b;    /* Block     */
  --skip: #e8a52a;     /* Skip      */
  --lock: #6d685e;     /* Do not unlock */

  --rs: "RuneScape UF", monospace, sans-serif;
  --num: monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 24px 16px 48px;
  font-family: var(--rs);
  font-size: 16px;
  color: var(--ink);
  background-color: var(--wood);
  background-image:
    radial-gradient(circle at 20% 0%, #322e24 0%, transparent 55%),
    radial-gradient(circle at 80% 100%, #322e24 0%, transparent 55%),
    repeating-linear-gradient(0deg, #2a271f 0 2px, #28251d 2px 4px);
}

.frame {
  max-width: 1180px;
  height: calc(100vh - 72px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 2px solid var(--frame-dark);
  border-top-color: var(--frame-light);
  border-left-color: var(--frame-light);
  box-shadow: 0 0 0 2px var(--wood-2), 0 18px 40px rgba(0, 0, 0, 0.55);
  padding: 14px;
}

/* ---- top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: linear-gradient(#4a4130, #322c20);
  border: 2px solid var(--frame-dark);
  border-top-color: var(--frame-light);
  border-left-color: var(--frame-light);
}
.title-wrap { display: flex; align-items: center; gap: 14px; }
.title-icon { width: 40px; height: 40px; filter: drop-shadow(2px 2px 0 #000); }
.topbar h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 1px;
  color: var(--orange);
  text-shadow: 2px 2px 0 #000;
}
.subtitle {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--gold);
  text-shadow: 1px 1px 0 #000;
}

/* ---- search + count (live in the sidebar) ---- */
.search-wrap { flex: 0 0 auto; }
.osrs-input {
  width: 100%;
  font-family: var(--rs);
  font-size: 16px;
  color: var(--ink);
  padding: 8px 12px;
  background: #f0e7cc;
  border: 2px solid var(--frame-dark);
  border-top-color: #fff;
  border-left-color: #fff;
}
.osrs-input::placeholder { color: #8a7c5c; }
.osrs-input:focus { outline: none; background: #fff7e2; }
.count {
  display: block;
  font-size: 13px;
  color: var(--gold);
  text-shadow: 1px 1px 0 #000;
  white-space: nowrap;
}

/* ---- legend ---- */
.legend {
  margin-top: 12px;
  background: var(--parchment);
  border: 2px solid var(--frame-dark);
  border-top-color: var(--frame-light);
  border-left-color: var(--frame-light);
}
.legend > summary {
  cursor: pointer;
  padding: 8px 14px;
  color: var(--ink);
  background: linear-gradient(#c3b485, #b3a274);
  user-select: none;
  font-size: 15px;
}
.legend > summary:hover { color: #000; }
.legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px 18px;
  padding: 12px 16px;
}
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.legend-item img { width: 24px; height: 24px; }

/* ---- shared icons / chips ---- */
.ico { width: 22px; height: 22px; vertical-align: middle; }
.chips { display: inline-flex; flex-wrap: wrap; gap: 6px; flex-direction: column; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px 2px 5px;
  background: rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 2px;
  font-family: var(--num);
  font-size: 12px;
  color: var(--ink);
  white-space: nowrap;
}
.chip img { width: 25px; height: 25px; }

/* wiki links */
a.wiki {
  color: #5a3b12;
  text-decoration: none;
  border-bottom: 1px dotted rgba(90, 59, 18, 0.6);
}
a.wiki:hover { color: #000; border-bottom-color: #000; }

/* ============================ TWO-COLUMN WORKSPACE ============================ */
.workspace {
  flex: 1 1 auto;
  min-height: 0;            /* allow children to scroll instead of growing the frame */
  margin-top: 12px;
  display: flex;
  gap: 12px;
}

/* ---- left column: search + task list ---- */
.sidebar {
  flex: 0 0 300px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  padding: 10px;
  background: linear-gradient(#b9a878, #a8966a);
  border: 2px solid var(--frame-dark);
  border-top-color: #d8caa0;
  border-left-color: #d8caa0;
}

.list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--parchment-2);
  border: 2px solid var(--frame-dark);
  border-top-color: var(--frame-light);
  border-left-color: var(--frame-light);
}
.list-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-bottom: 1px solid rgba(13, 11, 7, 0.18);
  background: transparent;
  font-family: var(--rs);
  font-size: 15px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.list-item:hover { background: rgba(255, 247, 226, 0.55); }
.list-item.active {
  background: linear-gradient(#4a4130, #322c20);
  color: var(--gold);
  text-shadow: 1px 1px 0 #000;
}
.list-item .li-status { width: 22px; height: 22px; flex: 0 0 auto; }
.list-item.active .li-status { filter: drop-shadow(1px 1px 0 #000); }
.list-item .li-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item.dim { opacity: 0.55; }
.list-item.dim:hover, .list-item.dim.active { opacity: 1; }

/* ---- right column: selected task detail ---- */
.detail {
  flex: 1 1 auto;
  min-width: 0;
  overflow-y: auto;
  background: var(--parchment);
  border: 2px solid var(--frame-dark);
  border-top-color: var(--frame-light);
  border-left-color: var(--frame-light);
}
.detail:focus { outline: none; }

.detail-empty, .detail-note {
  margin: 0;
  padding: 32px 24px;
  color: #6b5a33;
  font-size: 16px;
}

.detail-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 12px 16px;
  background: linear-gradient(#4a4130, #322c20);
  border-bottom: 2px solid var(--frame-dark);
}
.detail-head h2 { margin: 0; flex: 1 1 auto; min-width: 0; font-size: 24px; line-height: 1.1; }
.detail-head h2 a { color: var(--orange); text-decoration: none; text-shadow: 2px 2px 0 #000; }
.detail-head h2 a:hover { color: var(--gold); }
.detail-meta { display: inline-flex; align-items: center; gap: 16px; flex: 0 0 auto; }
.detail-head .status-ico { width: 24px; height: 24px; filter: drop-shadow(1px 1px 0 #000); }
.detail-head .status-text {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 15px; text-shadow: 1px 1px 0 #000; white-space: nowrap;
}
.detail-head .lvl {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 16px; color: var(--gold); text-shadow: 1px 1px 0 #000; white-space: nowrap;
}
.detail-head .lvl img { width: 22px; height: 22px; }

/* detail grid */
.detail-body { padding: 14px 16px; }
.attrs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px 18px;
  align-items: start;
}
.attr { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.attr.wide { grid-column: 1 / -1; }
.attr .glabel {
  font-size: 14px; font-weight: 700;
  text-transform: uppercase; color: #463612;
}
.attr .aval { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; font-size: 14px; }
.attr .sub { font-size: 12px; font-family: var(--num); }
.attr .links { line-height: 1.6; }

/* notes panel — prominent, full width, single warning icon */
.card-notes {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 14px 14px;
  padding: 10px 14px;
  background: #f6dcb6;
  border: 1px solid #c79a6a;
  border-left: 5px solid var(--block);
  color: #5a3320;
  font-size: 14px;
  font-weight: 600;
}
.card-notes .notes-ico { font-size: 22px; line-height: 1.1; color: var(--block); flex: 0 0 auto; }
.card-notes ul { margin: 0; padding: 0; list-style: none; }
.card-notes li + li { margin-top: 5px; }

.empty {
  margin: 16px 4px;
  text-align: center;
  color: var(--gold);
  text-shadow: 1px 1px 0 #000;
  font-size: 15px;
}

.foot { margin: 18px 4px 2px; font-size: 13px; color: #9c8f6f; }
.foot a { color: var(--gold); }

/* ---- responsive ---- */
@media (max-width: 760px) {
  body { padding: 12px 8px; }
  .frame { height: calc(100vh - 24px); padding: 8px; }
  .topbar h1 { font-size: 24px; }
  .title-icon { width: 32px; height: 32px; }

  /* stack the columns: short scrollable list on top, detail below */
  .workspace { flex-direction: column; }
  .sidebar { flex: 0 0 auto; max-height: 38vh; }
  .detail { flex: 1 1 auto; }
}
