/* The dungeon owns its palette: it stays dark whatever the system is set to,
   because a lit corridor is part of the atmosphere, not a preference. */

:root {
  color-scheme: dark;
  --bg: #05070b;
  --fg: #e8e2d6;
  --muted: #8d8578;

  --dd-gold: #d8a94a;
  --dd-gold-dim: rgba(216, 169, 74, 0.28);
  --dd-hp: #b8342a;
  --dd-mana: #4d8fdd;
  --dd-stam: #5aa457;
  --dd-xp: #a97bf0;
  --dd-panel: rgba(10, 12, 17, 0.9);
  --dd-panel-soft: rgba(16, 19, 26, 0.86);
  --dd-line: rgba(216, 169, 74, 0.3);
  --dd-text: #e8e2d6;
  --dd-text-dim: #9a9184;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.4 -apple-system, system-ui, sans-serif;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#stage { position: fixed; inset: 0; }
#stage canvas { display: block; width: 100%; height: 100%; cursor: crosshair; }
#stage canvas.dd-no-lock { cursor: default; }

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
  font-family: ui-sans-serif, -apple-system, system-ui, sans-serif;
}

/* Only elements that opt in take input. A blanket rule for every child of #hud
   made the full-screen HUD layer swallow every click meant for the game view. */

/* ------------------------------------------------------------------ boot */

.dd-boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--dd-gold);
  letter-spacing: 0.32em;
  font-size: 12px;
  text-transform: uppercase;
  z-index: 50;
}

/* ------------------------------------------------------------------ root */

.dd-root {
  position: absolute;
  inset: 0;
  pointer-events: none;
  color: var(--dd-text);
  font-size: 13px;
}

.dd-root > * { pointer-events: none; }

/* ------------------------------------------------------------- vitals HUD */

.dd-vitals {
  position: absolute;
  top: 16px;
  left: 16px;
  width: min(268px, 42vw);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dd-bar {
  position: relative;
  height: 12px;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}

.dd-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  transform-origin: left center;
  transition: width 140ms ease-out;
}

