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

:root {
  --bg: #111815;
  --bg-panel: #161f1b;
  --border: #3a4e44;
  --text: #e0ead8;
  --text-dim: #c0d4b8;
  --text-muted: #a0b898;
  --accent: #88cc88;
  --accent-dim: #7aba7a;
  --warn: #d8b880;
  --error: #d88888;
  --cell-id: #70d0d0;
  --prompt-color: #88cc88;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  font-size: 15px;
  line-height: 1.6;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
#header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0 8px;
  flex-shrink: 0;
}

#location-info {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 0;
  padding: 5px 0 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-width: 0;
  overflow: hidden;
}

.bc-sep {
  color: var(--text-muted);
  flex-shrink: 0;
  white-space: nowrap;
  padding: 0 2px;
}

.bc-province {
  color: var(--text);
  flex-shrink: 0;
  white-space: nowrap;
}

.bc-terrain {
  color: var(--text-dim);
  flex-shrink: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.bc-settlement {
  color: var(--accent-dim);
  flex-shrink: 0;
  white-space: nowrap;
}

#worlds-link {
  background: transparent;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.15em;
  padding: 0;
  text-transform: uppercase;
  flex-shrink: 0;
  opacity: 0.85;
  transition: opacity 0.15s;
}

#worlds-link:hover {
  opacity: 1;
}


/* Output log */
#output {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 0 72px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.entry {
  margin-bottom: 22px;
  animation: fadeIn 0.2s ease;
}

.entry[data-group-id] {
  border-left: 2px solid var(--accent-dim);
  padding-left: 10px;
  margin-bottom: 0;
  padding-bottom: 22px;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.entry-command {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 6px;
  cursor: pointer;
  user-select: none;
}

.entry-command:hover {
  color: var(--text);
  background: rgba(136, 204, 136, 0.05);
  border-radius: 2px;
  padding-left: 4px;
  margin-left: -4px;
}

.entry-command:hover::after {
  content: ' ↵';
  color: var(--text-muted);
  font-size: 11px;
}

.entry-command::before {
  content: '> ';
  color: var(--prompt-color);
}

.entry-revisit {
  color: var(--text-dim);
  font-style: italic;
  font-size: 13px;
  margin-bottom: 6px;
}

.entry-body {
  color: var(--text);
  white-space: pre-wrap;
}

.entry-meta {
  font-size: 15px;
  color: var(--text-muted);
  margin-top: 8px;
}

.entry-knowledge {
  font-size: 12px;
  color: var(--accent-dim);
  opacity: 0.8;
  margin-top: 8px;
}
.entry-knowledge::before {
  content: '◈ ';
  font-size: 13px;
  opacity: 0.7;
}


.entry-label {
  display: inline-block;
  color: var(--accent-dim);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  margin-bottom: 6px;
}

.entry-error .entry-body {
  color: var(--error);
}

.entry-warn .entry-body {
  color: var(--warn);
}

.entry-system .entry-body {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.9em;
}

.entry-system .entry-body i.ph,
.entry-system .entry-body i[class^="ph-"],
.entry-system .entry-body i[class*=" ph-"] {
  font-style: normal;
  vertical-align: -0.2em;
}

.readable-lang {
  font-style: italic;
  margin-bottom: 8px;
  opacity: 0.7;
}

.readable-body {
  font-style: normal;
  white-space: normal;
}

.readable-body h1,
.readable-body h2,
.readable-body h3 {
  font-size: 1em;
  font-weight: bold;
  margin: 8px 0 4px;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
}

.readable-body p {
  margin: 4px 0;
}

.readable-body ul,
.readable-body ol {
  margin: 10px 0 4px;
  padding-left: 0;
  list-style-position: inside;
}

.readable-body li {
  text-indent: -1.5em;
  padding-left: 1.5em;
  margin: 2px 0;
}

.readable-body strong {
  color: var(--text);
}

.readable-body em {
  font-style: italic;
}

.readable-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 8px 0;
}

.entry-world .entry-label {
  color: var(--warn);
}

.entry-dialogue .entry-label {
  color: var(--accent-dim);
}

.entry-dialogue .entry-body {
  font-style: italic;
}

