@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/nunito-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF
}

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/nunito-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD
}

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/nunito-latin-ext-600-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF
}

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/nunito-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD
}

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/fonts/nunito-latin-ext-800-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF
}

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/fonts/nunito-latin-800-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD
}

* {
  box-sizing: border-box
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  background: #151e30;
  color: #f9fafb;
  font-family: Nunito, system-ui, sans-serif
}

body {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  overflow-x: hidden
}

button {
  font: inherit
}

.page,
.game-page {
  padding: 12px 0 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page {
  width: min(94vw, 720px);
  font-family: Nunito, system-ui, sans-serif;
}

.site-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  min-height: 72px;
  padding: 0 4px
}

.language-switch {
  position: relative;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  z-index: 100;
}

.lang-dropdown-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(126, 226, 59, 0.3);
  background: rgba(17, 24, 39, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #f1f5f9;
  font: 700 13px/1 Nunito, system-ui, sans-serif;
  letter-spacing: 0.03em;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  box-sizing: border-box;
}

.lang-dropdown-btn:hover {
  background: rgba(23, 37, 56, 0.95);
  border-color: rgba(126, 226, 59, 0.7);
  color: #c8ff9b;
  box-shadow: 0 0 12px rgba(126, 226, 59, 0.25);
}

.lang-dropdown-btn[aria-expanded="true"] {
  background: rgba(23, 37, 56, 0.98);
  border-color: #7ee23b;
  box-shadow: 0 0 14px rgba(126, 226, 59, 0.35);
}

.lang-flag-current,
.lang-option-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 13px;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

.lang-flag-current svg,
.lang-option-flag svg {
  display: block;
  width: 100%;
  height: 100%;
}

.lang-code-current {
  font-weight: 800;
  font-size: 13px;
  line-height: 1;
}

.lang-chevron {
  display: block;
  width: 11px;
  height: 11px;
  color: #94a3b8;
  transition: transform 0.2s ease, color 0.15s ease;
}

.lang-dropdown-btn:hover .lang-chevron,
.lang-dropdown-btn[aria-expanded="true"] .lang-chevron {
  color: #c8ff9b;
}

.lang-dropdown-btn[aria-expanded="true"] .lang-chevron {
  transform: rotate(180deg);
}

.lang-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 1200;
  width: min(310px, calc(100vw - 24px));
  padding: 8px;
  border-radius: 16px;
  border: 1px solid rgba(126, 226, 59, 0.35);
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.7), 0 0 25px rgba(16, 185, 129, 0.15);
  box-sizing: border-box;
}

.lang-popover[hidden] {
  display: none !important;
}

.lang-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
  box-sizing: border-box;
}

.lang-option-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #cbd5e1;
  font: 600 12px/1.2 Nunito, system-ui, sans-serif;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.12s ease;
  user-select: none;
  -webkit-user-select: none;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.lang-option-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #f1f5f9;
  border-color: rgba(255, 255, 255, 0.1);
}

.lang-option-btn.active {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(126, 226, 59, 0.55);
  color: #7ee23b;
  font-weight: 800;
}

.lang-option-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.title-block {
  display: flex;
  flex-direction: column;
  align-items: center
}

.title {
  font-size: 34px;
  line-height: 36px;
  font-weight: 800;
  text-align: center;
  margin: 0;
  color: #7ee23b;
  text-shadow: 0 3px 12px #0009;
  letter-spacing: .01em;
  white-space: nowrap
}

.subtitle {
  margin-top: 2px;
  font: 600 13px/18px Nunito, system-ui, sans-serif;
  color: #c9d0db;
  text-align: center
}

.info-button {
  justify-self: end;
  appearance: none;
  border: 0;
  background: transparent;
  color: #e1e6ee;
  padding: 0;
  font: 400 15px/24px Nunito, system-ui, sans-serif;
  cursor: pointer;
  height: 24px;
  white-space: nowrap
}

.info-button:active {
  color: #fff
}

