:root {
  color-scheme: dark;
  --text: #f8fbff;
  --muted: #d5e8ff;
  --shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
  --yellow: #ffe36a;
  --cyan: #a9ecff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    linear-gradient(rgba(4, 14, 28, 0.22), rgba(4, 14, 28, 0.34)),
    url('/img/asset_bg_panel_burst_blue.png') center center / cover no-repeat fixed;
}

body {
  overflow: hidden;
}

.app-shell {
  height: 100vh;
  max-width: 1440px;
  margin: 0 auto;
  padding: 10px 14px 12px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 8px;
}

.topbar {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

.topbar-left {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
}

.game-logo {
  display: block;
  width: 100%;
  max-width: 238px;
  height: auto;
  object-fit: contain;
}



.game-main {
  min-height: 0;
  display: grid;
  grid-template-columns: 170px 1fr 240px;
  align-items: stretch;
  gap: 12px;
}

.left-side-panel {
  display: flex;
  align-items: center;
  justify-content: center;
}

.vertical-hud {
  width: 100%;
  max-width: 185px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  padding: 18px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255,255,255,0.10);
  backdrop-filter: blur(5px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.10);
}



.hud-inline-item {
  text-align: left;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.hud-inline-item span {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--cyan);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}

.hud-inline-item strong {
  display: block;
  font-size: 28px;
  line-height: 1;
  color: #ffffff;
}

.board-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.board-panel {
  width: min(78vh, 78vw, 760px);
  height: min(78vh, 78vw, 760px);
  padding: 12px;
  border-radius: 24px;
  background: rgba(12, 28, 48, 0.22);
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: var(--shadow);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  background: linear-gradient(180deg, rgba(15, 34, 58, 0.60), rgba(18, 40, 68, 0.72));
  border-radius: 20px;
  border: 2px solid rgba(255,255,255,0.06);
}

.right-side-panel {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.right-side-inner {
  width: 100%;
  max-width: 240px;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
}

.arcade-panel {
  width: 100%;
  max-width: 240px;
  border-radius: 18px;
  padding: 14px 14px 12px;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255,255,255,0.10) !important;
  box-shadow: 0 8px 20px rgba(0,0,0,0.10) !important;
  backdrop-filter: blur(5px) !important;
}



.arcade-panel h2 {
  margin: 0 0 10px;
  font-size: 20px;
  color: #ffffff;
  letter-spacing: 0.05em;
  text-align: left;
  text-shadow: 0 2px 8px rgba(0,0,0,0.28);
}

.ranking-list {
  display: grid;
  gap: 4px;
}

.rank-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
  border-radius: 0;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.rank-pos {
  color: var(--yellow);
  font-weight: 900;
  font-size: 15px;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0,0,0,0.30);
}

.rank-name {
  color: #ffffff;
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 0.03em;
  text-shadow: 0 2px 8px rgba(0,0,0,0.30);
}

.rank-score {
  color: var(--cyan);
  font-weight: 900;
  font-size: 16px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.30);
}

.right-actions-bottom {
  margin-top: auto;
  display: grid;
  gap: 8px;
  justify-items: end;
  padding: 14px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255,255,255,0.10);
  backdrop-filter: blur(5px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.10);
}



.plain-action-btn {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.18);
  background: linear-gradient(180deg, rgba(31, 91, 150, 0.72), rgba(20, 60, 110, 0.72));
  color: #ffffff;
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 0.04em;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(0,0,0,0.12);
  text-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.plain-action-btn.green {
  background: linear-gradient(180deg, rgba(50, 151, 84, 0.76), rgba(29, 111, 58, 0.76));
}

.plain-action-btn:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.plain-action-btn.small {
  min-width: 118px;
  padding: 7px 10px;
  font-size: 11px;
}

.overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 10, 22, 0.72);
  z-index: 40;
}

.overlay.visible {
  display: flex;
}

.overlay-card {
  width: min(100%, 560px);
  border-radius: 24px;
  padding: 22px;
  background:
    linear-gradient(rgba(10, 22, 40, 0.95), rgba(10, 22, 40, 0.95)),
    url('/img/asset_bg_panel_burst_blue.png') center center / cover no-repeat;
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: var(--shadow);
}

.intro-logo {
  display: block;
  width: 100%;
  max-width: 340px;
  margin: 0 auto 14px;
  object-fit: contain;
}

.intro-text {
  color: var(--muted);
  line-height: 1.5;
  text-align: center;
  margin: 0 0 16px;
}

.help-card h2 {
  margin: 0 0 14px;
  text-align: center;
}

.help-list {
  margin: 0 0 18px;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
}

.overlay-card label {
  display: block;
  margin-top: 12px;
  margin-bottom: 8px;
  font-weight: 700;
}

.overlay-card input {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 18px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text);
  background: rgba(255, 255, 255, 0.10);
  outline: none;
}

.overlay-card input:focus {
  border-color: rgba(124, 231, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(124, 231, 255, 0.12);
}

.overlay-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.center-btn {
  display: block;
  margin: 14px auto 0;
  min-width: 180px;
}

.message-toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(120px);
  min-width: 280px;
  max-width: min(90vw, 520px);
  padding: 14px 18px;
  border-radius: 14px;
  background: rgba(8, 20, 40, 0.92);
  color: var(--text);
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.25s ease;
  z-index: 50;
}

.message-toast.visible {
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 1100px) {
  html, body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
    grid-template-rows: auto auto;
  }

  .game-main {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .left-side-panel,
  .right-side-panel {
    justify-content: center;
    align-items: center;
  }

  .vertical-hud {
    max-width: 420px;
    grid-template-columns: repeat(2, 1fr);
  }

  .hud-inline-item {
    text-align: center;
  }

  .right-side-inner {
    min-height: 0;
    max-width: 320px;
    align-items: center;
  }

  .arcade-panel {
    max-width: 320px;
  }

  .right-actions-bottom {
    justify-items: center;
    margin-top: 10px;
  }

  .board-panel {
    width: min(92vw, 760px);
    height: min(92vw, 760px);
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 8px 10px 12px;
    gap: 8px;
  }

  .game-logo {
    max-width: 170px;
  }

  .vertical-hud {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 320px;
  }

  .hud-inline-item span {
    font-size: 12px;
  }

  .hud-inline-item strong {
    font-size: 20px;
  }

  .board-panel {
    width: min(94vw, 94vh);
    height: min(94vw, 94vh);
    padding: 8px;
  }

  .right-actions-bottom {
    width: 100%;
  }

  .plain-action-btn.small {
    width: 100%;
    max-width: 180px;
  }
}
