* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #1a1a2e;
  color: #eee;
}

#loading.screen {
  z-index: 100;
}

#ui-overlay {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

.btn {
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  font-size: 1rem;
  text-transform: uppercase;
  font-weight: 500;
  transition: opacity 0.2s, background 0.15s;
}

.btn:active {
  opacity: 0.7;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-transparent {
  background: transparent;
  color: #fff;
}

.btn-transparent:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-white {
  background: #fff;
  color: #333;
}

.btn-white:hover {
  background: rgba(255, 255, 255, 0.8);
}

.btn-primary {
  background: #e94560;
  color: #fff;
}

.btn-primary:disabled {
  background: #555;
}

.btn-small {
  font-size: .9rem;
  padding: 4px 10px;
  border-radius: 8px;
}

#info-panel {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  border-radius: 20px;
  padding: 20px;
  max-width: 400px;
  width: 90%;
  z-index: 35;
  transition: opacity 0.3s, transform 0.3s;
}

#info-panel.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(20px);
}

#info-title {
  font-size: 1.6rem;
  margin-bottom: 8px;
  color: #333;
}

#info-desc {
  font-size: 1.2rem;
  color: #333;
  line-height: 1.2;
}

#btn-select-department {
  margin-top: 12px;
  width: 100%;
  padding: 10px;
  font-size: 0.9rem;
}

#btn-select-department.hidden {
  display: none;
}

#info-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: #888;
  font-size: 1.4rem;
  cursor: pointer;
}

/* Building map */
.building-map {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #8e8983;
  z-index: 1;
  touch-action: none;
  cursor: grab;
}

.building-map.grabbing {
  cursor: grabbing;
}

.map-stage {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.map-image {
  display: block;
  max-width: 100vw;
  max-height: 100vh;
  width: auto;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

.map-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.map-zoom-controls {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.46);
  padding: 7px;
  border-radius: 13px;
  z-index: 5;
  backdrop-filter: blur(9px);
  box-shadow: 0px -10px 17px 2px rgba(0, 0, 0, .1);
}

.btn-zoom {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1.2rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-zoom:active {
  background: rgba(255, 255, 255, 0.25);
}

.btn-zoom.active {
  background: #ffcc00;
  color: #1a1a2e;
  border-color: #ffcc00;
}

.zoom-level {
  color: #ffffff;
  font-size: 0.75rem;
  min-width: 36px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.budget {
  font-size: 0.9rem;
  color: #ffd54f;
  font-weight: 600;
}

.btn-action {
  background: #4caf50;
  color: #fff;
}

/* Card selection modal */
#card-selection {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70vw;
  max-width: 92vw;
  max-height: 80vh;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  border-radius: 20px;
  z-index: 45;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0px 10px 17px 2px rgba(0, 0, 0, .1);
}

#card-selection.hidden {
  display: none;
}

.card-modal-header {
  padding: 20px 20px 0;
  text-align: center;
}

#card-modal-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 6px;
}

#card-modal-budget {
  font-size: 2.6rem;
  color: #73ab7e;
  font-weight: 800;
  margin-bottom: 12px;
}

.card-modal-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  gap: 0;
}

.card-modal-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 20px;
}

#card-list {
  width: 40%;
  overflow-y: auto;
}

.card-list-item {
  padding: 12px 16px;
  cursor: pointer;
  border-left: 4px solid transparent;
  transition: background 0.15s;
  font-size: 1.3rem;
}

.card-list-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.card-list-item.selected {
  background: rgba(255, 255, 255, 0.33);
  border-left-color: #0d35c8;
}

.card-list-item.owned {
  border-left-color: #099d6e;
}

.card-list-item .card-list-name {
  font-weight: 600;
  color: #333;
}


.card-list-item .card-list-cost {
  font-size: 1rem;
  color: #0d35c8;
  margin-top: 2px;
}

.card-list-item .card-list-cost.red-cost {
  color: #e57373;
}

#card-detail {
  width: 60%;
  display: flex;
  flex-direction: column;
  padding: 5px 20px;
  overflow-y: auto;
}

#detail-title {
  font-size: 2.2rem;
  margin-bottom: 4px;
  color: #333;
}

#detail-desc {
  font-size: 1.4rem;
  color: #333;
  line-height: 1.15;
  margin-bottom: 40px;
  font-weight: 500;
}

