:root {
  --game-ink: #243244;
  --game-muted: #65758b;
  --game-paper: rgba(255, 255, 255, 0.92);
  --game-panel: rgba(255, 255, 255, 0.96);
  --game-line: rgba(71, 85, 105, 0.16);
  --game-blue: #2563eb;
  --game-cyan: #0891b2;
  --game-green: #16a34a;
  --game-gold: #d89b12;
  --game-red: #dc2626;
  --shadow-soft: 0 18px 46px rgba(30, 41, 59, 0.16);
  --shadow-crisp: 0 10px 24px rgba(30, 41, 59, 0.12);
}

body.visual-upgrade {
  color: var(--game-ink);
  background:
    linear-gradient(120deg, rgba(14, 165, 233, 0.11), rgba(22, 163, 74, 0.08) 42%, rgba(245, 158, 11, 0.1)),
    linear-gradient(180deg, #eef8ff 0%, #f8fbf4 52%, #fff8ec 100%);
}

body.visual-upgrade header {
  border-color: rgba(37, 99, 235, 0.14);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 30px rgba(30, 41, 59, 0.08);
  backdrop-filter: blur(14px);
}

body.visual-upgrade header h1 {
  color: #1f365c;
}

body.visual-upgrade header [data-lucide="map"] {
  color: var(--game-cyan);
  filter: drop-shadow(0 3px 5px rgba(8, 145, 178, 0.2));
}

body.visual-upgrade header .h-2 {
  height: 0.58rem;
  padding: 2px;
  background: rgba(148, 163, 184, 0.2);
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.12);
}

#progressBar {
  border-radius: 999px;
  background: linear-gradient(90deg, #22c55e, #06b6d4 54%, #f59e0b);
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.45);
}

.map-shell {
  overflow: visible;
  border-color: rgba(255, 255, 255, 0.86) !important;
  background: #dff7ff;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.7),
    inset 0 -30px 60px rgba(15, 118, 110, 0.16),
    0 28px 70px rgba(15, 23, 42, 0.18);
  isolation: isolate;
}

.map-shell::before {
  content: "";
  position: absolute;
  inset: 3.8%;
  z-index: 2;
  border-radius: 999px;
  pointer-events: none;
  background:
    radial-gradient(circle at 24% 24%, rgba(255, 255, 255, 0.62), transparent 12%),
    radial-gradient(circle at 76% 30%, rgba(250, 204, 21, 0.28), transparent 13%),
    radial-gradient(circle at 63% 78%, rgba(34, 197, 94, 0.2), transparent 16%);
  box-shadow: inset 0 0 0 8px rgba(255, 255, 255, 0.22);
}

.map-shell::after {
  content: "";
  position: absolute;
  inset: 8%;
  z-index: 4;
  border-radius: 999px;
  pointer-events: none;
  border: 2px dashed rgba(255, 255, 255, 0.6);
  animation: routeSparkle 4.2s linear infinite;
}

.map-backdrop {
  position: absolute;
  inset: -1%;
  z-index: 1;
  width: 102%;
  height: 102%;
  object-fit: cover;
  opacity: 0.58;
  filter: saturate(1.03) contrast(0.96);
  clip-path: circle(49% at 50% 50%);
  border-radius: 999px;
  pointer-events: none;
}

.route-svg {
  z-index: 5;
  opacity: 0.92 !important;
  filter: drop-shadow(0 3px 0 rgba(255, 255, 255, 0.92)) drop-shadow(0 8px 12px rgba(37, 99, 235, 0.2));
}

.route-svg circle {
  stroke: rgba(30, 64, 175, 0.58);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 10 12;
}

#stationsContainer {
  position: absolute;
  inset: 0;
  z-index: 12;
}

#stationsContainer > div > div:first-child {
  background: rgba(255, 255, 255, 0.94) !important;
  border-color: rgba(255, 255, 255, 0.85) !important;
  box-shadow:
    0 12px 26px rgba(15, 23, 42, 0.16),
    inset 0 0 0 1px rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
}

#stationsContainer > div > div:first-child::before {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 18px;
  background: conic-gradient(from 90deg, rgba(6, 182, 212, 0), rgba(6, 182, 212, 0.32), rgba(245, 158, 11, 0.28), rgba(6, 182, 212, 0));
  opacity: 0;
  z-index: -1;
  transition: opacity 0.25s ease;
}

#stationsContainer > div > div:first-child:has(+ div.bg-blue-600)::before,
#stationsContainer > div > div:first-child[class*="bg-amber-100"]::before {
  opacity: 1;
  animation: ladderGlow 1.8s ease-in-out infinite;
}

#stationsContainer > div > div:first-child[class*="bg-amber-100"] {
  box-shadow:
    0 0 0 5px rgba(250, 204, 21, 0.22),
    0 18px 35px rgba(245, 158, 11, 0.25);
}

