/*
 * PC game page visual polish.
 * Scoped to tetris-pc.html so the shared site styles and game behavior stay intact.
 */

body.tetris-pc-page {
  background:
    radial-gradient(circle at 50% -12%, rgba(52, 152, 219, 0.16), transparent 34rem),
    linear-gradient(180deg, #2c3e50 0%, #26394b 54%, #223344 100%);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

.tetris-pc-page .base-wrapper {
  padding: 20px clamp(16px, 2vw, 32px) 48px;
}

.tetris-pc-page .game-page-top-ad-space {
  max-width: 1000px;
  margin-bottom: 28px;
}

.tetris-pc-page .ad_banner-slot {
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 12px;
}

.tetris-pc-page .game-header {
  width: min(100%, 1000px);
  min-height: 56px;
  height: auto;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 14px;
  padding: 0;
}

.tetris-pc-page .game-header h1 {
  flex: 0 0 auto;
  margin-right: 0 !important;
  font-size: clamp(1.75rem, 2.4vw, 2.2rem);
  letter-spacing: -0.035em;
}

.tetris-pc-page .game-settings {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.tetris-pc-page .btn.icon-btn,
.tetris-pc-page .lang-flag-icon {
  width: 44px;
  min-width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 6px 18px rgba(10, 23, 38, 0.14);
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.tetris-pc-page .btn.icon-btn:hover,
.tetris-pc-page .lang-flag-icon:hover {
  transform: translateY(-2px);
  border-color: rgba(125, 211, 252, 0.36);
  background: rgba(255, 255, 255, 0.17);
  box-shadow: 0 9px 22px rgba(10, 23, 38, 0.22);
}

.tetris-pc-page .btn.icon-btn:active,
.tetris-pc-page .lang-flag-icon:active {
  transform: translateY(0);
}

.tetris-pc-page .btn.icon-btn:focus-visible,
.tetris-pc-page .lang-flag-icon:focus-visible,
.tetris-pc-page .rank-link-compact:focus-visible,
.tetris-pc-page .rank-refresh-compact:focus-visible,
.tetris-pc-page .quick-links-list a:focus-visible {
  outline: 3px solid rgba(125, 211, 252, 0.9);
  outline-offset: 3px;
}

.tetris-pc-page .rank-info-text {
  width: min(100%, 1000px);
  margin-bottom: 18px;
  padding: 0;
}

.tetris-pc-page .rank-text-content {
  width: 100%;
  padding: 10px;
  border-color: rgba(148, 163, 184, 0.16);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(14, 165, 233, 0.055), rgba(20, 184, 166, 0.03)),
    rgba(13, 25, 39, 0.76);
  box-shadow: 0 12px 30px rgba(10, 23, 38, 0.18);
}

.tetris-pc-page .rank-info-container {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 8px;
  align-items: stretch;
}

.tetris-pc-page .rank-module {
  min-height: 44px;
  padding: 8px 10px;
  gap: 8px;
  border-radius: 8px;
}

.tetris-pc-page .rank-module-icon {
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.tetris-pc-page .rank-module-stats {
  justify-content: flex-start;
  gap: 4px 10px;
}

.tetris-pc-page .rank-stat,
.tetris-pc-page .rank-link-compact {
  font-size: 0.75rem;
}

.tetris-pc-page .rank-stat-label {
  color: rgba(255, 255, 255, 0.7);
}

.tetris-pc-page .rank-stat-value {
  font-size: 0.78rem;
}

.tetris-pc-page .rank-actions-inline {
  gap: 8px;
}

.tetris-pc-page .rank-link-compact,
.tetris-pc-page .rank-refresh-compact {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.tetris-pc-page .rank-link-compact {
  padding: 0 12px;
}

.tetris-pc-page .rank-refresh-compact {
  min-width: 40px;
  padding: 0;
}

.tetris-pc-page .game-stage-shell {
  position: relative;
  display: flex;
  width: 100%;
  justify-content: center;
}

.tetris-pc-page .base-content {
  max-width: 1000px;
  gap: 28px;
}

.tetris-pc-page .game-container {
  width: 100%;
  max-width: 860px;
  gap: 16px;
  align-items: flex-start;
}

.tetris-pc-page .game-sidebar,
.tetris-pc-page .sidebar-content {
  gap: 16px;
}

.tetris-pc-page .panel {
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 12px;
  background: rgba(18, 32, 47, 0.72);
  box-shadow: 0 10px 28px rgba(9, 21, 34, 0.16);
}

.tetris-pc-page .panel h2,
.tetris-pc-page .panel h3 {
  margin-bottom: 12px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.tetris-pc-page .score-grid {
  gap: 8px;
}

.tetris-pc-page .score-item {
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.07);
  border-radius: 8px;
  background: rgba(7, 18, 30, 0.34);
}

.tetris-pc-page .score-item h2,
.tetris-pc-page .score-item h3 {
  margin-bottom: 6px;
  color: rgba(236, 240, 241, 0.82);
  font-size: 0.86rem;
  font-weight: 600;
}

.tetris-pc-page .score-item .value {
  line-height: 1.1;
}

.tetris-pc-page .quick-links-panel {
  margin-top: 0 !important;
}

.tetris-pc-page .quick-links-list {
  gap: 2px;
  margin-top: 4px !important;
}

.tetris-pc-page .quick-links-list a {
  width: 100%;
  padding: 5px 7px;
  border-radius: 7px;
  color: #62c8f2 !important;
  line-height: 1.35;
  transition:
    color 150ms ease,
    background-color 150ms ease,
    transform 150ms ease;
}

.tetris-pc-page .quick-links-list a:hover {
  color: #b8ecff !important;
  background: rgba(56, 189, 248, 0.09);
  transform: translateX(2px);
}

.tetris-pc-page .canvas-container {
  padding: 8px;
  border: 1px solid rgba(125, 211, 252, 0.12);
  border-radius: 12px;
  background: rgba(6, 15, 25, 0.46);
  box-shadow:
    inset 0 0 24px rgba(0, 0, 0, 0.22),
    0 14px 34px rgba(7, 18, 30, 0.18);
}

.tetris-pc-page canvas#gameCanvas {
  border-radius: 8px;
}

.tetris-pc-page .preview-panel {
  margin-bottom: 0 !important;
}

.tetris-pc-page .preview-container {
  border: 1px solid rgba(148, 163, 184, 0.08);
  border-radius: 8px;
  background: rgba(7, 18, 30, 0.34);
}

.tetris-pc-page .controls-list {
  gap: 7px;
}

.tetris-pc-page .control-item {
  gap: 9px;
  color: rgba(236, 240, 241, 0.86);
  font-size: 0.92rem;
}

.tetris-pc-page .control-item .key {
  border: 1px solid rgba(125, 211, 252, 0.12);
  background: rgba(55, 91, 128, 0.88);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.16);
}

.tetris-pc-page .review-content {
  max-width: 1000px;
  margin: 20px 0 0;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 14px;
  background: rgba(18, 32, 47, 0.76);
  box-shadow: 0 14px 36px rgba(9, 21, 34, 0.17);
}

.tetris-pc-page .share-button {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(22, 42, 60, 0.82);
  box-shadow: 0 10px 30px rgba(5, 14, 24, 0.24);
}

.tetris-pc-page .share-button-hint {
  opacity: 0.82;
  animation-duration: 8s;
}

@media (min-width: 1300px) {
  .tetris-pc-page .ad_sidebar {
    position: absolute;
    top: 0;
    left: max(16px, calc(50% - 720px));
    width: 200px;
  }
}

@media (min-width: 768px) and (max-width: 1299px) {
  .tetris-pc-page .game-stage-shell {
    flex-direction: column;
    align-items: center;
  }

  .tetris-pc-page .ad_sidebar {
    order: 2;
    width: 200px;
    margin-top: 32px;
  }

  .tetris-pc-page .base-content {
    order: 1;
  }
}

@media (max-width: 1100px) {
  html {
    min-width: 0;
  }

  .tetris-pc-page .base-wrapper {
    padding-inline: 16px;
  }

  .tetris-pc-page .game-header,
  .tetris-pc-page .rank-info-text {
    width: min(100%, 920px);
  }

  .tetris-pc-page .game-container {
    max-width: 800px;
    gap: 14px;
  }

  .tetris-pc-page .game-sidebar {
    width: 220px;
  }
}

@media (max-width: 900px) {
  .tetris-pc-page .game-header {
    flex-direction: column;
    justify-content: center;
    gap: 12px;
  }

  .tetris-pc-page .game-settings {
    width: 100%;
    justify-content: center;
    overflow-x: auto;
    padding: 4px;
    scrollbar-width: none;
  }

  .tetris-pc-page .game-settings::-webkit-scrollbar {
    display: none;
  }

  .tetris-pc-page .rank-info-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tetris-pc-page .rank-actions-inline {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .tetris-pc-page .game-container {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 700px;
    gap: 16px;
  }

  .tetris-pc-page .game-main {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-self: center;
  }

  .tetris-pc-page .game-sidebar {
    width: auto;
  }

  .tetris-pc-page .game-sidebar.left {
    grid-column: 1;
    grid-row: 2;
  }

  .tetris-pc-page .game-sidebar.right {
    grid-column: 2;
    grid-row: 2;
  }

  .tetris-pc-page .score-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tetris-pc-page .score-item:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .tetris-pc-page .base-wrapper {
    padding: 12px 12px 40px;
  }

  .tetris-pc-page .game-page-top-ad-space {
    margin-bottom: 18px;
  }

  .tetris-pc-page .game-header h1 {
    font-size: 1.75rem;
  }

  .tetris-pc-page .game-settings {
    justify-content: flex-start;
  }

  .tetris-pc-page .rank-info-container,
  .tetris-pc-page .game-container {
    grid-template-columns: minmax(0, 1fr);
  }

  .tetris-pc-page .rank-actions-inline,
  .tetris-pc-page .game-main,
  .tetris-pc-page .game-sidebar.left,
  .tetris-pc-page .game-sidebar.right {
    grid-column: 1;
  }

  .tetris-pc-page .game-main {
    grid-row: 1;
    min-width: 0;
    width: 100%;
  }

  .tetris-pc-page .game-sidebar.left {
    grid-row: 2;
  }

  .tetris-pc-page .game-sidebar.right {
    grid-row: 3;
  }

  .tetris-pc-page .panel {
    min-width: 0;
  }

  .tetris-pc-page .score-grid {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .tetris-pc-page .canvas-container {
    width: 100% !important;
    max-width: 336px;
    height: calc((min(100vw - 44px, 318px) * 2) + 18px) !important;
    aspect-ratio: auto;
    align-self: stretch;
    margin-inline: auto;
  }

  .tetris-pc-page canvas#gameCanvas {
    width: 100% !important;
    height: 100% !important;
    max-height: none;
    aspect-ratio: auto;
  }

  .tetris-pc-page .preview-container {
    width: 100%;
    height: auto;
    margin: 0;
    background: rgba(7, 18, 30, 0.34);
  }

  .tetris-pc-page .review-content {
    padding: 14px;
  }

  .tetris-pc-page .share-button-hint {
    display: none;
  }
}

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