#detail-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;

  margin-bottom: 40px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 1.2rem;
}

.stat-row .stat-label {
  color: #333;
}

.stat-row .stat-value {
  color: #333;
  font-weight: 600;
}

#btn-buy {
  align-self: flex-start;
}

.effective-against {
  margin-bottom: 12px;
  font-size: 1.4rem;
  color: #333;
  line-height: 1.5;
}

#btn-buy:disabled {
  background: #555;
  cursor: not-allowed;
  color: #fff;
}

/* Scrollbar */
#card-list::-webkit-scrollbar,
#card-detail::-webkit-scrollbar {
  width: 4px;
}

#card-list::-webkit-scrollbar-thumb,
#card-detail::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 2px;
}

/* Phase overlay */
#phase-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  z-index: 50;
}

#phase-overlay.hidden {
  display: none;
}

#phase-overlay .phase-text {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  text-align: center;
}

#phase-overlay .phase-sub {
  font-size: 0.9rem;
  color: #aaa;
  margin-bottom: 24px;
  text-align: center;
}

#phase-overlay .btn {
  font-size: 1rem;
  padding: 14px 40px;
}

/* Screens */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.screen.hidden {
  display: none;
}

.screen-box {
  text-align: center;
  padding: 40px;
}

.top-navbar {
  position: fixed;
  top: 1vh;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: rgba(255, 255, 255, 0.46);
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 10px;
  backdrop-filter: blur(9px);
  border-radius: 20px;
  box-shadow: 0px 10px 17px 2px rgba(0, 0, 0, .1);
}

.btn-navbar {
  background: transparent;
  color: #aaa;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: .85rem;
  white-space: nowrap;
}

.btn-navbar:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.btn-find-game {
  font-size: 0.9rem;
  padding: 10px 20px;
  margin: 0;
}

.btn-find-game.hidden {
  display: none;
}

.btn-end-game {
  font-size: 0.85rem;
  padding: 8px 18px;
  background: rgba(200, 60, 60, 0.85);
  color: #fff;
  border: 1px solid rgba(255, 100, 100, 0.3);
}

.btn-end-game:hover {
  background: rgba(220, 40, 40, 0.95);
}

.btn-end-game.hidden {
  display: none;
}

.btn-danger {
  background: #c62828;
  color: #fff;
}

.btn-danger:hover {
  background: #e53935;
}

.btn-danger.hidden {
  display: none;
}

.btn-secondary {
  background: #444;
  color: #ddd;
}

.btn-secondary:hover {
  background: #555;
}

.btn-secondary.hidden {
  display: none;
}

/* Confirm modal */
.confirm-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(255 255 255 / 60%);
  z-index: 120;
  backdrop-filter: blur(9px);
}
}

.confirm-modal.hidden {
  display: none;
}

.confirm-box {
  background: rgba(255, 255, 255, 0.6);
  border-radius: 20px;
  padding: 32px 40px;
  text-align: center;
  max-width: 360px;
  width: 90%;
  box-shadow: 0px 10px 17px 2px rgba(0, 0, 0, .1);
}

.confirm-text {
  font-size: 1.2rem;
  color: #333;
  margin: 0 0 24px;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.btn-large {
  font-size: 1.2rem;
  padding: 16px 48px;
}

.team-buttons {
  display: flex;
  gap: 16px;
  margin-top: 24px;
}

.btn-team {
  padding: 20px 32px;
  border-radius: 12px;
  min-width: 200px;
}

.btn-team:hover {
  transform: scale(1.05);
}

.btn-team-blue-select {
  background: #1565c0;
  color: #fff;
}

.btn-team-red-select {
  background: #c62828;
  color: #fff;
}

/* Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #333;
  border-top-color: #e94560;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}

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

#waiting {
  z-index: 50;
}

.waiting-text {
  font-size: 1.2rem;
  color: #aaa;
}

/* Dice */
#dice-screen {
  background: none;
  backdrop-filter: none;
}

.dice-content {
  text-align: center;
  padding: 30px 40px;
  width: 70vw;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  border-radius: 20px;
  box-shadow: 0px 10px 17px 2px rgba(0, 0, 0, .1);
}

.dice-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #333;
}