.card-section {
  margin-top: 16px;
  padding: 20px;
  border: 1px solid #2f4058;
  border-radius: 18px;
  background: linear-gradient(180deg, #18263a, #152235);
  box-shadow: 0 10px 30px #0005
}

.section-title {
  margin: 0 0 14px;
  text-align: center;
  font-size: 20px;
  line-height: 24px;
  font-weight: 800;
  color: #dfe7f2
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px
}

.option-card {
  appearance: none;
  width: 100%;
  border: 2px solid #2e4965;
  border-radius: 16px;
  background: #17283d;
  color: #eef3f8;
  padding: 12px;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, box-shadow .15s, transform .12s, background .15s;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  box-sizing: border-box;
}

.option-card:hover {
  border-color: #7ee23b;
  box-shadow: 0 0 0 1px #7ee23b55, 0 0 24px #7ee23b1c;
  background: #193043;
}

.option-card.selected {
  border-color: #7ee23b;
  background: #18372f;
  box-shadow: 0 0 0 1px #7ee23b55, 0 0 28px #7ee23b24;
}

.option-card:active {
  transform: scale(.985);
}

.option-visual {
  height: 100px;
  flex: 0 0 100px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #101c2d;
  border: 1px solid #2b4059;
  overflow: hidden;
}

.option-card.selected .option-visual {
  border-color: #4c7d54;
}

.option-name {
  display: block;
  margin-top: 10px;
  font-size: 18px;
  line-height: 22px;
  font-weight: 800;
  flex-shrink: 0;
  min-height: 22px;
}

.option-desc {
  display: block;
  margin-top: 4px;
  color: #b9c5d4;
  font-size: 13px;
  line-height: 18px;
  min-height: 36px;
  flex: 1 1 auto;
}

.start-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 16px;
  width: 100%;
}

.action-btn-row,
.game-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  width: 100%;
  margin-top: 12px;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 16px;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.icon-btn[hidden] {
  display: none !important;
}

.icon-btn svg {
  width: 28px;
  height: 28px;
  display: block;
}

.icon-btn:hover:not(:disabled) {
  background: #1d4ed8;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.icon-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.icon-btn:disabled {
  background: #334155;
  color: #64748b;
  cursor: not-allowed;
  box-shadow: none;
}

.icon-btn.primary {
  width: 64px;
  height: 64px;
}

.icon-btn.primary svg {
  width: 32px;
  height: 32px;
}

.start-hint {
  margin: 8px 0 0;
  color: #aeb9c8;
  font-size: 13px;
  line-height: 18px;
  text-align: center
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: auto;
  padding: 20px 4px 12px;
  font-size: 11px;
  color: #b6bfce;
}

.copyright {
  flex: 1;
  text-align: left;
  white-space: nowrap;
}

.privacy-link {
  flex: 1;
  text-align: center;
  background: none;
  border: none;
  color: #93c5fd;
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
  padding: 0;
  white-space: nowrap;
}

.version {
  flex: 1;
  text-align: right;
  white-space: nowrap;
  color: #d5dce7;
  margin-left: 0;
}

.info-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #07101dcc;
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s, visibility .15s
}

.info-overlay.open {
  opacity: 1;
  visibility: visible
}

.info-panel {
  width: min(520px, 94vw);
  max-height: min(80vh, 650px);
  overflow: auto;
  padding: 20px;
  border: 1px solid #4a586d;
  border-radius: 16px;
  background: #29364a;
  color: #edf1f7;
  box-shadow: 0 18px 50px #0009
}

.info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px
}

.info-header h2 {
  margin: 0;
  font-size: 20px
}

.info-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: #46546a;
  color: #fff;
  cursor: pointer;
  font-size: 22px;
  line-height: 1
}

.info-panel p {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.5
}

.info-panel p:last-child {
  margin-bottom: 0
}

.info-panel strong {
  color: #fff
}

.game-page {
  width: min(94vw, 520px);
  font-family: Nunito, system-ui, sans-serif;
}

.game-top {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  column-gap: 12px;
  align-items: center;
  padding: 0 4px;
  min-height: 64px;
  margin-bottom: 12px;
}

.game-title-block {
  grid-column: 2;
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.game-title {
  font-size: 29px;
  line-height: 30px;
  font-weight: 800;
  text-align: center;
  margin: 0;
  color: #7ee23b;
  text-shadow: 0 3px 12px #0009;
  letter-spacing: .01em;
  white-space: nowrap;
}

.game-subtitle {
  margin-top: 2px;
  font: 600 13px/18px Nunito, system-ui, sans-serif;
  color: #c9d0db;
  text-align: center;
  white-space: nowrap;
}

.game-info {
  justify-self: start;
}

.game-top .header-left {
  grid-column: 1;
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}

.game-top .header-left-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-box {
  grid-column: 3;
  grid-row: 1 / 3;
  display: grid;
  grid-template-rows: 24px 24px;
  row-gap: 4px;
  justify-self: end;
  align-self: center;
  min-width: 86px;
}

.score-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  height: 24px;
  column-gap: 7px;
  font: 400 15px/1 Nunito, system-ui, sans-serif;
  white-space: nowrap;
}

