:root {
  color-scheme: dark;
  --accent: #d4f19b;
  --ink: #050a12;
  --text: #edf2f5;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
}
button,
select,
input {
  font: inherit;
}
button {
  cursor: pointer;
  color: inherit;
  touch-action: manipulation;
}
button:disabled,
select:disabled {
  cursor: default;
}
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
[hidden] {
  display: none !important;
}
#map {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, #142638, var(--ink) 72%);
}
.bottom-shade {
  position: fixed;
  inset: 70% 0 0;
  pointer-events: none;
  background: linear-gradient(transparent, #03070d80);
}
.top-controls {
  position: fixed;
  top: max(18px, env(safe-area-inset-top, 0px));
  right: max(18px, env(safe-area-inset-right, 0px));
  z-index: 6;
  display: flex;
  gap: 7px;
}
.ui-toggle,
.fullscreen-button {
  width: 40px;
  height: 36px;
  display: grid;
  place-items: center;
  background: #07111ab0;
  border: 1px solid #ffffff28;
  border-radius: 8px;
  color: #bac9d3;
  backdrop-filter: blur(12px);
  font-size: 10px;
  letter-spacing: 1px;
  opacity: 0.65;
}
.ui-toggle:hover,
.ui-toggle:focus-visible,
.ui-toggle[aria-expanded='true'],
.fullscreen-button:hover,
.fullscreen-button:focus-visible,
.fullscreen-button[aria-pressed='true'] {
  opacity: 1;
}
.fullscreen-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.draw-dock {
  position: fixed;
  left: 50%;
  bottom: max(38px, calc(26px + env(safe-area-inset-bottom, 0px)));
  transform: translateX(-50%);
  z-index: 5;
  width: 1050px;
  max-width: calc(100vw - 40px);
  display: flex;
  align-items: center;
  gap: 14px;
}
.roll-panel {
  flex: 1;
  min-width: 0;
  height: 112px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 22px;
  border-radius: 20px;
  border: 1px solid #ffffff25;
  background: #081421ee;
  backdrop-filter: blur(20px);
  box-shadow: 0 10px 45px #0005;
}
.dice-button {
  flex: 0 0 78px;
  width: 78px;
  height: 78px;
  padding: 15px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  border: 1px solid #d4f19840;
  background: #d4f19b08;
  transition:
    background 0.2s,
    border-color 0.2s;
}
.dice-button:hover:not(:disabled) {
  border-color: #d4f198b0;
  background: #d4f19b18;
}
.dice-button:disabled {
  cursor: default;
}
.dice-button svg {
  width: 46px;
  height: 46px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.4;
}
.dice-button svg[hidden] {
  display: none;
}
.dice-button .dice-icon circle {
  fill: var(--accent);
  stroke: none;
}
.roll-name {
  flex: 1;
  min-width: 0;
  max-height: 80px;
  overflow: hidden;
  font-size: 32px;
  line-height: 1.15;
  font-weight: 550;
  color: var(--accent);
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.letter-reel {
  display: inline-flex;
  gap: 0.06em;
  max-width: 100%;
  height: 1.15em;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}
.letter-reel-column {
  display: block;
  width: 0.72em;
  height: 1.15em;
  overflow: hidden;
}
.letter-reel-strip {
  display: flex;
  flex-direction: column;
  animation: letter-roll var(--reel-duration) linear var(--reel-delay) infinite;
}
.letter-reel-strip > span {
  display: block;
  flex: 0 0 1.15em;
  height: 1.15em;
  line-height: 1.15em;
  text-align: center;
}
.draw-filters {
  flex: 0 0 332px;
  width: 332px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}
.continent-filter {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid #ffffff25;
  background: #081421e8;
  backdrop-filter: blur(20px);
  box-shadow: 0 10px 45px #0004;
  color: #d0dde5;
  font-size: 12px;
  cursor: pointer;
}
.continent-filter:hover:not(:disabled) {
  border-color: #d4f19880;
}
.continent-filter:disabled {
  opacity: 0.6;
}
.rolling .dice-button .dice-icon {
  animation: dice-roll 0.8s ease-in-out infinite alternate;
}
.settings {
  position: fixed;
  margin: 0;
  left: auto;
  right: 18px;
  top: 68px;
  width: 370px;
  max-width: calc(100vw - 36px);
  max-height: calc(100dvh - 90px);
  overflow: auto;
  z-index: 10;
  background: #101b29f5;
  backdrop-filter: blur(24px);
  border: 1px solid #ffffff28;
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 10px 70px #0007;
  color: var(--text);
}
.settings::backdrop {
  background: #03070c38;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.panel-head h2 {
  font-size: 18px;
  letter-spacing: 0.3px;
  font-weight: 600;
  margin: 0;
}
.panel-head .site-version {
  display: inline-block;
  margin-left: 7px;
  vertical-align: middle;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  color: #bdcdd9;
  border: 1px solid #ffffff28;
  border-radius: 5px;
  padding: 3px 6px;
}
.close-button {
  border: 1px solid #ffffff20;
  background: #ffffff08;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  font-size: 23px;
}
.settings label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #bdcdd9;
  font-size: 11px;
  margin: 0 0 16px;
}
.settings select {
  width: 100%;
  border: 1px solid #ffffff28;
  border-radius: 8px;
  background: #07111c;
  color: #e7edf2;
  padding: 11px;
  font-size: 12px;
}
.settings .check-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  min-height: 30px;
}
.check-row input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}
.panel-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 20px;
}
.panel-actions button {
  padding: 11px;
  border-radius: 8px;
  border: 1px solid #ffffff25;
  background: #ffffff08;
  font-size: 11px;
}
.panel-actions button:hover {
  background: #ffffff15;
}
.route-upload-action {
  grid-template-columns: 1fr;
  margin-top: 9px;
}
.settings textarea {
  width: 100%;
  resize: vertical;
  min-height: 110px;
  border: 1px solid #ffffff28;
  border-radius: 8px;
  background: #07111c;
  color: #e7edf2;
  padding: 11px;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.6;
}
.settings textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.settings input[type='file'] {
  width: 100%;
  font-size: 11px;
  color: #bdcdd9;
}
#route-upload-panel {
  border-top: 1px solid #ffffff20;
  margin-top: 16px;
  padding-top: 4px;
}
#route-import-status:empty {
  display: none;
}
#route-import-status[data-error='true'] {
  color: #ffb7aa;
}
.panel-actions a {
  padding: 11px;
  border-radius: 8px;
  border: 1px solid #ffffff25;
  background: #ffffff08;
  font-size: 11px;
  text-align: center;
  color: inherit;
  text-decoration: none;
}
.draw-filters[hidden],
#viewer-route[hidden] {
  display: none;
}
.help {
  font-size: 10px;
  line-height: 1.7;
  color: #90a5b6;
  margin: 18px 0 0;
}
#message {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 210px);
  z-index: 20;
  background: #0c1b29ed;
  border: 1px solid #ffffff25;
  border-radius: 9px;
  color: #e2ebf2;
  font-size: 12px;
  padding: 12px 16px;
  line-height: 1.5;
  text-align: center;
}
.maplibregl-ctrl-attrib {
  font-size: 8px !important;
  background: #050c16b0 !important;
  color: #b5c5d0 !important;
  padding: 2px 5px !important;
  max-width: calc(100vw - 16px);
}
.maplibregl-ctrl-attrib a {
  color: #b5c5d0 !important;
}
.maplibregl-ctrl-bottom-right {
  bottom: 5px;
  right: 7px;
}
.fallback-world {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.fallback-world path {
  fill: #25423f;
  stroke: #96b4a6;
  stroke-width: 0.2;
}
.fallback-world .selected-border,
.fallback-world .previous-border {
  fill: none;
  stroke: #efffc4;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}
.fallback-world .fallback-pin {
  fill: #d4f19b;
}
.map-label {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.map-label-dot {
  display: block;
  width: 10px;
  height: 10px;
  border: 2px solid #efffc4;
  border-radius: 50%;
  background: #d4f19b;
  box-shadow: 0 0 0 3px #10220caa;
}
.map-label-name:empty {
  display: none;
}
.maplibregl-canvas:focus {
  outline: none;
}
@keyframes dice-roll {
  from {
    transform: rotate(-12deg);
  }
  to {
    transform: rotate(12deg);
  }
}
@keyframes letter-roll {
  to {
    transform: translateY(-83.333333%);
  }
}
@media (max-width: 600px) {
  .draw-dock {
    width: 490px;
    max-width: calc(100vw - 28px);
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    bottom: max(32px, calc(24px + env(safe-area-inset-bottom, 0px)));
  }
  .roll-panel {
    flex-basis: 100%;
    height: 104px;
    padding: 14px;
    gap: 14px;
    border-radius: 17px;
  }
  .dice-button {
    flex-basis: 66px;
    width: 66px;
    height: 66px;
    padding: 12px;
    border-radius: 13px;
  }
  .dice-button svg {
    width: 40px;
    height: 40px;
  }
  .roll-name {
    font-size: 22px;
    max-height: 76px;
  }
  .draw-filters {
    flex-basis: 100%;
    width: 100%;
  }
  .continent-filter {
    height: 42px;
    padding: 0 9px;
    font-size: 11px;
  }
  .settings {
    right: 12px;
    top: 62px;
    max-width: calc(100vw - 24px);
    padding: 20px;
  }
  .top-controls {
    top: max(14px, env(safe-area-inset-top, 0px));
    right: max(14px, env(safe-area-inset-right, 0px));
  }
  #message {
    top: 62px;
    max-width: calc(100vw - 30px);
    font-size: 11px;
  }
}
@media (max-width: 380px) {
  .roll-name {
    font-size: 20px;
  }
  .roll-panel {
    gap: 12px;
    padding: 12px;
  }
  .dice-button {
    flex-basis: 60px;
    width: 60px;
    height: 60px;
  }
}
@media (max-height: 450px) {
  .draw-dock {
    bottom: max(22px, env(safe-area-inset-bottom, 0px));
    flex-wrap: nowrap;
  }
  .roll-panel {
    height: 78px;
    padding: 10px;
    gap: 14px;
    flex-basis: auto;
  }
  .dice-button {
    flex-basis: 56px;
    width: 56px;
    height: 56px;
    padding: 9px;
  }
  .dice-button svg {
    width: 36px;
    height: 36px;
  }
  .roll-name {
    font-size: 24px;
    max-height: 58px;
  }
  .draw-filters {
    flex-basis: 264px;
    width: 264px;
  }
}
@media (max-width: 600px) and (max-height: 450px) {
  .draw-dock {
    flex-wrap: wrap;
    gap: 8px;
  }
  .roll-panel {
    flex-basis: 100%;
  }
  .draw-filters {
    flex-basis: 100%;
    width: 100%;
  }
  .continent-filter {
    height: 36px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

.journey-toggle {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  border: 1px solid #ffffff28;
  border-radius: 11px;
  background: #07111c;
}
.journey-toggle button {
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #bdcdd9;
  padding: 11px;
  font-size: 12px;
}
.journey-toggle button[aria-pressed='true'] {
  background: #d4f19b18;
  border-color: #d4f19b70;
  color: var(--accent);
}
.journey-toggle button:disabled {
  opacity: 0.6;
}
.mode-help {
  margin: 0 0 18px;
}

.roll-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.roll-copy .roll-name {
  display: block;
  flex: none;
  max-height: 74px;
}
.arrival-details {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: #bed0dd;
  font-size: 12px;
  line-height: 1.4;
  animation: arrival-reveal 1.4s ease-out both;
  overflow-wrap: anywhere;
}
.arrival-flag {
  width: 23px;
  height: 17px;
  object-fit: cover;
  border-radius: 2px;
  flex: none;
  margin-top: 1px;
  box-shadow: 0 0 0 1px #ffffff25;
}
.recording-options {
  margin: 8px 0 20px;
  border: 1px solid #d4f19b35;
  border-radius: 10px;
  padding: 12px;
}
.recording-options > summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 12px;
  line-height: 1.5;
}
.recording-options[open] > summary {
  margin-bottom: 16px;
}
@keyframes arrival-reveal {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (max-width: 600px) {
  .roll-copy {
    gap: 5px;
  }
  .roll-copy .roll-name {
    font-size: 21px;
    max-height: 52px;
  }
  .arrival-details {
    font-size: 10px;
    line-height: 1.3;
  }
  .arrival-flag {
    width: 20px;
    height: 15px;
  }
}
@media (max-height: 450px) {
  .arrival-details {
    font-size: 10px;
  }
  .roll-copy .roll-name {
    max-height: 42px;
    font-size: 23px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .arrival-details {
    animation: none;
  }
}
.roll-panel {
  height: 140px;
}
.roll-copy .roll-name {
  font-size: 28px;
  max-height: 65px;
}
.arrival-details > span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
@media (max-width: 600px) {
  .roll-panel {
    height: 126px;
  }
  .roll-copy .roll-name {
    font-size: 21px;
    max-height: 50px;
  }
}
@media (max-height: 450px) {
  .roll-panel {
    height: 104px;
  }
  .roll-copy .roll-name {
    font-size: 23px;
    max-height: 50px;
  }
}

.hand-target {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 4;
  filter: drop-shadow(0 1px 2px #000);
}
.hand-target:before,
.hand-target:after {
  content: '';
  position: absolute;
  background: #fff;
  border-radius: 1px;
}
.hand-target:before {
  left: 10px;
  top: 0;
  width: 2px;
  height: 22px;
}
.hand-target:after {
  left: 0;
  top: 10px;
  width: 22px;
  height: 2px;
}

.hand-guide {
  pointer-events: auto;
  align-self: center;
  padding: 10px 18px;
  border: 1px solid #a2be7155;
  border-radius: 14px;
  background: #10222feb;
  color: #e7f4c2;
  font: inherit;
  margin-top: 8px;
  max-width: 90vw;
}
.hand-guide[hidden] {
  display: none;
}
#roll-speed {
  width: 100%;
  accent-color: #cde992;
}

.hand-context {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 9px;
  font-size: 13px;
  line-height: 1.45;
  color: #d0dbdf;
  margin-top: 5px;
}
.hand-context[hidden] {
  display: none;
}
.hand-context img {
  object-fit: contain;
  flex: none;
}
.hand-municipality {
  flex-basis: 100%;
  font-size: 12px;
  color: #aebdc7;
}

.hand-context > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.hand-status {
  flex-basis: 100%;
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
}

/* Hand readout, guidance and lookup status occupy independent rows. */
/* Compact Hand readout; optional controls never participate in its layout. */
.draw-dock.hand-mode {
  display: block;
  width: 460px;
  max-width: calc(100vw - 28px);
  height: 106px;
  max-height: none;
  overflow: visible;
  border-radius: 16px;
}
.hand-mode .roll-panel {
  position: relative;
  width: 100%;
  height: 106px;
  min-height: 106px;
  padding: 12px;
  gap: 12px;
  border-radius: 16px;
}
.hand-mode .dice-button {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  padding: 10px;
  border-radius: 13px;
}
.hand-mode .dice-button svg {
  width: 36px;
  height: 36px;
}
.hand-mode .roll-copy {
  width: 0;
  flex: 1 1 0;
  gap: 4px;
}
.hand-mode .roll-copy .roll-name {
  font-size: 24px;
  line-height: 29px;
  max-height: 29px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-wrap: nowrap;
}
.hand-mode .hand-context {
  font-size: 12px;
  line-height: 17px;
  margin-top: 0;
  gap: 3px 7px;
}
.hand-mode .hand-context > span:not(.hand-municipality) {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hand-mode .hand-municipality {
  height: 16px;
  line-height: 16px;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hand-mode .municipality-unavailable {
  font-size: 14px;
  cursor: help;
}
.hand-mode .hand-guide {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  margin: 0;
  max-width: 100%;
  height: 34px;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  font-size: 12px;
}
.hand-mode .hand-status {
  position: absolute;
  left: 0;
  right: auto;
  top: auto;
  bottom: calc(100% + 50px);
  max-width: 100%;
  margin: 0;
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 8px;
  background: #081421ee;
}
@media (max-width: 600px) {
  .draw-dock.hand-mode,
  .hand-mode .roll-panel {
    height: 102px;
    min-height: 102px;
  }
  .hand-mode .roll-copy .roll-name {
    font-size: 21px;
    line-height: 26px;
    max-height: 26px;
  }
}
@media (max-height: 450px) {
  .draw-dock.hand-mode,
  .hand-mode .roll-panel {
    height: 94px;
    min-height: 94px;
  }
  .hand-mode .roll-copy .roll-name {
    font-size: 21px;
    line-height: 26px;
    max-height: 26px;
  }
}

.hand-globe {
  width: 42px;
  height: 42px;
  border: 1px solid #ffffff35;
  border-radius: 50%;
  background: #0b1825e8;
  color: #e1edf2;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.hand-globe[hidden] {
  display: none;
}
.hand-globe svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}
.hand-globe:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Nearest-town guidance belongs inside the fixed Hand box. */
.draw-dock.hand-mode,
.hand-mode .roll-panel {
  height: 132px;
  min-height: 132px;
}
.hand-mode .roll-copy {
  align-self: stretch;
  justify-content: flex-start;
  padding-top: 4px;
  padding-bottom: 30px;
}
.hand-mode .hand-guide {
  left: 80px;
  right: 12px;
  bottom: 10px;
  max-width: none;
  height: 24px;
  min-height: 24px;
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 7px;
}
@media (max-width: 600px) {
  .draw-dock.hand-mode,
  .hand-mode .roll-panel {
    height: 128px;
    min-height: 128px;
  }
}
@media (max-height: 450px) {
  .draw-dock.hand-mode,
  .hand-mode .roll-panel {
    height: 124px;
    min-height: 124px;
  }
}

.audience-reveal {
  width: auto;
  min-width: 72px;
  padding: 0 10px;
  min-height: 44px;
  letter-spacing: 0;
}
.audience-dot {
  display: block;
  width: 24px;
  height: 24px;
  border: 0;
  background: transparent;
  padding: 7px;
  cursor: pointer;
  position: relative;
  touch-action: manipulation;
}
.audience-dot::before {
  content: '';
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f4bb65;
  border: 1px solid #fff4;
  box-shadow: 0 0 0 2px #091827aa;
}
.audience-dot:focus-visible {
  outline: 2px solid white;
  border-radius: 50%;
}
.audience-tooltip {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 230px;
  white-space: pre-wrap;
  background: #081421f5;
  color: #fff;
  padding: 10px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
  text-align: left;
  box-shadow: 0 4px 20px #0008;
}
.top-controls {
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
}

/* MapLibre positions markers in map pixels; never let button layout offset them. */
.audience-dot.maplibregl-marker {
  position: absolute;
}
.audience-dot.maplibregl-marker[style*='opacity: 0;'] {
  visibility: hidden;
  pointer-events: none;
}

/* Recording view: just the result panel; selectors live inside settings. */
.draw-dock:not(.hand-mode) {
  width: 640px;
}
.top-controls {
  max-width: calc(100vw - 24px);
  flex-wrap: wrap;
  justify-content: flex-end;
}
.borders-reveal {
  width: auto;
  min-width: 64px;
  padding: 0 10px;
  min-height: 44px;
  letter-spacing: 0;
}
.settings {
  inset: 0;
  width: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: #0d1724;
  overflow: auto;
  overscroll-behavior: contain;
}
.settings-content {
  width: min(100%, 960px);
  margin: 0 auto;
  padding: 0 max(24px, env(safe-area-inset-right)) max(40px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
}
.settings .panel-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #0d1724;
  padding: max(20px, env(safe-area-inset-top)) 0 20px;
  border-bottom: 1px solid #ffffff20;
}
.settings .panel-head h2 {
  font-size: 24px;
}
.settings .close-button {
  width: 48px;
  height: 48px;
  font-size: 30px;
}
.settings label {
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: 22px;
}
.settings select,
.settings textarea {
  font-size: 16px;
  padding: 12px;
  min-height: 48px;
}
.settings button {
  min-height: 44px;
  font-size: 14px;
}
.settings .check-row {
  min-height: 44px;
  gap: 20px;
}
.settings input[type='checkbox'] {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}
.settings input[type='file'] {
  font-size: 14px;
}
.settings .help {
  font-size: 13px;
  line-height: 1.7;
}
.settings .help + label {
  margin-top: 16px;
}
#country-odds-panel {
  margin-bottom: 16px;
}
.settings details {
  padding: 16px 0;
  border-bottom: 1px solid #ffffff18;
  margin-bottom: 18px;
}
.settings summary {
  font-size: 16px;
  cursor: pointer;
  min-height: 44px;
  align-content: center;
}
.settings .draw-filters {
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin: 22px 0 0;
}
.settings .draw-filters label {
  min-width: 0;
}
.fallback-world.country-borders-visible > path[data-code] {
  stroke: #e7efcc;
  stroke-width: 1.1;
  stroke-opacity: 0.8;
  vector-effect: non-scaling-stroke;
}
@media (max-width: 600px) {
  .settings-content {
    padding-left: max(18px, env(safe-area-inset-left));
    padding-right: max(18px, env(safe-area-inset-right));
  }
  .settings .draw-filters {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .settings .panel-head h2 {
    font-size: 21px;
  }
}

.settings-tabs {
  position: sticky;
  top: 88px;
  z-index: 2;
  display: flex;
  gap: 8px;
  background: #0d1724;
  padding: 12px 0;
  flex-wrap: wrap;
}
.settings-tabs button {
  flex: 1;
  border: 1px solid #ffffff25;
  border-radius: 8px;
  padding: 12px;
  background: #ffffff08;
  color: #bdcdd9;
}
.settings-tabs button:hover {
  background: #ffffff12;
}
.settings-tabs button[aria-pressed='true'] {
  color: var(--accent);
  border-color: #d4f19b70;
  background: #d4f19b18;
}
.settings-section[hidden] {
  display: none;
}
.import-review {
  white-space: pre-wrap;
  max-height: 300px;
  overflow: auto;
  font: 14px/1.6 system-ui;
}
.quiet-controls .top-controls {
  opacity: 0;
  pointer-events: none;
}
.top-controls:focus-within {
  opacity: 1;
  pointer-events: auto;
}

.audience-dot[data-count]::after {
  content: attr(data-count);
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: #f4bb65;
  color: #101b29;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: bold;
  border: 1px solid #fff8;
}

.compass {
  position: absolute;
  z-index: 5;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
}
.compass {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid #ffffff35;
  border-radius: 50%;
  background: #0b1825e8;
  color: #e1edf2;
  cursor: pointer;
}
.compass svg {
  width: 24px;
  height: 24px;
}
.compass[hidden],
.hand-facts[hidden] {
  display: none;
}
.quiet-controls .compass:not(:focus-visible) {
  opacity: 0;
  pointer-events: none;
}
.hand-facts {
  flex: none;
  margin: 0;
  font-size: 11px;
  line-height: 16px;
  color: #aebdc7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audience-editor {
  max-height: 300px;
  overflow: auto;
}
.audience-editor > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto;
  gap: 6px;
  padding: 6px 0;
  border-bottom: 1px solid #ffffff25;
}
.audience-editor input {
  min-width: 0;
  width: 100%;
  padding: 6px;
}
@media (max-width: 600px) {
  .audience-editor > div {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .audience-editor input {
    grid-column: 1/-1;
  }
}

@media (max-width: 420px) {
  body:has(.compass:not([hidden])) .top-controls {
    max-width: calc(
      100vw - max(12px, env(safe-area-inset-left)) - max(12px, env(safe-area-inset-right)) - 50px
    );
  }
}

.landmarks-card {
  position: absolute;
  z-index: 6;
  top: max(112px, calc(env(safe-area-inset-top) + 100px));
  right: max(12px, env(safe-area-inset-right));
  width: min(320px, calc(100vw - 24px));
  max-height: calc(100dvh - 240px);
  overflow-y: auto;
  padding: 12px 44px 12px 14px;
  border: 1px solid #ffd58455;
  border-radius: 12px;
  background: #0b1825f2;
  color: #edf4f7;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.landmarks-card strong {
  font-size: 16px;
  color: #ffd584;
}
.landmarks-card p {
  margin: 5px 0;
}
.landmarks-card button {
  position: absolute;
  top: 4px;
  right: 5px;
  width: 36px;
  height: 36px;
}
.atlas-landmarks circle {
  fill: #ffd584;
  stroke: #402e18;
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
}
.atlas-landmarks image {
  cursor: pointer;
}
.landmarks-card label {
  display: grid;
  gap: 4px;
  margin: 8px 0;
}
.landmarks-card select {
  width: 100%;
  min-width: 0;
  color: inherit;
  background: #152739;
}

.landmarks-reveal {
  width: auto;
  min-width: 82px;
  padding: 0 10px;
  min-height: 44px;
  letter-spacing: 0;
  white-space: nowrap;
}
.landmarks-reveal[aria-pressed='true'] {
  border-color: #ffd58488;
  color: #ffd584;
  opacity: 1;
}
.landmarks-card button {
  background: #ffffff10;
  border: 1px solid #ffffff28;
  border-radius: 7px;
}
.landmarks-card a {
  color: #ffd584;
}
.landmarks-image {
  display: block;
  width: calc(100% + 58px);
  max-height: 180px;
  margin: -12px -44px 10px -14px;
  object-fit: cover;
  border-radius: 11px 11px 0 0;
  background: #152739;
}
.landmarks-image[hidden] {
  display: none;
}
.landmarks-image-note {
  margin: -6px 0 6px;
  font-size: 11px;
  color: #90a5b6;
}
.landmarks-image-note[hidden] {
  display: none;
}
.landmarks-summary {
  line-height: 1.5;
  color: #cfdbe3;
}
.landmarks-wiki-status {
  color: #90a5b6;
  font-size: 12px;
}
.landmarks-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}
@media (max-width: 420px) {
  .landmarks-reveal {
    min-width: 68px;
    padding-inline: 7px;
  }
}

.landmark-filter-group {
  padding: 6px 0;
  border-bottom: 1px solid #ffffff20;
}
.landmark-filter-group details {
  margin: 0 0 0 34px;
  padding: 0;
  border: 0;
}
.landmark-filter-group summary {
  min-height: 34px;
  font-size: 14px;
}
.settings label.landmark-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 38px;
  margin: 0;
}
.landmark-check input {
  flex: none;
  width: 18px;
  height: 18px;
  accent-color: #ffd584;
}
.landmark-check img {
  flex: none;
}

/* One extra 16px line for population and place facts in the Hand panel. */
.hand-mode .roll-panel:has(.hand-facts:not([hidden])),
.draw-dock.hand-mode:has(.hand-facts:not([hidden])) {
  height: 148px;
  min-height: 148px;
}
@media (max-width: 600px) {
  .hand-mode .roll-panel:has(.hand-facts:not([hidden])),
  .draw-dock.hand-mode:has(.hand-facts:not([hidden])) {
    height: 144px;
    min-height: 144px;
  }
}
@media (max-height: 450px) {
  .hand-mode .roll-panel:has(.hand-facts:not([hidden])),
  .draw-dock.hand-mode:has(.hand-facts:not([hidden])) {
    height: 140px;
    min-height: 140px;
  }
}

/* Circles: top-bar reveal button, and the radius tool in the bottom-right corner */
.circles-reveal {
  width: auto;
  min-width: 70px;
  padding: 0 10px;
  min-height: 44px;
  letter-spacing: 0;
  white-space: nowrap;
}
.circles-reveal[aria-pressed='true'] {
  border-color: #ffd16688;
  color: #ffd166;
  opacity: 1;
}
.circle-tool {
  --next-color: #ffd166;
  position: fixed;
  right: 16px;
  bottom: max(38px, calc(26px + env(safe-area-inset-bottom, 0px)));
  z-index: 6;
  display: flex;
  gap: 6px;
  align-items: center;
}
.circle-size {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  width: 170px;
  padding: 6px 10px 4px;
  border: 1px solid #ffffff28;
  border-radius: 12px;
  background: #07111ab0;
  opacity: 0.85;
}
.circle-km-value {
  color: #d6e2ea;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.circle-km {
  width: 100%;
  margin: 0;
  accent-color: var(--next-color, #ffd166);
}
.circle-draw {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid #ffffff28;
  border-radius: 14px;
  background: #07111ab0;
  color: var(--next-color);
}
.circle-draw svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}
.circle-draw svg circle:last-child {
  fill: currentColor;
}
.circle-draw:active {
  transform: scale(0.94);
}
