/* OSRS Pursuit - Old School RuneScape inspired theme */

:root {
  --stone-900: #120d08;
  --stone-800: #1e1810;
  --stone-700: #2b2318;
  --panel: #3e3529;
  --panel-light: #4d4234;
  --panel-edge: #5c5141;
  --osrs-orange: #ff981f;
  --osrs-yellow: #ffff00;
  --osrs-white: #f4ead0;
  --gold: #c9a227;
  --parchment: #e4d5aa;
  --parchment-dark: #c9b27c;
  --ink: #3a2a14;
  --green: #2f8a3c;
  --red: #a8261f;
  --shadow-text: 1px 1px 0 #000;
  --radius: 6px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  font-family: 'Alegreya Sans', 'Trebuchet MS', sans-serif;
  color: var(--osrs-white);
  background-color: var(--stone-800);
  background-image:
    radial-gradient(circle at 20% 15%, rgba(255, 200, 120, .05), transparent 40%),
    radial-gradient(circle at 80% 85%, rgba(255, 200, 120, .04), transparent 45%),
    repeating-linear-gradient(45deg, rgba(0, 0, 0, .12) 0 2px, transparent 2px 6px),
    linear-gradient(#231c13, #15100a);
  background-attachment: fixed;
}

h1, h2, h3, .panel-title, .frame-label {
  font-family: 'Cinzel', Georgia, serif;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 20px;
  background: linear-gradient(#4a3f30, #2c2419);
  border-bottom: 3px solid var(--stone-900);
  box-shadow: inset 0 -2px 0 var(--panel-edge), 0 4px 12px rgba(0, 0, 0, .5);
}

.logo { display: flex; align-items: center; gap: 10px; }
.logo-mark {
  font-size: 30px;
  color: var(--gold);
  text-shadow: 2px 2px 0 #000;
}
.logo h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--osrs-yellow);
  text-shadow: 2px 2px 0 #000, 0 0 12px rgba(255, 200, 0, .25);
}
.logo h1 span { color: var(--osrs-orange); }

.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- buttons ---------- */