.dice-round {
  font-size: 1.2rem;
  color: #333;
  margin-bottom: 4px;
  font-weight: 800;
  opacity: .7;
}

.dice-scene {
  perspective: 300px;
  width: 100px;
  height: 100px;
  margin: 20px auto;
}

.dice-cube {
  width: 80px;
  height: 80px;
  position: relative;
  margin: 10px auto;
  transform-style: preserve-3d;
  transition: transform 0.1s;
}

.dice-face {
  position: absolute;
  width: 80px;
  height: 80px;
  background: #f5f5f5;
  border: 2px solid #ccc;
  border-radius: 10px;
  display: grid;
  grid-template: 1fr 1fr 1fr / 1fr 1fr 1fr;
  padding: 8px;
  box-sizing: border-box;
  backface-visibility: hidden;
}

.dot {
  width: 12px;
  height: 12px;
  background: #222;
  border-radius: 50%;
  justify-self: center;
  align-self: center;
}

/* Face positions */
.face-1 {
  transform: translateZ(40px);
}

.face-2 {
  transform: rotateY(90deg) translateZ(40px);
}

.face-3 {
  transform: rotateX(90deg) translateZ(40px);
}

.face-4 {
  transform: rotateY(180deg) translateZ(40px);
}

.face-5 {
  transform: rotateY(-90deg) translateZ(40px);
}

.face-6 {
  transform: rotateX(-90deg) translateZ(40px);
}

/* Dot patterns — grid-area: row/col */
.face-1 .dot:nth-child(1) {
  grid-area: 2/2;
}

.face-2 .dot:nth-child(1) {
  grid-area: 1/3;
}

.face-2 .dot:nth-child(2) {
  grid-area: 3/1;
}

.face-3 .dot:nth-child(1) {
  grid-area: 1/3;
}

.face-3 .dot:nth-child(2) {
  grid-area: 2/2;
}

.face-3 .dot:nth-child(3) {
  grid-area: 3/1;
}

.face-4 .dot:nth-child(1) {
  grid-area: 1/1;
}

.face-4 .dot:nth-child(2) {
  grid-area: 1/3;
}

.face-4 .dot:nth-child(3) {
  grid-area: 3/1;
}

.face-4 .dot:nth-child(4) {
  grid-area: 3/3;
}

.face-5 .dot:nth-child(1) {
  grid-area: 1/1;
}

.face-5 .dot:nth-child(2) {
  grid-area: 1/3;
}

.face-5 .dot:nth-child(3) {
  grid-area: 2/2;
}

.face-5 .dot:nth-child(4) {
  grid-area: 3/1;
}

.face-5 .dot:nth-child(5) {
  grid-area: 3/3;
}

.face-6 .dot:nth-child(1) {
  grid-area: 1/1;
}

.face-6 .dot:nth-child(2) {
  grid-area: 1/3;
}

.face-6 .dot:nth-child(3) {
  grid-area: 2/1;
}

.face-6 .dot:nth-child(4) {
  grid-area: 2/3;
}

.face-6 .dot:nth-child(5) {
  grid-area: 3/1;
}

.face-6 .dot:nth-child(6) {
  grid-area: 3/3;
}

.dice-results {
  margin-top: 24px;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

.dice-results.hidden {
  display: none;
}

.stat-bonus {
  color: #4caf50;
}

.opponent-ready {
  font-size: 0.8rem;
  color: #4caf50;
  font-weight: 600;
  padding: 4px 10px;
  background: rgba(76, 175, 80, 0.15);
  border-radius: 4px;
  display: none;
}

.opponent-ready.hidden {
  display: none;
}

/* Placement */
#placement-screen {
  position: absolute;
  top: 10px;
  left: 10px;
  bottom: 10px;
  width: calc(20vw - 10px);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  z-index: 15;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  border-radius: 20px;
  box-shadow: 0px 10px 17px 2px rgba(0, 0, 0, .1);
}

#placement-screen.hidden {
  transform: translateX(-100%);
  pointer-events: none;
}

#placement-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

#placement-title {
  margin-bottom: 16px;
  color: #333;
  font-size: 1.3rem;
}

#placement-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.placement-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  cursor: pointer;
}

.placement-row.placed {
  background: rgb(0 191 71 / 11%)
}