.game-board-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  margin-top: auto;
  margin-left: auto;
  margin-right: auto;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 30px #0005;
}

.game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 1;
  border-radius: 16px;
  background: #121e2f;
  touch-action: none;
  transform: translateZ(0);
}

.bordered-canvas,
.demo-board-wrap.bordered-canvas {
  border: 2px solid #aebbc9;
  box-sizing: border-box;
}

#gameOverOverlay,
.canvas-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(11, 23, 39, 0.85);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 50;
  border-radius: inherit;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  text-align: center;
  padding: 20px;
  box-sizing: border-box;
}

#gameOverOverlay.hidden,
.canvas-overlay.hidden {
  display: none !important;
}

.canvas-overlay .game-message {
  height: auto;
  min-height: unset;
  margin: 0 0 10px;
  font-size: 20px;
  line-height: 26px;
  font-weight: 800;
  color: #7ee23b;
  text-shadow: 0 0 12px rgba(126, 226, 59, 0.35);
  display: block;
}

.canvas-overlay #leaderboard-prompt-container {
  width: 100%;
  max-width: 290px;
  margin: 6px auto;
}

.game-message {
  text-align: center;
  height: 32px;
  min-height: 32px;
  margin: 8px 0 2px;
  font-size: 14px;
  line-height: 22px;
  color: #e1e6ee;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.game-message.game-over {
  font-size: 18px;
  line-height: 24px;
  font-weight: 800;
  color: #7ee23b;
  text-shadow: 0 0 12px #7ee23b33;
}

.controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  width: min(270px, 73vw);
  margin: 16px auto 0;
}

.control-button {
  border: 0;
  border-radius: 12px;
  background: #46546a;
  color: white;
  font-size: 23px;
  font-weight: 700;
  height: 54px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.control-button:active {
  background: #58677e;
  transform: scale(.96)
}

.empty {
  visibility: hidden
}


.privacy-note {
  margin: 14px 0 0;
  text-align: center;
  color: #b6bfce;
  font-size: 10px;
  line-height: 1.4;
  letter-spacing: .01em
}

svg {
  display: block
}

@media (max-width:600px) {
  body {
    align-items: flex-start
  }

  .page {
    padding: 8px 0 0;
  }

  .site-top {
    min-height: 54px
  }

  .title {
    font-size: 30px;
    line-height: 32px
  }

  .card-section {
    padding: 12px;
    margin-top: 8px
  }

  .option-grid {
    gap: 8px
  }

  .option-visual {
    height: 100px;
    flex: 0 0 100px;
  }

  .start-wrap {
    margin-top: 10px
  }
}

@media (max-width:430px) {
  .site-top {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    min-height: 50px
  }

  .title {
    font-size: 27px;
    line-height: 29px
  }

  .subtitle {
    font-size: 12px
  }

  .info-button {
    font-size: 14px;
  }

  .lang-dropdown-btn {
    height: 32px;
    padding: 0 8px;
    gap: 5px;
  }

  .lang-popover {
    width: min(290px, calc(100vw - 20px));
    padding: 6px;
  }

  .lang-option-btn {
    padding: 6px 7px;
    font-size: 11px;
    gap: 6px;
  }

  .option-grid {
    gap: 8px
  }

  .option-card {
    padding: 8px;
    border-radius: 14px
  }

  .option-visual {
    height: 80px;
    flex: 0 0 80px;
  }

  .option-name {
    font-size: 16px;
    line-height: 20px
  }

  .option-desc {
    font-size: 12px;
    line-height: 16px
  }

  .section-title {
    font-size: 18px
  }
}

@media (max-width:360px) {
  .page {
    padding-top: 6px
  }

  .site-top {
    min-height: 46px
  }

  .title {
    font-size: 24px;
    line-height: 26px
  }

  .subtitle {
    font-size: 11px
  }

  .card-section {
    padding: 12px
  }

  .option-visual {
    height: 80px;
    flex: 0 0 80px;
  }

  .option-desc {
    min-height: 32px
  }
}


@media (max-width:430px) {

  .site-top,
  .game-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
  }

  .site-top {
    min-height: 50px;
  }

  .game-top {
    grid-template-rows: auto auto;
    gap: 4px 8px;
    min-height: 50px;
    padding: 0 4px;
    margin-bottom: 8px;
  }

  .header-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
  }

  .game-top .header-left {
    grid-column: 1;
    grid-row: 1 / 3;
  }

  .game-title-block {
    grid-column: 2;
    grid-row: 1 / 3;
    align-items: center;
    width: 100%;
  }

  .game-title {
    font-size: 20px;
    line-height: 22px;
  }

  .game-subtitle {
    font-size: 10px;
    line-height: 12px;
  }

  .game-top .score-box {
    grid-column: 3;
    grid-row: 1 / 3;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
    justify-content: center;
    align-self: center;
    min-width: auto;
    height: 100%;
  }

  .score-row {
    font-size: 13px;
    line-height: 1;
    height: auto;
    column-gap: 4px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }

  .action-btn-row,
  .game-actions {
    gap: 12px;
  }

  .icon-btn {
    width: 50px;
    height: 50px;
  }

  .icon-btn svg {
    width: 24px;
    height: 24px;
  }

  .icon-btn.primary {
    width: 58px;
    height: 58px;
  }

  .icon-btn.primary svg {
    width: 28px;
    height: 28px;
  }
}