.entry-dream .entry-label {
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

.entry-dream .entry-body {
  font-style: italic;
  color: var(--text-dim);
  opacity: 0.88;
  letter-spacing: 0.01em;
}

.entry-prose_entry .entry-body {
  color: var(--text);
}

.loading-indicator {
  color: var(--text-dim);
  font-size: 13px;
  padding: 8px 0 2px;
  animation: blink 1s step-end infinite;
}

.loading-forming {
  color: var(--text-dim);
  font-size: 12px;
  padding: 0 0 8px;
  opacity: 0.6;
  font-style: italic;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ── Explorer loading effects — genre-themed replacements for the blink ────── */

/* Fantasy group: warm amber ember-pulse */
.loading-indicator.loading-effect-fantasy {
  color: rgba(210, 165, 75, 0.9);
  animation: loadingFantasy 3s ease-in-out infinite;
}

@keyframes loadingFantasy {
  0%, 100% { opacity: 0.9;  text-shadow: 0 0 5px rgba(220, 165, 60, 0.25); }
  50%       { opacity: 0.62; text-shadow: 0 0 12px rgba(235, 180, 70, 0.55), 0 0 24px rgba(200, 140, 40, 0.2); }
}

/* Comic Fantasy: warm tones, per-character antics via JS WAAPI — no CSS blink */
.loading-indicator.loading-effect-comicfantasy {
  color: rgba(210, 165, 75, 0.9);
  animation: none;
}

.loading-indicator.loading-effect-comicfantasy .loading-char {
  display: inline-block;
}

/* Dream Fantasy: slow ethereal drift through lavender, rose, and misty blue */
.loading-indicator.loading-effect-dreamfantasy {
  animation: loadingDreamfantasy 9s ease-in-out infinite;
}

@keyframes loadingDreamfantasy {
  0%   { opacity: 0.86; color: rgba(180, 150, 220, 0.88); text-shadow: 0 0 12px rgba(175, 138, 232, 0.4);  filter: blur(0.3px); }
  25%  { opacity: 0.78; color: rgba(215, 148, 188, 0.85); text-shadow: 0 0 16px rgba(222, 138, 195, 0.35); filter: blur(0.8px); }
  50%  { opacity: 0.88; color: rgba(148, 172, 228, 0.86); text-shadow: 0 0 14px rgba(140, 165, 238, 0.45); filter: blur(0.2px); }
  75%  { opacity: 0.76; color: rgba(205, 148, 215, 0.85); text-shadow: 0 0 18px rgba(198, 138, 228, 0.38); filter: blur(0.8px); }
  100% { opacity: 0.86; color: rgba(180, 150, 220, 0.88); text-shadow: 0 0 12px rgba(175, 138, 232, 0.4);  filter: blur(0.3px); }
}

/* Steampunk: copper-brass with rhythmic piston double-pulse + steam vent */
.loading-indicator.loading-effect-steampunk {
  color: rgba(190, 135, 55, 0.92);
  animation: loadingSteampunk 4s linear infinite;
}

@keyframes loadingSteampunk {
  /* piston 1 */
  0%   { opacity: 0.82; text-shadow: 0 0 5px rgba(205, 148, 58, 0.32); }
  7%   { opacity: 0.96; text-shadow: 0 0 14px rgba(220, 162, 65, 0.72), 0 0 28px rgba(200, 135, 48, 0.3); }
  13%  { opacity: 0.80; text-shadow: 0 0 4px rgba(200, 140, 55, 0.25); }
  /* piston 2 */
  21%  { opacity: 0.96; text-shadow: 0 0 14px rgba(220, 162, 65, 0.72), 0 0 28px rgba(200, 135, 48, 0.3); }
  27%  { opacity: 0.80; text-shadow: 0 0 4px rgba(200, 140, 55, 0.25); }
  /* pressure build → steam vent */
  38%  { opacity: 0.70; text-shadow: 0 0 2px rgba(185, 128, 45, 0.15); }
  50%  { opacity: 0.58; text-shadow: none; }
  60%  { opacity: 0.84; text-shadow: 0 0 6px rgba(208, 150, 60, 0.4); }
  /* piston 3 */
  68%  { opacity: 0.96; text-shadow: 0 0 14px rgba(220, 162, 65, 0.72), 0 0 28px rgba(200, 135, 48, 0.3); }
  74%  { opacity: 0.80; text-shadow: 0 0 4px rgba(200, 140, 55, 0.25); }
  /* piston 4 */
  82%  { opacity: 0.96; text-shadow: 0 0 14px rgba(220, 162, 65, 0.72), 0 0 28px rgba(200, 135, 48, 0.3); }
  88%  { opacity: 0.80; text-shadow: 0 0 4px rgba(200, 140, 55, 0.25); }
  100% { opacity: 0.82; text-shadow: 0 0 5px rgba(205, 148, 58, 0.32); }
}

/* Gaslamp Fantasy: orange-warm flame with irregular organic flicker */
.loading-indicator.loading-effect-gaslamp {
  color: rgba(220, 145, 50, 0.92);
  animation: loadingGaslamp 5s linear infinite;
}

@keyframes loadingGaslamp {
  0%   { opacity: 0.88; text-shadow: 0 0 8px rgba(230, 155, 45, 0.5); }
  7%   { opacity: 0.60; text-shadow: 0 0 3px rgba(200, 120, 30, 0.2); }
  10%  { opacity: 0.90; text-shadow: 0 0 12px rgba(240, 165, 50, 0.6); }
  30%  { opacity: 0.84; text-shadow: 0 0 6px rgba(225, 148, 42, 0.38); }
  48%  { opacity: 0.64; text-shadow: 0 0 3px rgba(200, 120, 28, 0.18); }
  52%  { opacity: 0.55; text-shadow: none; }
  56%  { opacity: 0.88; text-shadow: 0 0 10px rgba(235, 160, 48, 0.55); }
  74%  { opacity: 0.82; text-shadow: 0 0 5px rgba(220, 145, 40, 0.32); }
  88%  { opacity: 0.58; text-shadow: none; }
  91%  { opacity: 0.90; text-shadow: 0 0 8px rgba(230, 155, 45, 0.5); }
  100% { opacity: 0.88; text-shadow: 0 0 8px rgba(230, 155, 45, 0.5); }
}

/* Sci-fi group: cyan data-scan flicker */
.loading-indicator.loading-effect-scifi {
  color: rgba(70, 200, 230, 0.9);
  animation: loadingScifi 1.1s linear infinite;
}

/* Comic Sci-fi: cyan + whole-element electric zap jitter (cross-pollinates comicZap) */
.loading-indicator.loading-effect-comicscifi {
  color: rgba(70, 200, 230, 0.9);
  animation: loadingComicscifiJitter 1.1s steps(1) infinite, loadingComicscifiGlow 2.5s ease-in-out infinite;
}

@keyframes loadingComicscifiJitter {
  0%   { transform: translateX(0px)  translateY(0px); }
  14%  { transform: translateX(2px)  translateY(-1px); }
  28%  { transform: translateX(-2px) translateY(1px); }
  42%  { transform: translateX(1px)  translateY(0px); }
  57%  { transform: translateX(0px)  translateY(-1px); }
  71%  { transform: translateX(-1px) translateY(0px); }
  85%  { transform: translateX(2px)  translateY(1px); }
  100% { transform: translateX(0px)  translateY(0px); }
}

@keyframes loadingComicscifiGlow {
  0%, 100% { opacity: 0.88; text-shadow: 0 0 6px rgba(70, 200, 230, 0.5); }
  50%       { opacity: 0.80; text-shadow: 0 0 14px rgba(70, 215, 245, 0.72); }
}

@keyframes loadingScifi {
  0%, 100% { opacity: 0.9;  text-shadow: 0 0 6px rgba(70, 200, 230, 0.45); }
  18%       { opacity: 0.45; text-shadow: none; }
  30%       { opacity: 0.88; text-shadow: 0 0 14px rgba(70, 200, 230, 0.75); }
  55%       { opacity: 0.4;  text-shadow: none; }
  70%       { opacity: 0.9;  text-shadow: 0 0 6px rgba(70, 200, 230, 0.45); }
}

/* Crossover group: colour-shifts between amber and cyan */
.loading-indicator.loading-effect-crossover {
  animation: loadingCrossover 5s ease-in-out infinite;
}

/* Weird West: sun-baked dusty gold with dust-cloud dips and heat-shimmer */
.loading-indicator.loading-effect-weirdwest {
  color: rgba(200, 162, 80, 0.90);
  animation: loadingWeirdwest 6s linear infinite;
}

@keyframes loadingWeirdwest {
  0%   { opacity: 0.86; letter-spacing: 0px;     filter: blur(0.2px); text-shadow: 0 0 5px rgba(210, 165, 52, 0.28); }
  18%  { opacity: 0.62; letter-spacing: 0.6px;   filter: blur(0.5px); text-shadow: none; }
  30%  { opacity: 0.88; letter-spacing: -0.2px;  filter: blur(0.2px); text-shadow: 0 0 8px rgba(215, 170, 55, 0.38); }
  55%  { opacity: 0.82; letter-spacing: 0.4px;   filter: blur(0.3px); text-shadow: 0 0 4px rgba(210, 162, 50, 0.22); }
  70%  { opacity: 0.62; letter-spacing: 0.7px;   filter: blur(0.5px); text-shadow: none; }
  82%  { opacity: 0.88; letter-spacing: 0px;     filter: blur(0.2px); text-shadow: 0 0 6px rgba(212, 167, 53, 0.32); }
  100% { opacity: 0.86; letter-spacing: 0px;     filter: blur(0.2px); text-shadow: 0 0 5px rgba(210, 165, 52, 0.28); }
}

@keyframes loadingCrossover {
  0%, 100% { opacity: 0.88; color: rgba(210, 165, 75, 0.9);  text-shadow: 0 0 5px rgba(220, 165, 60, 0.25); }
  45%       { opacity: 0.55; color: rgba(130, 195, 220, 0.85); text-shadow: none; }
  50%       { opacity: 0.82; color: rgba(70, 200, 230, 0.9);  text-shadow: 0 0 10px rgba(70, 200, 230, 0.4); }
  95%       { opacity: 0.55; color: rgba(155, 180, 165, 0.8);  text-shadow: none; }
}

/* Cosmic Horror: sickly green with rare vivid corruption flash */
.loading-indicator.loading-effect-cosmichorror {
  color: rgba(50, 185, 70, 0.85);
  animation: loadingCosmic 7s linear infinite;
}

@keyframes loadingCosmic {
  0%   { opacity: 0.72; text-shadow: 0 0 3px rgba(40, 230, 10, 0.12); }
  20%  { opacity: 0.5;  text-shadow: none; }
  38%  { opacity: 0.78; text-shadow: 0 0 5px rgba(40, 230, 10, 0.18); }
  55%  { opacity: 0.5;  text-shadow: none; }
  70%  { opacity: 0.68; text-shadow: 0 0 4px rgba(40, 230, 10, 0.12); }
  74%  { opacity: 0.65; text-shadow: 0 0 4px rgba(40, 230, 10, 0.12); }
  76%  { opacity: 1;    text-shadow: 0 0 20px rgba(40, 255, 10, 0.95), 0 0 40px rgba(40, 255, 10, 0.35); }
  79%  { opacity: 0.5;  text-shadow: none; }
  85%  { opacity: 0.75; text-shadow: 0 0 3px rgba(40, 230, 10, 0.12); }
  100% { opacity: 0.72; text-shadow: 0 0 3px rgba(40, 230, 10, 0.12); }
}

/* Gothic Horror: vivid arterial red with irregular blood-drip text-shadow */
.loading-indicator.loading-effect-gothichorror {
  color: rgba(228, 72, 72, 0.96);
  animation: loadingGothic 7s linear infinite;
}

@keyframes loadingGothic {
  0%   { opacity: 0.88; text-shadow: 0 0 5px rgba(180, 0, 0, 0.25); }
  12%  { opacity: 0.58; text-shadow: 0 0 2px rgba(140, 0, 0, 0.1); }
  28%  { opacity: 0.95; text-shadow: 0 4px 12px rgba(215, 0, 0, 0.9), 0 8px 22px rgba(160, 0, 0, 0.4); }
  42%  { opacity: 0.65; text-shadow: 0 1px 5px rgba(175, 0, 0, 0.3); }
  58%  { opacity: 0.55; text-shadow: 0 0 2px rgba(130, 0, 0, 0.1); }
  72%  { opacity: 0.97; text-shadow: 0 5px 15px rgba(220, 0, 0, 0.95), 0 10px 28px rgba(170, 0, 0, 0.45); }
  82%  { opacity: 0.65; text-shadow: 0 2px 6px rgba(175, 0, 0, 0.28); }
  100% { opacity: 0.88; text-shadow: 0 0 5px rgba(180, 0, 0, 0.25); }
}

/* Cyberpunk: cyan base with periodic magenta/cyan chroma-split glitch bursts */
.loading-indicator.loading-effect-cyberpunk {
  color: rgba(70, 220, 255, 0.95);
  animation: loadingCyberpunk 3.5s linear infinite;
}

@keyframes loadingCyberpunk {
  0%   { opacity: 0.88; text-shadow: 0 0 5px rgba(70, 220, 255, 0.3); }
  10%  { opacity: 0.48; text-shadow: none; }
  22%  { opacity: 0.88; text-shadow: 0 0 9px rgba(70, 220, 255, 0.5); }
  36%  { opacity: 0.45; text-shadow: none; }
  /* first chroma burst */
  54%  { opacity: 0.88; text-shadow: 0 0 5px rgba(70, 220, 255, 0.3); }
  56%  { opacity: 1;    text-shadow: -7px 0 rgba(255, 0, 200, 0.92),  7px 0 rgba(0, 255, 215, 0.92); }
  58%  { opacity: 1;    text-shadow:  5px 0 rgba(255, 0, 200, 0.75), -5px 0 rgba(0, 255, 215, 0.75); }
  60%  { opacity: 1;    text-shadow: -3px 0 rgba(255, 0, 200, 0.5),   3px 0 rgba(0, 255, 215, 0.5); }
  62%  { opacity: 0.88; text-shadow: 0 0 5px rgba(70, 220, 255, 0.3); }
  72%  { opacity: 0.48; text-shadow: none; }
  78%  { opacity: 0.88; text-shadow: 0 0 5px rgba(70, 220, 255, 0.3); }
  /* second chroma burst — wider split, faster decay */
  87%  { opacity: 0.88; text-shadow: 0 0 5px rgba(70, 220, 255, 0.3); }
  88%  { opacity: 1;    text-shadow: -9px 0 rgba(255, 0, 200, 0.95),  9px 0 rgba(0, 255, 215, 0.95); }
  89%  { opacity: 1;    text-shadow:  6px 0 rgba(255, 0, 200, 0.8),  -6px 0 rgba(0, 255, 215, 0.8); }
  90%  { opacity: 0.88; text-shadow: none; }
  91%  { opacity: 0.88; text-shadow: -4px 0 rgba(255, 0, 200, 0.6),   4px 0 rgba(0, 255, 215, 0.6); }
  93%  { opacity: 0.88; text-shadow: 0 0 5px rgba(70, 220, 255, 0.3); }
  100% { opacity: 0.88; text-shadow: 0 0 5px rgba(70, 220, 255, 0.3); }
}

/* Input bar */
#input-bar {
  display: flex;
  align-items: center;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: 10px 16px 12px;
  margin: 0 -16px;
  flex-shrink: 0;
  gap: 8px;
}

#input-prompt {
  color: var(--prompt-color);
  font-size: 14px;
  flex-shrink: 0;
}