#stationsContainer svg {
  stroke-width: 2.2;
}

#stationsContainer > div > div:last-child {
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(8px);
}

#arisElement {
  width: 64px;
  height: 68px;
  display: grid;
  place-items: end center;
  filter: drop-shadow(0 11px 12px rgba(15, 23, 42, 0.26));
}

.aris-sprite {
  width: 64px;
  height: 64px;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
  animation: arisIdle 2.2s ease-in-out infinite;
}

.travel-dust {
  position: absolute;
  left: 4px;
  bottom: 4px;
  width: 34px;
  height: 12px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0 2px, transparent 3px);
  background-size: 9px 9px;
  opacity: 0.72;
  filter: blur(0.2px);
  animation: dustTrail 0.8s linear infinite;
}

body:has(#playingText:not(.hidden)) .aris-sprite {
  animation: arisTravel 0.56s ease-in-out infinite;
}

body:has(#feedbackMsg:not(.hidden)) .aris-sprite,
body:has(#feedbackMsg:not(.hidden)) #encounterContainer {
  animation: wrongDegreeShake 0.42s ease-in-out;
}

#controlsContainer {
  margin-top: 1.25rem !important;
}

#playBtn,
#endScreen button,
#tasksContainer button {
  border-radius: 10px !important;
  transform: translateZ(0);
}

#playBtn {
  background: linear-gradient(135deg, #16a34a, #0891b2) !important;
  box-shadow: 0 14px 28px rgba(8, 145, 178, 0.22);
}

#playBtn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(8, 145, 178, 0.28);
}

#playingText {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: #1f5672 !important;
  font-weight: 800;
}

#playingText.hidden {
  display: none !important;
}

#playingText::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #22c55e, #06b6d4);
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.6);
  animation: routeSparkle 1.2s linear infinite;
}

#encounterContainer,
#travelGuidePanel {
  border-radius: 8px !important;
  border-color: rgba(59, 130, 246, 0.16) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.94)),
    var(--game-panel) !important;
  box-shadow: var(--shadow-soft) !important;
  backdrop-filter: blur(14px);
}

#encounterContainer {
  position: relative;
  overflow: hidden;
}

#encounterContainer::before {
  content: "";
  position: absolute;
  top: -36px;
  right: -24px;
  width: 130px;
  height: 130px;
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(250, 204, 21, 0.5), rgba(14, 165, 233, 0.22)),
    repeating-linear-gradient(135deg, transparent 0 11px, rgba(255, 255, 255, 0.55) 12px 16px);
  opacity: 0.64;
  pointer-events: none;
}

#encounterContainer::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 18px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 3px solid rgba(217, 119, 6, 0.8);
  box-shadow:
    inset 0 0 0 6px rgba(253, 230, 138, 0.88),
    0 0 22px rgba(245, 158, 11, 0.26);
  opacity: 0.28;
  animation: goldBurst 2.7s ease-in-out infinite;
  pointer-events: none;
}

#encounterTitle {
  color: #17365d !important;
}

#encounterDesc {
  color: var(--game-muted) !important;
  line-height: 1.45;
}

#feedbackMsg {
  border-radius: 8px !important;
  background: #fff1f2 !important;
  color: var(--game-red) !important;
  border-color: rgba(220, 38, 38, 0.24) !important;
  box-shadow: 0 10px 22px rgba(220, 38, 38, 0.12);
}

#tasksContainer > div:first-child {
  position: relative;
  overflow: hidden;
  border-radius: 8px !important;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(240, 249, 255, 0.86)),
    #f8fafc !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

#tasksContainer > div:first-child::after {
  content: "";
  position: absolute;
  inset: auto 12px 8px auto;
  width: 58px;
  height: 24px;
  border-radius: 4px;
  background:
    linear-gradient(90deg, rgba(217, 119, 6, 0.16), rgba(6, 182, 212, 0.14)),
    repeating-linear-gradient(90deg, transparent 0 8px, rgba(30, 64, 175, 0.22) 9px 11px);
  opacity: 0.5;
  transform: rotate(-5deg);
  animation: scaleSparkle 2.3s ease-in-out infinite;
}

#tasksContainer button {
  min-height: 50px;
  color: #243244 !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(240, 249, 255, 0.86)) !important;
  border-color: rgba(37, 99, 235, 0.18) !important;
  box-shadow: 0 10px 20px rgba(30, 41, 59, 0.08);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

#tasksContainer button:hover {
  color: #164e63 !important;
  border-color: rgba(6, 182, 212, 0.5) !important;
  background:
    linear-gradient(180deg, rgba(236, 254, 255, 0.98), rgba(255, 251, 235, 0.88)) !important;
  box-shadow: 0 14px 26px rgba(8, 145, 178, 0.16);
  transform: translateY(-1px);
}