/* B.1: fekvő helyzetben teljes sötétítés és figyelmeztetés */
.rotate-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #000;
  color: #fff;
  text-align: center;
  font-family: Nunito, system-ui, sans-serif
}

.rotate-overlay.show {
  display: flex
}

.rotate-overlay p {
  margin: 0;
  font-size: 20px;
  line-height: 1.4;
  font-weight: 600;
  max-width: 420px
}

/* ==========================================================================
   Leaderboard UI Components & Integration Styles (Phase 2)
   ========================================================================== */

.header-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}

.profile-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #1e293b;
  border: 2px solid #475569;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  padding: 0;
  flex-shrink: 0;
}

.profile-icon-btn svg {
  width: 18px;
  height: 18px;
}

.profile-icon-btn:hover {
  border-color: #64748b;
  color: #f8fafc;
  transform: translateY(-1px);
}

/* Logged in state: vibrant blue to harmonize with action buttons */
.profile-icon-btn.logged-in {
  background: rgba(37, 99, 235, 0.15);
  border-color: #3b82f6;
  color: #60a5fa;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.profile-icon-btn.logged-in:hover {
  background: rgba(37, 99, 235, 0.25);
  border-color: #60a5fa;
  color: #bfdbfe;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}


/* Game Over Prompt Container */
#leaderboard-prompt-container {
  width: 100%;
  text-align: center;
  margin: 10px 0 6px;
}

#leaderboard-prompt-container:empty {
  display: none;
}

.leaderboard-record-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: linear-gradient(135deg, rgba(22, 101, 52, 0.4), rgba(17, 28, 44, 0.95));
  border: 1px solid #16a34a;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(22, 101, 52, 0.25);
  animation: promptFadeIn 0.25s ease-out;
}

.leaderboard-record-text {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: #86efac;
  letter-spacing: 0.02em;
}

.leaderboard-view-btn {
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 800;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.leaderboard-view-btn:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.leaderboard-prompt-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.15), rgba(17, 28, 44, 0.95));
  border: 1px solid #3b82f6;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.2);
  animation: promptFadeIn 0.25s ease-out;
}

.leaderboard-prompt-text {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #e2e8f0;
}

.leaderboard-prompt-btn {
  padding: 8px 20px;
  font-size: 13px;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 800;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.leaderboard-prompt-btn:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

@keyframes promptFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Modal Components */
body.modal-open {
  overflow: hidden;
}

.modal-tabs {
  display: flex;
  border-bottom: 1px solid #3d4d65;
  margin-bottom: 16px;
  gap: 8px;
}

.modal-tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: #94a3b8;
  font: 700 14px/1 Nunito, system-ui, sans-serif;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.modal-tab:hover {
  color: #fff;
}

.modal-tab.active {
  color: #60a5fa;
  border-bottom-color: #3b82f6;
}

.modal-prompt {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: #cbd5e1;
}

.modal-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 14px;
  background: #111c2c;
  border: 1px solid #334155;
  border-radius: 10px;
  color: #fff;
  font: 600 15px Nunito, system-ui, sans-serif;
  margin-bottom: 6px;
  outline: none;
  transition: border-color 0.15s ease;
}

