/* Public help pages and accessible presentation preferences. */
.skip-link {
  position: fixed;
  left: 12px;
  top: -100px;
  z-index: 100;
  padding: 12px 18px;
  background: var(--cream);
  color: var(--deep);
  border-radius: 4px;
}
.skip-link:focus {
  top: 8px;
}
:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}
a {
  color: var(--gold);
  text-underline-offset: 3px;
}
.site-links {
  display: flex;
  gap: 8px 14px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}
.site-links a {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}
footer {
  flex-wrap: wrap;
  gap: 8px 20px;
}
.information {
  max-width: 860px;
  min-height: 70vh;
}
.information h1 {
  font-size: clamp(32px, 7vw, 54px);
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.information section {
  margin: 28px 0;
}
.information h2 {
  font-size: 22px;
  line-height: 1.4;
  margin-bottom: 8px;
}
.information p {
  overflow-wrap: anywhere;
}
.information-page header nav {
  font-size: 13px;
}
.information-page footer {
  max-width: 1100px;
  margin: auto;
  text-align: center;
}
.information-page footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
#connection-panel {
  position: fixed;
  z-index: 15;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  width: min(540px, calc(100% - 24px));
  background: var(--panel);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 14px 18px;
  box-shadow: 0 8px 40px #0005;
}
#connection-panel[hidden] {
  display: none;
}
#connection-panel button {
  margin: 8px 8px 0 0;
}
#connection-panel p {
  margin: 0;
}
.lobby .restart-note {
  font-size: 12px;
  color: var(--muted);
}
#modal {
  overflow-y: auto;
}
#modal-body > h2:first-of-type {
  margin-top: 8px;
}
#modal label small {
  display: block;
  color: var(--muted);
}
html[data-theme="light"] {
  --navy: #eee2c7;
  --deep: #f3ead7;
  --panel: #fff8e9;
  --cream: #192f37;
  --gold: #775018;
  --gold-aged: #80551f;
  --muted: #435861;
  --red: #9d382c;
  --aqua: #205e5a;
  --line: #243a3c35;
  color-scheme: light;
}
html[data-theme="light"] body {
  background: #eee2c7;
  color: var(--cream);
}
html[data-theme="light"] body::before {
  background:
    radial-gradient(ellipse at 78% 18%, #fff8df99, transparent 55%),
    linear-gradient(115deg, #e5d7bb, #f7eedb 55%, #e5dcc6);
}
html[data-theme="light"] .atlas {
  opacity: 0.25;
}
html[data-theme="light"] .atlas::before {
  opacity: 0.18;
}
html[data-theme="light"] .panel,
html[data-theme="light"] dialog {
  background: linear-gradient(140deg, #fff9eb, #eee1c6);
}
html[data-theme="light"] input,
html[data-theme="light"] select {
  background: #fffaf0;
  color: #192f37;
  border-color: #7e7054;
}
html[data-theme="light"] button:not(.wanted):not(.primary) {
  color: #192f37;
  border-color: #8b7955;
}
html[data-theme="light"] .primary {
  background: linear-gradient(120deg, #c79546, #e8c687);
  color: #241b0d;
  border-color: #9b6a29;
}
html[data-theme="light"] .intro,
html[data-theme="light"] .hero .intro strong,
html[data-theme="light"] .hero .call-hint,
html[data-theme="light"] .coordinates,
html[data-theme="light"] .game-logo-subtitle,
html[data-theme="light"] .game-logo-title {
  color: #243e45;
}
html[data-theme="light"] .game-logo-title {
  text-shadow: 0 1px 0 #fff5;
}
html[data-theme="light"] .chips span,
html[data-theme="light"] .callout,
html[data-theme="light"] .mode-option,
html[data-theme="light"] .mode-badge {
  background: #fff8e6;
  color: #29464a;
  border-color: #887447;
}
html[data-theme="light"] .turn-banner {
  background: #dce9dc;
  color: #173d39;
}
html[data-theme="light"] .board-stage {
  background: #d4c5a6;
  border-color: #a38e61;
}
html[data-theme="light"] .board-toolbar,
html[data-theme="light"] .match-crew {
  background: #eee1c6;
  color: #192f37;
}
html[data-theme="light"] .secret-mini,
html[data-theme="light"] .crew-person {
  color: #192f37;
}
html[data-theme="light"] .history,
html[data-theme="light"] .question {
  color: #192f37;
}
html[data-theme="light"] .developer-credit {
  color: #62400d;
}
html[data-theme="light"] #connection {
  color: #1d5750;
  border-color: #587c70;
  background: #ffffff66;
}
html[data-theme="light"] #form-error {
  color: #9a241a;
}
html[data-theme="light"] #notice {
  background: #234b50;
  color: #fff;
}
@media (max-width: 700px) {
  header {
    gap: 8px;
  }
  .brand {
    flex-shrink: 0;
  }
  .site-links {
    gap: 2px 12px;
  }
  footer .site-links a {
    min-height: 44px;
  }
  .information-page header {
    flex-wrap: wrap;
  }
  #connection-panel {
    top: 92px;
  }
  .in-match #connection-panel {
    top: 50px;
  }
}
@media (prefers-reduced-motion: reduce) {
  html:not([data-explicit-motion="on"]) .brand-smoke,
  html:not([data-explicit-motion="on"]) .logo-smoke {
    display: none;
  }
}
html[data-theme="light"] .in-match .secret-mini {
  background: #fff8e6;
  color: #192f37;
}
html[data-theme="light"] .in-match .secret-mini strong {
  color: #243e45;
}
html[data-theme="light"] .in-match .secret-mini small {
  color: #205e5a;
}
html[data-theme="light"] .in-match .crew-person.is-active {
  background: #e5ead4 !important;
}
/* Chart contrast and controls: keep decoration away from text. */
html[data-theme="dark"] .atlas::before,
html[data-theme="dark"] body:has(#app > .hero) .atlas::before {
  opacity: 0.66;
}
html[data-theme="light"] .atlas {
  opacity: 1;
}
html[data-theme="light"] .atlas::before,
html[data-theme="light"] body:has(#app > .hero) .atlas::before {
  opacity: 0.58;
  filter: brightness(0.58) saturate(0.7);
}
html[data-theme="light"] .ambient-glow,
html[data-theme="light"] .embers {
  opacity: 0.18;
}
html[data-theme="light"] .sea {
  opacity: 0.28;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select {
  min-width: 0;
  min-height: 46px;
  border-width: 1px;
  line-height: 1.5;
  font-size: 16px;
  box-shadow: none;
  text-shadow: none;
}
select,
#entry select {
  padding-right: 36px;
}
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--aqua);
  outline-offset: 2px;
  box-shadow: none;
}
input[type="checkbox"],
input[type="radio"] {
  display: inline-block;
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  flex-shrink: 0;
  accent-color: var(--gold);
}
input[type="range"] {
  min-height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
html[data-theme="light"]
  :is(h1, h2, h3, .brand, .game-logo-title, .invitation strong, .victory-seal) {
  text-shadow: none;
}
html[data-theme="light"] :is(input, select):focus {
  box-shadow: none;
}
html[data-theme="light"]
  :is(input[type="checkbox"], input[type="radio"], input[type="range"]) {
  background: transparent;
}
html[data-theme="light"] dialog {
  box-shadow: 0 16px 48px #382d2129;
}
html[data-theme="light"] dialog::backdrop {
  background: #263d4659;
  backdrop-filter: blur(3px);
}
html[data-theme="light"] button:not(.wanted):not(.quiet) {
  box-shadow: 0 2px 5px #4c371a18;
}
html[data-theme="light"] button.primary {
  box-shadow:
    inset 0 1px 0 #fff8,
    0 2px 0 #956b35,
    0 4px 10px #7b57251a;
}
html[data-theme="light"] button.primary:hover:not(:disabled) {
  box-shadow:
    inset 0 1px 0 #fff8,
    0 2px 0 #956b35,
    0 5px 12px #7b572524;
}
html[data-theme="light"] .hero .poster .wanted {
  filter: drop-shadow(1px 3px 3px #49392130);
}
html[data-theme="light"] .hero .landing-shadow {
  filter: opacity(0.35);
}
html[data-theme="light"] .hero .poster::after {
  box-shadow: 4px 7px 14px #49392126;
}

html[data-theme="dark"] body:has(#app > .hero) .atlas::before {
  opacity: 0.46;
}
.hero .question-ideas-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  max-width: 100%;
  margin-top: 12px;
  padding: 10px 14px;
  min-height: 56px;
  color: var(--gold);
  background: color-mix(in srgb, var(--gold) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--gold) 48%, transparent);
  border-radius: 10px;
  box-shadow: 0 3px 14px #00000012;
  animation: ideas-card-invite 3s ease-in-out infinite !important;
  transform-origin: center;
  text-align: left;
  transition:
    background 180ms ease,
    border-color 180ms ease;
}
.hero .question-ideas-link strong {
  display: block;
  font-size: 14px;
  line-height: 1.4;
}
.hero .question-ideas-link small {
  display: block;
  font-size: 12px;
  line-height: 1.5;
  color: var(--cream);
}
.hero .question-ideas-link .ideas-icon {
  display: inline-block;
  flex-shrink: 0;
  font-size: 25px;
}
.hero .question-ideas-link .ideas-arrow {
  margin-left: 6px;
  font-size: 22px;
}
.hero .question-ideas-link:hover {
  transform: none;
  translate: none;
  scale: 1;
  background: color-mix(in srgb, var(--gold) 16%, transparent);
  border-color: var(--gold);
}
.hero .question-ideas-link:active {
  transform: none;
  translate: none;
  scale: 1;
}
@keyframes ideas-card-invite {
  0%,
  38%,
  100% {
    transform: translateY(0) rotate(0);
    box-shadow: 0 3px 14px #00000012;
  }
  8% {
    transform: translateY(-2px) rotate(-1.4deg);
  }
  16% {
    transform: translateY(-2px) rotate(1.2deg);
    box-shadow: 0 4px 22px #ecc98635;
  }
  24% {
    transform: translateY(-1px) rotate(-0.8deg);
  }
  31% {
    transform: translateY(0) rotate(0.4deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  /* This invitation explicitly stays animated; keep the movement small. */
  .hero .question-ideas-link {
    animation: ideas-card-invite 4s ease-in-out infinite !important;
    transition: none;
  }
}
.game-heading-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.in-match .game-heading-actions button {
  min-height: 32px;
  min-width: 32px;
  padding: 4px 8px;
  font-size: 12px;
}
.question-ideas ul {
  list-style: none;
  padding: 0;
  margin: 22px 0;
}
.question-ideas li {
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  line-height: 1.5;
}
.question-ideas li::before {
  content: "✦";
  color: var(--gold);
  margin-right: 8px;
}
.question-ideas .muted {
  line-height: 1.6;
}

/* Transparent emblems in circular, accessible controls. */
.accessible-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px !important;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
#modal:has(.flag-selector) {
  width: min(440px, calc(100% - 32px));
  padding: 42px 20px 20px;
}
.flag-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.flag-options .flag-option {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: color-mix(in srgb, var(--gold) 5%, transparent);
  box-shadow: none;
  cursor: pointer;
  transition:
    border-color 150ms ease,
    background 150ms ease;
}
.flag-option img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.flag-options .flag-option:hover,
.flag-options .flag-option[aria-pressed="true"] {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 14%, transparent);
}
.flag-options .flag-option[aria-pressed="true"] {
  box-shadow: 0 0 0 1px var(--gold);
}
#flag-error:empty {
  display: none;
}
.crew-person .pirate-avatar {
  background: transparent;
  overflow: hidden;
  border-radius: 50%;
}
.pirate-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
  border-radius: 50%;
}
.crew-person .editable-avatar {
  position: relative;
  overflow: visible;
  padding: 0;
  min-height: 0;
  min-width: 0;
  cursor: pointer;
}
@media (max-width: 380px) {
  .flag-options {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (prefers-reduced-motion: reduce) {
  .flag-options .flag-option {
    transition: none;
  }
}
.avatar-pencil {
  position: absolute;
  right: -5px;
  bottom: -4px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  background: var(--gold);
  color: var(--deep);
  border: 1px solid var(--panel);
  border-radius: 50%;
  font:
    bold 13px/1 system-ui,
    sans-serif;
  pointer-events: none;
}
.crew-person .editable-avatar:hover {
  border-color: var(--gold);
}

/* Turn ownership stays visible after the change notification disappears. */
.in-match .game[data-phase="playing"] .turn-banner {
  padding: 7px 12px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 6px;
}
.in-match .game[data-phase="playing"] .turn-banner::after {
  display: none;
}
.in-match .game[data-phase="playing"] .turn-banner strong {
  display: block;
  font-size: 15px;
  letter-spacing: 0.6px;
}
.in-match .game[data-phase="playing"] .turn-banner .turn-hint {
  display: block;
  font-size: 11px;
  line-height: 1.4;
  margin: 1px 0 0;
  color: inherit;
  opacity: 1;
}
.in-match .game[data-active-turn="mine"] .turn-banner {
  background: #ecc986;
  color: #152b32;
  border-color: #ecc986;
  box-shadow: 0 3px 18px #ecc98622;
}
.in-match .game[data-active-turn="mine"] .turn-banner strong small {
  color: #33474b;
}
.in-match .game[data-active-turn="other"] .turn-banner {
  background: #183745;
  color: #e0eaf0;
  border-color: #6d939f;
}
.in-match .game[data-active-turn="other"] .turn-banner strong small {
  color: #c1d3da;
}
.in-match .game[data-active-turn="other"] .board {
  filter: brightness(0.88) saturate(0.84);
}
html[data-theme="light"]
  .in-match
  .game[data-active-turn="other"]
  .turn-banner {
  background: #dce4e7;
  color: #203d48;
  border-color: #6d858e;
}
html[data-theme="light"]
  .in-match
  .game[data-active-turn="other"]
  .turn-banner
  strong
  small {
  color: #405762;
}
html[data-theme="light"] .in-match .game[data-active-turn="other"] .board {
  filter: brightness(0.97) saturate(0.84);
}
.turn-cinematic {
  top: auto;
  bottom: 24px;
  animation: turn-notice-enter 0.22s ease-out both;
  color: #f7edda;
}
.turn-cinematic small {
  color: #ecc986;
}
.turn-cinematic span {
  color: #c7d7dd;
}
.turn-cinematic img,
.turn-cinematic span {
  animation: none;
}
.turn-cinematic::after {
  display: none;
}
@keyframes turn-notice-enter {
  from {
    opacity: 0;
    translate: 0 8px;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}
@media (max-width: 600px) {
  .in-match .game[data-phase="playing"] .turn-banner {
    padding: 6px 8px;
  }
  .in-match .game[data-phase="playing"] .turn-banner strong {
    font-size: 13px;
    letter-spacing: 0;
  }
  .in-match .game[data-phase="playing"] .turn-banner .turn-hint {
    font-size: 10px;
  }
  .turn-cinematic {
    bottom: 16px;
  }
}
@media (max-height: 500px) {
  .in-match .game[data-phase="playing"] .turn-banner {
    min-height: 30px;
    padding: 4px 8px;
  }
  .in-match .game[data-phase="playing"] .turn-banner .turn-hint {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .turn-cinematic {
    display: flex;
    animation: none;
  }
}

.custom-board-size[hidden] {
  display: none;
}
