/* Juego del CNLC: 100 m libres */
:root { --navy: #04122b; --deep: #030e22; --orange: #ff7a1a; --ice: #eef3fa; }
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--deep); color: var(--ice); font-family: "Inter", system-ui, sans-serif; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }

.game-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px clamp(16px, 4vw, 40px); }
.game-brand { display: flex; align-items: center; gap: 10px; font-family: "Anton", sans-serif; font-size: 18px; text-transform: uppercase; }
.game-brand img { width: 40px; height: auto; }
.game-back { font-size: 14px; font-weight: 600; color: rgba(238, 243, 250, .75); }
.game-back:hover { color: var(--orange); }

.game-main { width: min(100%, 1000px); margin: 0 auto; padding: 0 16px 40px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.game-title { margin: 0; font-family: "Press Start 2P", monospace; font-weight: 400; font-size: clamp(18px, 3.4vw, 30px); color: var(--orange); text-transform: uppercase; text-shadow: 3px 3px 0 #0b2b63; }
.game-screen { position: relative; width: 100%; padding: 8px; border-radius: 10px; background: #0b2b63; box-shadow: 0 0 0 3px var(--orange), 0 16px 50px rgba(0, 0, 0, .5); }
canvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; image-rendering: pixelated; background: #000; touch-action: manipulation; }

.game-pad { display: none; width: 100%; grid-template-columns: 1fr 2fr; gap: 10px; }
.game-pad button {
  min-height: 92px; border: 0; border-radius: 12px; cursor: pointer;
  font-family: "Press Start 2P", monospace; font-size: 16px; color: var(--navy); background: var(--orange);
  box-shadow: 0 6px 0 #b9500b; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.game-pad button:active { transform: translateY(4px); box-shadow: 0 2px 0 #b9500b; }
.game-pad #btn-viraje { background: #3fb8f0; box-shadow: 0 6px 0 #1b7fae; }
.game-pad small { display: block; margin-top: 8px; font-size: 8px; }

.game-help { margin: 4px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; font-size: 14px; color: rgba(238, 243, 250, .82); }
kbd { display: inline-block; padding: 2px 8px; margin-right: 4px; border-radius: 5px; border-bottom: 2px solid #1b3b78; background: #0b2b63; color: #fff; font-family: inherit; font-size: 12px; font-weight: 700; }
.game-note { margin: 0; font-size: 14px; color: rgba(238, 243, 250, .7); }
.game-join { margin-top: 6px; font-weight: 700; color: var(--orange); }
.game-join:hover { text-decoration: underline; }

[hidden] { display: none !important; }
.game-save {
  position: absolute; left: 50%; top: 50%; z-index: 2; transform: translate(-50%, -50%);
  width: min(92%, 380px); padding: 18px; display: flex; flex-direction: column; gap: 8px;
  border: 2px solid var(--orange); border-radius: 10px; background: var(--deep); font-size: 14px;
}
.game-save__title { margin: 0; font-family: "Press Start 2P", monospace; font-size: 12px; color: var(--orange); }
.game-save strong { color: #fff; font-weight: 400; }
.game-save input { padding: 10px 12px; border: 2px solid #1b3b78; border-radius: 6px; background: var(--navy); color: #fff; font: 600 16px "Inter", sans-serif; }
.game-save small { color: rgba(238, 243, 250, .7); }
.game-save__error { margin: 0; color: #ff8a8a; font-weight: 600; }
.game-save__error:empty { display: none; }
.game-save__actions { display: flex; gap: 8px; }
.game-save__actions button { flex: 1; padding: 11px; border: 0; border-radius: 6px; cursor: pointer; font: 700 14px "Inter", sans-serif; background: var(--orange); color: var(--navy); }
.game-save__actions button[type=button] { background: #0b2b63; color: #fff; }
.game-save__actions button:disabled { opacity: .6; }

.locker { width: min(100%, 720px); margin-top: 10px; padding: 18px; border: 2px solid #0b2b63; border-radius: 10px; }
.locker h2 { margin: 0; font-family: "Press Start 2P", monospace; font-weight: 400; font-size: 16px; text-align: center; color: var(--orange); }
.locker__lead { margin: 8px 0 12px; text-align: center; font-size: 14px; color: rgba(238, 243, 250, .75); }
.locker__layout { display: grid; grid-template-columns: 170px 1fr; gap: 20px; align-items: center; }
.locker canvas { width: 100%; height: auto; aspect-ratio: 40 / 64; border-radius: 6px; }
.locker__card { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 2px solid #0b2b63; font-size: 13px; font-weight: 700; }
.locker__card input { flex: 1; min-width: 150px; padding: 9px 11px; border: 2px solid #1b3b78; border-radius: 6px; background: var(--navy); color: #fff; font: 600 16px "Inter", sans-serif; }
.game-start { position: absolute; left: 0; right: 0; top: 8%; z-index: 1; display: flex; justify-content: center; gap: 8px; padding: 0 12px; }
.game-start button { padding: 9px 14px; border: 2px solid var(--navy); border-radius: 8px; cursor: pointer; font: 700 clamp(12px, 1.5vw, 15px) "Inter", sans-serif; background: var(--orange); color: var(--navy); box-shadow: 3px 3px 0 var(--navy); }
.game-start button + button { background: #fff; }
.locker__card .locker__go { background: #fff; }
.locker__card button { padding: 11px 14px; border: 0; border-radius: 6px; cursor: pointer; background: var(--orange); color: var(--navy); font: 700 14px "Inter", sans-serif; }
.locker__options { display: grid; gap: 12px; }
.locker__group { display: grid; grid-template-columns: 86px 1fr; align-items: center; gap: 10px; }
.locker__title { margin: 0; font-size: 13px; font-weight: 700; }
.locker__row { display: flex; flex-wrap: wrap; gap: 8px; }
.locker__swatch { width: 32px; height: 32px; padding: 0; border: 2px solid rgba(238, 243, 250, .35); border-radius: 6px; cursor: pointer; }
.locker__pill { padding: 7px 11px; border: 2px solid #1b3b78; border-radius: 6px; background: var(--navy); color: #fff; font: 600 13px "Inter", sans-serif; cursor: pointer; }
.locker__swatch[aria-pressed=true], .locker__pill[aria-pressed=true] { border-color: var(--orange); box-shadow: 0 0 0 2px var(--orange); }

.game-rank { width: min(100%, 520px); margin-top: 8px; }
.game-rank h2 { margin: 0 0 10px; font-family: "Press Start 2P", monospace; font-weight: 400; font-size: 16px; text-align: center; color: var(--orange); }
.game-rank ol { margin: 0; padding: 0; list-style: none; border: 2px solid #0b2b63; border-radius: 10px; overflow: hidden; }
.game-rank li { display: grid; grid-template-columns: 26px 28px 1fr auto; align-items: center; gap: 10px; padding: 9px 14px; font-weight: 600; }
.game-rank li:nth-child(even) { background: rgba(11, 43, 99, .45); }
.game-rank__face { width: 24px; height: 28px; border-radius: 3px; image-rendering: pixelated; }
.game-rank li span:first-child { color: var(--orange); }
.game-rank li.game-rank__empty { display: block; text-align: center; font-weight: 400; color: rgba(238, 243, 250, .7); }

@media (max-width: 640px) {
  .locker__layout { grid-template-columns: 1fr; justify-items: center; }
  .locker canvas { width: 150px; }
  .locker__options { width: 100%; }
  .locker__group { grid-template-columns: 1fr; gap: 6px; }
}

@media (hover: none) {
  .game-pad { display: grid; }
  .game-help li:first-child, .game-help li:nth-child(2), .game-help li:last-child { display: none; }
  .game-help { display: none; }
}
@media (hover: none) and (orientation: landscape) {
  .game-top, .game-title, .game-note, .game-join { display: none; }
  .game-main { flex-direction: row; flex-wrap: wrap; justify-content: center; padding: 4px; gap: 6px; }
  .game-screen { width: min(100%, 124vh); padding: 3px; }
  .game-pad button { min-height: 56px; }
}