.modal-input:focus {
  border-color: #3b82f6;
}

p.modal-warning,
.modal-warning {
  margin: 0;
  margin-bottom: 0 !important;
  min-height: 20px;
  font-size: 12px;
  color: #f59e0b;
}

.modal-actions {
  position: relative;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 12px;
  margin-top: 14px;
}

#registerSection .modal-actions {
  justify-content: space-between !important;
}

.reg-status-text {
  flex: 1;
  min-width: 0;
  text-align: left;
  font-size: 13.5px;
  line-height: 1.25;
  font-weight: 600;
  color: #cbd5e1;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, color 0.15s ease;
}

.reg-status-text.visible {
  opacity: 1;
  visibility: visible;
}

.reg-status-text.error {
  color: #ef4444;
  font-weight: 700;
}

.modal-btn,
.modal-actions button {
  background: #2563eb;
  color: #fff;
  border: 0;
  min-width: 140px;
  height: 40px;
  min-height: 40px;
  line-height: 1;
  flex-shrink: 0;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  box-sizing: border-box;
  transition: background 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.modal-btn:hover,
.modal-actions button:hover {
  background: #1d4ed8;
}

.modal-btn:focus,
.modal-actions button:focus,
.modal-btn:active,
.modal-actions button:active {
  outline: none;
  box-shadow: none;
}

.modal-btn:active,
.modal-actions button:active {
  transform: scale(0.97);
}

.modal-btn:disabled,
.modal-actions button:disabled {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
}

.btn-loading {
  position: relative !important;
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  margin: 0 !important;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: button-spin 1s linear infinite;
}

@keyframes button-spin {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

.modal-status-msg {
  margin-top: 12px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  min-height: 48px;
  height: 48px !important;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#authStatusMsg.error,
#authError,
.modal-status-msg.error {
  font-size: 1.1rem;
  color: #ef4444;
  font-weight: bold;
  text-align: center;
  margin-top: 12px;
  min-height: 48px;
  height: 48px !important;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.modal-status-msg.success {
  color: #22c55e;
}

#profileStatusMsg {
  display: none !important;
}

#regLimitTimer {
  position: absolute;
  left: 0;
  display: inline-block;
  min-width: 100px;
  margin-right: auto !important;
}

/* Auth result box */
.auth-result-box {
  margin-top: 8px;
  padding: 16px;
  background: #111c2c;
  border: 1px solid #2d455e;
  border-radius: 12px;
}

.reg-instructions {
  margin-top: 16px;
}

.info-panel .reg-note,
.reg-note {
  margin: 0 0 12px;
  font-size: 1rem;
  line-height: 1.6;
  color: #f1f5f9;
}

.info-panel .reg-note:last-child,
.reg-note:last-child {
  margin-bottom: 0;
}

.info-panel .reg-note-secondary,
.reg-note-secondary {
  color: #cbd5e1;
  font-style: italic;
}

.secret-id-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #0b1727;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px dashed #3b82f6;
}

.secret-id-display code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1.125rem;
  font-weight: 700;
  color: #93c5fd;
  letter-spacing: 0.05em;
}

.secret-id-display .copy-btn {
  height: 36px;
  min-height: 36px;
  line-height: 1;
  font-size: 14px;
  font-weight: 800;
  padding: 8px 16px;
  border-radius: 8px;
}

.copy-btn {
  background: #2563eb;
  border: 0;
  border-radius: 6px;
  color: #fff;
  font: 700 12px/1 Nunito, system-ui, sans-serif;
  height: 32px;
  min-height: 32px;
  line-height: 1;
  padding: 6px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  white-space: nowrap;
  box-sizing: border-box;
}

.copy-btn:hover {
  background: #1d4ed8;
}

/* Profile modal styles */
.profile-info-block {
  background: #111c2c;
  border: 1px solid #2d455e;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
}

.profile-user-line,
.profile-id-line {
  margin: 0 0 8px;
  font-size: 14px;
  color: #cbd5e1;
}

.profile-id-line code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 14px;
  font-weight: 700;
  color: #93c5fd;
  letter-spacing: 0.05em;
}

.profile-label {
  color: #64748b;
  font-weight: 600;
  margin-right: 4px;
}

