/* =========================================================================
   LoL Guessr — feuille de style
   Palette et ornements inspirés de l'interface Hextech : bleu nuit, or patiné,
   angles biseautés. Aucun framework, aucune dépendance en dehors des polices.
   ====================================================================== */

:root {
    --bg:            #04070f;
    --bg-deep:       #070c18;
    --panel:         rgba(11, 18, 34, 0.86);
    --panel-line:    rgba(200, 170, 110, 0.28);

    --gold-100:      #f4e9d2;
    --gold-200:      #e3cd9a;
    --gold-300:      #c8aa6e;
    --gold-500:      #8d6f36;
    --gold-700:      #4a3a1c;

    --teal:          #0ac8b9;
    --red:           #e05a4f;
    --red-deep:      #6d1f1b;
    --green:         #35d39a;

    --ink:           #f0e6d2;
    --ink-soft:      #a6b1c4;
    --ink-faint:     #66738a;

    --radius:        14px;
    --bevel:         18px;
    --ease:          cubic-bezier(0.22, 1, 0.36, 1);

    --font-display:  'Cinzel', 'Trajan Pro', Georgia, serif;
    --font-body:     'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(0.75rem, 3vw, 2.5rem);
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    overflow-x: hidden;
}

/* --- Décor de fond ------------------------------------------------------ */

.ambient {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(90ch 60ch at 50% -10%,  rgba(200, 170, 110, 0.16), transparent 62%),
        radial-gradient(70ch 50ch at 12% 108%,  rgba(10, 200, 185, 0.12),  transparent 60%),
        radial-gradient(60ch 50ch at 92% 84%,   rgba(120, 90, 200, 0.10),  transparent 62%),
        linear-gradient(180deg, var(--bg-deep), var(--bg) 70%);
}

.ambient::after {
    content: '';
    position: absolute;
    inset: -20%;
    opacity: 0.55;
    background-image:
        repeating-linear-gradient(45deg,  transparent 0 26px, rgba(200, 170, 110, 0.035) 26px 27px),
        repeating-linear-gradient(-45deg, transparent 0 26px, rgba(200, 170, 110, 0.025) 26px 27px);
    animation: drift 90s linear infinite;
}

@keyframes drift {
    from { transform: translate3d(0, 0, 0); }
    to   { transform: translate3d(-54px, -54px, 0); }
}

/* --- Panneau ------------------------------------------------------------ */

.panel {
    position: relative;
    width: min(100%, 44rem);
    padding: clamp(1.1rem, 3vw, 1.9rem);
    background: var(--panel);
    border: 1px solid var(--panel-line);
    border-radius: var(--radius);
    backdrop-filter: blur(14px) saturate(120%);
    box-shadow:
        0 40px 90px -30px rgba(0, 0, 0, 0.9),
        0 0 0 1px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(244, 233, 210, 0.07);
}

/* Équerres d'angle : le détail qui fait « interface de jeu ». */
.panel__corner {
    position: absolute;
    width: 16px;
    height: 16px;
    border: 0 solid var(--gold-300);
    opacity: 0.85;
    pointer-events: none;
}
.panel__corner--tl { top: -1px;    left: -1px;    border-top-width: 2px;    border-left-width: 2px;    border-top-left-radius: var(--radius); }
.panel__corner--tr { top: -1px;    right: -1px;   border-top-width: 2px;    border-right-width: 2px;   border-top-right-radius: var(--radius); }
.panel__corner--bl { bottom: -1px; left: -1px;    border-bottom-width: 2px; border-left-width: 2px;    border-bottom-left-radius: var(--radius); }
.panel__corner--br { bottom: -1px; right: -1px;   border-bottom-width: 2px; border-right-width: 2px;   border-bottom-right-radius: var(--radius); }

.panel.is-miss { animation: jolt 0.5s var(--ease); }

@keyframes jolt {
    0%, 100% { transform: translateX(0); }
    15%      { transform: translateX(-9px); }
    32%      { transform: translateX(7px); }
    52%      { transform: translateX(-5px); }
    72%      { transform: translateX(3px); }
}

/* --- En-tête ------------------------------------------------------------ */

.head {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.brand__title {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 4vw, 1.75rem);
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    background: linear-gradient(180deg, var(--gold-100) 8%, var(--gold-300) 55%, var(--gold-500));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 2px 6px rgba(200, 170, 110, 0.22));
}

.brand__title span { font-weight: 600; opacity: 0.85; }

.brand__meta {
    margin: 0.3rem 0 0;
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

/* --- Sélecteur de mode -------------------------------------------------- */

.modes {
    display: flex;
    gap: 2px;
    padding: 3px;
    background: rgba(3, 6, 14, 0.75);
    border: 1px solid rgba(200, 170, 110, 0.18);
    border-radius: 10px;
}

.modes__item {
    padding: 0.5rem 1rem;
    border-radius: 7px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--ink-soft);
    transition: color 0.2s, background 0.25s var(--ease), box-shadow 0.25s;
}