#dotsContainer > div {
  width: 0.72rem !important;
  height: 0.72rem !important;
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 4px 8px rgba(15, 23, 42, 0.12);
}

.crew-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  gap: 5px;
  min-height: 52px;
  margin: -0.25rem 0 0.85rem;
  padding: 6px;
  border: 1px solid rgba(14, 165, 233, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(236, 254, 255, 0.8), rgba(255, 251, 235, 0.72));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.crew-strip img {
  width: 100%;
  height: 44px;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 5px 5px rgba(15, 23, 42, 0.16));
}

#travelGuidePanel h2 {
  color: #17365d !important;
  border-color: rgba(37, 99, 235, 0.12) !important;
}

#travelGuideList {
  scrollbar-width: thin;
  scrollbar-color: rgba(8, 145, 178, 0.4) rgba(226, 232, 240, 0.5);
}

#travelGuideList > div {
  position: relative;
  border-radius: 8px !important;
  border-color: rgba(14, 165, 233, 0.16) !important;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 251, 235, 0.84)) !important;
  box-shadow: 0 8px 16px rgba(30, 41, 59, 0.07);
}

#travelGuideList > div::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(#06b6d4, #f59e0b);
}

#endScreen {
  background:
    linear-gradient(rgba(15, 23, 42, 0.58), rgba(15, 23, 42, 0.66)),
    url("maps/greece-travel-board.png") center / cover !important;
  backdrop-filter: blur(6px);
}

#endScreen > div {
  position: relative;
  overflow: hidden;
  border-radius: 8px !important;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.94) !important;
  box-shadow: 0 32px 80px rgba(15, 23, 42, 0.36) !important;
}

#endScreen > div::before {
  content: "";
  position: absolute;
  inset: -18% -18% auto auto;
  width: 190px;
  height: 190px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(250, 204, 21, 0.34), transparent 68%);
  animation: goldBurst 2s ease-in-out infinite;
}

#endScreen [data-lucide="award"] {
  filter: drop-shadow(0 10px 20px rgba(217, 119, 6, 0.28));
  animation: goldenStamp 1.8s ease-in-out infinite;
}

#endScreen .bg-amber-50 {
  border-radius: 8px !important;
  background:
    linear-gradient(135deg, rgba(255, 251, 235, 0.96), rgba(254, 243, 199, 0.94)) !important;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.78),
    0 18px 35px rgba(217, 119, 6, 0.14) !important;
}

#endScreen button {
  background: linear-gradient(135deg, #2563eb, #0891b2) !important;
  box-shadow: 0 16px 30px rgba(37, 99, 235, 0.24) !important;
}

body:has(#endScreen:not(.hidden)) .map-shell {
  animation: finalMapGlow 1.4s ease-in-out infinite alternate;
}

@keyframes arisIdle {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-2px) scale(1.015); }
}

@keyframes arisTravel {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-5px) rotate(2deg); }
}

@keyframes dustTrail {
  from { background-position: 0 0; opacity: 0.3; }
  to { background-position: -18px 0; opacity: 0.78; }
}

@keyframes routeSparkle {
  from { filter: hue-rotate(0deg) brightness(1); }
  50% { filter: hue-rotate(12deg) brightness(1.08); }
  to { filter: hue-rotate(0deg) brightness(1); }
}

@keyframes ladderGlow {
  0%, 100% { transform: scale(1); opacity: 0.55; }
  50% { transform: scale(1.06); opacity: 0.86; }
}

@keyframes scaleSparkle {
  0%, 100% { opacity: 0.34; transform: rotate(-5deg) translateY(0); }
  50% { opacity: 0.72; transform: rotate(-5deg) translateY(-2px); }
}

@keyframes goldBurst {
  0%, 100% { transform: scale(0.96); opacity: 0.25; }
  50% { transform: scale(1.08); opacity: 0.55; }
}

@keyframes goldenStamp {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-2px) rotate(2deg); }
}

@keyframes wrongDegreeShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

@keyframes finalMapGlow {
  from { box-shadow: 0 28px 70px rgba(15, 23, 42, 0.18), 0 0 0 rgba(250, 204, 21, 0); }
  to { box-shadow: 0 28px 70px rgba(15, 23, 42, 0.18), 0 0 44px rgba(250, 204, 21, 0.4); }
}

@media (max-width: 640px) {
  body.visual-upgrade header {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  body.visual-upgrade header h1 {
    font-size: 1rem !important;
    line-height: 1.2;
  }

  #arisElement {
    width: 54px;
    height: 58px;
  }

  .aris-sprite {
    width: 54px;
    height: 54px;
  }

  .crew-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .crew-strip img {
    height: 38px;
  }

  #tasksContainer button {
    min-height: 46px;
    font-size: 0.9rem;
  }
}

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