.profile-actions-row,
.profile-info-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.profile-actions-row button,
.profile-actions-row .copy-btn,
.profile-actions-row .logout-btn {
  flex: 1;
  text-align: center;
  justify-content: center;
}

.action-button.secondary,
.logout-btn {
  background: #334155;
  border: 0;
  border-radius: 6px;
  color: #e2e8f0;
  font: 700 12px/1 Nunito, system-ui, sans-serif;
  height: 32px;
  min-height: 32px;
  line-height: 1;
  padding: 6px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
  box-sizing: border-box;
}

.action-button.secondary:hover,
.logout-btn:hover {
  background: #475569;
  color: #fff;
}

/* Personal bests container in profile modal */
.personal-bests-section {
  background: #111c2c;
  border: 1px solid #2d455e;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
}

.personal-bests-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 800;
  color: #93c5fd;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.personal-bests-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.personal-best-item {
  background: #0b1727;
  border: 1px solid #24384e;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.personal-best-label {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
  line-height: 1.2;
}

.personal-best-score {
  font-size: 16px;
  font-weight: 800;
  color: #38bdf8;
  text-align: center;
}

.personal-bests-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
}

.profile-delete-block {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #334155;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.delete-warning {
  margin: 0;
  color: #f87171;
  font-size: 13.5px;
  margin-bottom: 12px;
}

.delete-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.delete-status-text {
  flex: 1;
  min-width: 0;
  text-align: left;
  font-size: 13.5px;
  line-height: 1.25;
  font-weight: 700;
  color: #ef4444;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.delete-status-text.visible {
  opacity: 1;
  visibility: visible;
}

.delete-btn {
  background: #991b1b;
  border: 0;
  border-radius: 10px;
  color: #fff;
  font: 800 12px/1 Nunito, system-ui, sans-serif;
  height: 36px;
  min-height: 36px;
  line-height: 1;
  padding: 8px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  white-space: nowrap;
  box-sizing: border-box;
  transition: background 0.15s ease;
}

.delete-btn:hover:not(:disabled) {
  background: #b91c1c;
}

.delete-btn:disabled {
  opacity: 0.75;
  cursor: not-allowed;
  pointer-events: none;
}

/* Leaderboard modal styles */
.leaderboard-panel {
  position: relative;
  display: flex;
  flex-direction: column;
}

.leaderboard-filters {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-pill {
  appearance: none;
  border: 1px solid #334155;
  background: #111c2c;
  color: #94a3b8;
  font: 700 12px/1 Nunito, system-ui, sans-serif;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-pill:hover {
  border-color: #475569;
  color: #fff;
}

.filter-pill.active {
  background: #2563eb;
  border-color: #3b82f6;
  color: #fff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

.leaderboard-list-wrap {
  flex: 1;
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid #2d455e;
  border-radius: 12px;
  background: #111c2c;
  padding: 4px 0 0 0;
  margin-bottom: 10px;
  position: relative;
}

.rank-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 14px;
  transition: background 0.15s ease;
}

.rank-row:last-child {
  border-bottom: 0;
}

.rank-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.rank-row.user-row {
  position: sticky;
  bottom: -1px;
  /* Prevents 1px scroll gap */
  z-index: 10;
  background: #15294e;
  /* Solid dark blue matching the previous rgba overlay */
  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.25);
}

.rank-row.user-row::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #3b82f6;
}

.rank-left {
  display: flex;
  align-items: center;
  min-width: 0;
}

.rank-num,
.rank {
  display: inline-block;
  min-width: 40px;
  width: 40px;
  text-align: right;
  margin-right: 15px;
  flex-shrink: 0;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #64748b;
  font-size: 14px;
  line-height: 1;
  box-sizing: border-box;
}

.rank-num.medal-1,
.rank.medal-1 {
  color: #FFD700;
  font-size: 14px;
}

.rank-num.medal-2,
.rank.medal-2 {
  color: #C0C0C0;
  font-size: 14px;
}

.rank-num.medal-3,
.rank.medal-3 {
  color: #CD7F32;
  font-size: 14px;
}

.rank-name {
  color: #f1f5f9;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-score {
  font-weight: 800;
  color: #38bdf8;
  font-size: 15px;
  flex-shrink: 0;
  margin-left: 10px;
}

.sticky-user-rank {
  display: none !important;
}

.sticky-user-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-weight: 700;
  font-size: 14px;
}

