/**
 * Track & Field 3D
 */
.tf-app [hidden] { display: none !important; }

.tf-app {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    color: #f1f5f9;
    background: #070a12;
    overflow-x: hidden;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

.tf-stage {
    position: relative;
    width: 100vw;
    height: calc(100vh - 72px);
    height: calc(100dvh - 72px);
    min-height: 520px;
    overflow: hidden;
    background: #070a12;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: none;
}
.tf-stage:fullscreen { height: 100vh; }
#tfCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* --- barra in alto ------------------------------------------------------- */
.tf-hud-top {
    position: absolute; top: 12px; left: 12px; right: 12px; z-index: 6;
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap; pointer-events: none;
}
.tf-chip {
    background: rgba(8, 12, 22, 0.78); border: 1px solid rgba(255,255,255,0.14);
    border-radius: 999px; padding: 7px 14px; font-weight: 800; font-size: 15px;
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    white-space: nowrap; font-variant-numeric: tabular-nums;
}
.tf-chip:empty { display: none; }
.tf-brand span { color: #facc15; }
.tf-event { color: #fff; background: linear-gradient(90deg, rgba(29,78,216,0.9), rgba(8,12,22,0.8)); }
.tf-att { color: #fde68a; }
.tf-wind.is-over { color: #fca5a5; }
.tf-hud-btns { margin-left: auto; display: flex; gap: 6px; pointer-events: auto; flex-wrap: wrap; justify-content: flex-end; }
.tf-btn {
    width: 46px; height: 46px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.18);
    background: rgba(8, 12, 22, 0.78); color: #fff; font-size: 20px; cursor: pointer; display: grid; place-items: center;
}
.tf-btn:hover { background: rgba(29, 78, 216, 0.85); }
.tf-btn.is-off { opacity: 0.5; }

/* --- classifica live -------------------------------------------------------- */
.tf-board {
    position: absolute; right: 12px; top: 70px; z-index: 5; width: 290px;
    background: rgba(6, 10, 20, 0.82); border: 1px solid rgba(255,255,255,0.12); border-radius: 14px;
    overflow: hidden; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.tf-board-head {
    width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 8px 12px; border: 0; background: #facc15; color: #0b1020; font-weight: 900; font-size: 14px;
    text-transform: uppercase; letter-spacing: 0.03em; cursor: pointer; text-align: left;
}
.tf-board-head i { font-style: normal; transition: transform 0.2s; }
.tf-board.is-collapsed ol { display: none; }
.tf-board.is-collapsed .tf-board-head i { transform: rotate(-90deg); }
.tf-board ol { list-style: none; margin: 0; padding: 4px 0; }
.tf-board li {
    display: grid; grid-template-columns: 22px 26px 1fr auto; align-items: center; gap: 6px;
    padding: 4px 10px; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.tf-board li b { color: #94a3b8; }
.tf-board li.is-me { background: rgba(56, 189, 248, 0.22); }
.tf-board li.is-me .tf-bn { color: #7dd3fc; }
.tf-board li.is-out { opacity: 0.5; }
.tf-bn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-bm { color: #fde68a; font-family: ui-monospace, 'Courier New', monospace; font-size: 13px; }
.tf-flag { width: 24px; height: 16px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255,255,255,0.25); vertical-align: middle; object-fit: cover; }

/* --- grafiche TV ------------------------------------------------------------ */
.tf-big {
    position: absolute; top: 74px; left: 50%; transform: translateX(-50%); z-index: 5;
    padding: 6px 22px; border-radius: 12px; background: rgba(6,10,20,0.85); border: 2px solid #facc15;
    font: 900 44px/1.1 ui-monospace, 'Courier New', monospace; color: #fde047; letter-spacing: 0.02em;
    text-shadow: 0 0 18px rgba(250, 204, 21, 0.5); pointer-events: none;
}
.tf-big.is-pb { border-color: #38bdf8; color: #7dd3fc; }
.tf-big.is-wr { border-color: #22c55e; color: #86efac; animation: tf-glow 0.6s infinite alternate; }
.tf-big.is-bad { border-color: #ef4444; color: #fca5a5; }
@keyframes tf-glow { to { box-shadow: 0 0 30px rgba(34, 197, 94, 0.8); } }

.tf-lower {
    position: absolute; left: 16px; bottom: 150px; z-index: 5; display: flex; align-items: center; gap: 12px;
    padding: 10px 18px 10px 12px; border-radius: 10px; pointer-events: none;
    background: linear-gradient(90deg, rgba(29,78,216,0.95), rgba(8,12,22,0.9)); border-left: 5px solid #facc15;
    animation: tf-slide 0.35s ease-out;
}
.tf-lower .tf-flag { width: 42px; height: 28px; }
.tf-lower b { font-size: 21px; text-transform: uppercase; }
.tf-lower small { color: #fde68a; font-weight: 800; margin-left: 4px; }
.tf-lower em { display: block; font-style: normal; font-size: 14px; color: #cbd5e1; margin-top: 2px; }
@keyframes tf-slide { from { transform: translateX(-40px); opacity: 0; } }

.tf-prompt {
    position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%); z-index: 5; pointer-events: none;
    padding: 10px 18px; border-radius: 12px; background: rgba(6,10,20,0.85); border: 2px solid #38bdf8;
    font-weight: 800; font-size: 17px; text-align: center; animation: tf-pulse 1.1s infinite; max-width: calc(100% - 32px);
}
@keyframes tf-pulse { 50% { border-color: rgba(56,189,248,0.25); } }

.tf-banner {
    position: absolute; top: 30%; left: 50%; transform: translate(-50%, -50%); z-index: 7; pointer-events: none;
    text-align: center; animation: tf-zoom 0.35s cubic-bezier(.2,1.6,.4,1);
}
.tf-banner-title {
    font-size: clamp(34px, 7vw, 76px); font-weight: 900; font-style: italic; letter-spacing: 0.02em; color: #fff;
    text-shadow: 0 4px 0 #1d4ed8, 0 8px 26px rgba(0,0,0,0.6); white-space: nowrap;
}
.tf-banner-sub { font-size: clamp(16px, 2.6vw, 24px); font-weight: 800; color: #fde68a; text-shadow: 0 2px 8px rgba(0,0,0,0.8); }
.tf-banner.is-bad .tf-banner-title { text-shadow: 0 4px 0 #b91c1c, 0 8px 26px rgba(0,0,0,0.6); }
.tf-banner.is-good .tf-banner-title { text-shadow: 0 4px 0 #15803d, 0 8px 26px rgba(0,0,0,0.6); }
.tf-banner.is-wr .tf-banner-title { color: #fde047; text-shadow: 0 4px 0 #15803d, 0 0 40px rgba(250,204,21,0.9); animation: tf-shake 0.25s infinite; }
@keyframes tf-zoom { from { transform: translate(-50%, -50%) scale(2.2); opacity: 0; } }
@keyframes tf-shake { 50% { transform: rotate(-1.5deg) scale(1.03); } }

.tf-pop {
    position: absolute; top: 42%; left: 50%; transform: translateX(-50%); z-index: 6; pointer-events: none;
    font-size: 26px; font-weight: 900; color: #fff; text-shadow: 0 3px 10px rgba(0,0,0,0.8); white-space: nowrap;
}
.tf-pop.is-anim { animation: tf-rise 1.1s ease-out forwards; }
.tf-pop.is-good { color: #86efac; }
.tf-pop.is-bad { color: #fca5a5; }
@keyframes tf-rise { from { transform: translate(-50%, 20px); opacity: 0; } 20% { opacity: 1; } to { transform: translate(-50%, -40px); opacity: 0; } }

.tf-replay { position: absolute; top: 70px; left: 16px; z-index: 6; display: flex; align-items: center; gap: 10px; }
.tf-rec { padding: 8px 14px; border-radius: 8px; background: rgba(185, 28, 28, 0.9); font-weight: 900; letter-spacing: 0.08em; animation: tf-pulse 1s infinite; }
.tf-skip, .tf-endbtn {
    min-height: 46px; padding: 0 18px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.25);
    background: rgba(8,12,22,0.85); color: #fff; font-weight: 800; font-size: 15px; cursor: pointer;
}
.tf-endbtn { position: absolute; left: 16px; top: 70px; z-index: 6; }
.tf-skip:hover, .tf-endbtn:hover { background: #1d4ed8; }

/* --- strumenti in basso ---------------------------------------------------- */
.tf-dock {
    position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 5;
    display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: min(560px, calc(100% - 24px));
}
.tf-meter {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 8px 10px; border-radius: 14px; background: rgba(6,10,20,0.82); border: 1px solid rgba(255,255,255,0.14);
}
.tf-key {
    min-width: 54px; padding: 8px 10px; border-radius: 10px; text-align: center; font-weight: 900; font-size: 15px;
    background: #1e293b; border: 2px solid #334155; color: #cbd5e1;
}
.tf-key.is-hit, .tf-tbtn.is-hit { animation: tf-hit 0.18s ease-out; }
.tf-key.is-bad, .tf-tbtn.is-bad { animation: tf-bad 0.3s ease-out; }
@keyframes tf-hit { from { background: #22c55e; border-color: #86efac; color: #fff; transform: scale(1.08); } }
@keyframes tf-bad { from { background: #b91c1c; border-color: #fca5a5; } }
.tf-meter-body { flex: 1; min-width: 0; }
.tf-meter-bar { position: relative; height: 16px; border-radius: 8px; background: #1e293b; overflow: hidden; }
.tf-meter-bar::after { content: ''; position: absolute; top: 0; bottom: 0; right: 0; width: 6%; background: rgba(34, 197, 94, 0.35); }
.tf-meter-fill { height: 100%; width: 0; border-radius: 8px; background: linear-gradient(90deg, #2563eb, #22d3ee, #facc15); transition: width 0.08s linear; }
.tf-meter-fill.is-max { background: linear-gradient(90deg, #16a34a, #4ade80); box-shadow: 0 0 14px #4ade80; }
.tf-meter-txt { display: flex; justify-content: space-between; margin-top: 4px; font-size: 13px; }
.tf-meter-txt small { color: #94a3b8; font-weight: 800; letter-spacing: 0.08em; }
.tf-meter-txt b { font-variant-numeric: tabular-nums; }

.tf-hurdle, .tf-dist {
    padding: 8px 18px; border-radius: 12px; font-weight: 900; font-size: 20px; min-width: 150px; text-align: center;
    background: rgba(6,10,20,0.85); border: 2px solid #475569;
}
.tf-hurdle.is-near { border-color: #facc15; color: #fde047; }
.tf-hurdle.is-go { border-color: #22c55e; color: #fff; background: rgba(22, 163, 74, 0.85); transform: scale(1.08); }
.tf-hurdle.is-late { border-color: #ef4444; color: #fca5a5; }
.tf-dist small { display: block; font-size: 11px; color: #94a3b8; letter-spacing: 0.08em; text-transform: uppercase; }
.tf-dist.is-near { border-color: #facc15; }
.tf-dist.is-go { border-color: #22c55e; background: rgba(22, 163, 74, 0.8); }
.tf-dist.is-late { border-color: #ef4444; background: rgba(185, 28, 28, 0.8); }

.tf-angle {
    display: flex; align-items: center; gap: 12px; padding: 8px 16px; border-radius: 16px;
    background: rgba(6,10,20,0.88); border: 2px solid #475569;
}
.tf-angle.is-good { border-color: #22c55e; box-shadow: 0 0 22px rgba(34, 197, 94, 0.5); }
.tf-angle svg { width: 110px; height: 104px; }
.tf-arc { fill: rgba(148, 163, 184, 0.18); stroke: rgba(255,255,255,0.35); stroke-width: 1; }
.tf-zone { fill: rgba(34, 197, 94, 0.55); }
.tf-needle { stroke: #facc15; stroke-width: 3.5; stroke-linecap: round; }
.tf-hub { fill: #facc15; }
.tf-angle-txt b { display: block; font-size: 40px; font-weight: 900; font-variant-numeric: tabular-nums; }
.tf-angle.is-good .tf-angle-txt b { color: #86efac; }
.tf-angle-txt small { color: #cbd5e1; font-weight: 700; font-size: 13px; }

.tf-push { width: min(360px, 100%); padding: 8px 12px; border-radius: 12px; background: rgba(6,10,20,0.88); border: 2px solid #facc15; text-align: center; }
.tf-push small { font-weight: 900; font-size: 14px; color: #fde047; }
.tf-push-bar { position: relative; height: 18px; margin-top: 6px; border-radius: 9px; background: #1e293b; }
.tf-push-sweet { position: absolute; top: 0; bottom: 0; left: 36%; width: 40%; border-radius: 9px; background: linear-gradient(90deg, rgba(34,197,94,0.2), #22c55e 50%, rgba(34,197,94,0.2)); }
.tf-push-cur { position: absolute; top: -4px; bottom: -4px; width: 6px; margin-left: -3px; border-radius: 3px; background: #fff; box-shadow: 0 0 10px #fff; }

/* --- comandi touch ------------------------------------------------------------ */
.tf-touch { display: none; }
body.tf-is-touch .tf-touch {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 8;
    display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 10px; padding: 10px max(10px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-bottom));
}
.tf-tbtn {
    min-height: 104px; border-radius: 22px; border: 2px solid rgba(255,255,255,0.3);
    background: rgba(15, 23, 42, 0.62); color: #fff; font-size: 30px; font-weight: 900;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    touch-action: none; -webkit-tap-highlight-color: transparent;
}
.tf-tbtn b { font-size: 13px; letter-spacing: 0.06em; }
.tf-mirror { display: inline-block; transform: scaleX(-1); }
.tf-tbtn-a { background: rgba(29, 78, 216, 0.72); border-color: #93c5fd; }
.tf-tbtn-a:active { background: #2563eb; }
body.tf-is-touch .tf-dock { bottom: 132px; }
body.tf-is-touch .tf-lower, body.tf-is-touch .tf-prompt { bottom: 260px; }

/* --- finestre ------------------------------------------------------------ */
.tf-overlay {
    position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
    padding: 16px; background: rgba(3, 6, 14, 0.55); overflow-y: auto; touch-action: pan-y;
}
.tf-modal {
    width: min(860px, 100%); max-height: calc(100% - 8px); overflow-y: auto; margin: auto;
    padding: 22px; border-radius: 20px; background: rgba(10, 16, 32, 0.96); border: 1px solid rgba(255,255,255,0.14);
    box-shadow: 0 20px 60px rgba(0,0,0,0.6); user-select: text; -webkit-user-select: text;
}
.tf-logo { font-size: 30px; font-weight: 900; font-style: italic; letter-spacing: 0.02em; }
.tf-logo span { background: linear-gradient(90deg, #facc15, #f97316); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tf-tagline { margin: 4px 0 14px; color: #cbd5e1; }
.tf-modal h2 { margin: 0 0 6px; font-size: 26px; }
.tf-modal h3 { margin: 18px 0 8px; font-size: 16px; color: #93c5fd; text-transform: uppercase; letter-spacing: 0.05em; }
.tf-tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid rgba(255,255,255,0.12); padding-bottom: 10px; }
.tf-tab {
    min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.14);
    background: transparent; color: #cbd5e1; font-weight: 800; font-size: 15px; cursor: pointer;
}
.tf-tab.is-on { background: #1d4ed8; color: #fff; border-color: #3b82f6; }
.tf-pane { padding-top: 14px; }
.tf-resume, .tf-oly {
    width: 100%; display: flex; align-items: center; gap: 14px; text-align: left; cursor: pointer;
    padding: 16px 18px; border-radius: 16px; border: 2px solid #facc15; color: #fff;
    background: linear-gradient(120deg, rgba(202, 138, 4, 0.35), rgba(29, 78, 216, 0.35));
}
.tf-resume { border-color: #22c55e; background: rgba(22, 163, 74, 0.3); font-size: 18px; font-weight: 900; margin-bottom: 12px; justify-content: center; min-height: 56px; }
.tf-oly:hover { background: linear-gradient(120deg, rgba(202, 138, 4, 0.55), rgba(29, 78, 216, 0.55)); }
.tf-oly-ico { font-size: 44px; }
.tf-oly b { display: block; font-size: 21px; }
.tf-oly small { display: block; color: #e2e8f0; font-size: 14px; margin-top: 3px; }
.tf-events { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tf-ev {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 110px; padding: 12px 14px;
    border-radius: 14px; border: 1px solid rgba(255,255,255,0.14); background: rgba(30, 41, 59, 0.7); color: #fff; cursor: pointer; text-align: left;
}
.tf-ev:hover { border-color: #38bdf8; background: rgba(29, 78, 216, 0.4); }
.tf-ev-ico { font-size: 30px; }
.tf-ev b { font-size: 16px; }
.tf-ev small { color: #94a3b8; font-size: 13px; font-variant-numeric: tabular-nums; }
.tf-ev small.tf-pb { color: #7dd3fc; }
.tf-field { display: flex; flex-direction: column; gap: 6px; font-weight: 800; }
.tf-field input {
    min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.2);
    background: #0f172a; color: #fff; font-size: 17px;
}
.tf-nations { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.tf-nat {
    min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    border-radius: 12px; border: 2px solid transparent; background: rgba(30, 41, 59, 0.7); color: #e2e8f0; font-weight: 800; cursor: pointer;
}
.tf-nat .tf-flag { width: 36px; height: 24px; }
.tf-nat.is-on { border-color: #facc15; background: rgba(202, 138, 4, 0.3); }
.tf-skins { display: flex; gap: 10px; flex-wrap: wrap; }
.tf-skin { width: 48px; height: 48px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.tf-skin.is-on { border-color: #facc15; box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.3); }
.tf-diffs { display: flex; gap: 8px; flex-wrap: wrap; }
.tf-diff {
    flex: 1; min-width: 120px; min-height: 50px; border-radius: 12px; border: 2px solid rgba(255,255,255,0.14);
    background: rgba(30, 41, 59, 0.7); color: #fff; font-weight: 800; font-size: 16px; cursor: pointer;
}
.tf-diff.is-on { border-color: #22c55e; background: rgba(22, 163, 74, 0.35); }
.tf-medals { font-size: 18px; font-weight: 800; }
.tf-table-wrap { overflow-x: auto; }
.tf-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.tf-table th { text-align: left; color: #94a3b8; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; padding: 6px 8px; border-bottom: 1px solid rgba(255,255,255,0.12); }
.tf-table td { padding: 7px 8px; border-bottom: 1px solid rgba(255,255,255,0.06); white-space: nowrap; }
.tf-table tr.is-me td { background: rgba(56, 189, 248, 0.18); font-weight: 800; }
.tf-num { font-variant-numeric: tabular-nums; font-family: ui-monospace, 'Courier New', monospace; }
.tf-res-sub { font-size: 18px; font-weight: 800; color: #fde68a; margin: 0 0 12px; }
.tf-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.tf-primary, .tf-secondary {
    min-height: 52px; padding: 0 22px; border-radius: 14px; font-weight: 900; font-size: 17px; cursor: pointer; border: 0;
}
.tf-primary { flex: 1; background: linear-gradient(90deg, #f59e0b, #facc15); color: #0b1020; }
.tf-primary:hover, .tf-primary:focus-visible { filter: brightness(1.1); outline: 3px solid #fff; outline-offset: 2px; }
.tf-secondary { background: #1e293b; color: #fff; border: 1px solid rgba(255,255,255,0.18); }
.tf-help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.tf-help h4 { margin: 10px 0 6px; color: #93c5fd; }
.tf-help ul { margin: 0; padding-left: 18px; line-height: 1.5; }
.tf-help li { margin-bottom: 6px; }

.tf-podium {
    position: absolute; left: 16px; bottom: 16px; z-index: 9; width: min(430px, calc(100% - 32px));
    padding: 16px 20px; border-radius: 18px; background: rgba(10, 16, 32, 0.9); border: 2px solid #facc15; text-align: center;
    line-height: 1.7; text-align: left;
}
.tf-podium h2 { margin: 0; font-size: 24px; color: #fde047; text-transform: uppercase; }
.tf-podium p { margin: 2px 0 6px; font-weight: 800; }
.tf-podium span { color: #fde68a; font-family: ui-monospace, 'Courier New', monospace; }

/* --- sezione SEO -------------------------------------------------------------- */
.tf-seo { max-width: 1100px; margin: 0 auto; padding: 48px 20px 64px; color: #cbd5e1; line-height: 1.6; }
.tf-seo h2 { color: #fff; font-size: 28px; }
.tf-seo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-top: 20px; }
.tf-seo article { padding: 18px; border-radius: 16px; background: #0f172a; border: 1px solid rgba(255,255,255,0.08); }
.tf-seo h3 { color: #fde68a; margin-top: 0; font-size: 18px; }

/* --- schermi piccoli ------------------------------------------------------ */
@media (max-width: 760px) {
    .tf-brand, .tf-att { display: none; }
    .tf-chip { font-size: 13px; padding: 6px 10px; }
    .tf-board { top: auto; bottom: auto; top: 118px; right: 8px; width: min(250px, 60vw); }
    .tf-board li { font-size: 13px; padding: 3px 8px; }
    .tf-events { grid-template-columns: repeat(2, 1fr); }
    .tf-help-grid { grid-template-columns: 1fr; }
    .tf-big { top: 118px; font-size: 32px; left: 12px; transform: none; }
    .tf-lower b { font-size: 17px; }
    .tf-modal { padding: 16px; }
    .tf-endbtn, .tf-replay { top: 118px; }
    .tf-key { display: none; }
}
@media (max-height: 560px) and (pointer: coarse) {
    .tf-tbtn { min-height: 84px; }
    body.tf-is-touch .tf-dock { bottom: 106px; }
    body.tf-is-touch .tf-lower, body.tf-is-touch .tf-prompt { bottom: 200px; }
    .tf-board { display: none; }
}
