* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: "Trebuchet MS", "Segoe UI", Verdana, sans-serif;
  color: #f4fbff;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(255, 221, 120, .55), transparent 60%),
    linear-gradient(180deg, #1976d2 0%, #0e8fc9 35%, #14b0c9 62%, #f4d58d 100%);
  user-select: none; -webkit-user-select: none;
  touch-action: none;
}
#app { display: flex; justify-content: center; align-items: stretch; height: 100%; gap: 14px; padding: 6px; }
#col { display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }

/* ---------- afficheur ---------- */
#hud { display: flex; align-items: stretch; gap: 6px; width: var(--tw, 320px); height: 74px; flex: none; margin-bottom: 6px; }
#dmd {
  flex: 1; min-width: 0; border-radius: 10px; padding: 5px 10px 4px;
  background:
    radial-gradient(circle at 1.5px 1.5px, rgba(255, 170, 60, .13) 1px, transparent 1.6px) 0 0 / 4px 4px,
    linear-gradient(180deg, #1a0d05, #2a1509);
  border: 2px solid #6b4423; box-shadow: inset 0 0 14px #000, 0 3px 10px rgba(0, 30, 60, .45);
  color: #ffb347; text-shadow: 0 0 8px rgba(255, 150, 40, .9), 0 0 2px #ff8a1f;
  font-family: "Consolas", "Courier New", monospace; font-weight: 700; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
}
#dmdTop { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; white-space: nowrap; }
#hudBall, #hudMult { font-size: 12px; opacity: .9; }
#hudScore { font-size: 30px; letter-spacing: 1px; line-height: 1; }
#hudMsg { font-size: 13px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #ffd98a; }
#hudMsg.big { color: #fff3c4; animation: pop .35s ease-out; }
@keyframes pop { from { transform: scale(1.25); } to { transform: scale(1); } }
#hudBtns { display: grid; grid-template-columns: 26px 44px 26px 34px; grid-template-rows: 1fr 1fr; gap: 4px; flex: none; }
#hudBtns button, #hudSpeed {
  border-radius: 8px; border: 1px solid rgba(255, 255, 255, .5); background: rgba(8, 50, 90, .55); color: #fff;
  font: 700 15px "Trebuchet MS", sans-serif; display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer;
}
#hudSpeed { font-size: 12px; cursor: default; }
#btnNudge { grid-column: 1 / 3; }
#hudBtns button:active { background: rgba(255, 180, 60, .8); }
#hudBtns button.on { background: #ffd54f; color: #5a3a10; }
#btnView, #btnZoom { font-size: 12px !important; }

#stage { flex: 1; min-height: 0; position: relative; }
#table { display: block; position: absolute; left: 0; transform-origin: 50% 100%; border-radius: 14px 14px 8px 8px; box-shadow: 0 10px 30px rgba(0, 20, 50, .55), 0 0 0 3px #3a2413, 0 0 0 5px #a8763f; }