.sticky-rank {
  color: #86efac;
}

.sticky-name {
  flex: 1;
  margin: 0 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sticky-score {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
}

.leaderboard-empty {
  text-align: center;
  padding: 30px 16px;
  color: #94a3b8;
  font-size: 14px;
  margin: 0;
}

.leaderboard-empty.error {
  color: #f87171;
}

.leaderboard-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-height: 700px) {

  /* Home Page Aggressive Shrink */
  .page {
    padding-top: 4px;
  }

  .site-top {
    min-height: 44px;
    margin-bottom: 4px;
  }

  .card-section {
    padding: 8px;
    margin-top: 8px;
  }

  .section-title {
    margin-bottom: 6px;
    font-size: 16px;
    line-height: 18px;
  }

  .option-grid {
    gap: 6px;
  }

  .option-visual {
    height: 60px;
    flex: 0 0 60px;
  }

  .option-name {
    font-size: 14px;
    margin-top: 4px;
    min-height: 16px;
    line-height: 1.2;
  }

  .option-desc {
    font-size: 11px;
    line-height: 1.2;
    min-height: 26px;
    margin-top: 2px;
  }

  .start-wrap {
    margin-top: 10px;
  }

  .start-hint {
    margin-top: 4px;
    font-size: 11px;
    margin-bottom: 0;
  }

  .action-btn-row,
  .game-actions {
    margin-top: 8px;
    gap: 10px;
  }

  .icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }

  .icon-btn svg {
    width: 22px;
    height: 22px;
  }

  .icon-btn.primary {
    width: 50px;
    height: 50px;
  }

  .icon-btn.primary svg {
    width: 26px;
    height: 26px;
  }

  .site-footer {
    padding: 10px 4px 6px;
  }

  /* Game Page Shrink */
  .game-page {
    padding: 8px 0 0;
  }

  .game-top {
    min-height: 52px;
    column-gap: 12px;
  }

  .game-title {
    font-size: 25px;
    line-height: 26px;
  }

  .game-subtitle {
    font-size: 12px;
    line-height: 16px;
  }

  .game-board-wrap {
    width: min(100%, 42vh);
    margin-left: auto;
    margin-right: auto;
  }

  .controls {
    width: min(250px, 70vw, 42vh);
    gap: 5px;
  }

  .control-button {
    height: 46px;
    font-size: 21px;
  }

  /* Modals Aggressive Shrink */
  .info-panel {
    padding: 12px 14px;
  }

  .info-header {
    margin-bottom: 8px;
  }

  .info-header h2 {
    font-size: 17px;
  }

  .profile-info-block,
  .personal-bests-section {
    padding: 10px;
    margin-bottom: 10px;
  }

  .profile-user-line,
  .profile-id-line {
    margin-bottom: 4px;
    font-size: 13px;
  }

  .profile-actions-row {
    margin-top: 10px;
  }

  .personal-bests-title {
    margin-bottom: 6px;
    font-size: 12px;
  }

  .personal-bests-grid {
    gap: 6px;
  }

  .personal-best-item {
    padding: 4px 6px;
  }

  .personal-best-label {
    font-size: 10px;
  }

  .personal-best-score {
    font-size: 14px;
  }

  .profile-delete-block {
    margin-top: 10px;
    padding-top: 10px;
  }

  .delete-warning {
    margin-bottom: 6px;
    font-size: 11.5px;
  }

  .delete-btn {
    height: 32px;
    min-height: 32px;
    line-height: 1;
    font-size: 11px;
    padding: 6px 12px;
  }

  .action-button.secondary,
  .logout-btn,
  .copy-btn {
    height: 28px;
    min-height: 28px;
    line-height: 1;
    padding: 6px;
    font-size: 11.5px;
  }

  .secret-id-display .copy-btn {
    height: 34px;
    min-height: 34px;
    line-height: 1;
    padding: 6px 14px;
    font-size: 13px;
  }

  .modal-tabs {
    margin-bottom: 10px;
  }

  .modal-prompt {
    margin-bottom: 6px;
    font-size: 12px;
  }

  p.modal-warning,
  .modal-warning {
    margin-bottom: 0 !important;
    font-size: 12px;
  }

  .modal-input {
    padding: 6px 10px;
    font-size: 14px;
  }

  .auth-result-box {
    margin-top: 10px;
    padding: 10px;
  }
}