#command-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  caret-color: var(--accent);
}

#command-input::placeholder {
  color: var(--text-dim);
}

#command-input:disabled {
  opacity: 0.4;
}

#command-submit {
  background: none;
  border: none;
  color: var(--prompt-color);
  cursor: pointer;
  padding: 0 2px;
  font-size: 17px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  touch-action: manipulation;
  user-select: none;
  opacity: 0.85;
}

#command-submit:hover {
  opacity: 1;
}

#command-submit:active {
  opacity: 1;
}

/* Help panel */
#help-bar {
  display: flex;
  gap: 0;
  align-items: stretch;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 6px 6px;
  padding: 8px 16px 10px;
  margin: 0 -16px;
  flex-shrink: 0;
}

#help-bar-buttons {
  flex: 1;
  min-height: 56px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: center;
  gap: 12px;
  padding-right: 8px;
}

/* Hex compass column */
#hex-compass-col {
  flex-shrink: 0;
  align-self: stretch;
  display: flex;
  align-items: center;
}

#hex-compass {
  display: block;
  height: 100%;
  width: auto;
  min-height: 56px;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 600px) {
  #help-bar-buttons {
    min-height: 84px;
  }
  #hex-compass {
    min-height: 84px;
  }
}

.dir-sector {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.dir-sector:focus-visible polygon {
  fill: color-mix(in srgb, var(--accent) 16%, transparent);
}

.dir-sector:focus-visible text {
  fill: var(--accent);
}

.dir-sector polygon {
  fill: transparent;
  transition: fill 100ms;
}

.dir-sector text {
  fill: var(--accent-dim);
  font-size: 9px;
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  pointer-events: none;
  user-select: none;
  transition: fill 100ms;
}

.dir-sector.has-road polygon {
  fill: color-mix(in srgb, var(--accent) 7%, transparent);
}

.dir-sector.has-road text {
  fill: var(--accent);
}

.dir-sector:hover polygon {
  fill: color-mix(in srgb, var(--accent) 16%, transparent);
}

.dir-sector:hover text {
  fill: var(--accent);
}

.dir-sector:active polygon {
  fill: color-mix(in srgb, var(--accent) 35%, transparent);
  transition: none;
}

.dir-sector:active text {
  fill: var(--accent);
  transition: none;
}

.dir-sector.armed polygon {
  fill: color-mix(in srgb, var(--accent) 12%, transparent);
}

.dir-sector.armed text {
  fill: var(--accent);
}

#hex-count-display {
  fill: var(--bg-panel);
  font-size: 9px;
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  font-weight: bold;
}