.placement-card-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

#btn-placement-done {
  width: 100%;
  text-align: center;
}

.placement-card-name {
  font-weight: 600;
  color: #333;
  font-size: 1rem;
}

.placement-dept-status {
  font-size: 0.78rem;
  color: #666;
}

.placement-dept-status.placed {
  color: #4caf50;
}

.placement-remove {
  background: none;
  border: none;
  color: #666;
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.placement-row:hover .placement-remove,
.placement-row.placed .placement-remove {
  opacity: 1;
  pointer-events: auto;
}

.placement-remove:hover {
  color: #e57373;
  background: rgba(229, 115, 115, 0.1);
}

.placement-empty {
  text-align: center;
  color: #666;
  padding: 20px;
}

.placement-hint {
  color: #333;
  font-size: 0.8rem;
  padding: 4px 0 8px;
  margin-bottom: 4px;
}

.placement-row.active {
  background: rgba(255, 255, 255, 0.33);
  cursor: pointer;
}

.placement-row:not(.active) {
  cursor: pointer;
}

.placement-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 20px;
}

/* Reveal sidebars */
.reveal-sidebar {
  position: absolute;
  top: 10px;
  bottom: 10px;
  width: calc(20vw - 10px);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  z-index: 15;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  border-radius: 20px;
  box-shadow: 0px 10px 17px 2px rgba(0, 0, 0, .1);
}

.reveal-sidebar.hidden {
  display: none;
}

.reveal-sidebar-left {
  left: 10px;
}

.reveal-sidebar-right {
  right: 10px;
}

.reveal-sidebar-header {
  padding: 20px 20px 0;
  font-size: 1.3rem;
  color: #333;
  flex-shrink: 0;
}

.reveal-sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 20px;
}

/* Reveal buttons (centered bottom) */
.reveal-buttons {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
}

.reveal-buttons.hidden {
  display: none;
}

/* Resolve modal (centered, like card-selection) */
#resolve-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70vw;
  max-width: 92vw;
  max-height: 80vh;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  border-radius: 20px;
  z-index: 45;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0px 10px 17px 2px rgba(0, 0, 0, .1);
}

#resolve-modal.hidden {
  display: none;
}

.resolve-modal-header {
  padding: 20px 20px 0;
  text-align: center;
  flex-shrink: 0;
}

#resolve-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 12px;
}

.resolve-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 20px 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.resolve-modal-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 20px 20px;
  flex-shrink: 0;
}

/* Resolve cards */
.reveal-card {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.33);
  border-radius: 8px;
  font-size: 1rem;
  color: #333;
  line-height: 1.5;
  opacity: 0;
  transform: scale(1.3);
}

.reveal-card .reveal-stat {
  color: #ffd54f;
  font-size: 0.8rem;
  font-weight: 600;
  margin-left: 8px;
}

.reveal-card.result-blocked {
  border-left: 3px solid #4caf50;
}

.reveal-card.result-success {
  border-left: 3px solid #e57373;
}

/* Reveal sidebar department groups */
.dept-group {
  margin-bottom: 10px;
}

.dept-group-header {
  font-size: 1rem;
  font-weight: 400;
  color: #333;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  border-bottom: 2px solid #3333331f;
  padding-bottom: 3px;
}

.dept-card {
  margin-bottom: 5px;
  font-size: 1.1rem;
  color: #333;
  line-height: 1.4;
}

.dept-card-stat {
  color: #0d35c8;
  font-size: 1.1rem;
  font-weight: 600;
  margin-left: 6px;
}

.dept-card-empty {
  color: #666;
  font-style: italic;
  font-size: 0.7rem;
  padding-left: 10px;
}

.text-green {
  color: #4caf50;
  font-weight: 600;
}

.text-red {
  color: #e57373;
  font-weight: 600;
}

.resolve-summary {
  grid-column: 1 / -1;
  margin-top: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.33);
  border-radius: 8px;
  font-size: 1rem;
  color: #333;
  line-height: 1.8;
}

.resolve-summary .stat-icon svg {
  width: 100px;
  height: 100px;
  color: #333;

}

.resolve-stats .stat-icon svg {

  width: 60px;
  height: 60px;
  color: #333;

}