.modes__item:hover { color: var(--gold-100); }

.modes__item.is-active {
    color: #16110a;
    background: linear-gradient(180deg, var(--gold-200), var(--gold-300) 60%, var(--gold-500));
    box-shadow: 0 2px 12px rgba(200, 170, 110, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* --- Scène (image) ------------------------------------------------------ */

.stage {
    position: relative;
    isolation: isolate;
}

.stage__frame {
    padding: 2px;
    clip-path: polygon(
        var(--bevel) 0, 100% 0,
        100% calc(100% - var(--bevel)), calc(100% - var(--bevel)) 100%,
        0 100%, 0 var(--bevel)
    );
    background: linear-gradient(150deg, var(--gold-200), var(--gold-500) 45%, #241c10 100%);
    transition: background 0.5s var(--ease), filter 0.5s var(--ease);
}

.stage--won .stage__frame {
    background: linear-gradient(150deg, #9df3d0, var(--green) 45%, #0d4d38 100%);
    filter: drop-shadow(0 0 26px rgba(53, 211, 154, 0.35));
}

.stage--lost .stage__frame {
    background: linear-gradient(150deg, #f0968e, var(--red) 45%, #4a1512 100%);
    filter: drop-shadow(0 0 26px rgba(224, 90, 79, 0.32));
}

/* Biseau intérieur, décalé de l'épaisseur du liseré doré. */
.stage__inner,
.reveal {
    clip-path: polygon(
        calc(var(--bevel) - 2px) 0, 100% 0,
        100% calc(100% - var(--bevel) + 2px), calc(100% - var(--bevel) + 2px) 100%,
        0 100%, 0 calc(var(--bevel) - 2px)
    );
}

.stage__inner {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #050810;
}

.stage__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.85s var(--ease);
}

.stage__vignette {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(120% 90% at 50% 50%, transparent 52%, rgba(0, 0, 0, 0.55) 100%),
        linear-gradient(180deg, rgba(0, 0, 0, 0.22), transparent 30%);
}

/* --- Révélation --------------------------------------------------------- */

.reveal {
    position: absolute;
    inset: 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    padding: 1rem;
    text-align: center;
    background: linear-gradient(180deg, rgba(4, 7, 15, 0.62), rgba(4, 7, 15, 0.86));
    backdrop-filter: blur(3px);
    animation: revealIn 0.55s var(--ease) both;
}

@keyframes revealIn {
    from { opacity: 0; transform: scale(1.04); }
    to   { opacity: 1; transform: scale(1); }
}

.reveal__verdict {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 6vw, 2.6rem);
    font-weight: 800;
    letter-spacing: 0.22em;
    text-indent: 0.22em;
    text-transform: uppercase;
    text-shadow: 0 6px 26px rgba(0, 0, 0, 0.85);
}

.reveal--win  .reveal__verdict { color: var(--green); }
.reveal--lose .reveal__verdict { color: var(--red); }

.reveal__rule {
    display: block;
    width: min(58%, 15rem);
    height: 1px;
    margin: 0.55rem 0 0.7rem;
    background: linear-gradient(90deg, transparent, var(--gold-300), transparent);
}

.reveal__name {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(1.25rem, 4.6vw, 1.9rem);
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--gold-100);
}

.reveal__title {
    margin: 0.1rem 0 0;
    font-size: 0.85rem;
    font-style: italic;
    color: var(--ink-soft);
}

.reveal__skin {
    margin: 0.7rem 0 0;
    padding: 0.3rem 0.85rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gold-200);
    border: 1px solid rgba(200, 170, 110, 0.35);
    border-radius: 999px;
    background: rgba(200, 170, 110, 0.08);
}

/* --- Jauge de tentatives ------------------------------------------------ */

.meter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1.15rem 0 1rem;
}

.pips { display: flex; gap: 7px; }

.pip {
    width: 34px;
    height: 13px;
    background: rgba(160, 180, 210, 0.13);
    box-shadow: inset 0 0 0 1px rgba(200, 170, 110, 0.14);
    clip-path: polygon(14% 0, 86% 0, 100% 50%, 86% 100%, 14% 100%, 0 50%);
    transition: background 0.45s var(--ease), box-shadow 0.45s var(--ease);
}