.hex-sep {
  stroke: var(--border);
  stroke-width: 0.5;
  pointer-events: none;
}

.hex-outline {
  fill: none;
  stroke: var(--accent);
  stroke-width: 0.8;
  stroke-dasharray: 3,2;
  stroke-opacity: 0.5;
  pointer-events: none;
}

.hex-center {
  fill: var(--accent);
  fill-opacity: 0.5;
  pointer-events: none;
}

.hint-btn {
  background: none;
  border: 1px dotted var(--accent);
  border-radius: 4px;
  color: var(--accent-dim);
  font-family: inherit;
  font-size: 12px;
  padding: 2px 8px;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

.hint-btn:hover {
  background: var(--bg);
  color: var(--accent);
  border-color: var(--accent);
}

.hint-btn:active {
  background: var(--border);
}

/* Minimap */
.entry-map .entry-body {
  white-space: pre;
  font-style: normal;
  color: var(--text-dim);
  overflow-x: auto;
}

.map-current { color: var(--accent); }
.map-visited { color: var(--cell-id); }
.map-unknown { color: var(--text-dim); }

/* Phosphor icon font baseline */
i.ph, i[class^="ph-"], i[class*=" ph-"] {
  font-size: 1em;
  vertical-align: -0.125em;
  flex-shrink: 0;
}

/* Icons in console output lists (Present:, Items:, etc.) */
#output i.ph,
#output i[class^="ph-"],
#output i[class*=" ph-"] {
  margin-right: 0.35em;
}

