:root {
  --accent: #7de7ff;
  --accent-strong: #b6f5ff;
  --accent-dim: rgb(125 231 255 / 42%);
  --accent-soft: rgb(125 231 255 / 20%);
  --panel: rgb(5 19 30 / 84%);
  --panel-border: rgb(123 222 255 / 35%);
  --panel-shadow: 0 16px 34px rgb(0 0 0 / 34%);
  --button-grad-top: rgb(25 96 125 / 80%);
  --button-grad-bottom: rgb(12 59 81 / 86%);
  --danger: #ff9f9f;
  --transition-fast: 0.16s ease;
  --transition-normal: 0.35s ease;
}

* {
  box-sizing: border-box;
}

button {
  cursor: pointer;
}

select {
  cursor: pointer;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  color: var(--accent);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: url("../Background/DashboardBackground.webp") no-repeat center center fixed;
  background-size: cover;
  position: relative;
  transition: background-image 0.7s ease-in-out;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 10% 10%, rgb(18 84 114 / 26%), transparent 28%),
    radial-gradient(circle at 84% 24%, rgb(16 80 109 / 22%), transparent 30%),
    rgb(5 12 18 / 74%);
  z-index: 0;
  pointer-events: none;
}

#scale-wrapper {
  position: relative;
  z-index: 1;
  width: min(1540px, calc(100vw - 20px));
  margin: 0 auto;
  padding: 20px 0 28px;
}

#scale-wrapper.hidden {
  display: none;
}

#main-ui {
  width: 100%;
  min-height: calc(100vh - 44px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

#dashboard-header-row {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
}

#dashboard-header {
  text-align: center;
  cursor: pointer;
  flex: 0 1 760px;
  min-width: 0;
  padding-top: 34px;
}

#dashboard-header h1 {
  margin: 0 0 4px;
  font-size: clamp(3.15rem, 9.4vw, 6.4rem);
  line-height: 1;
  letter-spacing: 1px;
  text-shadow: 0 0 28px rgb(0 0 0 / 55%);
}

#dashboard-header p {
  margin: 0;
  font-size: clamp(1.03rem, 2vw, 1.24rem);
  color: var(--accent-strong);
  text-shadow: 0 0 12px rgb(0 0 0 / 65%);
}

.dashboard-corner {
  position: relative;
  z-index: 5;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 11px 13px;
  box-shadow: inset 0 0 0 1px rgb(170 241 255 / 9%), var(--panel-shadow);
  backdrop-filter: blur(10px);
  color: var(--accent-strong);
  width: min(230px, 100%);
}

.corner-left {
  flex: 0 0 230px;
  max-width: 230px;
  text-align: left;
}

.corner-right {
  flex: 0 0 230px;
  max-width: 230px;
  text-align: left;
}

.dashboard-corner button,
.mode-btn,
.play-btn,
.discord-button,
#back-button,
#game-view button {
  border: 1px solid var(--panel-border);
  border-radius: 9px;
  padding: 7px 11px;
  background: linear-gradient(180deg, var(--button-grad-top), var(--button-grad-bottom));
  color: #e8fbff;
  cursor: pointer;
  font: inherit;
  transition:
    transform var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.dashboard-corner button:hover,
.mode-btn:hover,
.play-btn:hover,
.discord-button:hover,
#back-button:hover,
#game-view button:hover {
  transform: translateY(-1px);
  border-color: rgb(162 243 255 / 70%);
  box-shadow: 0 0 0 1px rgb(146 241 255 / 34%);
}

#open-updates-button {
  margin-top: 8px;
  width: 100%;
}

.username-container {
  display: grid;
  gap: 6px;
}

.dashboard-discord {
  width: 100%;
  margin-top: 10px;
  flex: 0 0 auto;
}

#dashboard-meta-right .dashboard-discord {
  width: 100%;
}

.username-container label {
  font-size: 0.78rem;
  opacity: 0.9;
}

#username-input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgb(2 15 24 / 78%);
  color: #dff8ff;
  padding: 6px 10px;
  font: inherit;
  font-size: 0.92rem;
}

#username-input::placeholder {
  color: rgb(198 243 255 / 66%);
}

#back-button {
  position: fixed;
  top: 14px;
  left: 14px;
  display: none;
  z-index: 120;
}

.entire-map-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  opacity: 1;
  transition: opacity var(--transition-normal);
}

#dashboard-top-row {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
}

.gamemode-container {
  width: 100%;
  max-width: 1360px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  opacity: 1;
  transition: opacity var(--transition-normal);
}

