/* updated 2026-11-11: hero sits below the fixed header */
/* =====================================================================
   NSL Freight Game: "Fill the Box"
   views/freight-game.php + assets/js/freight-game.js
   Everything is scoped to .ftb-wrap so it never touches the rest of the site.
   ===================================================================== */
.ftb-wrap {
    --red: #C3151C; --red2: #A01117; --navy: #1B1F5A; --navy2: #0E1033; --ink: #171A33;
    --mute: #64688A; --line: #E4E6F0; --soft: #F4F5FA; --gold: #F5A623; --ok: #16884A; --bad: #C62828;
    color: var(--ink); padding-bottom: 3.5rem; background: linear-gradient(#fff, var(--soft) 420px);
}
.ftb-wrap *, .ftb-drag { box-sizing: border-box; }

/* ---------- hero ---------- */
.ftb-head { position: relative; overflow: hidden; color: #fff; text-align: center; padding: calc(var(--header-h, 84px) + var(--topbar-h, 40px) + 48px) 0 132px;
    background: radial-gradient(1200px 400px at 80% -10%, rgba(195, 21, 28, .55), transparent 60%), linear-gradient(135deg, var(--navy2), var(--navy) 55%, #2a2f7a); }
.ftb-head .container-xl { position: relative; z-index: 1; }
.ftb-head__kick { margin: 0; font-family: var(--font-head, inherit); font-size: 12px; font-weight: 700; letter-spacing: .28em; color: #FFC7CA; }
.ftb-head h1 { margin: 10px 0 12px; color: #fff; font-family: var(--font-head, inherit); font-weight: 800; font-size: clamp(34px, 6vw, 60px); letter-spacing: -.02em; line-height: 1.02; }
.ftb-head__lead { margin: 0 auto; max-width: 660px; color: #D9DBFF; font-size: clamp(15px, 1.6vw, 17px); }
.ftb-head__chips { list-style: none; padding: 0; margin: 22px 0 0; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.ftb-head__chips li { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 99px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); font-size: 13.5px; font-weight: 500; backdrop-filter: blur(4px); }
.ftb-head__bg span { position: absolute; width: 90px; height: 40px; border: 3px solid rgba(255, 255, 255, .12); border-radius: 4px; background: repeating-linear-gradient(90deg, rgba(255,255,255,.08) 0 6px, transparent 6px 11px); animation: ftb-float 14s ease-in-out infinite; }
.ftb-head__bg span:nth-child(1) { left: 6%; top: 22%; }
.ftb-head__bg span:nth-child(2) { right: 8%; top: 18%; width: 130px; animation-delay: -4s; }
.ftb-head__bg span:nth-child(3) { left: 14%; bottom: 22%; width: 120px; animation-delay: -8s; }
.ftb-head__bg span:nth-child(4) { right: 16%; bottom: 26%; animation-delay: -11s; }
@keyframes ftb-float { 50% { transform: translateY(-14px) rotate(-2deg); } }

/* ---------- game card ---------- */
.ftb-card { position: relative; margin: -92px auto 28px; max-width: 1180px; min-height: 500px; padding: 26px; border-radius: 24px; background: #fff; box-shadow: 0 24px 60px rgba(14, 16, 51, .14); border: 1px solid var(--line); overflow: hidden; }
.ftb-noscript { text-align: center; padding: 40px; margin: 0; }
.ftb-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 12px 24px; border: 0; border-radius: 99px; font-family: inherit; font-weight: 600; font-size: 15px; line-height: 1; background: var(--red); color: #fff; cursor: pointer; text-decoration: none; box-shadow: 0 8px 20px rgba(195, 21, 28, .25); transition: transform .2s, background .2s, box-shadow .2s; }
.ftb-btn:hover, .ftb-btn:focus-visible { background: var(--red2); color: #fff; transform: translateY(-2px); box-shadow: 0 12px 26px rgba(195, 21, 28, .3); }
.ftb-btn:focus-visible { outline: 3px solid rgba(195, 21, 28, .35); outline-offset: 2px; }
.ftb-btn.ftb-alt { background: #EEF0FA; color: var(--navy); box-shadow: none; }
.ftb-btn.ftb-alt:hover { background: #E1E4F5; color: var(--navy); }
.ftb-btn.ftb-navy { background: var(--navy); box-shadow: 0 8px 20px rgba(27, 31, 90, .25); }
.ftb-btn.ftb-navy:hover { background: var(--navy2); }
.ftb-kick { font-family: var(--font-head, inherit); font-size: 12px; font-weight: 800; letter-spacing: .2em; color: var(--red); }

/* ---------- screens ---------- */
.ftb-screen { display: flex; align-items: center; justify-content: center; min-height: 450px; animation: ftb-in .45s ease both; }
@keyframes ftb-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.ftb-hero { text-align: center; max-width: 660px; padding: 18px 6px; }
.ftb-hero h2 { font-family: var(--font-head, inherit); font-weight: 800; font-size: clamp(28px, 4vw, 42px); margin: 8px 0 12px; letter-spacing: -.02em; color: var(--navy); }
.ftb-hero p { color: var(--mute); margin: 0 auto 16px; }
.ftb-levels { list-style: none; padding: 0; margin: 0 0 24px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.ftb-levels li { background: var(--soft); border: 1px solid var(--line); border-radius: 99px; padding: 8px 15px; font-size: 13.5px; }
.ftb-levels b { color: var(--navy); }
.ftb-best, .ftb-small { font-size: 13px; }
.ftb-howto { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 8px 0 16px; }
.ftb-howto span { background: var(--soft); border: 1px solid var(--line); border-radius: 14px; padding: 12px; font-size: 13.5px; display: flex; align-items: center; gap: 8px; text-align: left; }
.ftb-howto b { flex: 0 0 26px; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 12px; }
.ftb-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 16px 0; }
.ftb-share { font-size: 13.5px; color: var(--mute); align-items: center; }
.ftb-share a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: var(--soft); color: var(--navy); font-weight: 600; text-decoration: none; }
.ftb-share a:hover { background: #E1E4F5; }
.ftb-lesson { background: #FFF6E8; border: 1px solid #F8E1BB; color: #6B4300; border-radius: 14px; padding: 14px 16px; text-align: left; font-size: 14px; margin: 12px 0; }
.ftb-score { font-size: 16px; color: var(--ink) !important; }
.ftb-rank { font-size: 17px; color: var(--ink) !important; }
.ftb-stars { font-size: 44px; letter-spacing: 8px; margin-top: 6px; line-height: 1; }
.ftb-stars i { font-style: normal; color: #E3E4EE; display: inline-block; }
.ftb-stars i.on { color: var(--gold); animation: ftb-pop .5s ease both; text-shadow: 0 4px 14px rgba(245, 166, 35, .4); }
.ftb-stars i.on:nth-child(2) { animation-delay: .15s; } .ftb-stars i.on:nth-child(3) { animation-delay: .3s; }
@keyframes ftb-pop { from { transform: scale(.2); opacity: 0; } 70% { transform: scale(1.25); } to { transform: scale(1); opacity: 1; } }
.ftb-boxart { width: 240px; height: 100px; margin: 0 auto 16px; border: 6px solid var(--navy); border-radius: 8px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); gap: 3px; padding: 3px; background: repeating-linear-gradient(90deg, #ECEEF6 0 9px, #E2E5F0 9px 11px); box-shadow: 0 14px 30px rgba(27, 31, 90, .18); }
.ftb-boxart i { border-radius: 3px; animation: ftb-fall .7s cubic-bezier(.3, 1.4, .5, 1) both; }
.ftb-boxart i:nth-child(1) { background: var(--red); animation-delay: .1s; grid-row: 2; } .ftb-boxart i:nth-child(2) { background: var(--navy); animation-delay: .3s; grid-row: 2; }
.ftb-boxart i:nth-child(3) { background: var(--gold); animation-delay: .5s; grid-row: 2; } .ftb-boxart i:nth-child(4) { background: #0081C8; animation-delay: .7s; grid-row: 1; grid-column: 1; }
.ftb-boxart i:nth-child(5) { background: #2E7D32; animation-delay: .9s; grid-row: 1; grid-column: 2; } .ftb-boxart i:nth-child(6) { background: #B07A3A; animation-delay: 1.1s; grid-row: 1; grid-column: 3; }

/* ---------- top bar ---------- */
.ftb-top { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 18px; }
.ftb-goal { margin: 6px 0 0; color: var(--mute); font-size: 14px; max-width: 660px; }
.ftb-hud { display: flex; gap: 8px; }
.ftb-hud div { background: var(--soft); border: 1px solid var(--line); border-radius: 14px; padding: 7px 14px; text-align: center; min-width: 84px; transition: background .2s, color .2s; }
.ftb-hud small { display: block; font-size: 11px; color: var(--mute); text-transform: uppercase; letter-spacing: .06em; }
.ftb-hud b { font-family: var(--font-head, inherit); font-size: 20px; color: var(--navy); font-variant-numeric: tabular-nums; }
.ftb-hud .ftb-low { background: #FDECEE; border-color: #F7C9CE; animation: ftb-pulse 1s infinite; }
.ftb-hud .ftb-low b { color: var(--bad); }
@keyframes ftb-pulse { 50% { transform: scale(1.05); } }

/* ---------- play area ---------- */
.ftb-play { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; }
.ftb-box { display: flex; align-items: stretch; filter: drop-shadow(0 12px 22px rgba(27, 31, 90, .15)); }
.ftb-cont { position: relative; flex: 1; aspect-ratio: 14 / 6; border: 7px solid var(--navy); border-right: 0; border-radius: 10px 0 0 10px;
    background: linear-gradient(rgba(27, 31, 90, .07) 1px, transparent 1px) 0 0 / 100% calc(100% / 6), repeating-linear-gradient(90deg, #F0F1F8 0 calc(100% / 14 - 1px), #DCDFEC calc(100% / 14 - 1px) calc(100% / 14)); }
.ftb-door { width: 36px; background: repeating-linear-gradient(90deg, var(--navy) 0 3px, #2A2F78 3px 8px); border-radius: 0 10px 10px 0; display: flex; align-items: center; justify-content: center; }
.ftb-door span { writing-mode: vertical-rl; color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .22em; }
.ftb-col { position: absolute; top: 0; bottom: 0; cursor: pointer; z-index: 4; transition: background .15s; }
.ftb-col:hover { background: rgba(195, 21, 28, .07); }
.ftb-block { position: absolute; z-index: 2; border: 2px solid rgba(0, 0, 0, .18); border-radius: 5px; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; line-height: 1.15; overflow: hidden; padding: 2px; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .12); background-image: linear-gradient(rgba(255, 255, 255, .16), rgba(0, 0, 0, .08)) !important; }
.ftb-block b { font-size: 11.5px; font-weight: 600; }
.ftb-block span { font-size: 10.5px; opacity: .88; }
.ftb-block.drop { animation: ftb-fall .38s cubic-bezier(.3, 1.3, .5, 1); }
.ftb-block.bad { outline: 3px solid #FF3B3B; outline-offset: -3px; animation: ftb-shake .4s 3; }
@keyframes ftb-fall { from { transform: translateY(-120%); opacity: .3; } to { transform: none; opacity: 1; } }
@keyframes ftb-shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.ftb-ghost { position: absolute; display: none; z-index: 3; border: 2px dashed var(--red); background: rgba(195, 21, 28, .14); border-radius: 5px; pointer-events: none; transition: left .08s, top .08s; }
.ftb-ports { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; font-weight: 700; margin-top: 8px; }
.ftb-pj { color: var(--navy); } .ftb-pd { color: var(--red2); text-align: right; }
.ftb-meters { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 14px; }
.ftb-meters small { font-size: 12px; color: var(--mute); }
.ftb-bar { position: relative; height: 10px; background: var(--line); border-radius: 99px; margin-top: 5px; }
.ftb-bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--red), var(--gold)); transition: width .35s ease; }
.ftb-bar i.over { background: var(--bad); }
.ftb-bar em { position: absolute; top: -4px; width: 2px; height: 18px; background: var(--navy); border-radius: 2px; }
.ftb-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.ftb-msg { min-height: 24px; font-weight: 600; font-size: 14px; margin-top: 10px; }
.ftb-msg.ok { color: var(--ok); } .ftb-msg.bad { color: var(--bad); }

/* ---------- cargo tray ---------- */
.ftb-right { min-width: 0; }
.ftb-tray-title { font-family: var(--font-head, inherit); font-size: 13px; font-weight: 700; color: var(--navy); margin: 0 0 8px; letter-spacing: .04em; }
.ftb-tray { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-height: 480px; overflow-y: auto; padding: 2px 6px 2px 2px; scrollbar-width: thin; }
.ftb-piece { border: 2px solid var(--line); border-radius: 12px; background: #fff; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 5px; font: inherit; color: var(--ink); cursor: grab; text-align: center; line-height: 1.2; touch-action: manipulation; transition: border-color .15s, transform .15s, box-shadow .15s, opacity .2s; }
.ftb-piece:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(27, 31, 90, .1); }
.ftb-piece:active { cursor: grabbing; }
.ftb-piece.sel { border-color: var(--red); background: #FFF5F5; box-shadow: 0 0 0 3px rgba(195, 21, 28, .15); }
.ftb-piece.used { opacity: .2; pointer-events: none; }
.ftb-mini { display: grid; gap: 1px; }
.ftb-mini span { width: 10px; height: 10px; border-radius: 2px; }
.ftb-pn { font-size: 12px; font-weight: 600; }
.ftb-tags { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; }
.ftb-tag { font-size: 9.5px; font-weight: 700; border-radius: 4px; padding: 1px 5px; background: #EEF0FA; color: var(--navy); }
.ftb-tag.h { background: #FFE1E3; color: var(--red2); } .ftb-tag.f { background: #FFF2D6; color: #8A5300; } .ftb-tag.u { background: #DFF3EA; color: #0F6B3B; }
.ftb-tag.d { background: var(--red); color: #fff; } .ftb-tag.j { background: var(--navy); color: #fff; }
.ftb-legend { font-size: 12px; color: var(--mute); margin-top: 10px; line-height: 2; }
.ftb-drag { position: fixed; z-index: 9999; pointer-events: none; transform: translate(-50%, -50%) rotate(-3deg); border-radius: 5px; color: #fff; font: 600 11px 'Poppins', system-ui, sans-serif; display: flex; align-items: center; justify-content: center; text-align: center; opacity: .92; box-shadow: 0 12px 28px rgba(0, 0, 0, .28); }

/* ---------- confetti ---------- */
.ftb-confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 20; }
.ftb-confetti i { position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px; animation: ftb-conf linear forwards; }
@keyframes ftb-conf { to { transform: translateY(620px) rotate(540deg); opacity: 0; } }

/* ---------- learn strip ---------- */
.ftb-learn { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.ftb-learn article { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 22px; transition: transform .25s, box-shadow .25s; }
.ftb-learn article:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(27, 31, 90, .08); }
.ftb-learn__ico { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: #FDECEE; color: var(--red); font-size: 18px; margin-bottom: 12px; }
.ftb-learn h2 { margin: 0 0 6px; font-size: 17px; color: var(--navy); }
.ftb-learn p { margin: 0; color: var(--mute); font-size: 14px; }

/* ---------- responsive ---------- */
@media (max-width: 991.98px) {
    .ftb-play { grid-template-columns: 1fr; }
    .ftb-tray { grid-template-columns: repeat(5, 1fr); max-height: none; }
    .ftb-learn { grid-template-columns: 1fr; }
}
/* phone: cargo strip directly under the container, no scrolling up and down while loading */
@media (max-width: 767.98px) {
    .ftb-head { padding: calc(var(--header-h, 70px) + var(--topbar-h, 36px) + 32px) 0 112px; }
    .ftb-card { padding: 16px; border-radius: 18px; margin-top: -80px; min-height: 440px; }
    .ftb-howto { grid-template-columns: 1fr; }
    .ftb-top { padding-bottom: 12px; margin-bottom: 12px; }
    .ftb-goal { font-size: 13px; }
    .ftb-hud { width: 100%; }
    .ftb-hud div { flex: 1; min-width: 0; padding: 6px 8px; }
    .ftb-play { display: flex; flex-direction: column; gap: 10px; }
    .ftb-left { display: contents; }
    .ftb-box { order: 1; } .ftb-ports { order: 2; margin-top: -4px; } .ftb-msg { order: 3; margin: 0; min-height: 20px; font-size: 13px; }
    .ftb-right { order: 4; } .ftb-actions { order: 5; margin: 0; } .ftb-meters { order: 6; margin: 0; }
    .ftb-actions .ftb-btn { flex: 1; padding: 12px 10px; }
    .ftb-tray { display: flex; overflow-x: auto; gap: 8px; padding-bottom: 6px; scroll-snap-type: x proximity; }
    .ftb-piece { flex: 0 0 100px; scroll-snap-align: start; }
    .ftb-piece.used { display: none; }
    .ftb-legend { margin-top: 4px; line-height: 1.8; }
}
@media (max-width: 520px) {
    .ftb-block b { font-size: 8.5px; } .ftb-block span { display: none; }
    .ftb-door { width: 20px; } .ftb-door span { font-size: 8px; }
    .ftb-cont { border-width: 5px; }
    .ftb-meters { grid-template-columns: 1fr; }
    .ftb-ports { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { .ftb-wrap *, .ftb-wrap *::before, .ftb-wrap *::after { animation: none !important; transition: none !important; } }