/* World selection screen */
#world-select {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 16px;
}

#world-select::after {
  content: '';
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: linear-gradient(to bottom, transparent, #111815);
  pointer-events: none;
  z-index: 1;
  opacity: 1;
  transition: opacity 0.3s ease;
}

#world-select.ws-scroll-end::after {
  opacity: 0;
}

#ws-header {
  padding: 10px 0 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#ws-title {
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

#ws-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  padding: 32px 0;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}

@media (max-height: 500px) {
  #ws-body {
    padding: 12px 0;
    gap: 8px;
  }
}

#ws-worlds {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ws-loading,
.ws-empty {
  color: var(--text-dim);
  font-style: italic;
  font-size: 13px;
  padding: 8px 0;
}

.ws-error {
  color: var(--error);
  font-size: 13px;
  padding: 8px 0;
}

.ws-world-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  animation: fadeIn 0.2s ease;
}

.ws-world-item:hover {
  border-color: var(--accent-dim);
  background: var(--bg-panel);
}

.ws-world-active {
  border-color: var(--accent-dim);
}

.ws-world-name {
  color: var(--text);
  font-size: 14px;
}

.ws-world-genre {
  color: var(--text-dim);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-world-meta {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.ws-world-generating {
  border-color: var(--accent-dim);
  opacity: 0.85;
  cursor: default;
}

.ws-world-generating:hover {
  background: transparent;
}

.ws-world-item-row {
  display: grid;
  grid-template-columns: 1fr minmax(0, 100px) 28px;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.ws-info-btn-placeholder {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.ws-info-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: normal;
  line-height: 1;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.ws-info-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.ws-info-popup {
  position: fixed;
  z-index: 9999;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 12px 14px;
  min-width: 200px;
  max-width: 300px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  font-size: 12px;
  display: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.ws-info-popup--visible {
  opacity: 1;
  transform: translateY(0);
}

.ws-info-popup-name {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  word-break: break-word;
  margin-bottom: 2px;
  padding-right: 28px;
}

.ws-info-popup-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}

.ws-info-popup-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.ws-info-popup-genre {
  color: var(--accent-dim);
  font-size: 11px;
  margin-bottom: 8px;
}

.ws-info-popup-divider {
  border-top: 1px solid var(--border);
  margin: 8px 0;
}

.ws-info-popup-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-dim);
  line-height: 1.7;
}

.ws-info-popup-label {
  color: var(--text-muted);
  flex-shrink: 0;
}

.ws-info-popup-desc {
  color: var(--text-dim);
  font-size: 11px;
  margin-top: 8px;
  line-height: 1.5;
  border-top: 1px solid var(--border);
  padding-top: 8px;
  max-height: min(200px, 30vh);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ws-info-popup-loading {
  color: var(--text-muted);
  font-style: italic;
}

.ws-forming-name {
  flex: 1;
  min-width: 0;
  overflow-x: clip;
  overflow-y: visible;
  white-space: nowrap;
}

.ws-forming-name[data-effect="fantasy"] {
  filter: blur(2.5px);
  opacity: 0.55;
  animation: formingShimmer 3.5s ease-in-out infinite;
}

.ws-forming-char {
  transition: opacity 0.35s ease;
}

.ws-forming-glitch {
  filter: blur(0px) !important;
  color: var(--accent);
  text-shadow: -4px 0 rgba(255, 0, 80, 0.8), 4px 0 rgba(0, 220, 255, 0.8) !important;
}

.ws-forming-name[data-effect="scifi"] {
  filter: blur(0.5px);
  opacity: 0.55;
  font-family: monospace;
  animation: formingShimmer 0.7s linear infinite, chromaShift 5s ease-in-out infinite;
}

@keyframes chromaShift {
  0%, 78%, 100% { text-shadow: none; }
  80%  { text-shadow: -4px 0 rgba(255, 0, 80, 0.85), 4px 0 rgba(0, 220, 255, 0.85); }
  83%  { text-shadow:  3px 0 rgba(255, 0, 80, 0.65), -3px 0 rgba(0, 220, 255, 0.65); }
  86%  { text-shadow: -2px 0 rgba(255, 0, 80, 0.4),   2px 0 rgba(0, 220, 255, 0.4); }
  89%  { text-shadow: none; }
  91%  { text-shadow: -3px 0 rgba(255, 0, 80, 0.55),  3px 0 rgba(0, 220, 255, 0.55); }
  94%  { text-shadow: none; }
}

.ws-forming-name[data-effect="crossover"] {
  filter: blur(1px);
  opacity: 0.55;
  animation: formingShimmer 1.3s ease-in-out infinite;
}

/* ── Genre-specific effect overrides ────────────────────────────────────── */

.ws-forming-name[data-effect="cosmichorror"] {
  filter: blur(3px);
  opacity: 0.48;
  animation: formingShimmer 6s ease-in-out infinite, cosmicWrong 9s ease-in-out infinite;
}

@keyframes cosmicWrong {
  0%, 100% { text-shadow: 0 0 6px rgba(80, 220, 60, 0.12); }
  20%       { text-shadow: 0 0 14px rgba(80, 220, 60, 0.45), 0 0 30px rgba(50, 180, 30, 0.08); }
  55%       { text-shadow: 0 0 2px rgba(80, 220, 60, 0.06), 1px 0 rgba(100, 255, 50, 0.1); }
  75%       { text-shadow: 0 0 20px rgba(40, 255, 10, 0.95), 0 0 45px rgba(60, 255, 20, 0.35), -1px 1px rgba(120, 255, 60, 0.4); }
}

.ws-forming-name[data-effect="comicfantasy"] {
  opacity: 0.58;
  animation: formingShimmer 1.8s ease-in-out infinite;
}

/* inline-block required for transform to work on individual characters */
.ws-forming-name[data-effect="comicfantasy"] .ws-forming-char {
  display: inline-block;
}


.ws-forming-name[data-effect="cyberpunk"] {
  filter: blur(0.3px);
  opacity: 0.62;
  font-family: monospace;
  animation: formingShimmer 0.4s linear infinite, cyberpunkChroma 2.5s ease-in-out infinite;
}

@keyframes cyberpunkChroma {
  0%, 60%, 100% { text-shadow: none; }
  62%  { text-shadow: -7px 0 rgba(255, 0, 200, 0.9),  7px 0 rgba(0, 255, 210, 0.9); }
  65%  { text-shadow:  6px 0 rgba(255, 0, 200, 0.7), -6px 0 rgba(0, 255, 210, 0.7); }
  68%  { text-shadow: -4px 0 rgba(255, 0, 200, 0.5),  4px 0 rgba(0, 255, 210, 0.5); }
  71%  { text-shadow: none; }
  73%  { text-shadow: -9px 0 rgba(255, 0, 200, 0.8),  9px 0 rgba(0, 255, 210, 0.8); }
  76%  { text-shadow: none; }
  78%  { text-shadow: -5px 0 rgba(255, 0, 200, 0.6),  5px 0 rgba(0, 255, 210, 0.6); }
  81%  { text-shadow: none; }
}

.ws-forming-name[data-effect="comicscifi"] {
  filter: blur(0.6px);
  opacity: 0.58;
  font-family: monospace;
  animation: formingShimmer 0.25s linear infinite, comicZap 0.9s steps(1) infinite;
}

@keyframes comicZap {
  0%  { transform: translateX(0px)  translateY(0px); }
  11% { transform: translateX(3px)  translateY(-1px); }
  22% { transform: translateX(-2px) translateY(1px); }
  33% { transform: translateX(1px)  translateY(0px); }
  44% { transform: translateX(0px)  translateY(-2px); }
  55% { transform: translateX(-3px) translateY(0px); }
  66% { transform: translateX(2px)  translateY(1px); }
  77% { transform: translateX(0px)  translateY(0px); }
}

.ws-forming-name[data-effect="weirdwest"] {
  filter: blur(1.8px);
  opacity: 0.48;
  animation: formingShimmer 3s ease-in-out infinite, dustDrift 10s ease-in-out infinite;
}

@keyframes dustDrift {
  0%, 100% { letter-spacing: 0px;    }
  30%       { letter-spacing: 1.5px; }
  60%       { letter-spacing: -0.5px;}
  80%       { letter-spacing: 0.5px; }
}

.ws-forming-name[data-effect="gothichorror"] {
  filter: blur(2px);
  opacity: 0.50;
  animation: formingShimmer 4.5s ease-in-out infinite, gothicDrip 7s ease-in-out infinite;
}

@keyframes gothicDrip {
  0%, 100% { text-shadow: 0 0 6px rgba(180, 0, 0, 0.4); }
  30%       { text-shadow: 0 2px 10px rgba(210, 0, 0, 0.9), 0 5px 22px rgba(160, 0, 0, 0.35); }
  60%       { text-shadow: 0 0 4px rgba(160, 0, 0, 0.25); }
  75%       { text-shadow: 0 3px 14px rgba(220, 0, 0, 1.0), 0 6px 30px rgba(180, 0, 0, 0.45); }
}

.ws-forming-name[data-effect="steampunk"] {
  filter: blur(0.3px);
  opacity: 0.58;
  animation: formingShimmer 2.2s ease-in-out infinite;
}

/* inline-block required for transform to work on individual characters */
.ws-forming-name[data-effect="steampunk"] .ws-forming-char {
  display: inline-block;
}


.ws-forming-name[data-effect="dreamfantasy"] {
  filter: blur(1.2px);
  opacity: 0.45;
  animation: formingShimmer 5s ease-in-out infinite, dreamShift 9s ease-in-out infinite;
}

@keyframes dreamShift {
  0%, 100% { text-shadow: none; }
  25%       { text-shadow: 0 0 8px rgba(150, 100, 255, 0.3), 0 0 20px rgba(100, 150, 255, 0.15); }
  60%       { text-shadow: 0 0 12px rgba(200, 150, 255, 0.2); }
  80%       { text-shadow: 0 0 6px rgba(120, 180, 255, 0.4), 0 0 15px rgba(150, 100, 255, 0.2); }
}

.ws-forming-name[data-effect="gaslamp"] {
  filter: blur(0.6px);
  opacity: 0.52;
  animation: formingShimmer 4s ease-in-out infinite, gaslampGlow 6.5s ease-in-out infinite;
}

@keyframes gaslampGlow {
  0%, 100% { text-shadow: 0 0 6px rgba(220, 160, 40, 0.3); }
  25%       { text-shadow: 0 0 16px rgba(240, 180, 60, 0.7), 0 0 30px rgba(200, 130, 20, 0.3); }
  55%       { text-shadow: 0 0 4px rgba(200, 140, 20, 0.2); }
  78%       { text-shadow: 0 0 20px rgba(250, 190, 70, 0.8), 0 0 40px rgba(210, 150, 30, 0.4); }
}

@keyframes formingShimmer {
  0%, 100% { opacity: 0.40; }
  50%       { opacity: 0.68; }
}

.ws-forming-date {
  opacity: 0.45;
}

.ws-forming-name.ws-forming-resolved {
  filter: none !important;
  opacity: 1 !important;
  animation: none !important;
  font-size: 14px;
  transition: filter 0.5s ease, opacity 0.5s ease, font-size 0.5s ease;
}

.ws-world-progress {
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  overflow: hidden;
}

.ws-world-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-dim);
  border-radius: 1px;
  transition: width 1.5s ease;
}

.ws-world-phase-caption {
  color: var(--text-dim);
  font-size: 11px;
  font-style: italic;
  width: 100%;
}

.ws-world-failed {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  opacity: 0.6;
  cursor: default;
}

.ws-world-failed:hover {
  background: transparent;
}

.ws-delete-btn {
  background: transparent;
  border: 1px solid var(--error);
  border-radius: 3px;
  color: var(--error);
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  padding: 2px 8px;
  transition: opacity 0.15s;
}

.ws-delete-btn:hover {
  opacity: 0.7;
}

#ws-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

#ws-create-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  padding: 8px 14px;
  transition: border-color 0.15s, color 0.15s;
}