.gamemode-card {
  appearance: none;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
  padding: 16px 13px;
  text-align: left;
  color: #eafcff;
  background-color: #0c1f2c;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  box-shadow:
    inset 0 0 0 1px rgb(171 245 255 / 8%),
    0 14px 26px rgb(0 0 0 / 34%);
  transition:
    transform var(--transition-fast),
    border-color var(--transition-fast),
    filter var(--transition-fast),
    opacity var(--transition-fast);
}

.gamemode-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgb(2 8 13 / 10%), rgb(2 8 13 / 44%)),
    radial-gradient(circle at 78% 22%, rgb(125 231 255 / 19%), transparent 32%);
  z-index: 0;
}

.gamemode-card > * {
  position: relative;
  z-index: 1;
}

.gamemode-card:hover {
  transform: translateY(-2px);
  border-color: rgb(162 243 255 / 70%);
}

.gamemode-card:focus-visible {
  outline: 2px solid rgb(162 243 255 / 75%);
  outline-offset: 2px;
}

.gamemode-card .card-title {
  width: 100%;
  font-size: 1.16rem;
  font-weight: 700;
  text-align: center;
  text-shadow: 0 0 14px rgb(0 0 0 / 90%);
  line-height: 1.16;
  min-height: 2.32em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.gamemode-card .card-meta {
  margin-top: 7px;
  font-size: 0.92rem;
  color: #c8f5ff;
  text-shadow: 0 0 10px rgb(0 0 0 / 75%);
  width: 100%;
  text-align: center;
}

.gamemode-card.is-unplayable {
  filter: saturate(0.8) brightness(0.92) blur(0.35px);
  opacity: 0.72;
  cursor: not-allowed;
}

.gamemode-card.is-unplayable .card-meta {
  color: var(--danger);
}

.gamemode-card.is-unplayable::before {
  background: linear-gradient(180deg, rgb(2 8 13 / 10%), rgb(2 8 13 / 38%));
}

.gamemode-card:not(.entire-map-card) {
  aspect-ratio: 16 / 9;
}

.entire-map {
  width: min(620px, 100%);
}

.entire-map-card {
  flex: 0 1 620px;
  min-height: 148px;
  background-image:
    linear-gradient(150deg, rgb(14 98 132 / 20%), rgb(8 57 77 / 32%)),
    url("../Background/Entire Map.webp");
  background-size: 100% 100%, 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  border-color: rgb(154 240 255 / 62%);
}

.entire-map-card .card-title {
  font-size: clamp(1.16rem, 1.9vw, 1.52rem);
  min-height: 0;
  text-align: center;
}

.discord-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  width: auto;
  min-height: 42px;
  padding: 9px 13px;
  font-size: 1rem;
}

.discord-button img {
  width: 20px;
  height: 20px;
}

.updates-credits {
  margin-top: 12px;
  width: 100%;
  color: #cdefff;
  font-size: 0.92rem;
  line-height: 1.45;
  text-align: center;
  opacity: 0.96;
}

.panel {
  display: none;
  flex-direction: column;
  align-items: center;
  width: min(760px, 100%);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1px rgb(151 239 255 / 8%), var(--panel-shadow);
  padding: 18px;
  opacity: 0;
  transform: translateY(8px) scale(0.985);
  transition:
    opacity var(--transition-normal),
    transform var(--transition-normal);
}

.panel.active {
  opacity: 1;
  transform: translateY(0) scale(1);
}

#leaderboard {
  gap: 12px;
  width: min(820px, 100%);
  padding: 22px;
}

#panel-title {
  margin: 0;
  text-align: center;
}

#mode-description {
  margin: 0;
  color: #c8f5ff;
  font-size: 0.98rem;
  text-align: center;
  min-height: 2.8em;
}

.mode-buttons {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mode-btn.active {
  border-color: rgb(181 250 255 / 95%);
  box-shadow: 0 0 0 1px rgb(146 241 255 / 40%);
}

.play-btn-main {
  width: min(340px, 100%);
  min-height: 46px;
  margin-top: 2px;
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: 0.2px;
  background: linear-gradient(180deg, rgb(50 128 87 / 92%), rgb(26 94 61 / 95%));
  border-color: rgb(149 255 202 / 58%);
}

.leaderboard-placeholder {
  width: 100%;
  border: 1px dashed var(--accent-dim);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  color: #c7f3ff;
}

/* Update notes */
#update-notes.panel {
  align-items: stretch;
  width: min(1200px, calc(100vw - 30px));
  background: none;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  padding: 0;
  font-size: 1.04rem;
}