.pip.is-spent {
    background: linear-gradient(180deg, #ff8b80, var(--red) 55%, var(--red-deep));
    box-shadow: 0 0 14px rgba(224, 90, 79, 0.55);
}

.meter__label {
    margin: 0;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.meter__label strong { color: var(--gold-200); font-size: 0.95rem; }

/* --- Saisie ------------------------------------------------------------- */

.guess { position: relative; }

.guess__field {
    display: flex;
    gap: 0.5rem;
    padding: 4px;
    background: rgba(3, 6, 14, 0.8);
    border: 1px solid rgba(200, 170, 110, 0.22);
    border-radius: 12px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.guess__field:focus-within {
    border-color: var(--gold-300);
    box-shadow: 0 0 0 1px rgba(200, 170, 110, 0.35), 0 0 28px -6px rgba(200, 170, 110, 0.45);
}

.guess__combo { flex: 1; min-width: 0; }

.guess__input {
    width: 100%;
    padding: 0.8rem 0.9rem;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-family: inherit;
    font-size: 1.02rem;
    font-weight: 500;
}

.guess__input:focus { outline: none; }
.guess__input::placeholder { color: #4d596c; }

/* --- Boutons ------------------------------------------------------------ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.6rem;
    border: 0;
    border-radius: 9px;
    font-family: inherit;
    font-size: 0.74rem;
    font-weight: 900;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s var(--ease), box-shadow 0.25s, filter 0.25s;
}

.btn--gold {
    color: #16110a;
    background: linear-gradient(180deg, var(--gold-200), var(--gold-300) 55%, var(--gold-500));
    box-shadow: 0 4px 18px -4px rgba(200, 170, 110, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.btn--gold:hover  { filter: brightness(1.08); box-shadow: 0 8px 26px -6px rgba(200, 170, 110, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.btn--gold:active { transform: translateY(1px) scale(0.99); }

.btn--block { width: 100%; padding: 1rem; }

.btn:focus-visible,
.modes__item:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 3px;
}

/* --- Autocomplétion ----------------------------------------------------- */

.suggestions {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 0.6rem);
    z-index: 20;
    max-height: 17rem;
    margin: 0;
    padding: 4px;
    overflow-y: auto;
    list-style: none;
    background: rgba(6, 10, 20, 0.97);
    border: 1px solid rgba(200, 170, 110, 0.3);
    border-radius: 12px;
    box-shadow: 0 22px 50px -12px rgba(0, 0, 0, 0.9);
    scrollbar-width: thin;
    scrollbar-color: var(--gold-700) transparent;
}

.suggestions[hidden] { display: none; }

.suggestion {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.45rem 0.6rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.suggestion__icon {
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 6px;
    background: #0d1424;
    box-shadow: inset 0 0 0 1px rgba(200, 170, 110, 0.28);
}

.suggestion__name {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--ink);
}

.suggestion__title {
    display: block;
    font-size: 0.68rem;
    font-weight: 400;
    font-style: italic;
    color: var(--ink-faint);
}

.suggestion.is-active,
.suggestion:hover {
    background: linear-gradient(90deg, rgba(200, 170, 110, 0.22), rgba(200, 170, 110, 0.07));
    box-shadow: inset 2px 0 0 var(--gold-300);
}

.suggestion.is-active .suggestion__name,
.suggestion:hover .suggestion__name { color: var(--gold-100); }

/* --- Historique --------------------------------------------------------- */

.history {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 1.15rem 0 0;
    padding: 1.05rem 0 0;
    list-style: none;
    border-top: 1px solid rgba(200, 170, 110, 0.14);
}

.history__item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.32rem 0.7rem;
    font-size: 0.76rem;
    font-weight: 600;
    color: #d59a94;
    background: rgba(224, 90, 79, 0.09);
    border: 1px solid rgba(224, 90, 79, 0.28);
    border-radius: 8px;
    animation: chipIn 0.3s var(--ease) both;
}

.history__item svg {
    width: 12px;
    height: 12px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    opacity: 0.8;
}

@keyframes chipIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: none; }
}

/* --- Compteurs ---------------------------------------------------------- */

.scoreboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    margin-top: 1.2rem;
    overflow: hidden;
    background: rgba(200, 170, 110, 0.14);
    border: 1px solid rgba(200, 170, 110, 0.14);
    border-radius: 10px;
}

.scoreboard__cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.7rem 0.4rem;
    background: rgba(6, 10, 20, 0.85);
}

.scoreboard__value {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gold-200);
}

.scoreboard__value i { font-style: normal; opacity: 0.4; }

.scoreboard__label {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

/* --- Petits écrans ------------------------------------------------------ */

@media (max-width: 32rem) {
    .head          { flex-direction: column; align-items: stretch; gap: 0.85rem; }
    .modes         { justify-content: stretch; }
    .modes__item   { flex: 1; text-align: center; padding-inline: 0.4rem; }
    .stage__inner  { aspect-ratio: 4 / 3; }
    .guess__field  { flex-direction: column; }
    .btn           { width: 100%; }
    .meter         { flex-direction: column-reverse; align-items: flex-start; gap: 0.6rem; }
    .pip           { width: 100%; }
    .pips          { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