#ws-create-btn:hover:not(:disabled) {
  border-color: var(--accent-dim);
  color: var(--accent);
}

#ws-create-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#ws-status {
  font-size: 13px;
  color: var(--text-dim);
  font-style: italic;
  min-height: 1.4em;
}

/* Genre picker modal */
#genre-modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 21, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#genre-modal-box {
  width: min(480px, 100vw - 32px);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  max-height: min(600px, 90vh);
}

#genre-modal-header {
  padding: 14px 18px 10px;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#genre-modal-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  color: var(--prompt-color);
  font-size: 13px;
}

#genre-search {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  caret-color: var(--accent);
}

#genre-search::placeholder {
  color: var(--text-muted);
}

#genre-list-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.genre-category-header {
  padding: 10px 18px 4px;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.genre-item {
  padding: 7px 18px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.1s, background 0.1s;
}

.genre-item:hover {
  color: var(--text);
  background: rgba(136, 204, 136, 0.04);
}

.genre-item.genre-selected {
  color: var(--accent);
}

.genre-no-match {
  padding: 12px 18px;
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

#genre-modal-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

#genre-cancel-btn,
#genre-confirm-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  padding: 7px 14px;
  transition: border-color 0.15s, color 0.15s;
}

#genre-cancel-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

#genre-confirm-btn:hover:not(:disabled) {
  border-color: var(--accent-dim);
  color: var(--accent);
}