.update-notes-layout {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(430px, 500px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.update-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: hidden;
}

.update-notes-card {
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1px rgb(151 239 255 / 8%), var(--panel-shadow);
}

.column-title {
  margin: 0;
  color: var(--accent-strong);
  letter-spacing: 0.3px;
}

.locations-title {
  grid-column: auto;
  grid-row: auto;
}

.updates-title {
  grid-column: auto;
  grid-row: auto;
}

.coverage-column {
  min-width: 0;
}

.coverage-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  min-height: 52px;
  padding: 8px 10px;
  background: rgb(2 15 24 / 78%);
}

.coverage-count {
  font-size: 1.05rem;
  color: #cff5ff;
}

.coverage-select .select-shell {
  position: relative;
}

.coverage-select select,
#game-map-select {
  appearance: none;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgb(2 15 24 / 88%);
  color: #dcf9ff;
  font: inherit;
  padding: 7px 28px 7px 10px;
}

.coverage-select .select-caret {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #ccf4ff;
  font-size: 0.82rem;
}

#coverage-card {
  margin: 0;
  padding: 8px;
  display: block;
  overflow: hidden;
}

#coverage-map {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  border: 1px solid var(--accent-dim);
  background: #09131a;
  cursor: grab;
  touch-action: none;
}

.notes-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: hidden;
  align-self: start;
}

.coverage-column {
  align-self: start;
}

#updates-card {
  flex: 1 1 auto;
  height: auto;
  max-height: none;
  min-height: 0;
  overflow-y: scroll;
  overflow-x: hidden;
  padding: 16px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#updates-card::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.updates-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

#updates-latest-wrap {
  margin-bottom: 2px;
}

.updates-section-title {
  margin: 0 0 6px;
  color: #bff2ff;
}

.updates-scroll {
  display: grid;
  gap: 10px;
}

.update-card {
  border: 1px solid var(--accent-dim);
  border-radius: 10px;
  background: rgb(4 22 33 / 88%);
  padding: 12px;
}

.update-card h4 {
  margin: 0 0 6px;
}

.update-meta {
  opacity: 0.84;
  margin-bottom: 8px;
}

.update-changes {
  margin: 0;
  padding-left: 16px;
  display: grid;
  gap: 4px;
}

/* Game */
#game-view {
  --game-map-base-size: clamp(260px, 32vw, 450px);
  --game-map-scale: 1;
  --game-map-panel-size: calc(var(--game-map-base-size) * var(--game-map-scale));
  position: fixed;
  inset: 0;
  display: none;
  z-index: 80;
  background: #000;
  color: #fff;
}

#game-view,
#game-view * {
  user-select: none;
  -webkit-user-select: none;
}

#game-view.active {
  display: block;
}

#game-viewer {
  width: 100%;
  height: 100%;
}

#game-top-info {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 105;
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: none;
  padding: 0;
}

#game-round-display,
#game-timer-display {
  border: 1px solid var(--accent-soft);
  border-radius: 7px;
  background: rgb(0 0 0 / 33%);
  color: #e8fbff;
  font-size: 0.95rem;
  padding: 6px 10px;
  user-select: none;
}

#game-compass-bar {
  position: fixed;
  top: 52px;
  left: 50%;
  transform: translateX(-50%);
  width: 228px;
  height: 38px;
  background: rgb(0 0 0 / 45%);
  border: 1px solid var(--accent);
  border-radius: 19px;
  overflow: hidden;
  z-index: 100;
  box-shadow: 0 0 12px #0ff50a33 inset;
  pointer-events: none;
}

#game-compass-near {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#game-compass-strip {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  display: flex;
  align-items: center;
  will-change: transform;
}

#game-compass-strip span {
  flex: 0 0 76px;
  text-align: center;
  color: var(--accent-strong);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-shadow: 0 0 14px rgb(0 0 0 / 76%);
  opacity: 0.98;
}

#game-compass-bar .pointer {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 100%;
  border-radius: 2px;
  background: #ff6868;
  box-shadow: 0 0 8px #ff6868;
}

#game-right-panel {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: var(--game-map-panel-size);
  z-index: 110;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transform-origin: bottom right;
  transition: transform 0.18s ease;
}

#game-right-panel > * {
  width: 100%;
  max-width: 100%;
}

#game-map-toolbar {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: rgb(5 19 30 / 88%);
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

#game-map-controls-inline {
  display: flex;
  align-items: center;
  gap: 6px;
}