/* ---------- panneaux latéraux ---------- */
.side {
  width: 236px; flex: none; align-self: center; max-height: 96%; overflow: hidden;
  background: rgba(6, 46, 86, .55); border: 1px solid rgba(255, 255, 255, .35); border-radius: 14px;
  padding: 10px 14px 14px; backdrop-filter: blur(6px); box-shadow: 0 8px 24px rgba(0, 20, 50, .35);
  display: none;
}
body.wide .side { display: block; }
.side h2 { font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: #ffe08a; margin: 10px 0 6px; border-bottom: 1px solid rgba(255, 224, 138, .4); padding-bottom: 4px; }
.side ul, .side ol { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.side li { padding: 3px 0; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
#goals li, #ramps li { justify-content: flex-start; opacity: .78; }
#goals li::before, #ramps li::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, .25); flex: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5); }
#goals li.on, #ramps li.on { opacity: 1; }
#goals li.on::before { background: #ffd166; box-shadow: 0 0 8px #ffd166; }
#ramps li.on::before { background: var(--c, #ffd166); box-shadow: 0 0 8px var(--c, #ffd166); }
#goals li.blink::before { animation: blink .5s steps(2) infinite; background: #ff7a59; }
#ramps li b { margin-left: auto; font-weight: 700; color: #ffe08a; }
@keyframes blink { 50% { opacity: .2; } }
#sideScores li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#sideScores li b { color: #ffe08a; font-weight: 700; }
.keys li { justify-content: flex-start; flex-wrap: wrap; gap: 4px; }
kbd { background: rgba(255, 255, 255, .92); color: #123; border-radius: 5px; padding: 1px 6px; font: 700 11px "Consolas", monospace; box-shadow: 0 2px 0 rgba(0, 0, 0, .35); }

/* ---------- fenêtres ---------- */
#overlay { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(4, 34, 70, .45); backdrop-filter: blur(3px); z-index: 10; padding: 10px; }
#overlay.show { display: flex; }
.panel {
  display: none; flex-direction: column; align-items: center; gap: 12px; width: min(380px, 96vw); max-height: 96vh; overflow-x: hidden; overflow-y: auto;
  padding: 22px 22px 18px; border-radius: 22px; text-align: center;
  background: linear-gradient(180deg, rgba(20, 120, 190, .96), rgba(10, 90, 150, .97) 55%, rgba(244, 206, 130, .97) 55.2%, rgba(236, 186, 104, .98));
  border: 3px solid #fff; box-shadow: 0 20px 60px rgba(0, 20, 50, .6), inset 0 0 0 3px rgba(255, 180, 60, .7);
}
.panel.wide { width: min(560px, 96vw); background: linear-gradient(180deg, rgba(20, 120, 190, .97), rgba(10, 90, 150, .98)); }
.panel.show { display: flex; }
.panel h2 { margin: 0; font-size: 26px; letter-spacing: 2px; color: #fff; text-shadow: 0 2px 0 #0a4f86; }
.logo { position: relative; padding-top: 44px; }
.logo .sun { position: absolute; left: 50%; top: -6px; width: 92px; height: 92px; margin-left: -46px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fffbe0, #ffd54f 55%, #ff9f1a); box-shadow: 0 0 0 10px rgba(255, 213, 79, .28), 0 0 0 24px rgba(255, 213, 79, .14), 0 0 60px rgba(255, 200, 60, .9); animation: sun 5s ease-in-out infinite; }
@keyframes sun { 50% { box-shadow: 0 0 0 16px rgba(255, 213, 79, .22), 0 0 0 34px rgba(255, 213, 79, .1), 0 0 80px rgba(255, 200, 60, 1); } }
.logo h1 { position: relative; margin: 0; font: 900 52px/1 Georgia, "Times New Roman", serif; font-style: italic; color: #fff; text-shadow: 0 3px 0 #0a4f86, 0 6px 14px rgba(0, 30, 70, .6); letter-spacing: -1px; }
.logo h1 span { color: #ffd54f; }
.logo p { margin: 2px 0 0; font-size: 15px; letter-spacing: 4px; text-transform: uppercase; color: #e3f6ff; }
button { font-family: inherit; cursor: pointer; }
.panel button { border: 2px solid #fff; border-radius: 12px; background: rgba(8, 60, 110, .75); color: #fff; font-size: 14px; font-weight: 700; padding: 9px 12px; }
.panel button:hover { background: rgba(8, 80, 140, .95); }
.panel button.big { font-size: 22px; letter-spacing: 2px; padding: 12px 34px; background: linear-gradient(180deg, #ff8a5c, #ff4d6d); box-shadow: 0 5px 0 #b3264a, 0 10px 20px rgba(120, 20, 50, .45); border-radius: 16px; }
.panel button.big:hover { filter: brightness(1.08); }
.panel button.big:active { transform: translateY(3px); box-shadow: 0 2px 0 #b3264a; }
.panel button.link { border: none; background: none; color: #5a3a10; text-decoration: underline; font-weight: 400; font-size: 13px; padding: 2px; }
.panel button.on { background: #ffd54f; color: #5a3a10; }
.row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.small { margin: 0; font-size: 12px; color: #5a3a10; font-weight: 700; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.field input { font: 800 20px "Trebuchet MS", sans-serif; text-align: center; text-transform: uppercase; width: 230px; padding: 7px; border-radius: 12px; border: 2px solid #fff; background: rgba(255, 255, 255, .95); color: #0a4f86; outline: none; user-select: text; -webkit-user-select: text; }
.field input:focus { box-shadow: 0 0 0 4px rgba(255, 213, 79, .8); }
.slider { width: 100%; text-align: left; font-size: 14px; font-weight: 700; color: #fff; display: block; }
.slider b { float: right; color: #ffe08a; }
.slider input { width: 100%; accent-color: #ff6b5e; margin: 4px 0 0; }
.slider small { display: block; font-weight: 400; font-size: 11px; opacity: .85; }
#pSettings { background: linear-gradient(180deg, rgba(20, 120, 190, .97), rgba(10, 90, 150, .98)); gap: 9px; }
.choice { width: 100%; display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: 700; }
.choice span { display: flex; gap: 6px; }
.checks label { font-size: 14px; display: flex; gap: 6px; align-items: center; }
#scoreList { list-style: none; margin: 0; padding: 0; width: 100%; font-size: 16px; }
#scoreList li { display: grid; grid-template-columns: 30px 1fr auto; gap: 8px; padding: 4px 10px; border-radius: 8px; text-align: left; align-items: baseline; }
#scoreList li:nth-child(odd) { background: rgba(255, 255, 255, .13); }
#scoreList li b { color: #ffe08a; font-family: Consolas, monospace; }
#scoreList li.me { background: #ffd54f; color: #5a3a10; box-shadow: 0 0 0 2px #fff, 0 0 14px rgba(255, 213, 79, .9); }
#scoreList li.me b { color: #8a2a00; }
#scoreList li:nth-child(n+7), #scoreList .empty { color: #4a2f0c; }
#scoreList li:nth-child(n+7) b { color: #8a2a00; }
#pScores { background: linear-gradient(180deg, rgba(20, 120, 190, .97), rgba(10, 90, 150, .98) 62%, rgba(244, 206, 130, .97) 62.2%, rgba(236, 186, 104, .98)); }
.help { text-align: left; font-size: 13.5px; line-height: 1.45; }
.help p { margin: 0 0 8px; }
[hidden] { display: none !important; }
.entry { display: flex; flex-direction: column; align-items: center; gap: 12px; }
#overScore { font: 800 40px Consolas, monospace; color: #ffe08a; text-shadow: 0 3px 0 #0a4f86; }
#overRank { margin: 0; font-weight: 700; min-height: 1.2em; }
#toast { position: fixed; left: 50%; top: 96px; transform: translateX(-50%); background: rgba(6, 40, 80, .88); border: 1px solid #fff; color: #fff; padding: 7px 16px; border-radius: 999px; font-weight: 700; font-size: 14px; opacity: 0; transition: opacity .25s; pointer-events: none; z-index: 20; }
#toast.show { opacity: 1; }

@media (max-height: 560px) { #hud { height: 54px; } #hudScore { font-size: 20px; } }
@media (max-width: 480px) { #hudMsg { font-size: 11px; } #hudScore { font-size: 24px; } #hud { height: 66px; } }
