* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #06050c;
  --purple: #a55cff;
  --yellow: #ffd719;
  --green: #7cff00;
  --blue: #4aa3ff;
  --red: #ff4b5c;
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.64);
}

html,
body {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  display: flex;
  min-width: 320px;
  min-height: 100svh;
  flex-direction: column;
  color: var(--text);
  background-color: var(--bg);
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}

button,
a {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

.arcade-nav {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  padding: 14px max(30px, 7vw);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(4, 3, 11, 0.72);
  backdrop-filter: blur(10px);
}

.arcade-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #ffffff;
  text-decoration: none;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.035em;
  white-space: nowrap;
}

.brand-code {
  color: var(--purple);
  font-size: 28px;
  letter-spacing: -0.12em;
}

.arcade-nav-links {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 999px;
  background: rgba(15, 12, 29, 0.78);
}

.arcade-nav-links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 15px;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.arcade-nav-links a:hover {
  color: #ffffff;
  background: rgba(123, 92, 255, 0.18);
}

.arcade-nav-links i {
  width: 17px;
  color: var(--purple);
  text-align: center;
}

.break-page {
  width: min(1400px, 94vw);
  flex: 1 0 auto;
  margin: 0 auto;
  padding-bottom: 26px;
}

.site-footer {
  flex: 0 0 auto;
  margin-top: auto;
}

.game-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 0 4px;
}

.toolbar-link {
  color: var(--purple);
  background: none;
  text-decoration: none;
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0.06em;
}

.toolbar-button {
  border: 0;
}

.arcade-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(330px, 0.95fr);
  min-height: calc(100svh - 160px);
  overflow: hidden;
  border: 1px solid rgba(181, 108, 255, 0.48);
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(11, 8, 25, 0.94), rgba(5, 4, 14, 0.92));
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(9px);
}

.board-column {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 18px 26px 20px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.break-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 70px;
  margin: 0 auto 7px;
  color: var(--blue);
  font-family: "Courier New", monospace;
  font-size: clamp(32px, 3.8vw, 52px);
  font-weight: 1000;
  letter-spacing: 0.06em;
  text-shadow: 2px 2px #4835bc, 0 0 16px rgba(74, 163, 255, 0.48);
}

.brick-mark {
  color: var(--red);
  font-size: clamp(15px, 1.8vw, 25px);
  letter-spacing: -0.25em;
  text-shadow: 0 0 8px rgba(255, 75, 92, 0.8);
}

.brick-mark.alt {
  color: var(--green);
  text-shadow: 0 0 8px rgba(124, 255, 0, 0.7);
}

.canvas-shell {
  position: relative;
  width: 100%;
  min-height: 390px;
  flex: 1;
  overflow: hidden;
  border: 2px solid rgba(18, 104, 255, 0.9);
  border-radius: 16px;
  background: #03060c;
  box-shadow: 0 0 28px rgba(32, 70, 255, 0.22), inset 0 0 28px rgba(0, 0, 0, 0.7);
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 390px;
  border-radius: 14px;
  background: #03060c;
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 20px;
  color: #ffffff;
  text-align: center;
  background: rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(2px);
}

.overlay-countdown {
  font-size: clamp(55px, 7vw, 78px);
  font-weight: 900;
  pointer-events: none;
}

.overlay-end {
  background: rgba(0, 0, 0, 0.6);
}

.ov-title {
  margin-bottom: 10px;
  color: var(--red);
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 900;
}

.ov-sub {
  color: rgba(255, 255, 255, 0.92);
  font-size: 16px;
}

.btn-play-again {
  min-width: 180px;
  min-height: 48px;
  margin-top: 18px;
  padding: 10px 18px;
  border: 2px solid var(--blue);
  border-radius: 12px;
  color: var(--blue);
  background: rgba(9, 22, 45, 0.92);
  font-weight: 900;
}

.btn-launch-mobile {
  display: none;
  position: absolute;
  left: 50%;
  bottom: 18%;
  z-index: 5;
  min-width: 180px;
  min-height: 48px;
  padding: 10px 18px;
  transform: translateX(-50%);
  border: 2px solid var(--green);
  border-radius: 12px;
  color: #091108;
  background: var(--green);
  font-weight: 900;
  box-shadow: 0 0 20px rgba(124, 255, 0, 0.35);
}

.game-help {
  display: flex;
  justify-content: center;
  gap: 28px;
  padding: 14px 5px 0;
  color: var(--muted);
  font-size: 12px;
}

.control-column {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 24px 28px 22px;
}

.desktop-stats,
.mobile-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.mobile-stats {
  display: none;
}

.stat-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 0;
  padding: 12px 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.stat-card > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-card b {
  color: var(--yellow);
  font-size: 19px;
}

.stat-icon {
  color: var(--yellow);
  font-size: 22px;
}

