/* ============================================================
 * responsive.css — Media Queries for All Screens
 * ============================================================
 * PURPOSE:
 *   Adapt the CRT frame and all screens across device sizes.
 *   IMPORTANT: The circular menu layout is NEVER collapsed
 *   into a vertical list. It always remains circular.
 *
 * BREAKPOINTS:
 *   Desktop: ≥1024px — Full experience
 *   Tablet:  768–1023px — Slightly smaller ring and CRT
 *   Mobile:  ≤767px — Compact but still circular
 * ============================================================ */

/* ============================================================
   TABLET (768px – 1023px)
   ============================================================ */
@media (max-width: 1023px) {
  .crt-monitor {
    width: 96vw;
    height: 90vh;
    border-radius: 22px / 20px;
  }

  .crt-screen {
    inset: 8px;
    border-radius: 16px / 14px;
  }

  /* Tablet arcade layout adjustments */
  .arcade-hud {
    margin-bottom: 8px;
    padding-bottom: 6px;
  }

  .hud-item {
    font-size: 9.5px;
    gap: 5px;
    padding: 3px 6px;
  }

  .hud-value {
    font-size: 10px;
  }

  .hud-label {
    font-size: 7px;
  }

  .arcade-grid {
    --grid-col-gap: 8px;
    --grid-row-gap: 8px;
    gap: var(--grid-row-gap) var(--grid-col-gap);
  }

  .grid-node {
    padding: 4px;
    border-width: 1.5px;
  }

  .grid-node-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
  }

  .grid-node-label {
    font-size: 6.5px;
  }

  /* Battleships bigger icon on tablet */
  .grid-node[data-id="battleships"] .grid-node-icon {
    width: 30px;
    height: 30px;
  }

  .grid-node[data-id="battleships"] .grid-node-label {
    font-size: 5.5px;
  }

  .arcade-details-panel {
    padding: 8px;
  }

  .details-showcase {
    gap: 8px;
    margin-bottom: 8px;
  }

  .details-icon-wrapper {
    width: 36px;
    height: 36px;
  }

  .details-icon-wrapper svg {
    width: 24px;
    height: 24px;
  }

  .details-title {
    font-size: 11px;
  }

  .details-stats-block {
    gap: 4px;
    margin-bottom: 8px;
  }

  .stat-row {
    font-size: 6.5px;
  }

  .details-info-box {
    font-size: 7px;
    line-height: 1.5;
    margin-bottom: 8px;
  }

  .details-action-btn {
    padding: 4px;
    font-size: 7.5px;
  }
}

/* ============================================================
   MOBILE (≤767px)
   Still circular — NOT a vertical list!
   ============================================================ */
