:root {
  --ink: #18231f;
  --muted: #68736e;
  --paper: #f7f9f6;
  --panel: #ffffff;
  --line: #dbe2dd;
  --accent: #176b55;
  --accent-dark: #0d4d3c;
  --accent-soft: #e5f2ec;
  --danger: #a13c31;
  --ocean: #dcecf2;
  --land: #eef0e7;
  --border: #8b978e;
  --highlight: #f2a23a;
  --shadow: 0 18px 55px rgba(25, 45, 36, 0.1);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body[data-game-type="laenderkarte"] {
  --accent: #17667a;
  --accent-dark: #0d4a5a;
  --accent-soft: #e2f0f4;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 15%, rgba(89, 160, 126, 0.12), transparent 30rem),
    radial-gradient(circle at 88% 5%, rgba(84, 151, 177, 0.11), transparent 27rem),
    var(--paper);
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 32px));
  min-height: 72px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  color: white;
  background: var(--accent);
  box-shadow: 0 7px 18px rgba(23, 107, 85, 0.2);
}

.connection-status {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.connection-status::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d29337;
  content: "";
}

.connection-status.online::before {
  background: #38a56e;
}

.connection-status.offline::before {
  background: #c75045;
}

.game-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 38px 0 72px;
}

.screen {
  animation: screen-in 220ms ease-out;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.home-screen {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(310px, 0.75fr);
  gap: clamp(38px, 8vw, 100px);
  align-items: center;
  min-height: min(680px, calc(100vh - 150px));
}

.eyebrow,
.mini-label,
.phase-label {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 850px;
  margin-bottom: 18px;
  font-size: clamp(2.35rem, 6vw, 5.25rem);
  line-height: 0.99;
  letter-spacing: -0.055em;
}

h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.lead {
  max-width: 660px;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: clamp(1.02rem, 2vw, 1.2rem);
  line-height: 1.65;
}

.feature-list {
  display: grid;
  gap: 12px;
  max-width: 590px;
}

.feature-item {
  display: flex;
  gap: 13px;
  align-items: center;
  color: #42514a;
  font-weight: 650;
}

.feature-icon {
  display: grid;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid #cfe1d8;
  border-radius: 50%;
  background: var(--accent-soft);
}

.join-card,
.panel,
.answer-card,
.review-card,
.result-answer-card {
  border: 1px solid rgba(125, 146, 136, 0.28);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.join-card {
  padding: clamp(24px, 4vw, 34px);
}

label,
.field {
  display: grid;
  gap: 8px;
  color: #3d4b44;
  font-size: 0.84rem;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid #cfd8d2;
  border-radius: 12px;
  outline: none;
  color: var(--ink);
  background: white;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent);
}

.join-card > input {
  margin-bottom: 14px;
}

.button {
  min-height: 47px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 850;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.button.primary {
  color: white;
  background: var(--accent);
}

.button.primary:hover:not(:disabled) {
  background: var(--accent-dark);
}

.button.secondary {
  border-color: #b8c8c0;
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.button.quiet {
  border-color: #d2dad5;
  color: #506059;
  background: white;
}

.button.wide {
  width: 100%;
}

.divider {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 25px 0 19px;
  color: #8a958f;
  font-size: 0.75rem;
  font-weight: 750;
  text-transform: uppercase;
}

.divider::before,
.divider::after {
  flex: 1;
  height: 1px;
  background: var(--line);
  content: "";
}

.join-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.code-input {
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.error {
  min-height: 1.2em;
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 0.86rem;
  font-weight: 750;
}

.section-heading,
.round-header,
.panel-heading,
.button-row,
.review-heading,
.answer-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.section-heading {
  margin-bottom: 26px;
}

.section-heading h1,
.round-header h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.5rem);
}

.room-code-box {
  display: grid;
  gap: 3px;
  min-width: 128px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  text-align: center;
  background: white;
}

.room-code-box > span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.room-code-box button {
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
}

.room-code-box strong {
  font-size: 1.45rem;
  letter-spacing: 0.13em;
}

.lobby-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) minmax(420px, 1.3fr);
  gap: 22px;
  align-items: start;
}

.panel {
  padding: 24px;
  box-shadow: 0 12px 40px rgba(25, 45, 36, 0.06);
}

.pill,
.score-chip,
.points-badge,
.submitted-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.77rem;
  font-weight: 850;
}

.pill {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.player-list {
  display: grid;
  gap: 9px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.player-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 9px 10px 9px 14px;
  border: 1px solid #e1e7e3;
  border-radius: 12px;
  background: #fbfcfb;
}

.player-name {
  font-weight: 820;
}

.player-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.73rem;
}

.kick-button {
  width: 31px;
  height: 31px;
  border: 0;
  border-radius: 9px;
  color: var(--danger);
  background: #f8e8e5;
  font-size: 1.1rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 17px;
  margin-top: 21px;
}