.stat-icon.red {
  color: var(--red);
}

.controls-block {
  display: grid;
  grid-template-columns: 1fr 175px;
  align-items: center;
  gap: 18px;
  margin: 30px 0 26px;
}

.keyboard-help h2,
.score-preview h2 {
  margin-bottom: 17px;
  color: var(--purple);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.045em;
}

.keyboard-help p {
  margin: 10px 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
}

.keyboard-help strong {
  color: var(--green);
}

.break-controls {
  display: grid;
  grid-template-columns: repeat(3, 50px);
  justify-content: center;
  gap: 7px;
}

.break-controls span {
  display: grid;
  height: 50px;
  place-items: center;
  border: 1px solid rgba(165, 92, 255, 0.5);
  border-radius: 13px;
  color: var(--purple);
  background: #1a122d;
  font-size: 20px;
}

.break-controls .ball-key {
  color: #071005;
  background: var(--green);
}

.action-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.arcade-action {
  min-height: 48px;
  border: 1px solid rgba(181, 108, 255, 0.45);
  border-radius: 13px;
  color: var(--purple);
  background: rgba(123, 92, 255, 0.08);
  font-size: 12px;
  font-weight: 900;
}

.score-preview {
  margin-top: 25px;
}

.ranking-preview {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.025);
  list-style: none;
}

.ranking-preview li {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 8px;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 13px;
}

.ranking-preview li:last-child {
  border-bottom: 0;
}

.rank-position {
  color: var(--purple);
  font-weight: 900;
}

.ranking-preview li:first-child .rank-position,
.rank-score {
  color: var(--yellow);
  font-weight: 900;
}

.rank-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-loading,
.ranking-empty {
  display: block !important;
  color: var(--muted);
  text-align: center;
}

.btn-start-break {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  min-height: 58px;
  margin-top: auto;
  border: 2px solid var(--blue);
  border-radius: 12px;
  color: var(--blue);
  background: rgba(9, 22, 45, 0.9);
  font-family: "Courier New", monospace;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.07em;
  box-shadow: 0 0 18px rgba(74, 163, 255, 0.24);
}

@media (max-width: 1050px) {
  .arcade-shell {
    grid-template-columns: minmax(0, 1.4fr) minmax(310px, 0.85fr);
  }

  .controls-block {
    grid-template-columns: 1fr;
  }

  .keyboard-help {
    text-align: center;
  }
}

@media (max-width: 820px) {
  .arcade-nav {
    min-height: 68px;
    padding: 10px 16px;
  }

  .arcade-nav-links a {
    padding: 9px 10px;
  }

  .arcade-nav-links a span {
    display: none;
  }

  .break-page {
    width: calc(100% - 24px);
    padding-bottom: 20px;
  }

  .game-toolbar {
    min-height: 50px;
  }

  .arcade-shell {
    display: block;
    min-height: 0;
    border-radius: 22px;
  }

  .board-column {
    padding: 18px 16px 16px;
    border-right: 0;
  }

  .control-column {
    display: none;
  }

  .break-logo {
    min-height: 48px;
    margin-bottom: 12px;
    font-size: clamp(27px, 8vw, 40px);
  }

  .mobile-stats {
    display: grid;
    margin-bottom: 12px;
  }

  .canvas-shell {
    min-height: 0;
    aspect-ratio: 12 / 7;
    flex: none;
  }

  #gameCanvas {
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  .game-help {
    justify-content: space-between;
    gap: 10px;
    font-size: 10px;
  }

  .btn-launch-mobile {
    min-width: 150px;
    min-height: 44px;
    bottom: 14%;
  }
}

@media (max-width: 480px) {
  .arcade-brand {
    font-size: 14px;
  }

  .arcade-nav-links {
    padding: 4px;
  }

  .arcade-nav-links a {
    padding: 8px;
  }

  .break-page {
    width: calc(100% - 16px);
  }

  .toolbar-link {
    font-size: 12px;
  }

  .board-column {
    padding: 14px 10px 12px;
  }

  .break-logo {
    gap: 9px;
    font-size: 27px;
  }

  .mobile-stats {
    gap: 8px;
  }

  .stat-card {
    gap: 7px;
    padding: 10px 7px;
    font-size: 10px;
  }

  .stat-card b {
    font-size: 18px;
  }

  .ov-title {
    font-size: clamp(26px, 9vw, 38px);
  }

  .ov-sub {
    font-size: 13px;
  }

  .btn-play-again {
    min-width: 160px;
    min-height: 44px;
    margin-top: 13px;
  }
}

@media (max-width: 360px) {
  .arcade-brand span:last-child {
    display: none;
  }

  .break-logo {
    font-size: 24px;
  }

  .brick-mark {
    display: none;
  }
}