@media (max-width: 767px) {
  body {
    display: block;
  }

  .website-container {
    width: 100%;
    height: 100%;
  }

  .crt-monitor {
    width: 100vw;
    height: var(--app-height, 100svh);
    max-width: none;
    max-height: none;
    border-radius: 0;
  }

  .crt-screen {
    inset: 0;
    border-radius: 0;
  }

  /* ---- MENU SCREEN PADDING ---- */
  .menu-screen {
    padding: max(10px, calc(env(safe-area-inset-top, 0px) + 8px)) 10px calc(env(safe-area-inset-bottom, 0px) + 14px);
    justify-content: flex-start;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .menu-screen.active::before,
  .menu-screen.active::after,
  .arcade-hud::after,
  .arcade-details-panel::before,
  .arcade-details-panel::after,
  .details-header-border::after,
  .grid-node::before,
  .grid-node.selected::before {
    display: none;
  }

  /* ---- COMPACT HUD ---- */
  .arcade-hud {
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-bottom: 8px;
    padding-bottom: 6px;
  }

  .hud-item {
    font-size: 7px;
    padding: 4px 7px;
    gap: 4px;
  }

  .hud-value {
    font-size: 8px;
  }

  .hud-label {
    font-size: 6px;
  }

  .hud-lives {
    min-width: auto;
    gap: 4px;
  }

  .pixel-heart {
    --heart-size: 3px;
  }

  .hud-soc-link {
    width: 22px;
    height: 22px;
  }

  .hud-item.soc-icons {
    gap: 4px;
    padding: 2px 5px;
  }

  /* ---- DASHBOARD LAYOUT ---- */
  .arcade-dashboard {
    width: 100%;
    flex-direction: column;
    gap: 10px;
    flex: 0 0 auto;
    min-height: auto;
    margin-bottom: 8px;
  }

  /* ---- GRID ---- */
  .arcade-grid {
    --grid-col-gap: 10px;
    --grid-row-gap: 10px;
    gap: var(--grid-row-gap) var(--grid-col-gap);
    flex: 0 0 auto;
    width: 100%;
    justify-content: space-between;
    align-content: flex-start;
  }

  .grid-node {
    flex: 0 0 calc((100% - var(--grid-col-gap)) / 2);
    max-width: calc((100% - var(--grid-col-gap)) / 2);
    min-height: 84px;
    aspect-ratio: auto;
    padding: 10px 8px;
    border-width: 1.5px;
    border-radius: 6px;
    animation: none;
    backdrop-filter: none;
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  }

  .grid-node.selected {
    transform: none;
    animation: none;
  }

  .grid-node-icon {
    width: 30px;
    height: 30px;
    margin-bottom: 6px;
  }

  .grid-node-label {
    font-size: 7px;
    line-height: 1.4;
    letter-spacing: 0.3px;
  }

  .grid-node[data-id="battleships"] .grid-node-icon {
    width: 30px;
    height: 30px;
  }

  .grid-node[data-id="battleships"] .grid-node-label {
    font-size: 6.4px;
  }

  /* ---- DETAILS PANEL ---- */
  .arcade-details-panel {
    flex: 1 1 auto;
    min-height: 280px;
    max-height: none;
    padding: 10px;
    border-width: 2px;
    overflow: visible;
    backdrop-filter: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
  }

  .details-header-border {
    margin-bottom: 8px;
    padding-bottom: 5px;
  }

  .details-header {
    font-size: 8px;
    animation: none;
  }

  .details-showcase {
    gap: 10px;
    margin-bottom: 10px;
    animation: none;
  }

  .details-icon-wrapper {
    width: 40px;
    height: 40px;
  }

  .details-icon-wrapper svg,
  .details-icon-wrapper .grid-node-img {
    width: 26px;
    height: 26px;
  }

  .details-title {
    font-size: 12px;
    line-height: 1.35;
    text-shadow: none;
  }

  .details-stats-block {
    gap: 4px;
    margin-bottom: 8px;
    padding-bottom: 7px;
  }

  .stat-row {
    font-size: 7.5px;
    animation: none;
  }

  .details-info-box {
    font-size: 8.5px;
    line-height: 1.75;
    max-height: none;
    min-height: 140px;
    flex: 1;
    overflow-y: auto;
    margin-bottom: 10px;
    padding-right: 6px;
  }

  .details-action-btn {
    padding: 10px 12px;
    font-size: 7.5px;
    line-height: 1.5;
  }

  /* ---- PROMPT ---- */
  .menu-select-prompt {
    font-size: 7px;
    letter-spacing: 0.6px;
    text-align: center;
    width: 100%;
    line-height: 1.5;
    margin-top: auto;
    animation: none;
  }

  /* ---- SPONSOR BAR ---- */
  .sponsor-bar {
    gap: 12px;
    padding: 4px 0 2px;
    flex-wrap: wrap;
  }

  .sponsor-bar-item img {
    width: 64px;
    height: 64px;
  }

  /* ---- SFX BUTTON ---- */
  .sfx-toggle {
    right: 10px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
    font-size: 8px;
    padding: 8px 10px;
    z-index: 10000;
    opacity: 0.9;
  }

  .sfx-toggle:hover {
    opacity: 1;
  }

  .hud-label,
  .hud-value,
  .details-icon-wrapper::after,
  .stat-bar span,
  .grid-node.selected .grid-node-label,
  .grid-node.selected .grid-node-icon,
  .grid-node.selected .grid-node-icon svg,
  .grid-node.selected .grid-node-icon .grid-node-img {
    animation: none;
  }

  .grid-node.selected .grid-node-label,
  .grid-node.selected .grid-node-icon {
    transform: none;
  }
}

/* ============================================================
   VERY SMALL SCREENS (≤400px)
   ============================================================ */
@media (max-width: 400px) {
  .grid-node-icon {
    width: 28px;
    height: 28px;
  }

  .grid-node-label {
    font-size: 6.4px;
    line-height: 1.35;
  }

  .grid-node[data-id="battleships"] .grid-node-icon {
    width: 28px;
    height: 28px;
  }

  .grid-node[data-id="battleships"] .grid-node-label {
    font-size: 6px;
  }

  .details-info-box {
    font-size: 8px;
    max-height: none;
  }

  .arcade-details-panel {
    min-height: 260px;
  }
}

@media (max-height: 720px) and (max-width: 400px) {
  .details-stats-block {
    display: none;
  }
}

/* ============================================================
   LANDSCAPE PHONE
   ============================================================ */
@media (max-height: 500px) and (orientation: landscape) {
  .arcade-dashboard {
    flex-direction: row;
    gap: 6px;
  }

  .arcade-grid {
    --grid-col-gap: 6px;
    --grid-row-gap: 6px;
    gap: var(--grid-row-gap) var(--grid-col-gap);
    justify-content: space-between;
  }

  .grid-node {
    flex: 0 0 calc((100% - (var(--grid-col-gap) * 2)) / 3);
    max-width: calc((100% - (var(--grid-col-gap) * 2)) / 3);
    min-height: 64px;
    padding: 6px 4px;
  }

  .grid-node-icon {
    width: 20px;
    height: 20px;
    margin-bottom: 2px;
  }

  .grid-node-label {
    font-size: 5.8px;
  }

  .details-stats-block {
    display: none;
  }

  .details-info-box {
    font-size: 6px;
    max-height: 60px;
  }

  .details-showcase {
    margin-bottom: 4px;
  }

  .details-icon-wrapper {
    width: 22px;
    height: 22px;
  }

  .details-title {
    font-size: 8px;
  }

  .details-action-btn {
    padding: 3px;
    font-size: 6px;
  }

  .loading-title {
    font-size: clamp(10px, 2.5vw, 18px);
  }

  .pizza-room {
    height: 80px;
  }

  .logo-placeholder {
    margin-bottom: 5px;
  }

  .press-start-text {
    margin-top: 10px;
  }

  /* Loading screen landscape */
  .loading-screen {
    padding: 8px 16px;
  }

  .bios-header {
    font-size: clamp(6px, 1.5vh, 10px);
    margin-bottom: 3px;
  }

  .bios-separator {
    margin-bottom: 4px;
  }

  .boot-checks {
    margin-bottom: 6px;
    gap: 2px;
  }

  .loading-section {
    margin-bottom: 4px;
  }

  .loading-arcade-label {
    margin-bottom: 4px;
    font-size: clamp(6px, 1.8vh, 10px);
    gap: 4px;
  }

  .loading-arcade-label .pizza-icon {
    font-size: 10px;
  }

  .pizza-bar-track {
    padding: 3px 5px;
  }

  .pizza-segment {
    width: 14px;
    height: 14px;
    font-size: 10px;
  }

  .pizza-bar-percent {
    font-size: 10px;
    min-width: 36px;
  }

  .loading-console {
    max-height: 40px;
    min-height: 20px;
    margin-bottom: 4px;
  }

  .pizza-tip-box {
    padding: 4px 8px;
    gap: 6px;
  }

  .pizza-tip-mascot {
    width: 24px;
  }

  .pizza-tip-mascot-fallback {
    font-size: 18px;
  }

  .pizza-tip-label {
    font-size: 4px;
  }

  .pizza-tip-text {
    font-size: 4px;
    min-height: 16px;
  }

  .loading-footer {
    font-size: 3.5px;
  }

  /* Start screen landscape */
  .start-tagline {
    bottom: 15%;
    font-size: 3px;
    letter-spacing: 3px;
  }

  .press-start-text {
    bottom: 6%;
    margin-top: 5px;
    padding: 6px 12px;
    font-size: 7px;
    letter-spacing: 3px;
  }

  .floating-mascot {
    width: 40px;
    bottom: 12%;
  }

  .logo-image {
    width: clamp(250px, 50vw, 400px);
  }

  .logo-text-fallback {
    font-size: clamp(14px, 3vw, 22px);
  }

  /* HUD landscape */
  .arcade-hud {
    margin-bottom: 4px;
    padding-bottom: 3px;
  }

  .hud-item {
    font-size: 6px;
    padding: 1px 4px;
    gap: 2px;
  }

  .hud-soc-link {
    width: 16px;
    height: 16px;
  }

  .hud-item.soc-icons {
    gap: 3px;
    padding: 1px 3px;
  }

  .hud-value {
    font-size: 7px;
    letter-spacing: 1px;
  }

  .hud-label {
    font-size: 5px;
  }

  .menu-select-prompt {
    font-size: 5px;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
  }

  .sponsor-bar {
    gap: 8px;
  }

  .sponsor-bar-item img {
    width: 44px;
    height: 44px;
  }

  .crt-screen {
    transform: perspective(900px) scale(1.01);
  }
}