#game-map-controls-inline button {
  padding: 4px 10px;
  min-width: 34px;
  font-weight: 700;
}

.game-select-shell {
  position: relative;
}

.game-select-shell .select-caret {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #ccf4ff;
  font-size: 0.82rem;
}

#game-map-select {
  min-width: 102px;
  padding-right: 28px;
}

#game-map-container {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 2px solid var(--accent);
  border-radius: 11px;
  overflow: hidden;
  background: rgb(11 21 30 / 95%);
  box-shadow: 0 10px 24px rgb(0 0 0 / 36%);
}

#game-map-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

#game-submit {
  width: 100%;
  min-height: 40px;
  font-weight: 700;
}

#game-result {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 111;
  color: #d8f6ff;
  background: rgb(3 16 24 / 64%);
  border: 1px solid var(--accent-soft);
  border-radius: 8px;
  padding: 7px 9px;
  max-width: min(55vw, 480px);
}

#game-result:empty {
  display: none;
}

#game-loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  background-color: rgb(0 0 0 / 82%);
  background-size: cover;
  background-position: center;
  transition: opacity 0.24s ease;
}

#game-loading-screen.visible {
  opacity: 1;
  pointer-events: all;
}

#game-view .spinner {
  width: 58px;
  height: 58px;
  border: 5px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  margin-bottom: 13px;
  animation: game-spin 0.9s linear infinite;
}

#game-loading-text {
  color: #dff8ff;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 10px;
}

#game-loading-progress-track {
  width: min(360px, 78vw);
  height: 10px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  overflow: hidden;
  background: rgb(6 20 31 / 86%);
  box-shadow: inset 0 0 10px rgb(0 0 0 / 35%);
}

#game-loading-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgb(75 191 219), rgb(151 255 203));
  box-shadow: 0 0 12px rgb(141 243 255 / 42%);
  transition: width 0.18s ease;
}

#game-loading-progress-meta {
  margin-top: 8px;
  font-size: 0.86rem;
  color: #c2efff;
}

@keyframes game-spin {
  to {
    transform: rotate(360deg);
  }
}

#game-summary-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgb(0 0 0 / 84%);
  text-align: center;
  padding: 20px;
}

#game-summary-text {
  max-width: min(720px, 92vw);
}

#game-summary-buttons {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

#game-exit-button {
  display: none !important;
}

/* Responsive */
@media (max-width: 980px) {
  #game-view {
    --game-map-base-size: 330px;
  }

  #dashboard-header-row {
    flex-direction: column;
    gap: 10px;
  }

  #dashboard-header {
    width: 100%;
    flex: 0 1 auto;
    padding-top: 2px;
  }

  .gamemode-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gamemode-card .card-title {
    font-size: 1.05rem;
  }

  .gamemode-card .card-meta {
    font-size: 0.84rem;
  }

  #dashboard-top-row {
    flex-direction: column;
    max-width: 560px;
    gap: 10px;
  }

  .entire-map-card {
    flex: 0 0 auto;
    width: min(560px, 100%);
    text-align: center;
  }

  .corner-left,
  .corner-right {
    flex: 0 0 auto;
    max-width: none;
    width: min(560px, 100%);
  }

  .dashboard-discord {
    width: 100%;
  }

  .mode-buttons {
    grid-template-columns: 1fr;
  }

  .update-notes-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .update-column {
    min-height: auto;
  }

  #coverage-card {
    min-height: 0;
  }

  #updates-card {
    max-height: none;
    flex: 0 0 auto;
  }

  #game-right-panel {
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    width: var(--game-map-panel-size);
    bottom: 10px;
  }

  #game-result {
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(var(--game-map-panel-size) + 90px);
    max-width: min(92vw, 520px);
    text-align: center;
  }

  #game-top-info {
    top: 10px;
  }

  #game-compass-bar {
    top: 52px;
    width: 228px;
  }
}

@media (max-width: 620px) {
  #scale-wrapper {
    width: calc(100vw - 12px);
    padding-top: 10px;
  }

  #main-ui {
    gap: 12px;
  }

  #dashboard-header {
    padding-top: 0;
  }

  #back-button {
    top: 10px;
    left: 10px;
  }

  .gamemode-container {
    gap: 12px;
  }

  .entire-map-card {
    min-height: 102px;
  }

  #game-compass-bar {
    left: 50%;
    transform: translateX(-50%);
    width: min(92vw, 228px);
  }

  #game-map-select {
    min-width: 102px;
    font-size: 0.84rem;
  }
}