.dd-bar-fill.hp { background: linear-gradient(180deg, #e0503f, #96271f); }
.dd-bar-fill.mana { background: linear-gradient(180deg, #6fb0f5, #2f66b0); }
.dd-bar-fill.stam { background: linear-gradient(180deg, #7cc46f, #3d7a3a); }
.dd-bar-fill.xp { background: linear-gradient(90deg, #8a5fd4, #c79bf7); }

.dd-bar-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.dd-xp-row { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.dd-level {
  min-width: 34px;
  height: 24px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #1c2029, #0b0d12);
  border: 1px solid var(--dd-line);
  border-radius: 4px;
  color: var(--dd-gold);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.04em;
}
.dd-xp-row .dd-bar { flex: 1; height: 8px; }

/* ---------------------------------------------------------------- top right */

.dd-stats {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  text-align: right;
}

.dd-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  background: var(--dd-panel);
  border: 1px solid var(--dd-gold-dim);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.dd-chip.gold { color: var(--dd-gold); }
.dd-chip.kills { color: #e08a7a; }

.dd-minimap {
  width: 132px;
  height: 132px;
  border-radius: 6px;
  border: 1px solid var(--dd-gold-dim);
  background: rgba(4, 6, 10, 0.82);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
  image-rendering: pixelated;
}

.dd-objective {
  max-width: 230px;
  padding: 5px 9px;
  background: var(--dd-panel);
  border-left: 2px solid var(--dd-gold);
  border-radius: 3px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--dd-text-dim);
  text-align: left;
}
.dd-objective b { color: var(--dd-gold); display: block; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; }

/* ------------------------------------------------------------- crosshair */

.dd-crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  opacity: 0.85;
}
.dd-crosshair::before,
.dd-crosshair::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.9);
}
.dd-crosshair::before { left: 50%; top: 0; width: 1.5px; height: 100%; margin-left: -0.75px; }
.dd-crosshair::after { top: 50%; left: 0; height: 1.5px; width: 100%; margin-top: -0.75px; }

.dd-hitmark {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  border: 2px solid rgba(255, 120, 90, 0.9);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.6);
}
.dd-hitmark::before,
.dd-hitmark::after {
  content: '';
  position: absolute;
  background: rgba(255, 140, 110, 0.9);
}
.dd-hitmark.active { animation: dd-hitmark 220ms ease-out; }
@keyframes dd-hitmark {
  from { opacity: 1; transform: scale(0.55) rotate(45deg); }
  to { opacity: 0; transform: scale(1.25) rotate(45deg); }
}

/* -------------------------------------------------------------- hotbar */

.dd-hotbar {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
}

.dd-slot {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--dd-panel);
  display: grid;
  place-items: center;
  position: relative;
  color: var(--dd-text-dim);
  font-size: 18px;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.7);
}
.dd-slot .key {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 9px;
  color: var(--muted);
  font-weight: 700;
}
.dd-slot .count {
  position: absolute;
  bottom: 2px;
  left: 5px;
  font-size: 10px;
  font-weight: 800;
  color: var(--dd-gold);
}
.dd-slot.ready { border-color: var(--dd-gold-dim); color: var(--dd-text); }
.dd-slot.cooling { opacity: 0.42; }
.dd-slot .fill {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  background: rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

/* ---------------------------------------------------------------- toasts */

.dd-toasts {
  position: absolute;
  left: 50%;
  top: 22%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 90%;
}

.dd-toast {
  padding: 5px 14px;
  border-radius: 4px;
  background: rgba(8, 10, 14, 0.86);
  border: 1px solid var(--dd-gold-dim);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  animation: dd-toast 2.6s ease-out forwards;
}
.dd-toast.good { color: #8fe08a; border-color: rgba(143, 224, 138, 0.4); }
.dd-toast.bad { color: #f08a7a; border-color: rgba(240, 138, 122, 0.4); }
.dd-toast.epic { color: #cfa4ff; border-color: rgba(207, 164, 255, 0.5); }
.dd-toast.legendary { color: #ffcf6b; border-color: rgba(255, 207, 107, 0.6); }

@keyframes dd-toast {
  0% { opacity: 0; transform: translateY(8px); }
  12% { opacity: 1; transform: translateY(0); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-10px); }
}

/* A story fragment: set like a passage, not a status line. */
.dd-lore {
  font-size: 14px;
  line-height: 1.65;
  color: var(--dd-text);
  letter-spacing: 0.005em;
  padding: 6px 2px 2px;
  font-style: italic;
}

/* -------------------------------------------------------- damage numbers */

.dd-dmg {
  position: absolute;
  left: 0;
  top: 0;
  font-weight: 800;
  font-size: 17px;
  color: #ffd9a0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.95);
  pointer-events: none;
  will-change: transform, opacity;
  font-variant-numeric: tabular-nums;
}
.dd-dmg.crit { color: #ff9a5c; font-size: 23px; }
.dd-dmg.heal { color: #8fe08a; }
.dd-dmg.player { color: #ff6f5f; }

/* ----------------------------------------------------------- chat + net */

.dd-net {
  position: absolute;
  left: 16px;
  bottom: 18px;
  width: min(300px, 46vw);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dd-chatlog {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11.5px;
  line-height: 1.35;
  max-height: 132px;
  overflow: hidden;
  color: var(--dd-text-dim);
}
.dd-chatlog .who { color: var(--dd-gold); font-weight: 700; }
.dd-chatlog .sys { color: #7fa8d8; font-style: italic; }

.dd-party { display: flex; flex-direction: column; gap: 3px; }
.dd-party-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--dd-text-dim);
  font-weight: 600;
}
.dd-party-row .swatch { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.dd-party-row .hpbar { flex: 1; height: 4px; background: rgba(255, 255, 255, 0.12); border-radius: 2px; overflow: hidden; }
.dd-party-row .hpbar i { display: block; height: 100%; background: #b8342a; }

/* --------------------------------------------------------- touch controls */

.dd-touch { position: absolute; inset: 0; pointer-events: none; }
.dd-touch > * { pointer-events: auto; }

.dd-joy {
  position: absolute;
  left: 22px;
  bottom: 24px;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(216, 169, 74, 0.22);
  touch-action: none;
}

.dd-joy-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 226, 170, 0.9), rgba(150, 100, 40, 0.75));
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
}

.dd-actions {
  position: absolute;
  right: 20px;
  bottom: 22px;
  display: grid;
  grid-template-columns: repeat(3, 66px);
  grid-template-rows: repeat(2, 66px);
  gap: 11px;
  justify-items: center;
  align-items: center;
}

.dd-act {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  border: 1px solid rgba(216, 169, 74, 0.4);
  background: radial-gradient(circle at 35% 30%, rgba(58, 44, 26, 0.92), rgba(12, 14, 19, 0.92));
  background-repeat: no-repeat;
  background-position: center;
  background-size: 42%;
  color: var(--dd-gold);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
}
.dd-act:active { transform: scale(0.93); }
.dd-act.cooling { opacity: 0.4; }
.dd-act.primary { border-color: rgba(255, 160, 90, 0.7); }

.dd-look {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 180px;
  left: 45%;
  touch-action: none;
}

/* -------------------------------------------------------------- overlays */

.dd-overlay {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 40%, rgba(10, 8, 6, 0.55), rgba(3, 4, 6, 0.93));
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  padding: 20px;
  overflow: auto;
}

.dd-panel {
  width: min(560px, 94vw);
  max-height: 92vh;
  overflow: auto;
  background: linear-gradient(180deg, rgba(20, 22, 28, 0.97), rgba(8, 9, 13, 0.98));
  border: 1px solid var(--dd-line);
  border-radius: 10px;
  padding: 26px 26px 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.8);
}

.dd-title {
  font-family: ui-serif, Georgia, serif;
  font-size: clamp(26px, 6vw, 42px);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dd-gold);
  text-align: center;
  text-shadow: 0 0 30px rgba(216, 169, 74, 0.35);
}

.dd-sub {
  text-align: center;
  color: var(--dd-text-dim);
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  margin-top: 6px;
}

.dd-rule {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--dd-line), transparent);
  margin: 18px 0;
}

.dd-btn {
  display: block;
  width: 100%;
  padding: 12px 16px;
  margin-top: 9px;
  background: linear-gradient(180deg, rgba(46, 40, 29, 0.9), rgba(20, 18, 14, 0.9));
  border: 1px solid var(--dd-line);
  border-radius: 6px;
  color: var(--dd-text);
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color 120ms, background 120ms, transform 80ms;
}
.dd-btn:hover { border-color: rgba(216, 169, 74, 0.75); background: linear-gradient(180deg, rgba(64, 54, 36, 0.95), rgba(28, 24, 18, 0.95)); }
.dd-btn:active { transform: scale(0.99); }
.dd-btn.primary {
  background: linear-gradient(180deg, #7a5a20, #3a2a10);
  border-color: rgba(216, 169, 74, 0.9);
  color: #ffe9bd;
  font-size: 14px;
  padding: 14px 16px;
}
.dd-btn.primary:hover { background: linear-gradient(180deg, #95701f, #4a3614); }
.dd-btn.danger { border-color: rgba(184, 52, 42, 0.6); color: #f0a89f; }
.dd-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.dd-field {
  width: 100%;
  padding: 11px 14px;
  margin-top: 9px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  color: var(--dd-text);
  font: 700 18px/1 ui-monospace, monospace;
  letter-spacing: 0.34em;
  text-align: center;
  text-transform: uppercase;
  outline: none;
}
.dd-field:focus { border-color: var(--dd-gold); }

.dd-note { color: var(--dd-text-dim); font-size: 11.5px; text-align: center; margin-top: 8px; line-height: 1.5; }

.dd-row { display: flex; gap: 10px; }
.dd-row > * { flex: 1; }

/* --------------------------------------------------------------- lists */

.dd-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.dd-tab {
  flex: 1;
  padding: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--dd-text-dim);
  font: 700 11px/1 inherit;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}
.dd-tab.on { background: rgba(216, 169, 74, 0.14); border-color: var(--dd-line); color: var(--dd-gold); }

.dd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  margin-bottom: 6px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 5px;
}
.dd-item .name { flex: 1; font-weight: 700; font-size: 13px; }
.dd-item .tag { font-size: 10px; color: var(--dd-text-dim); letter-spacing: 0.1em; text-transform: uppercase; }
.dd-item.rare { border-color: rgba(90, 162, 255, 0.42); }
.dd-item.rare .name { color: #9fc7ff; }
.dd-item.epic { border-color: rgba(170, 120, 240, 0.45); }
.dd-item.epic .name { color: #cfa4ff; }
.dd-item.legendary { border-color: rgba(255, 200, 90, 0.55); }
.dd-item.legendary .name { color: #ffcf6b; }
.dd-item.equipped { background: rgba(216, 169, 74, 0.1); }

.dd-mini {
  padding: 6px 10px;
  background: rgba(216, 169, 74, 0.16);
  border: 1px solid var(--dd-line);
  border-radius: 4px;
  color: var(--dd-gold);
  font: 700 10px/1 inherit;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}
.dd-mini:hover { background: rgba(216, 169, 74, 0.3); }

.dd-statgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.dd-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 5px;
  font-size: 12px;
}
.dd-stat b { color: var(--dd-gold); font-variant-numeric: tabular-nums; }
.dd-stat .plus {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid var(--dd-line);
  background: rgba(216, 169, 74, 0.16);
  color: var(--dd-gold);
  font: 800 13px/1 inherit;
  cursor: pointer;
}
.dd-stat .plus:disabled { opacity: 0.3; cursor: default; }

.dd-skill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  margin-bottom: 6px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 5px;
}
.dd-skill .info { flex: 1; }
.dd-skill .t { font-weight: 700; font-size: 12.5px; }
.dd-skill .d { font-size: 10.5px; color: var(--dd-text-dim); line-height: 1.3; }
.dd-skill .rank { font-size: 11px; color: var(--dd-gold); font-weight: 800; font-variant-numeric: tabular-nums; }

.dd-keyhint {
  text-align: center;
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.1em;
  margin-top: 14px;
}

/* ------------------------------------------------------------ small screens */

@media (max-width: 620px) {
  .dd-vitals { width: min(210px, 52vw); }
  .dd-minimap { width: 96px; height: 96px; }
  .dd-objective { max-width: 170px; font-size: 10px; }
  .dd-hotbar { bottom: 96px; }
  .dd-slot { width: 44px; height: 44px; }
  .dd-net { bottom: 96px; width: 150px; }
  .dd-panel { padding: 20px 16px 16px; }
}


/* ------------------------------------------------------------- additions */

/* The menu shows the shrine behind it, so it asks for a much lighter wash. */
.dd-overlay.clear {
  background: radial-gradient(circle at 50% 42%, rgba(5, 7, 11, 0.42), rgba(3, 4, 6, 0.88));
}

/* The interaction hint sits just under the crosshair. */
.dd-prompt {
  position: absolute;
  left: 50%;
  top: 58%;
  transform: translateX(-50%);
  padding: 5px 12px;
  background: rgba(8, 10, 14, 0.82);
  border: 1px solid var(--dd-gold-dim);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--dd-gold);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 140ms;
}
.dd-prompt.on { opacity: 1; }

.dd-roomcode {
  font-family: ui-monospace, monospace;
  letter-spacing: 0.28em;
  color: var(--dd-gold);
}

.dd-banner {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-family: ui-serif, Georgia, serif;
  font-size: clamp(22px, 5vw, 40px);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dd-gold);
  text-shadow: 0 0 34px rgba(216, 169, 74, 0.55), 0 3px 12px rgba(0, 0, 0, 0.9);
  opacity: 0;
  pointer-events: none;
}
.dd-banner.show { animation: dd-banner 2.4s ease-out forwards; }
@keyframes dd-banner {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  72% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(1.04); }
}

/* A red edge flash when the player is struck. */
.dd-hurt {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 50%, rgba(180, 30, 20, 0) 45%, rgba(180, 30, 20, 0.62) 100%);
  transition: opacity 220ms ease-out;
}
.dd-hurt.on { opacity: 1; transition: none; }


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

/* The bar duplicates what the action buttons already show, and on a phone it
   would sit exactly where the thumbs live. */
.dd-root.touch .dd-hotbar { display: none; }

/* Above the stick, clear of the thumb's resting place. */
.dd-root.touch .dd-net {
  bottom: 176px;
  left: 18px;
  width: min(210px, 52vw);
}

.dd-root.touch .dd-toasts { top: 26%; }

@media (max-width: 620px) {
  .dd-root.touch .dd-net { bottom: 176px; width: 148px; }
  .dd-root.touch .dd-chatlog { max-height: 66px; font-size: 10.5px; }
}

/* The only way into the pause menu without a keyboard. */
.dd-menu-btn {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(216, 169, 74, 0.35);
  background-color: rgba(10, 12, 17, 0.8);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 46%;
}
.dd-menu-btn:active { transform: translateX(-50%) scale(0.93); }


/* ----------------------------------------------- clickable HUD and roles */

.dd-root .dd-hotbar,
.dd-root .dd-slot { pointer-events: auto; cursor: pointer; }

.dd-roleline {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dd-gold);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  margin-bottom: 2px;
}

.dd-roles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 9px;
}

.dd-role {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 9px;
  text-align: left;
  font: inherit;
  color: var(--dd-text);
  background: linear-gradient(180deg, rgba(30, 30, 36, 0.9), rgba(12, 13, 17, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 120ms, background 120ms;
}
.dd-role:hover { border-color: rgba(216, 169, 74, 0.6); }
.dd-role b {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dd-gold);
}
.dd-role span {
  font-size: 10.5px;
  line-height: 1.35;
  color: var(--dd-text-dim);
}
.dd-role.on {
  border-color: rgba(216, 169, 74, 0.9);
  background: linear-gradient(180deg, rgba(90, 66, 26, 0.6), rgba(30, 22, 10, 0.9));
}

@media (max-width: 620px) {
  .dd-roles { grid-template-columns: 1fr; }
}


/* --------------------------------------------------------- the title screen */

/* The shrine stands in the right of the frame, so the card is pinned to the
   left rather than covering the characters. */
.dd-overlay.clear {
  place-items: center;
  justify-items: start;
  padding-left: clamp(16px, 5vw, 72px);
  padding-right: clamp(16px, 5vw, 72px);
}

@media (max-width: 900px), (max-aspect-ratio: 1/1) {
  .dd-overlay.clear {
    justify-items: center;
    padding-left: 16px;
    padding-right: 16px;
  }
}

.dd-chip.depth { color: #cfa4ff; }

/* The loading card sits in the middle of the screen with a bar that fills. */
.dd-overlay .dd-bar { margin-top: 6px; }


/* --------------------------------------------- the title screen, again */

/* The card has to leave the company visible, so it is narrower than the panel
   used elsewhere and lets the shrine glow through it. */
.dd-overlay.clear .dd-panel {
  width: min(430px, 92vw);
  padding: 20px 20px 16px;
  background: linear-gradient(180deg, rgba(16, 18, 24, 0.88), rgba(6, 7, 10, 0.92));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.62);
}

.dd-overlay.clear {
  background: linear-gradient(180deg, rgba(4, 5, 8, 0.18) 0%, rgba(4, 5, 8, 0.52) 60%, rgba(4, 5, 8, 0.78) 100%);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.dd-overlay.clear .dd-title { font-size: clamp(24px, 5vw, 34px); }
.dd-overlay.clear .dd-sub { margin-top: 4px; font-size: 10.5px; }
.dd-overlay.clear .dd-rule { margin: 12px 0; }
.dd-overlay.clear .dd-field { margin-top: 6px; padding: 9px 12px; }
.dd-overlay.clear .dd-roles { gap: 6px; margin-top: 6px; }
.dd-overlay.clear .dd-role { padding: 7px 9px; gap: 2px; }
.dd-overlay.clear .dd-role b { font-size: 11px; }
.dd-overlay.clear .dd-role span { font-size: 9.5px; line-height: 1.3; }
.dd-overlay.clear .dd-btn { margin-top: 7px; padding: 10px 14px; }
.dd-overlay.clear .dd-btn.primary { padding: 12px 14px; font-size: 13px; }
.dd-overlay.clear .dd-note { font-size: 10.5px; margin-top: 5px; }
.dd-overlay.clear .dd-row { margin-top: 7px; }

/* The browser's own focus ring is blue and loud, and this game is gold. */
.dd-role:focus,
.dd-btn:focus,
.dd-mini:focus,
.dd-tab:focus { outline: none; }

.dd-role:focus-visible,
.dd-btn:focus-visible,
.dd-mini:focus-visible,
.dd-tab:focus-visible {
  outline: 2px solid rgba(216, 169, 74, 0.85);
  outline-offset: 2px;
}

.dd-role.on {
  box-shadow: inset 0 0 22px rgba(216, 169, 74, 0.22), 0 0 0 1px rgba(216, 169, 74, 0.55);
}


/* On a narrow or portrait window the card is anchored to the bottom and made
   compact, so the company standing in the shrine is visible above it. */
@media (max-width: 900px), (max-aspect-ratio: 1/1) {
  .dd-overlay.clear {
    place-items: end center;
    padding-bottom: calc(env(safe-area-inset-bottom) + 10px);
    background: linear-gradient(180deg, rgba(4, 5, 8, 0) 30%, rgba(4, 5, 8, 0.72) 100%);
  }

  .dd-overlay.clear .dd-panel {
    width: min(430px, 94vw);
    max-height: 76vh;
    padding: 14px 14px 12px;
  }

  .dd-overlay.clear .dd-title { font-size: clamp(20px, 5.4vw, 26px); letter-spacing: 0.1em; }
  .dd-overlay.clear .dd-sub { display: none; }
  .dd-overlay.clear .dd-rule { margin: 8px 0; }

  .dd-overlay.clear .dd-roles { grid-template-columns: repeat(4, 1fr); gap: 5px; }
  .dd-overlay.clear .dd-role { padding: 8px 4px; align-items: center; text-align: center; }
  .dd-overlay.clear .dd-role span { display: none; }
  .dd-overlay.clear .dd-role b { font-size: 9.5px; letter-spacing: 0.04em; }

  .dd-overlay.clear .dd-field { padding: 8px 10px; font-size: 15px; }
  .dd-overlay.clear .dd-btn { padding: 9px 12px; font-size: 11.5px; }
  .dd-overlay.clear .dd-btn.primary { padding: 11px 12px; font-size: 12.5px; }
  .dd-overlay.clear .dd-note { font-size: 10px; line-height: 1.4; }
  .dd-overlay.clear .dd-note.controls { display: none; }
}

/* The selected card's blurb has to stay readable on the gold fill. */
.dd-role.on span { color: #f2e4c6; }
