/* ============================================================
   Falta Esportiva — interface
   ============================================================ */

:root {
    --bg:        #070b12;
    --panel:     #0e1522;
    --panel-2:   #141d2e;
    --line:      #22304a;
    --ink:       #e8edf5;
    --ink-dim:   #8b9ab4;
    --green:     #21c776;
    --green-lit: #4ade80;
    --red:       #f2555a;
    --amber:     #f7b32b;
    --shadow:    0 18px 50px rgba(0, 0, 0, 0.55);
}

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

html, body {
    height: 100%;
}

body {
    background:
        radial-gradient(120% 80% at 50% 0%, #16233c 0%, transparent 60%),
        var(--bg);
    color: var(--ink);
    font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    overscroll-behavior: none;
}

button {
    font: inherit;
    color: inherit;
    border: none;
    background: none;
    cursor: pointer;
}

/* ---------- Shell ---------- */

#app {
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* The playing surface. On a phone it is the whole screen; on a desktop it
   becomes a portrait panel so the pitch keeps its proportions. */
.stage {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #070b12;
    display: flex;
    flex-direction: column;
}

@media (min-width: 640px) {
    #app { padding: 1.25rem; }
    #game-container { height: auto; }
    .stage {
        width: min(440px, 100%);
        height: min(880px, calc(100dvh - 2.5rem));
        border-radius: 22px;
        border: 1px solid var(--line);
        box-shadow: var(--shadow);
    }
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: crosshair;
}

/* ---------- Heads-up display ---------- */

.hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: calc(env(safe-area-inset-top, 0px) + 0.7rem) 0.75rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(4, 8, 14, 0.72) 0%, transparent 100%);
}

.hud-row {
    display: flex;
    align-items: stretch;
    gap: 0.4rem;
}

.chip {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    padding: 0.35rem 0.4rem;
    background: rgba(10, 17, 28, 0.72);
    border: 1px solid rgba(90, 120, 165, 0.28);
    border-radius: 11px;
    backdrop-filter: blur(6px);
}

.chip-label {
    font-size: 0.58rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--ink-dim);
    white-space: nowrap;
}

.chip-value {
    font-size: 0.98rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.chip.accent .chip-value { color: var(--green-lit); }
.chip.warn   .chip-value { color: var(--amber); }

.game-msg {
    align-self: center;
    padding: 0.34rem 1.05rem;
    border-radius: 999px;
    background: rgba(10, 17, 28, 0.78);
    border: 1px solid rgba(90, 120, 165, 0.28);
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    transition: color 0.2s;
}

.game-msg.goal {
    color: #062d18;
    background: var(--green);
    border-color: var(--green-lit);
    animation: pop 0.35s ease;
}

.game-msg.miss {
    color: #fff;
    background: rgba(200, 45, 50, 0.9);
    border-color: var(--red);
    animation: pop 0.35s ease;
}

/* ---------- Result panel ---------- */

#result-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.75rem 0.75rem calc(env(safe-area-inset-bottom, 0px) + 0.75rem);
    pointer-events: none;
}

.result-card {
    pointer-events: auto;
    background: linear-gradient(180deg, rgba(18, 27, 43, 0.96), rgba(10, 16, 26, 0.98));
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 0.9rem 1rem 1rem;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.55);
    animation: slideUp 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    text-align: center;
}

.result-head {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.result-title {
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.result-title.is-goal { color: var(--green-lit); }
.result-title.is-miss { color: var(--red); }

.result-points {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--amber);
    font-variant-numeric: tabular-nums;
}

.result-msg {
    margin-top: 0.3rem;
    font-size: 0.88rem;
    line-height: 1.4;
    color: var(--ink-dim);
}

.result-actions {
    margin-top: 0.85rem;
    display: flex;
    gap: 0.55rem;
}

/* ---------- Buttons ---------- */

.btn {
    flex: 1;
    padding: 0.72rem 1rem;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 700;
    text-align: center;
    transition: transform 0.12s, filter 0.12s;
}

.btn:active { transform: scale(0.97); }
.btn:hover  { filter: brightness(1.1); }

.btn-primary {
    background: linear-gradient(135deg, var(--green), #14a05e);
    color: #04220f;
    box-shadow: 0 6px 20px rgba(33, 199, 118, 0.28);
}

.btn-ghost {
    background: var(--panel-2);
    border: 1px solid var(--line);
    color: var(--ink);
}

/* ---------- Start screen ---------- */

.start {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 2rem 1.5rem calc(env(safe-area-inset-bottom, 0px) + 2rem);
    text-align: center;
    background:
        radial-gradient(90% 55% at 50% 22%, rgba(33, 199, 118, 0.14) 0%, transparent 70%),
        linear-gradient(180deg, #0a1322 0%, #070b12 100%);
    animation: fade 0.35s ease;
}

.start-badge {
    font-size: 0.62rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink-dim);
}

.start h1 {
    font-size: clamp(2.1rem, 11vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.05;
    background: linear-gradient(120deg, var(--green-lit), #58c8ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.start p {
    max-width: 21rem;
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--ink-dim);
}

.start-list {
    margin: 0.4rem 0 1.1rem;
    display: grid;
    gap: 0.4rem;
    width: min(21rem, 100%);
}

.start-list li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    background: rgba(20, 29, 46, 0.7);
    border: 1px solid var(--line);
    border-radius: 12px;
    font-size: 0.82rem;
    text-align: left;
    color: var(--ink);
    list-style: none;
}

.start-list .key {
    flex: none;
    font-size: 1.1rem;
    line-height: 1;
}

.start .btn { flex: none; width: min(21rem, 100%); }

/* ---------- Animations ---------- */

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

@keyframes pop {
    0%   { transform: scale(0.75); opacity: 0; }
    60%  { transform: scale(1.08); }
    100% { transform: scale(1); opacity: 1; }
}

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

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

/* ---------- Striking style picker ---------- */

.hud-row.effects {
    /* The HUD itself ignores the pointer so the drag reaches the canvas; the
       buttons have to opt back in. */
    pointer-events: auto;
    gap: 0.35rem;
}

.fx {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.05rem;
    position: relative;
    padding: 0.3rem 0.2rem 0.34rem;
    background: rgba(10, 17, 28, 0.72);
    border: 1px solid rgba(90, 120, 165, 0.28);
    border-radius: 11px;
    backdrop-filter: blur(6px);
    color: var(--ink-dim);
    font: inherit;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.12s;
}

.fx:hover { color: var(--ink); }
.fx:active { transform: scale(0.96); }

.fx.on {
    color: var(--ink);
    border-color: var(--fx-accent);
    background: color-mix(in srgb, var(--fx-accent) 16%, rgba(10, 17, 28, 0.86));
    box-shadow: 0 0 0 1px var(--fx-accent) inset, 0 6px 18px rgba(0, 0, 0, 0.4);
}

.fx-icon {
    font-size: 1rem;
    line-height: 1.1;
    filter: grayscale(0.65);
    transition: filter 0.15s;
}

.fx.on .fx-icon { filter: none; }

.fx-name {
    font-size: 0.56rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* The keyboard shortcut is a desktop nicety; it only gets in the way on a
   phone, where the buttons are tapped. */
.fx-key {
    position: absolute;
    top: 0.16rem;
    right: 0.28rem;
    font-size: 0.5rem;
    font-weight: 700;
    color: rgba(139, 154, 180, 0.55);
}

.fx.on .fx-key { color: var(--fx-accent); }

@media (hover: none) {
    .fx-key { display: none; }
}
