:root {
  color-scheme: light;
  --ink: #17211d;
  --ink-dark: #0e1412;
  --muted: #5f6f68;
  --line: #dce5df;
  --panel: #ffffff;
  --field-light: #f3f4f6;
  --field: #e5e7eb;
  --field-dark: #d1d5db;
  --accent: #f0003c;
  --accent-dark: #a30136;
  --good: #157f5b;
  --shadow: 0 18px 50px rgba(23, 33, 29, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  background: var(--ink);
  color: var(--ink);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

button {
  font: inherit;
}

.app-shell {
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  display: block;
  height: 100lvh;
  min-height: 100lvh;
  overflow: hidden;
  position: relative;
}

.game-panel-container {
  z-index: 3000;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  padding: 12px;
}

.game-panel {
  max-width: 600px;
  margin-inline: auto;
  box-shadow: var(--shadow);
  background: var(--field-dark);
  border-radius: 20px;
}

.game-panel-front {
  color: var(--ink);
  border-radius: 20px;
  padding: 10px;
  gap: 10px;
  display: flex;
  flex-direction: column;
  transform: translateY(-4px);
  background: var(--panel);
}

.rounds-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.inset-box {
  box-shadow: inset 0 2px 0 0 var(--field-dark);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.topbar > div:first-child {
  max-width: calc(100% - 180px);
}

.map-icon {
  width: 25px;
  height: 25px;
}

h1 {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1;
}

.scorebox {
  min-height: 40px;
  display: flex !important;
  align-items: baseline;
  gap: 3px;
  justify-content: center;
  padding-top: 10px !important;
}

.scorebox span {
  font-weight: 850;
  line-height: 1;
  font-size: 1.35rem;
}

.scorebox small {
  color: #c8d5ce;
  font-weight: 750;
  font-size: 0.76rem;
}

.status-grid {
  display: grid;
  font-size: 0.8rem;
  gap: 10px;
  grid-template-columns: 0.45fr 1.55fr;
}

.tap-prompt {
  display: flex;
  justify-content: center;
  align-items: center;
}

.status-grid > div {
  border-radius: 12px;
  min-height: 72px;
  padding: 12px;
  background: var(--field);
  min-height: 48px;
  padding: 7px 8px;
}

.label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  font-size: 0.62rem;
}

.status-grid strong {
  font-size: 0.84rem;
  line-height: 1.15;
}

.controls {
  gap: 10px;
  display: block;
  min-height: 0;
}

.layer-options {
  box-shadow: 0 10px 28px rgba(23, 33, 29, 0.28);
  background: var(--field-dark);
  border-radius: 20px;
  display: none;
  min-width: 170px;
  position: absolute;
  right: 10px;
  top: 60px;
  z-index: 700;
}

.layer-options-front {
  background: var(--panel);
  border: 1px solid var(--field-dark);
  border-radius: 20px;
  padding: 10px;
  display: flex;
  gap: 10px;
  transform: translateY(-4px);
}

.segmented {
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-width: 0;
  padding: 3px;
}

.btn-pushable {
  border: none;
  border-radius: 12px;
  padding: 0;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary {
  background: var(--accent-dark);
}

.btn-secondary {
  background: var(--field-dark);
  color: var(--ink);
}

.btn-ink {
  background: #000;
}

.btn-front {
  display: block;
  padding: 12px 20px;
  border-radius: 12px;
  transform: translateY(-4px);
}

.btn-front-svg {
  padding: 6px 8px;
}

.btn-front-primary {
  color: #fff;
  background: var(--accent);
}

.btn-front-secondary {
  color: var(--ink);
  background: var(--field-light);
  border: 1px solid var(--field-dark);
}

.btn-front-ink {
  color: #fff;
  background: var(--ink);
}

.btn-pushable:active .front {
  transform: translateY(-2px);
}

.btn-pushable:focus:not(:focus-visible) {
  outline: none;
}

.btn-next {
  box-shadow: 0 10px 28px rgba(23, 33, 29, 0.28);
  height: 48px;
  left: 16px;
  position: fixed;
  right: 16px;
  top: auto;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 4000;
  max-width: 600px;
  margin-inline: auto;
}

.map-wrap {
  position: absolute;
  inset: 0;
  height: 100dvh;
  min-height: 0;
}

#map {
  inset: 0;
  position: absolute;
  width: 100%;
}

.leaflet-container img,
.leaflet-tile {
  max-width: none;
}

.share-button {
  width: 100%;
  margin-top: 8px;
  margin-bottom: 4px;
  right: 16px;
}

.rounds {
  z-index: 4;
  display: none;
  background: var(--panel);
  border-right: 0;
  padding: 6px 12px max(8px, env(safe-area-inset-bottom));
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  top: auto;
  z-index: 3500;
  max-width: 600px;
  margin-inline: auto;
  border-radius: 20px 20px 0 0;
}

.rounds-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  font-weight: 850;
  justify-content: space-between;
  min-height: 34px;
  padding: 4px 0;
  width: 100%;
}

.rounds ol {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0;
  max-height: 150px;
  overflow: hidden;
  transition:
    max-height 160ms ease,
    visibility 160ms ease;
}

.rounds.collapsed ol {
  max-height: 0;
  visibility: hidden;
}

.rounds li {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 24px;
}

.rounds.finished {
  display: block;
}

.rounds-toggle strong {
  color: var(--good);
  font-size: 0.82rem;
}

.round-name {
  font-size: 0.76rem;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.round-score {
  font-size: 0.76rem;
  font-weight: 850;
}

.target-marker {
  align-items: center;
  background: var(--accent);
  border: 3px solid #fff;
  border-radius: 999px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
  color: #fff;
  display: flex;
  font-size: 13px;
  font-weight: 900;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.layer-menu {
  z-index: 800;
}

.button-group {
  display: flex;
  gap: 10px;
}

.layer-menu.open .layer-options {
  display: block;
}