.resolve-summary .stat-value .resolve-stats .stat-value {
  font-size: 3.2rem;
  font-weight: 700;
  color: #333;
}

.resolve-stats {
  display: flex;
  justify-content: space-around;
  padding: 12px;
  background-color: rgba(255, 255, 255, .33);
  border-radius: 12px;
}

.stat-block {
  text-align: center;
  min-width: 80px;
}

.stat-label {
  color: #333;
  letter-spacing: 0.04em;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: #03bc5d;
}

.resolve-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.progress-label {
  font-size: 1.1rem;
  color: #333;
  white-space: nowrap;
}

.progress-track {
  flex: 1;
  height: 22px;
  background: rgb(147 147 147 / 28%);
  border-radius: 11px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4caf50, #66bb6a);
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  transition: width 0.5s;
}

/* Result */
.result-container {
  text-align: center;
  padding: 40px;
}

.result-win {
  font-size: 3rem;
  font-weight: 900;
  color: #4caf50;
  text-shadow: 0 0 30px rgba(76, 175, 80, 0.4);
}

.result-lose {
  font-size: 3rem;
  font-weight: 900;
  color: #e57373;
  text-shadow: 0 0 30px rgba(229, 115, 115, 0.4);
}

.result-reason {
  margin-top: 12px;
  color: #aaa;
  font-size: 1rem;
}

.result-round {
  margin-top: 8px;
  color: #666;
  font-size: 0.85rem;
}

.result-actions {
  margin-top: 32px;
  display: flex;
  gap: 16px;
  justify-content: center;
}

/* Visual Effects */
.confetti {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--color);
  border-radius: 2px;
  top: -10px;
  left: var(--x);
  animation: confetti-fall 2.5s ease-out forwards;
  animation-delay: var(--delay);
  will-change: transform, opacity;
  pointer-events: none;
  z-index: 10;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }

  100% {
    transform: translateY(400px) rotate(720deg);
    opacity: 0;
  }
}

.shake-anim {
  animation: shake 0.4s ease-out;
  will-change: transform;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-8px);
  }

  40% {
    transform: translateX(8px);
  }

  60% {
    transform: translateX(-5px);
  }

  80% {
    transform: translateX(5px);
  }
}

.result-pop {
  animation: result-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  will-change: transform, opacity;
}

@keyframes result-pop {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.resolve-pop {
  animation: resolve-pop 1s ease-out forwards;
}

@keyframes resolve-pop {
  0% {
    transform: scale(0.7);
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Disconnect overlay */
#disconnect-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  z-index: 60;
}

#disconnect-overlay.hidden {
  display: none;
}

.disconnect-box {
  text-align: center;
  padding: 40px;
  color: #ffd54f;
  font-size: 1.2rem;
}

/* Error toast */
#error-toast {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: #c62828;
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.9rem;
  z-index: 70;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

#error-toast.hidden {
  display: none;
}

/* Screensaver */
.screensaver-modal {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: #fff;
  overflow: hidden;
}

.screensaver-modal.hidden {
  display: none;
}

.screensaver-logo {
  position: absolute;
  width: 140px;
  height: auto;
  pointer-events: none;
}

.highlight-polygon {
  fill: rgba(255, 255, 255, 0.1);
  stroke: #fff;
  stroke-width: 0.2;
  animation: pulse 1s ease-out infinite alternate;
}

@keyframes pulse {
  0% {
    fill: rgba(255, 255, 255, 0.1);
  }

  100% {
    fill: rgba(255, 255, 255, 0.5);
  }
}

/* Marker panel */
.marker-panel {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: rgba(26, 26, 46, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid #ffcc00;
  border-radius: 12px;
  padding: 16px 20px;
  width: 300px;
  z-index: 35;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.marker-panel.hidden {
  display: none;
}

.marker-header {
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffcc00;
  margin-bottom: 4px;
}

.marker-points {
  font-size: 0.8rem;
  color: #aaa;
}

.marker-select {
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #444;
  background: rgba(255, 255, 255, 0.08);
  color: #eee;
  font-size: 0.8rem;
  font-family: inherit;
}

.marker-select option {
  background: #2a2a3e;
  color: #eee;
}

.marker-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-marker-action {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.75rem;
}

.btn-marker-action:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-marker-action:active {
  background: rgba(255, 255, 255, 0.25);
}