.field-wide {
  grid-column: 1 / -1;
}

.settings-help,
.lobby-hint,
.round-status,
.waiting-copy,
.map-note {
  color: var(--muted);
  line-height: 1.5;
}

.settings-help {
  margin: 18px 0 0;
  padding: 13px 14px;
  border-radius: 11px;
  background: var(--accent-soft);
  font-size: 0.86rem;
}

.lobby-hint {
  margin: 22px 0 0;
}

.button-row {
  justify-content: flex-start;
  margin-top: 22px;
}

.button-row.centered {
  justify-content: center;
}

.round-header {
  margin-bottom: 15px;
}

.timer-box {
  display: grid;
  min-width: 92px;
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 15px;
  text-align: center;
  background: white;
}

.timer-box span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.timer-box strong {
  font-size: 1.55rem;
  font-variant-numeric: tabular-nums;
}

.timer-box.urgent {
  border-color: #dda99f;
  color: var(--danger);
  background: #fff4f1;
}

.score-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 3px 0 9px;
  scrollbar-width: thin;
}

.score-chip {
  flex: 0 0 auto;
  gap: 7px;
  border: 1px solid var(--line);
  color: #4f5e57;
  background: white;
}

.score-chip.me {
  border-color: color-mix(in srgb, var(--accent) 45%, white);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.score-chip strong {
  font-variant-numeric: tabular-nums;
}

.round-status {
  min-height: 1.5em;
  margin: 8px 0 17px;
  font-size: 0.88rem;
}

.answer-card,
.review-card,
.result-answer-card {
  padding: clamp(22px, 4vw, 36px);
}

.answer-card {
  text-align: center;
}

.prompt-kicker {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.prompt-title {
  margin-bottom: 10px;
  font-size: clamp(1.5rem, 4vw, 2.6rem);
  line-height: 1.12;
}

.flag-large {
  display: block;
  margin: 7px auto 15px;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  font-size: clamp(5.5rem, 16vw, 10rem);
  line-height: 1;
  filter: drop-shadow(0 12px 14px rgba(28, 43, 36, 0.13));
}

.country-prompt {
  display: inline-block;
  margin: 10px 0 22px;
  padding: 12px 20px;
  border-radius: 13px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: clamp(1.4rem, 4vw, 2.25rem);
  font-weight: 900;
  letter-spacing: -0.025em;
}

.text-answer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  width: min(620px, 100%);
  margin: 24px auto 0;
}

.text-answer input {
  min-height: 54px;
  font-size: 1.05rem;
}

.country-input-wrap {
  position: relative;
  min-width: 0;
}

.country-suggestions {
  position: absolute;
  z-index: 5;
  top: calc(100% + 5px);
  right: 0;
  left: 0;
  max-height: min(260px, 40vh);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.country-suggestion {
  padding: 11px 14px;
  cursor: pointer;
}

.country-suggestion:hover,
.country-suggestion.active {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.choices-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
  width: min(760px, 100%);
  margin: 22px auto 0;
}

.choice-button {
  display: flex;
  gap: 13px;
  align-items: center;
  justify-content: center;
  min-height: 65px;
  padding: 10px 16px;
  border: 1px solid #ccd7d1;
  border-radius: 14px;
  color: var(--ink);
  background: white;
  font-weight: 820;
  transition: border-color 130ms ease, background 130ms ease, transform 130ms ease;
}

.choice-button:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.choice-button.selected {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.choice-flag,
.answer-flag {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  font-size: 2rem;
  line-height: 1;
}

.choice-confirm {
  margin-top: 17px;
}

.waiting-state {
  display: grid;
  min-height: 270px;
  place-items: center;
  text-align: center;
}

.waiting-mark {
  display: grid;
  width: 66px;
  height: 66px;
  margin: 0 auto 17px;
  place-items: center;
  border-radius: 50%;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 1.7rem;
  font-weight: 900;
}

.world-map-wrap {
  position: relative;
  width: 100%;
  margin: 20px auto 0;
  overflow: hidden;
  overscroll-behavior: contain;
  border: 1px solid #b9cbd1;
  border-radius: 18px;
  background: var(--ocean);
  box-shadow: inset 0 0 40px rgba(40, 90, 105, 0.08);
}

.world-map-wrap.loading {
  display: grid;
  min-height: 320px;
  place-items: center;
  color: #526b72;
  font-weight: 750;
}

.world-map {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.world-map.navigable {
  cursor: grab;
}

.world-map.interactive {
  cursor: crosshair;
}

.world-map.panning {
  cursor: grabbing;
}

.map-zoom-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: grid;
  gap: 5px;
  padding: 5px;
  border: 1px solid rgba(46, 74, 82, 0.18);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 20px rgba(35, 65, 75, 0.18);
  backdrop-filter: blur(7px);
}

.map-zoom-button {
  display: grid;
  width: 38px;
  height: 38px;
  min-height: 0;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 9px;
  color: var(--accent-dark);
  background: white;
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: inset 0 0 0 1px #d7e1e3;
}

.map-zoom-button.reset {
  font-size: 0.72rem;
}

.map-zoom-button:hover:not(:disabled) {
  background: var(--accent-soft);
}

.map-zoom-button:disabled {
  opacity: 0.38;
  cursor: default;
}

.map-ocean {
  fill: var(--ocean);
}

.map-country {
  fill: var(--land);
  stroke: var(--border);
  stroke-width: 0.52;
  vector-effect: non-scaling-stroke;
}

.map-country.quiz-country {
  fill: #f1f2e9;
}

.map-country.highlighted {
  fill: var(--highlight);
  stroke: #9b5c10;
  stroke-width: 2.1;
  vector-effect: non-scaling-stroke;
}

.target-halo {
  fill: rgba(242, 162, 58, 0.18);
  stroke: #a7600d;
  stroke-width: 2.2;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.map-pin {
  fill: #d63e34;
  stroke: white;
  stroke-width: 2.2;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.map-pin.correct-pin {
  fill: #238557;
}

.map-pin.other-pin {
  fill: #553b99;
}

.map-note {
  margin: 10px 0 0;
  font-size: 0.8rem;
  text-align: center;
}

.map-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin-top: 15px;
}

.map-selection {
  min-width: 150px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: left;
}

.review-heading {
  align-items: flex-start;
  margin-bottom: 22px;
}

.review-heading h2 {
  margin-bottom: 7px;
  font-size: clamp(1.45rem, 3vw, 2rem);
}

.solution {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  padding: 8px 12px;
  border-radius: 11px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-weight: 850;
}

.solution .answer-flag {
  font-size: 1.55rem;
}

.review-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.review-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(180px, 1.5fr) auto;
  gap: 15px;
  align-items: center;
  min-height: 63px;
  padding: 10px 12px 10px 16px;
  border: 1px solid #dfe6e1;
  border-radius: 13px;
  background: #fbfcfb;
}

.review-player {
  font-weight: 850;
}

.review-answer {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  color: #536159;
  overflow-wrap: anywhere;
}

.review-answer .answer-flag {
  font-size: 1.55rem;
}

.points-control {
  display: flex;
  gap: 6px;
  align-items: center;
}

.points-control select {
  width: auto;
  min-width: 92px;
  min-height: 40px;
  padding: 0 9px;
}

.points-badge {
  min-width: 75px;
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.review-help {
  margin: 17px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.results-screen {
  max-width: 780px;
  margin: 40px auto 0;
  text-align: center;
}

.results-screen h1 {
  margin-inline: auto;
}

.ranking-list {
  display: grid;
  gap: 10px;
  margin: 32px auto 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.ranking-list li {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 13px;
  align-items: center;
  min-height: 61px;
  padding: 10px 17px 10px 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
}

.rank-number {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 11px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-weight: 900;
}

.rank-name {
  font-weight: 850;
}

.rank-score {
  color: var(--muted);
  font-weight: 850;
}

@media (max-width: 780px) {
  .game-shell {
    padding-top: 18px;
  }

  .home-screen,
  .lobby-grid {
    grid-template-columns: 1fr;
  }

  .home-screen {
    gap: 36px;
    min-height: auto;
  }

  .hero-copy h1 {
    font-size: clamp(2.8rem, 14vw, 4.4rem);
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .field-wide {
    grid-column: auto;
  }

  .review-row {
    grid-template-columns: 1fr auto;
  }

  .review-answer {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (max-width: 520px) {
  .topbar,
  .game-shell {
    width: min(100% - 22px, 1120px);
  }

  .topbar {
    min-height: 62px;
  }

  .connection-status {
    font-size: 0;
  }

  .connection-status::before {
    width: 10px;
    height: 10px;
  }

  .section-heading,
  .round-header {
    align-items: flex-start;
  }

  .section-heading h1,
  .round-header h1 {
    font-size: 2rem;
  }

  .room-code-box {
    min-width: 104px;
  }

  .choices-grid,
  .text-answer {
    grid-template-columns: 1fr;
  }

  .choice-button {
    min-height: 57px;
  }

  .answer-card,
  .review-card {
    padding: 18px 13px;
    border-radius: 18px;
  }

  .map-zoom-controls {
    top: 7px;
    right: 7px;
  }

  .map-zoom-button {
    width: 44px;
    height: 44px;
  }

  .review-heading {
    display: grid;
  }

  .button-row {
    flex-wrap: wrap;
  }

  .button-row .button {
    flex: 1 1 180px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
