/* Minigolf 3D – menu.css : feutre, bois, blanc. Une colonne, gros boutons, une étape à la fois. */
:root {
    --ui-bg: rgba(10, 28, 18, .92);
    --ui-border: rgba(200, 154, 91, .38);
    --ui-text: #f4ecd8;
    --ui-pale: #bccaa6;
    --ui-accent: #e3b062;
    --ui-danger: #ef476f;
    --void: #121c17;
    --felt: #2f6b47;
    --felt-d: #1f4d33;
    --transition: all .25s cubic-bezier(.4, 0, .2, 1);
    --font: 'Fredoka', 'Nunito', 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body { font-family: var(--font); color: var(--ui-text); -webkit-tap-highlight-color: transparent; overscroll-behavior: none; background: var(--void); }
button, input { font: inherit; }
button { color: var(--ui-text); cursor: pointer; }
[hidden] { display: none !important; }

/* Barre du haut */
.top {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100; height: calc(52px + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 12px 0;
    display: flex; align-items: center; justify-content: space-between; background: var(--ui-bg); border-bottom: 1px solid var(--ui-border); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.top-title { font-size: 17px; font-weight: 700; letter-spacing: 1px; color: var(--ui-accent); }
.icon-btn {
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; padding: 0; text-decoration: none; border-radius: 10px;
    border: 1px solid var(--ui-border); background: rgba(227, 176, 98, .12); color: var(--ui-text); transition: var(--transition);
}
.icon-btn:hover { background: rgba(227, 176, 98, .25); }

.wrap { position: relative; z-index: 1; max-width: 480px; margin: 0 auto; padding: calc(52px + env(safe-area-inset-top, 0px) + 18px) 16px 40px; }

/* En-tête */
.hero { text-align: center; margin-bottom: 12px; }
.logo { width: 56px; height: 56px; margin: 0 auto 4px; display: block; filter: drop-shadow(0 10px 20px rgba(0, 0, 0, .5)); }
h1 { font-size: 30px; font-weight: 700; letter-spacing: 1px; line-height: 1.1; }
h1 span { color: var(--ui-accent); }
.sub { margin-top: 6px; font-size: 15px; color: var(--ui-pale); }

/* Panneau */
.panel { padding: 18px; border-radius: 22px; background: linear-gradient(160deg, #173222, #0c2217); border: 1px solid var(--ui-border); box-shadow: 0 24px 64px rgba(0, 0, 0, .55); }
.ttl { font-size: 22px; font-weight: 700; color: var(--ui-text); }
.lead { margin: 2px 0 6px; font-size: 15px; color: var(--ui-pale); }
.view > .ttl:first-child { margin-bottom: 12px; }
label { display: block; margin: 16px 0 8px; font-size: 14px; font-weight: 700; color: var(--ui-pale); }
label.chk { display: flex; align-items: center; gap: 10px; min-height: 48px; font-size: 16px; color: var(--ui-text); }
label.chk input { width: 24px; height: 24px; accent-color: var(--felt); }

/* Retour (haut de chaque panneau) */
.back { display: inline-flex; align-items: center; min-height: 44px; margin: -6px 0 6px -6px; padding: 0 12px 0 6px; border: none; background: none; font-size: 16px; font-weight: 700; color: var(--ui-pale); }
.back:hover { color: var(--ui-text); }

/* Les trois portes */
.door {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; min-height: 76px; margin-bottom: 10px; padding: 14px 18px; text-align: left; border-radius: 16px;
    border: 1px solid var(--ui-border); background: rgba(255, 255, 255, .05); transition: var(--transition);
}
.door:last-child { margin-bottom: 0; }
.door:hover { background: rgba(227, 176, 98, .14); transform: translateY(-1px); }
.door b { font-size: 20px; }
.door small { font-size: 14px; color: var(--ui-pale); }

/* Sélecteurs segmentés */
.seg { display: flex; gap: 8px; margin: 0 0 6px; }
.seg button { flex: 1; min-height: 48px; padding: 10px 6px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .06); font-size: 16px; font-weight: 700; transition: var(--transition); }
.seg button:hover { background: rgba(255, 255, 255, .12); }
.seg button.on { border-color: var(--ui-accent); background: rgba(227, 176, 98, .18); }

/* Cartes de map */
.maps { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }
.map {
    display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; min-height: 58px; padding: 8px 10px; text-align: left; border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .05); transition: var(--transition);
}
.map:hover:not(:disabled) { background: rgba(255, 255, 255, .1); transform: translateY(-1px); }
.map > i { flex: 0 0 36px; height: 36px; display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 18px; border-radius: 10px; background: linear-gradient(135deg, var(--felt), var(--felt-d)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); }
.map span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.map b { font-size: 15px; line-height: 1.15; }
.map small { font-size: 11.5px; line-height: 1.2; color: var(--ui-pale); }
/* Bouton d’action toujours visible : collé en bas de l’écran pendant qu’on parcourt les maps */
.bar { position: sticky; bottom: 0; z-index: 5; margin: 8px -18px -18px; padding: 14px 18px calc(16px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(180deg, rgba(12, 34, 23, 0), #0c2217 34%); border-radius: 0 0 22px 22px; }
.bar .big { margin: 0 0 8px; }
.bar .big:last-child { margin-bottom: 0; }
.map.on { border-color: var(--ui-accent); background: rgba(227, 176, 98, .16); box-shadow: 0 0 0 1px rgba(227, 176, 98, .3); }
.map.lock { opacity: .6; border-style: dashed; cursor: not-allowed; }
.map.lock > i { background: rgba(255, 255, 255, .08); }
.best { white-space: pre-line; line-height: 1.5; margin: 14px 0 4px; padding: 10px 14px; text-align: center; font-size: 14px; font-weight: 700; color: var(--ui-accent); background: rgba(255, 255, 255, .05); border-radius: 12px; }

/* Boutons d’action */
.big {
    display: block; width: 100%; min-height: 54px; margin: 14px 0 0; padding: 14px; border: none; border-radius: 14px; font-size: 18px; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, var(--felt), var(--felt-d)); box-shadow: 0 6px 18px rgba(0, 0, 0, .4); transition: var(--transition);
}
.big:hover:not(:disabled) { filter: brightness(1.12); transform: translateY(-2px); }
.big:active:not(:disabled) { transform: translateY(0); }
.big.alt { background: rgba(227, 176, 98, .12); border: 1px solid rgba(227, 176, 98, .32); color: var(--ui-accent); box-shadow: none; }
.big:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

/* Champs et room */
.fld, #jcode {
    width: 100%; min-height: 52px; padding: 10px 14px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .14); background: rgba(0, 0, 0, .3); color: var(--ui-text); font-size: 18px; text-align: center; margin-bottom: 14px;
}
#jcode { font-size: 24px; font-weight: 700; letter-spacing: .25em; text-transform: uppercase; margin-bottom: 0; }
.fld:focus, #jcode:focus { outline: none; border-color: var(--ui-accent); }
.hint { min-height: 1.4em; margin: 10px 0 0; font-size: 14px; line-height: 1.4; color: var(--ui-pale); text-align: center; }
.code { margin: 12px 0 4px; text-align: center; font-size: 40px; font-weight: 700; letter-spacing: 5px; color: var(--ui-accent); }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }
.chip { padding: 8px 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .06); font-size: 15px; font-weight: 700; }
.chip.me { border-color: var(--ui-accent); background: rgba(227, 176, 98, .18); }
.chip.off { opacity: .5; }

/* Règles (fenêtre) */
.overlay { display: none; position: fixed; inset: 0; z-index: 300; padding: 20px; align-items: center; justify-content: center; background: rgba(4, 14, 9, .86); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.overlay.open { display: flex; }
.modal { position: relative; width: 100%; max-width: 400px; max-height: 86vh; overflow-y: auto; padding: 28px 24px; background: linear-gradient(160deg, #173222, #0c2217); border: 1px solid var(--ui-border); border-radius: 22px; box-shadow: 0 24px 64px rgba(0, 0, 0, .7); }
.modal h2 { font-size: 22px; color: var(--ui-accent); margin: 0 0 14px; }
.modal h3 { font-size: 15px; color: var(--ui-accent); margin: 14px 0 6px; }
.modal section { border-bottom: 1px solid rgba(255, 255, 255, .07); padding-bottom: 10px; }
.modal ul { padding-left: 18px; }
.modal li { font-size: 14px; line-height: 1.6; margin-bottom: 4px; color: var(--ui-pale); }
.modal li strong { color: var(--ui-text); }
.modal-close { position: absolute; top: 14px; right: 14px; padding: 4px 8px; border: none; border-radius: 6px; background: none; color: var(--ui-pale); font-size: 20px; }
.modal-close:hover { background: rgba(255, 255, 255, .1); }

.ia-row { display:flex; align-items:center; justify-content:center; gap:10px; margin-top:12px; }
.ia-btn { padding:6px 16px; border-radius:999px; border:1px solid rgba(227,176,98,.4); background:rgba(227,176,98,.12); color:var(--ui-accent); font-size:14px; font-weight:700; cursor:pointer; }
.ia-btn:hover:not(:disabled) { background:rgba(227,176,98,.22); }
.ia-btn:disabled { opacity:.35; cursor:not-allowed; }
.chip-ia { background:rgba(100,100,100,.15) !important; border-color:rgba(255,255,255,.2) !important; opacity:.8; font-style:italic; }

/* Rooms publiques */
.pub-badge {
    display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px;
    font-size: 11px; font-weight: 800; border-radius: 999px; background: var(--ui-accent); color: #0a1c13;
    margin-left: 6px; vertical-align: middle; line-height: 1;
}
.pub-alert { margin: 0 0 14px; }
.pub-alert button {
    display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 44px; padding: 10px 14px;
    border-radius: 12px; border: 1px solid rgba(227, 176, 98, .4); background: rgba(227, 176, 98, .12);
    color: var(--ui-accent); font-size: 14px; font-weight: 700; text-align: left; transition: var(--transition);
}
.pub-alert button:hover { background: rgba(227, 176, 98, .22); transform: translateY(-1px); }

.pub-section { margin-top: 10px; }
.pub-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.pub-label { margin: 0; font-size: 14px; font-weight: 700; color: var(--ui-pale); }
.pub-count { font-size: 12px; font-weight: 700; color: var(--ui-accent); background: rgba(227, 176, 98, .14); padding: 2px 8px; border-radius: 999px; }

/* Espace fixe et scrollable pour la liste */
.pub-box {
    position: relative; height: 184px; max-height: 184px; overflow-y: auto; overflow-x: hidden;
    display: flex; flex-direction: column; gap: 6px; padding: 6px;
    border-radius: 14px; border: 1px solid rgba(255, 255, 255, .1); background: rgba(0, 0, 0, .26);
}
.pub-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; min-height: 170px;
    text-align: center; color: var(--ui-pale); gap: 4px; padding: 12px;
}
.pub-empty i { font-size: 26px; opacity: .7; font-style: normal; margin-bottom: 2px; }
.pub-empty p { font-size: 14px; font-weight: 700; color: var(--ui-pale); }
.pub-empty small { font-size: 12px; opacity: .75; max-width: 280px; line-height: 1.3; }

.pub-card {
    display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 52px; padding: 8px 12px;
    border-radius: 10px; border: 1px solid rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .05);
    text-align: left; transition: var(--transition); flex-shrink: 0;
}
.pub-card:hover { background: rgba(227, 176, 98, .14); border-color: var(--ui-accent); transform: translateY(-1px); }
.pub-card-left { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pub-card-host { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--ui-text); }
.pub-host-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 130px; }
.pub-map-pill {
    font-size: 11.5px; font-weight: 600; color: var(--ui-pale); background: rgba(255, 255, 255, .08);
    padding: 2px 6px; border-radius: 6px; white-space: nowrap;
}
.pub-card-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ui-pale); }
.pub-code { font-family: monospace; letter-spacing: 1px; color: var(--ui-accent); font-weight: 700; }
.pub-players { font-weight: 600; }
.pub-card-join {
    font-size: 13px; font-weight: 700; color: var(--ui-accent); background: rgba(227, 176, 98, .14);
    border: 1px solid rgba(227, 176, 98, .3); padding: 6px 12px; border-radius: 8px; white-space: nowrap; flex-shrink: 0;
    transition: var(--transition);
}
.pub-card:hover .pub-card-join { background: var(--ui-accent); color: #0a1c13; }

.pub-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; min-height: 32px; }
.pub-nav-btn {
    padding: 6px 14px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .14);
    background: rgba(255, 255, 255, .06); font-size: 13px; font-weight: 700; color: var(--ui-text);
    transition: var(--transition);
}
.pub-nav-btn:hover:not(:disabled) { background: rgba(227, 176, 98, .2); border-color: var(--ui-accent); }
.pub-nav-btn:disabled { opacity: .3; cursor: not-allowed; }
.pub-page { font-size: 12.5px; font-weight: 700; color: var(--ui-pale); }

.pub-divider {
    display: flex; align-items: center; text-align: center; margin: 18px 0 10px; color: var(--ui-pale);
    font-size: 13px; font-weight: 600;
}
.pub-divider::before, .pub-divider::after { content: ''; flex: 1; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.pub-divider span { padding: 0 10px; }