#genre-confirm-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Scrollbar */
#output::-webkit-scrollbar {
  width: 4px;
}
#output::-webkit-scrollbar-track {
  background: var(--bg);
}
#output::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* ── Auth screen ──────────────────────────────────────────────────────────── */
#auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  height: 100dvh;
}

#auth-box {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 340px;
  padding: 32px 24px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
}

#auth-title {
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

#auth-tabs {
  display: flex;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.auth-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}

.auth-tab-active {
  color: var(--accent);
}

#auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#auth-email, #auth-password {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 8px 10px;
  outline: none;
}

#auth-password-wrap {
  position: relative;
}

#auth-password-wrap #auth-password {
  width: 100%;
  box-sizing: border-box;
  padding-right: 34px;
}

#auth-password-toggle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 34px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  padding: 0;
}

#auth-password-toggle:hover {
  color: var(--text);
}

#auth-email:focus, #auth-password:focus {
  border-color: var(--accent);
}

#auth-submit {
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 0;
  cursor: pointer;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

#auth-submit:hover {
  background: rgba(136, 204, 136, 0.08);
}

#auth-error {
  color: var(--error);
  font-size: 12px;
  min-height: 16px;
}

#ws-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Site menu (shared hamburger, fixed top-right) ─────────── */
#site-menu {
  position: fixed;
  top: 10px;
  right: max(12px, calc(50vw - 418px));
  z-index: 200;
}

