/* MARBLE ASCENSION — estilos */
:root {
  --blue: #2a6fdb; --blue-d: #1d55b0; --blue-l: #e8f0fd;
  --mint: #23d6a4; --yellow: #f2dc7a; --pink: #ef8ade;
  --ink: #12233f; --ink-2: #4a5b78; --card: rgba(255, 255, 255, 0.92);
  --font: "Nunito", "Segoe UI", "Trebuchet MS", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #cfd1d8; font-family: var(--font); color: var(--ink); }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; touch-action: none; }
#ui { position: fixed; inset: 0; pointer-events: none; }
.screen { position: absolute; inset: 0; display: none; pointer-events: auto; }
.screen.active { display: flex; }
.hidden { display: none !important; }

/* Menú (oscuro, a juego con el logo) */
#scr-menu { align-items: center; justify-content: flex-start; padding-left: 6vw;
  background: radial-gradient(ellipse at 18% 45%, rgba(40, 20, 90, 0.55), rgba(8, 10, 28, 0.82) 45%, rgba(8, 10, 28, 0.15) 75%), linear-gradient(90deg, rgba(6, 8, 22, 0.88), rgba(6, 8, 22, 0) 62%); }
.menu-wrap { display: flex; flex-direction: column; gap: 14px; max-width: 470px; }
.logo-img { width: min(470px, 80vw); height: auto; margin-left: -10px; user-select: none; filter: drop-shadow(0 8px 30px rgba(30, 160, 255, 0.35)); animation: logoFloat 5s ease-in-out infinite; }
@keyframes logoFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.tagline { margin: -4px 0 10px; font-weight: 800; color: #b9c8ef; font-size: 18px; letter-spacing: 0.02em; }
#scr-menu .btn { background: rgba(14, 20, 48, 0.75); color: #e6efff; border-color: #2fc6ff; box-shadow: 0 3px 0 #7b4dff, 0 0 18px rgba(47, 198, 255, 0.18); }
#scr-menu .btn:hover:not(:disabled) { background: rgba(40, 60, 130, 0.85); }
#scr-menu .btn.primary { background: linear-gradient(90deg, #12b4ff, #8a4dff); border-color: #8fdcff; color: #fff; }
#scr-menu .btn.primary:hover:not(:disabled) { background: linear-gradient(90deg, #36c2ff, #9d66ff); }
#scr-menu .lang-switch button { background: rgba(14, 20, 48, 0.75); color: #e6efff; border-color: #2fc6ff; }
#scr-menu .lang-switch button.on { background: #2fc6ff; color: #0a1030; }
#scr-menu .credits { color: #9fb0d8; }
.btns { display: flex; flex-direction: column; gap: 10px; }
.btn { font: inherit; font-weight: 800; font-size: 17px; padding: 12px 22px; border-radius: 14px; border: 2px solid var(--blue); background: #fff; color: var(--blue);
  cursor: pointer; text-align: left; transition: transform .08s, background .15s, box-shadow .15s; box-shadow: 0 3px 0 var(--blue-d); white-space: normal; line-height: 1.2; }
.btn:hover:not(:disabled) { background: var(--blue-l); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--blue-d); }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #3a7ff0; }
.btn.big { font-size: 20px; padding: 14px 32px; text-align: center; }
.btn.small { font-size: 13px; padding: 5px 10px; border-radius: 9px; box-shadow: 0 2px 0 var(--blue-d); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.lang-switch { display: flex; gap: 6px; margin-top: 8px; }
.lang-switch button { font: inherit; font-weight: 800; border: 2px solid var(--blue); background: #fff; color: var(--blue); border-radius: 10px; padding: 4px 12px; cursor: pointer; }
.lang-switch button.on { background: var(--blue); color: #fff; }
.credits { position: absolute; bottom: 14px; left: 7vw; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.credits.inline { position: static; margin-top: 12px; text-align: center; }

/* Paneles */
.panel-screen { align-items: center; justify-content: center; padding: 18px; }
.panel-screen.dim-bg { background: rgba(18, 35, 63, 0.35); backdrop-filter: blur(3px); }
.panel { background: var(--card); border-radius: 22px; padding: 24px 28px; width: min(560px, 100%); max-height: calc(100vh - 36px); overflow: auto;
  box-shadow: 0 20px 60px rgba(18, 35, 63, 0.3); border: 2px solid rgba(255, 255, 255, 0.8); }
.panel.wide { width: min(980px, 100%); }
.panel h2 { margin: 0 0 4px; font-size: 28px; font-weight: 900; color: var(--blue); }
.panel .sub { margin: 0 0 14px; color: var(--ink-2); font-weight: 600; line-height: 1.4; }
.badge { display: inline-block; background: var(--yellow); color: #6a5410; font-weight: 900; font-size: 12px; padding: 3px 10px; border-radius: 99px; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.06em; }
.note { color: var(--ink-2); font-size: 14px; font-style: italic; }
.row-btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.row-btns.left { justify-content: flex-start; }
.panel .btns .btn { text-align: center; }

/* Formularios */
.form { display: grid; gap: 12px; }
#gen-form { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 12px 18px; }
.field { display: flex; flex-direction: column; gap: 5px; font-weight: 800; font-size: 14px; color: var(--ink); min-width: 0; }
.field > span.lbl, .field > span:first-child { overflow-wrap: anywhere; }
.field input[type=text], .field select { font: inherit; font-weight: 700; font-size: 15px; padding: 8px 10px; border-radius: 10px; border: 2px solid #c8d6ee; background: #fff; color: var(--ink); width: 100%; min-width: 0; }
.field input[type=text]:focus, .field select:focus { outline: none; border-color: var(--blue); }
.field input[type=range] { width: 100%; accent-color: var(--blue); }
.field .inline { display: flex; gap: 8px; align-items: center; }
.field .inline input[type=text] { flex: 1; }
.field .val { font-weight: 900; color: var(--blue); }
.field.full { grid-column: 1 / -1; }
.seg { display: flex; border: 2px solid var(--blue); border-radius: 12px; overflow: hidden; flex-wrap: wrap; }
.seg button { flex: 1 1 auto; font: inherit; font-weight: 900; font-size: 15px; padding: 9px 10px; border: none; background: #fff; color: var(--blue); cursor: pointer; min-width: 0; white-space: normal; }
.seg button + button { border-left: 2px solid var(--blue); }
.seg button.on { background: var(--blue); color: #fff; }
.seg.hard button.on[data-v=hard] { background: #d6336c; }
.desc { font-weight: 600; font-size: 13px; color: var(--ink-2); line-height: 1.35; }
.check { display: flex; align-items: flex-start; gap: 8px; font-weight: 700; font-size: 14px; cursor: pointer; line-height: 1.25; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); flex: 0 0 auto; margin: 0; }
.elements { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px 14px; padding: 10px 12px; border-radius: 12px; background: var(--blue-l); }
.el-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.el-head .mini { display: flex; gap: 6px; }
.summary { margin-top: 14px; padding: 10px 14px; border-radius: 12px; background: #f3f7ff; border: 2px dashed #c8d6ee; font-weight: 800; color: var(--ink-2); font-size: 14px; line-height: 1.5; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 32px; height: 32px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px #c8d6ee; cursor: pointer; }
.swatches button.on { box-shadow: 0 0 0 3px var(--blue); }

table.keys { width: 100%; border-collapse: collapse; font-weight: 700; }
table.keys td { padding: 7px 4px; border-bottom: 1px solid #e3eaf6; vertical-align: top; }
table.keys td:first-child { white-space: normal; color: var(--ink-2); width: 45%; }
kbd { display: inline-block; font-family: inherit; font-weight: 900; font-size: 12px; background: #fff; border: 2px solid #c8d6ee; border-bottom-width: 4px; border-radius: 7px; padding: 1px 7px; color: var(--ink); }
.seed-row { font-weight: 700; margin: 6px 0 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seed-row b { color: var(--blue); font-size: 18px; }
.record { font-weight: 900; color: #d6336c; min-height: 22px; margin: 4px 0; }
.win-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 10px 0 16px; }
.win-stats div { background: var(--blue-l); border-radius: 12px; padding: 10px; text-align: center; }
.win-stats small { display: block; font-weight: 800; color: var(--ink-2); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.win-stats b { font-size: 22px; color: var(--blue); }

/* HUD */
#hud { position: absolute; inset: 0; pointer-events: none; }
.hud-tl { position: absolute; top: 14px; left: 16px; color: #fff; text-shadow: 0 2px 6px rgba(10, 30, 70, 0.55); font-weight: 800; }
.hud-time { font-size: 34px; font-weight: 900; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.hud-row { font-size: 15px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.hud-row .dim { opacity: 0.8; }
.hud-row.biome { margin-top: 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.12em; opacity: 0.9; }
.hud-tr { position: absolute; top: 12px; right: 14px; display: flex; gap: 8px; pointer-events: auto; transition: right .2s; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: none; background: rgba(255, 255, 255, 0.25); color: #fff; font-size: 18px; cursor: pointer; backdrop-filter: blur(4px); }
.icon-btn.text-btn { width: auto; padding: 0 14px; font: inherit; font-weight: 800; font-size: 14px; white-space: nowrap; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.4); }
#altbar { position: absolute; right: 22px; top: 70px; bottom: 70px; width: 14px; display: flex; flex-direction: column; align-items: center; transition: right .2s; }
#altbar .goal-ico { order: -1; color: #fff; font-size: 18px; text-shadow: 0 2px 6px rgba(10, 30, 70, 0.55); margin-bottom: 4px; }
#altbar .track { position: relative; flex: 1; width: 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.28); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35); }
#alt-fill { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 8px; background: rgba(255, 255, 255, 0.55); }
#alt-max { position: absolute; left: -5px; right: -5px; height: 2px; background: var(--yellow); }
#alt-me { position: absolute; left: 50%; width: 16px; height: 16px; margin: 0 0 -8px -8px; border-radius: 50%; background: #1fbf95; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); }
#alt-bots .b { position: absolute; left: 50%; width: 9px; height: 9px; margin: 0 0 -4.5px -4.5px; border-radius: 50%; border: 1px solid #fff; }
body.dbg-open .hud-tr { right: 344px; }
body.dbg-open #altbar { right: 352px; }

#countdown { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); font-size: clamp(80px, 16vw, 180px); font-weight: 900; color: #fff;
  text-shadow: 0 6px 0 var(--blue), 0 14px 40px rgba(10, 30, 70, 0.5); pointer-events: none; opacity: 0; white-space: nowrap; }
#countdown.pop { animation: pop .8s ease-out forwards; }
@keyframes pop { 0% { opacity: 0; transform: translate(-50%, -50%) scale(1.6); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); } }
#intro-hint { position: absolute; bottom: 34px; left: 50%; transform: translateX(-50%); color: #fff; font-weight: 800; background: rgba(18, 35, 63, 0.45); padding: 8px 18px; border-radius: 99px; backdrop-filter: blur(4px); max-width: 90vw; text-align: center; }
#toasts { position: absolute; top: 22%; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { color: #fff; font-weight: 900; font-size: 26px; text-shadow: 0 3px 0 #d6336c, 0 8px 24px rgba(10, 30, 70, 0.5); animation: toast 2.2s ease-out forwards; white-space: nowrap; }
@keyframes toast { 0% { opacity: 0; transform: translateY(10px) scale(1.2); } 12% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }

/* Debug */
#debug { position: absolute; top: 0; right: 0; bottom: 0; width: 330px; background: rgba(12, 20, 38, 0.9); color: #dfe8f8; pointer-events: auto; overflow-y: auto;
  font: 12px/1.35 ui-monospace, "Cascadia Mono", Consolas, monospace; padding: 10px 12px 30px; border-left: 2px solid #2a6fdb; backdrop-filter: blur(4px); }
#debug h3 { margin: 0; font-size: 15px; color: #7fb2ff; letter-spacing: 0.1em; }
#debug .hint { color: #8aa0c4; margin-bottom: 8px; }
#debug details { border-top: 1px solid rgba(127, 178, 255, 0.25); padding: 6px 0; }
#debug summary { cursor: pointer; font-weight: 700; color: #a8c8ff; padding: 2px 0; }
#debug .d-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0; }
#debug .d-row label { flex: 1; min-width: 0; overflow-wrap: anywhere; cursor: pointer; }
#debug .d-row input[type=range] { width: 120px; accent-color: #7fb2ff; }
#debug .d-row .v { width: 44px; text-align: right; color: #ffd56b; }
#debug input[type=checkbox] { accent-color: #7fb2ff; }
#debug button { font: inherit; background: #1d3566; color: #dfe8f8; border: 1px solid #3a5ea8; border-radius: 6px; padding: 4px 8px; cursor: pointer; margin: 2px 2px 2px 0; }
#debug button:hover { background: #2a4a8a; }
#debug .info { white-space: pre-wrap; color: #cfe0ff; background: rgba(0, 0, 0, 0.25); padding: 6px; border-radius: 6px; }
#debug .btnrow { display: flex; flex-wrap: wrap; }

@media (max-width: 700px) {
  #scr-menu { padding-left: 16px; padding-right: 16px; }
  .credits { left: 16px; }
  #debug { width: 100%; }
}

/* ===== Pantallas de menú con el mismo overlay oscuro/neón que el menú principal ===== */
.panel-screen { background: radial-gradient(ellipse at 50% 40%, rgba(40, 20, 90, 0.5), rgba(8, 10, 28, 0.82) 55%, rgba(6, 8, 22, 0.92)); }
.panel-screen.dim-bg { background: radial-gradient(ellipse at 50% 40%, rgba(40, 20, 90, 0.45), rgba(8, 10, 28, 0.75) 60%, rgba(6, 8, 22, 0.88)); backdrop-filter: blur(3px); }
.panel-screen .panel {
  --ink: #e6efff; --ink-2: #9fb0d8; --blue: #2fc6ff; --blue-d: #7b4dff; --blue-l: rgba(47, 198, 255, 0.08);
  background: rgba(12, 16, 40, 0.86); color: var(--ink);
  border: 2px solid rgba(47, 198, 255, 0.45); box-shadow: 0 0 0 1px rgba(123, 77, 255, 0.25), 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(47, 198, 255, 0.12);
  backdrop-filter: blur(6px); scrollbar-color: #3a4f9a transparent;
}
.panel-screen .panel h2 { background: linear-gradient(90deg, #2fc6ff, #a06bff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.panel-screen .field input[type=text], .panel-screen .field select { background: rgba(6, 10, 28, 0.9); border-color: #2b3c78; color: var(--ink); }
.panel-screen .field input[type=text]:focus, .panel-screen .field select:focus { border-color: #2fc6ff; box-shadow: 0 0 12px rgba(47, 198, 255, 0.25); }
.panel-screen .field select option { background: #0c1028; color: #e6efff; }
.panel-screen .field input[type=text]:disabled { opacity: 0.5; }
.panel-screen .field input[type=range], .panel-screen .check input { accent-color: #2fc6ff; }
.panel-screen .seg { border-color: #2fc6ff; }
.panel-screen .seg button { background: rgba(14, 20, 48, 0.75); color: #cfe3ff; }
.panel-screen .seg button + button { border-left-color: rgba(47, 198, 255, 0.5); }
.panel-screen .seg button:hover { background: rgba(40, 60, 130, 0.8); }
.panel-screen .seg button.on { background: linear-gradient(90deg, #12b4ff, #8a4dff); color: #fff; }
.panel-screen .seg.hard button.on[data-v=hard] { background: linear-gradient(90deg, #ff3d7f, #b23dff); }
.panel-screen .btn { background: rgba(14, 20, 48, 0.75); color: #e6efff; border-color: #2fc6ff; box-shadow: 0 3px 0 #7b4dff, 0 0 18px rgba(47, 198, 255, 0.18); }
.panel-screen .btn:hover:not(:disabled) { background: rgba(40, 60, 130, 0.85); }
.panel-screen .btn.primary { background: linear-gradient(90deg, #12b4ff, #8a4dff); border-color: #8fdcff; color: #fff; }
.panel-screen .btn.primary:hover:not(:disabled) { background: linear-gradient(90deg, #36c2ff, #9d66ff); }
.panel-screen .btn.small { box-shadow: 0 2px 0 #7b4dff; }
.panel-screen .elements { background: rgba(47, 198, 255, 0.06); border: 1px solid rgba(47, 198, 255, 0.15); }
.panel-screen .summary { background: rgba(47, 198, 255, 0.06); border-color: rgba(47, 198, 255, 0.35); color: #b9c8ef; }
.panel-screen .field .val, .panel-screen .seed-row b { color: #2fc6ff; }
.panel-screen table.keys td { border-bottom-color: rgba(47, 198, 255, 0.15); }
.panel-screen kbd { background: rgba(6, 10, 28, 0.9); border-color: #2b3c78; color: #e6efff; }
.panel-screen .win-stats div { background: rgba(47, 198, 255, 0.08); border: 1px solid rgba(47, 198, 255, 0.2); }
.panel-screen .win-stats b { color: #2fc6ff; }
.panel-screen .record { color: #ff5c9a; }
.panel-screen .swatches button { border-color: #0c1028; box-shadow: 0 0 0 2px #2b3c78; }
.panel-screen .swatches button.on { box-shadow: 0 0 0 3px #2fc6ff; }
.panel-screen .credits.inline { color: #9fb0d8; }

.summary .warn { color: #ffb347; margin-top: 4px; }

#loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(6, 8, 22, 0.82); pointer-events: auto; z-index: 50; }
#loading .ld-box { color: #e6efff; font-weight: 900; font-size: 22px; text-align: center; }
#loading .ld-sub { color: #9fb0d8; font-size: 15px; margin-top: 6px; font-weight: 700; }
#loading .ld-box { width: min(460px, 86vw); }
#loading .ld-bar { margin-top: 16px; height: 14px; border-radius: 99px; background: rgba(47, 198, 255, 0.12); border: 1px solid rgba(47, 198, 255, 0.45); overflow: hidden; }
#ld-fill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #12b4ff, #8a4dff); box-shadow: 0 0 14px rgba(47, 198, 255, 0.6); transition: width .12s linear; }
#loading .ld-row { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; font-size: 13px; color: #9fb0d8; font-weight: 800; }
#ld-pct { color: #2fc6ff; font-variant-numeric: tabular-nums; }