.btn {
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  color: var(--osrs-orange);
  text-shadow: var(--shadow-text);
  background: linear-gradient(#5a4d3b, #3b3226);
  border: 2px solid var(--stone-900);
  border-radius: 4px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), inset 0 -2px 0 rgba(0, 0, 0, .3);
  padding: 7px 14px;
  cursor: pointer;
  transition: filter .12s, transform .05s;
}
.btn:hover:not(:disabled) { filter: brightness(1.18); color: var(--osrs-yellow); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary {
  color: #1d1306;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .4);
  background: linear-gradient(#ffe58a, #c9a227 55%, #8a6a14);
}
.btn-primary:hover:not(:disabled) { color: #000; }
.btn-success { color: #eaffea; background: linear-gradient(#3fa34d, #1f6a2a); }
.btn-success:hover:not(:disabled) { color: #fff; }
.btn-danger { color: #ffe3e0; background: linear-gradient(#b8382f, #6e1a14); }
.btn-danger:hover:not(:disabled) { color: #fff; }
.btn-small { font-size: 13px; padding: 5px 10px; }

.icon-btn {
  background: none;
  border: none;
  color: var(--osrs-orange);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  text-shadow: var(--shadow-text);
}
.icon-btn:hover { color: var(--osrs-yellow); }

/* ---------- layout ---------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 20px;
  padding: 20px;
  max-width: 1500px;
  margin: 0 auto;
}

.board-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* Both views sit in the same framed "window" onto Lumbridge */
.scene2d, .board3d {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: calc(100vh - 190px);
  min-height: 320px;
  overflow: hidden;
  border: 3px solid var(--stone-900);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 2px var(--panel-edge), 0 10px 24px rgba(0, 0, 0, .6);
}

.scene2d {
  display: grid;
  place-items: center;
  background: #6f9a4a url(img/lumbridge.svg) center / cover no-repeat;
}

#board {
  height: 94%;
  width: auto;
  max-width: 94%;
  aspect-ratio: 1;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, .55));
  user-select: none;
}
.board3d canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.board3d canvas:active { cursor: grabbing; }
.board3d.loading::after {
  content: 'Loading 3D board…';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--osrs-yellow);
  text-shadow: var(--shadow-text);
  font-size: 18px;
}
.board3d-hud {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #cbbd9c;
  text-shadow: var(--shadow-text);
}

.view-bar { display: flex; justify-content: center; width: 100%; }
.view-toggle {
  display: inline-flex;
  border: 2px solid var(--stone-900);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .4);
}
.view-toggle button {
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  padding: 6px 18px;
  color: var(--osrs-orange);
  text-shadow: var(--shadow-text);
  background: linear-gradient(#4a3f30, #2c2419);
  border: none;
  cursor: pointer;
}
.view-toggle button + button { border-left: 2px solid var(--stone-900); }
.view-toggle button:hover { color: var(--osrs-yellow); }
.view-toggle button.selected {
  color: #1d1306;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .4);
  background: linear-gradient(#ffe58a, #c9a227 55%, #8a6a14);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
  font-size: 14px;
  color: var(--osrs-orange);
  text-shadow: var(--shadow-text);
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-item i {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid var(--stone-900);
  border-radius: 4px;
  font-style: normal;
  font-size: 13px;
  color: #1d1306;
}
.legend-item i.round { border-radius: 50%; }

.sidebar { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ---------- panels (OSRS interface) ---------- */

.panel {
  background: var(--panel);
  border: 2px solid var(--stone-900);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 2px var(--panel-edge), inset 0 0 0 4px var(--stone-800), 0 6px 14px rgba(0, 0, 0, .45);
  padding: 14px 16px 16px;
}

.panel-title {
  margin: -2px 0 12px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--osrs-orange);
  text-shadow: var(--shadow-text);
  border-bottom: 1px solid var(--panel-edge);
  padding-bottom: 6px;
}

.muted { color: #b3a68a; margin: 0; }

/* ---------- turn panel ---------- */

.team-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.team-tabs:empty { display: none; }
.team-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--osrs-white);
  background: var(--stone-700);
  border: 2px solid var(--stone-900);
  border-radius: 20px;
  padding: 2px 10px 2px 2px;
  cursor: pointer;
  max-width: 100%;
}
.team-tab span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-tab.selected { border-color: var(--team); box-shadow: 0 0 0 1px var(--team), 0 0 10px var(--team); }

.turn-body { display: flex; gap: 16px; align-items: center; }
.turn-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.turn-team {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Cinzel', serif;
  font-size: 20px;
  font-weight: 800;
  text-shadow: var(--shadow-text);
  min-width: 0;
}
.turn-team span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.turn-hint { color: var(--osrs-yellow); text-shadow: var(--shadow-text); font-size: 15px; min-height: 1.2em; }

/* ---------- die ---------- */

.die {
  flex: none;
  width: 76px;
  height: 76px;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  place-items: center;
  background: linear-gradient(145deg, #f7efd8, #cdbb8c);
  border: 3px solid var(--stone-900);
  border-radius: 14px;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .2), inset 0 2px 0 rgba(255, 255, 255, .6), 0 4px 10px rgba(0, 0, 0, .5);
}
.die span { width: 12px; height: 12px; border-radius: 50%; }
.die span.pip { background: radial-gradient(circle at 35% 35%, #7a1a14, #2a0705); }
.die.rolling { animation: shake .12s infinite alternate; }
@keyframes shake {
  from { transform: rotate(-12deg) translate(-2px, 1px); }
  to { transform: rotate(12deg) translate(2px, -1px); }
}

/* ---------- task card (clue scroll) ---------- */

.scroll-card {
  position: relative;
  color: var(--ink);
  background:
    radial-gradient(ellipse at top left, rgba(255, 255, 255, .35), transparent 60%),
    radial-gradient(ellipse at bottom right, rgba(120, 80, 20, .25), transparent 60%),
    var(--parchment);
  border: 2px solid #7b5c2c;
  border-radius: 4px;
  padding: 16px 18px;
  box-shadow: inset 0 0 18px rgba(110, 70, 20, .45);
}
.scroll-card::before, .scroll-card::after {
  content: '';
  position: absolute;
  left: -6px;
  right: -6px;
  height: 10px;
  background: linear-gradient(#a98a52, #6b4f22);
  border: 2px solid #3e2c10;
  border-radius: 6px;
}
.scroll-card::before { top: -8px; }
.scroll-card::after { bottom: -8px; }

.task-cat {
  display: inline-block;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: #fff;
  text-shadow: var(--shadow-text);
  background: var(--cat);
  border: 2px solid rgba(0, 0, 0, .5);
  border-radius: 12px;
  padding: 2px 10px;
}
.task-title { margin: 10px 0 6px; font-size: 21px; line-height: 1.2; color: #2b1c08; }
.task-details { margin: 0 0 8px; font-size: 16px; line-height: 1.4; }
.task-reward { margin: 8px 0 0; font-weight: 700; color: #6b4a00; }
.task-reward.final { color: #8a1010; }
.task-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.cat-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.cat-btn { color: #fff; background: linear-gradient(rgba(255, 255, 255, .15), rgba(0, 0, 0, .25)), var(--cat); }
.cat-btn:hover:not(:disabled) { color: #fff; }

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

.teams-list { display: flex; flex-direction: column; gap: 8px; }
.team-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--stone-700);
  border: 2px solid var(--stone-900);
  border-left: 5px solid var(--team);
  border-radius: 4px;
}
.team-row.clickable { cursor: pointer; }
.team-row.clickable:hover { background: #352b1e; }
.team-row.active { box-shadow: 0 0 0 1px var(--gold), 0 0 10px rgba(201, 162, 39, .4); }
.team-meta { flex: 1; min-width: 0; }
.team-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 16px;
  color: var(--osrs-yellow);
  text-shadow: var(--shadow-text);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.team-status, .team-stats {
  font-size: 13px;
  color: #cbbd9c;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.team-stats { color: var(--osrs-orange); }
.badge {
  font-size: 10px;
  letter-spacing: 1px;
  color: #1d1306;
  text-shadow: none;
  background: var(--gold);
  border-radius: 3px;
  padding: 1px 5px;
}
.pie { flex: none; }

.avatar {
  flex: none;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--stone-900);
  box-shadow: 0 0 0 1px var(--gold);
  overflow: hidden;
  font-family: 'Cinzel', serif;
  font-weight: 800;
  font-size: 13px;
  color: #fff;
  text-shadow: var(--shadow-text);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- log ---------- */

.log {
  list-style: none;
  margin: 0;
  padding: 8px 10px;
  max-height: 260px;
  overflow-y: auto;
  background: var(--stone-900);
  border: 2px solid #000;
  border-radius: 3px;
  font-size: 14px;
  line-height: 1.45;
  color: #e9e1c8;
}
.log li { padding: 2px 0; border-bottom: 1px solid rgba(255, 255, 255, .04); }
.log-time { color: #8a7d62; margin-right: 6px; font-size: 12px; }

/* ---------- board SVG ---------- */

.frame-label {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 4px;
  fill: var(--osrs-yellow);
  paint-order: stroke;
  stroke: #000;
  stroke-width: 3px;
}

.sq-icon {
  font-size: 30px;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}
.sq-icon.small { font-size: 22px; }
.sq-icon.hq-icon { font-size: 40px; }
.sq-icon.hub-icon { font-size: 40px; }

.sq-ring { stroke: transparent; stroke-width: 5; pointer-events: none; }
.sq.reachable { cursor: pointer; }
.sq.reachable .sq-ring {
  stroke: var(--osrs-yellow);
  filter: drop-shadow(0 0 6px var(--osrs-yellow));
  animation: pulse 1s ease-in-out infinite alternate;
}
.sq.reachable:hover .sq-ring { stroke: #fff; }
@keyframes pulse {
  from { stroke-opacity: .45; }
  to { stroke-opacity: 1; }
}

.token {
  transition: transform .22s ease-in-out;
  pointer-events: none;
}
.token-inner { filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .7)); }
.token.active .token-inner {
  animation: bob 1.1s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 6px var(--osrs-yellow)) drop-shadow(0 3px 3px rgba(0, 0, 0, .7));
}
@keyframes bob {
  from { transform: translateY(0); }
  to { transform: translateY(-5px); }
}
.token-initials {
  font-family: 'Cinzel', serif;
  font-weight: 800;
  font-size: 15px;
  fill: #fff;
  text-anchor: middle;
  dominant-baseline: central;
  paint-order: stroke;
  stroke: #000;
  stroke-width: 2px;
}

/* ---------- modals ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, .65);
}
.modal {
  width: min(640px, 100%);
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 3px solid var(--stone-900);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 2px var(--panel-edge), 0 20px 50px rgba(0, 0, 0, .7);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 2px solid var(--stone-900);
}
.modal h2 { margin: 0; color: var(--osrs-yellow); text-shadow: 2px 2px 0 #000; font-size: 22px; }
.modal h3 { margin: 22px 0 10px; color: var(--osrs-orange); text-shadow: var(--shadow-text); font-size: 16px; }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-top: 2px solid var(--stone-900);
}
.error { color: #ff7b6b; text-shadow: var(--shadow-text); margin-right: auto; }

.setup-teams { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.setup-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: var(--stone-700);
  border: 2px solid var(--stone-900);
  border-radius: 4px;
}
.icon-upload {
  flex: none;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--stone-900);
  box-shadow: 0 0 0 2px var(--gold);
  overflow: hidden;
  cursor: pointer;
  font-size: 20px;
}
.icon-upload img { width: 100%; height: 100%; object-fit: cover; }
.text-input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 16px;
  color: var(--osrs-yellow);
  background: var(--stone-900);
  border: 2px solid #000;
  border-radius: 3px;
  padding: 8px 10px;
}
.text-input:focus { outline: 2px solid var(--gold); }
.color-input {
  flex: none;
  width: 40px;
  height: 36px;
  padding: 0;
  border: 2px solid #000;
  border-radius: 3px;
  background: none;
  cursor: pointer;
}

.radio {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 8px 0;
  font-size: 15px;
  line-height: 1.35;
  cursor: pointer;
}
.radio input { margin-top: 3px; accent-color: var(--gold); }
.radio b { color: var(--osrs-yellow); }

.modal.win { padding: 28px; text-align: center; align-items: center; }
.win-trophy { font-size: 80px; animation: bob 1s ease-in-out infinite alternate; }
.modal.win h2 { font-size: 32px; margin: 8px 0; }
.modal.win p { color: var(--osrs-white); margin: 0 0 20px; }

/* ---------- toast + fatal ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 20;
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  color: var(--osrs-yellow);
  text-shadow: var(--shadow-text);
  background: var(--stone-900);
  border: 2px solid var(--gold);
  border-radius: 4px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .6);
}
.fatal {
  padding: 14px 20px;
  color: #fff;
  background: var(--red);
  font-weight: 700;
}

/* ---------- game info + roles ---------- */

.game-info { display: flex; align-items: center; gap: 10px; min-width: 0; margin-right: auto; margin-left: 12px; }
.game-name {
  font-family: 'Cinzel', serif;
  font-weight: 800;
  font-size: 18px;
  color: var(--osrs-white);
  text-shadow: var(--shadow-text);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.role-badge {
  flex: none;
  font-size: 13px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  border: 2px solid var(--stone-900);
  color: #fff;
  text-shadow: var(--shadow-text);
  background: #555;
}
.role-admin { background: linear-gradient(#c9a227, #7a5c10); }
.role-team { background: linear-gradient(#2f8a3c, #1a5423); }
.role-viewer { background: linear-gradient(#5a5f6a, #33363d); }

/* ---------- join screen ---------- */

.join-screen {
  position: fixed;
  inset: 0;
  z-index: 15;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 7, 4, .82);
  backdrop-filter: blur(3px);
}
.join-card {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  padding: 28px 24px;
  background: var(--panel);
  border: 3px solid var(--stone-900);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 2px var(--panel-edge), 0 20px 50px rgba(0, 0, 0, .7);
}
.join-logo { font-size: 46px; color: var(--gold); text-shadow: 2px 2px 0 #000; }
.join-card h2 { margin: 0; color: var(--osrs-yellow); text-shadow: 2px 2px 0 #000; }
.join-card p { margin: 0; color: #cbbd9c; line-height: 1.4; }
.join-input { width: 100%; text-align: center; font-size: 20px; letter-spacing: 1px; }
.join-card .btn-primary { width: 100%; font-size: 17px; padding: 10px; }
.join-card .error { min-height: 1.2em; margin: 0; }
.host-link { color: var(--osrs-orange); font-size: 14px; text-shadow: var(--shadow-text); }

/* ---------- approvals ---------- */

.panel-title .count {
  display: inline-block;
  min-width: 22px;
  padding: 0 6px;
  margin-left: 6px;
  border-radius: 11px;
  background: #b8382f;
  color: #fff;
  font-family: 'Alegreya Sans', sans-serif;
  font-size: 13px;
  text-align: center;
}
#approvals-panel { box-shadow: inset 0 0 0 2px var(--gold), inset 0 0 0 4px var(--stone-800), 0 0 18px rgba(201, 162, 39, .35); }
.approvals { display: flex; flex-direction: column; gap: 8px; }
.approval {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: var(--stone-700);
  border: 2px solid var(--stone-900);
  border-left: 5px solid var(--team);
  border-radius: 4px;
}
.approval-meta { flex: 1; min-width: 0; }
.approval-team { font-weight: 700; color: var(--osrs-yellow); text-shadow: var(--shadow-text); }
.approval-task { font-size: 14px; color: #e9e1c8; }
.approval-task b { color: var(--gold); font-size: 12px; }
.approval-actions { display: flex; gap: 6px; }

.task-status { margin: 10px 0 0; padding: 8px 10px; border-radius: 4px; font-weight: 700; font-size: 15px; }
.task-status.pending { background: rgba(201, 162, 39, .25); border: 1px solid #a8801c; color: #5e4300; }
.task-status.rejected { background: rgba(168, 38, 31, .15); border: 1px solid #a8261f; color: #7a1410; }

.team-tab.pending, .team-row.pending { position: relative; }
.team-tab.pending::after, .team-row.pending::after {
  content: '⏳';
  position: absolute;
  top: -8px;
  right: -6px;
  font-size: 14px;
}

/* ---------- setup: codes ---------- */

.small { font-size: 13px; }
.muted.small { margin: 0 0 10px; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; font-weight: 700; color: var(--osrs-orange); text-shadow: var(--shadow-text); }
.field small { font-weight: 400; color: #b3a68a; }
.field .text-input { width: 100%; }
.field:has(.key-btns) { position: relative; }
.field .key-btns { position: absolute; right: 4px; bottom: 4px; display: flex; gap: 4px; }
.tasks-modal { width: min(820px, 100%); }
.tasks-import { margin-bottom: 14px; }
.task-lists { display: flex; flex-direction: column; gap: 14px; }
.task-list {
  padding: 10px 12px 12px;
  background: var(--stone-700);
  border: 2px solid var(--stone-900);
  border-left: 6px solid var(--cat);
  border-radius: 4px;
}
.task-list-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.task-list-head h4 { margin: 0; font-family: 'Cinzel', serif; color: var(--osrs-yellow); text-shadow: var(--shadow-text); font-size: 16px; }
.task-list-head .tag {
  font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 10px;
  background: var(--stone-900); color: #b3a68a; border: 1px solid #000;
}
.task-list-head .tag.custom { background: var(--gold); color: #1d1306; }
.task-list-head .spacer { flex: 1; }
.task-list textarea {
  width: 100%;
  min-height: 130px;
  resize: vertical;
  font: 14px/1.45 ui-monospace, Menlo, monospace;
  color: var(--osrs-white);
  background: var(--stone-900);
  border: 2px solid #000;
  border-radius: 3px;
  padding: 8px 10px;
}
.task-list textarea:focus { outline: 2px solid var(--gold); }
.webhook-row { display: flex; align-items: center; gap: 8px; }
.webhook-label { flex: none; font-weight: 700; color: var(--osrs-orange); text-shadow: var(--shadow-text); }
.webhook-input { flex: 1; min-width: 0; font-size: 13px !important; }
.webhook-input:not([readonly]) { color: var(--osrs-white); }
.key-input, .code-input { font-family: ui-monospace, Menlo, monospace; letter-spacing: .5px; }
.key-input[readonly], .code-input[readonly] { color: var(--osrs-yellow); cursor: default; }
.key-input::placeholder, .code-input::placeholder { color: #8a7d62; font-style: italic; font-family: 'Alegreya Sans', sans-serif; }

.join-divider {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #8a7d62;
  font-size: 13px;
}
.join-divider::before, .join-divider::after { content: ''; flex: 1; border-top: 1px solid var(--panel-edge); }
#btn-create-lobby { width: 100%; font-size: 16px; padding: 9px; }

.key-modal { width: min(520px, 100%); }
.key-modal p { margin: 0 0 12px; line-height: 1.45; }
.big-key {
  margin: 4px 0 14px;
  padding: 16px;
  text-align: center;
  background: var(--stone-900);
  border: 2px solid var(--gold);
  border-radius: 6px;
}
.big-key code { font-size: 34px; letter-spacing: 3px; color: var(--osrs-yellow); text-shadow: 2px 2px 0 #000; user-select: all; }
.key-actions { display: flex; gap: 10px; justify-content: center; margin-bottom: 14px; flex-wrap: wrap; }
.setup-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.setup-fields .text-input { width: 100%; }
.code-row { display: flex; align-items: center; gap: 6px; }
.code-label { font-size: 14px; }
.code-input { font-family: ui-monospace, Menlo, monospace; font-size: 14px !important; padding: 5px 8px !important; }

/* ---------- host page ---------- */

.host { max-width: 960px; margin: 0 auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.host-card { display: flex; flex-direction: column; gap: 12px; }
#host-main { display: flex; flex-direction: column; gap: 16px; }
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-form .text-input { flex: 1; min-width: 180px; }
.host-games { display: flex; flex-direction: column; gap: 12px; }
.host-game { padding: 12px; background: var(--stone-700); border: 2px solid var(--stone-900); border-radius: 4px; }
.host-game-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.host-game-head h3 { margin: 0; color: var(--osrs-yellow); text-shadow: var(--shadow-text); font-size: 18px; }
.host-game-head .btn-danger { margin-left: auto; }
.code-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.code-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px 3px 10px;
  background: var(--stone-900);
  border: 1px solid #000;
  border-radius: 4px;
  font-size: 14px;
}
.code-chip-label { color: var(--osrs-orange); font-weight: 700; }
.code-chip code { color: var(--osrs-yellow); font-size: 14px; }
code { font-family: ui-monospace, Menlo, monospace; }

/* ---------- responsive ---------- */

@media (max-width: 1000px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .scene2d, .board3d { max-height: none; }
}
@media (max-width: 760px) {
  .game-info { order: 3; width: 100%; margin: 0; }
}
@media (max-width: 480px) {
  .logo h1 { font-size: 24px; }
  .setup-row { flex-wrap: wrap; }
  .cat-picker { grid-template-columns: 1fr; }
}