.menu-trigger {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

.menu-trigger:hover {
  color: var(--accent);
}

.menu-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  min-width: 164px;
  z-index: 100;
  padding: 4px 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 8px 14px;
  text-align: left;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}

.menu-item:hover {
  color: var(--accent);
  background: rgba(136, 204, 136, 0.06);
}

#ws-simulate-btn {
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  padding: 8px 14px;
  transition: border-color 0.15s, color 0.15s;
  display: none;
}

#ws-simulate-btn:hover {
  border-color: var(--accent-dim);
  color: var(--accent);
}

.entry-restored {
  opacity: 0.65;
  filter: saturate(0.6);
  animation: none;
}

.session-divider {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75em;
  padding: 6px 0 10px;
  border-top: 1px dashed var(--border);
  margin-bottom: 10px;
  opacity: 0.5;
}

#history-sentinel {
  height: 1px;
}

/* ── Interactive console links (UI-H) ──────────────────────── */
.cmd-link,
.cmd-menu {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.cmd-label {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.cmd-link:hover,
.cmd-menu:hover {
  color: var(--accent);
}

.cmd-link:active,
.cmd-menu:active {
  opacity: 0.75;
}

.cmd-link i,
.cmd-menu i {
  display: inline-block;
}

.cmd-popup {
  position: fixed;
  z-index: 1000;
  background: var(--bg-panel, #1a1a1a);
  border: 1px solid var(--border);
  padding: 2px 0;
  list-style: none;
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 13px;
}

.cmd-popup li {
  padding: 4px 12px;
  cursor: pointer;
  white-space: nowrap;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.4em;
}

.cmd-popup i.ph,
.cmd-popup i[class^="ph-"],
.cmd-popup i[class*=" ph-"] {
  flex-shrink: 0;
  opacity: 0.75;
}

/* Footer action links */
.entry-meta .cmd-link i.ph,
.entry-meta .cmd-link i[class^="ph-"],
.entry-meta .cmd-link i[class*=" ph-"] {
  margin-right: 0.2em;
  opacity: 0.8;
}

.cmd-popup li:hover {
  background: rgba(136, 204, 136, 0.08);
  color: var(--accent);
}

.input-command-mode {
  border-color: var(--accent-dim) !important;
  color: var(--accent) !important;
}

/* ── Autocomplete dropdown (UI-I) ──────────────────────────────── */
.ac-dropdown {
  position: fixed;
  z-index: 1001;
  background: var(--bg-panel, #1a1a1a);
  border: 1px solid var(--border);
  padding: 2px 0;
  list-style: none;
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 13px;
  max-height: 156px; /* 6 items × 26px */
  overflow-y: auto;
  box-sizing: border-box;
}

.ac-dropdown li {
  padding: 4px 12px;
  cursor: pointer;
  white-space: nowrap;
  color: var(--text);
}

.ac-dropdown li.ac-highlighted {
  background: rgba(136, 204, 136, 0.08);
  color: var(--accent);
}

.ac-dropdown li.ac-disabled {
  color: var(--text-dim);
  cursor: default;
  font-style: italic;
}

.ac-dropdown li:hover:not(.ac-disabled) {
  background: rgba(136, 204, 136, 0.08);
  color: var(--accent);
}

@media (pointer: coarse) {
  .ac-dropdown { display: none !important; }
}

/* ── Icon style dev panel (Alt+I) ──────────────────────────────── */
#icon-dev-panel {
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: 320px;
  max-height: 72vh;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  font-size: 12px;
  color: var(--text);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.icon-dev-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  flex-shrink: 0;
}

.icon-dev-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 2px 4px;
}
.icon-dev-close:hover { color: var(--text); }

.icon-dev-body {
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.icon-dev-controls {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.icon-dev-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-dev-all-row {
  border-top: 1px solid var(--border);
  padding-top: 4px;
  margin-top: 2px;
}

.icon-dev-cat {
  width: 76px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.icon-dev-select,
.icon-dev-select-all {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 11px;
  padding: 2px 4px;
  flex: 1;
}

.icon-dev-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.icon-dev-group-name {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.icon-dev-weight-tag {
  color: var(--accent);
  font-size: 9px;
}

.icon-dev-group-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
}

.icon-dev-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 46px;
}

.icon-dev-item i.ph,
.icon-dev-item i[class^="ph-"],
.icon-dev-item i[class*=" ph-"] {
  font-size: 18px;
  vertical-align: unset;
}

.icon-dev-item-label {
  font-size: 9px;
  color: var(--text-muted);
  text-align: center;
  word-break: break-all;
  line-height: 1.2;
  max-width: 100%;
}

.icon-dev-refresh {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11px;
  padding: 4px 8px;
  cursor: pointer;
  text-align: left;
  flex-shrink: 0;
}
.icon-dev-refresh:hover { color: var(--text); border-color: var(--accent-dim); }
