@font-face { font-family: "Fraunces"; src: url("fonts/fraunces-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/inter-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #08161f;
  --bg-2: #0d2130;
  --panel: #102534;
  --card: #15303f;
  --card-2: #1a3a4b;
  --line: rgba(173, 214, 228, .14);
  --line-2: rgba(173, 214, 228, .24);
  --text: #eaf2f5;
  --muted: #93abb7;
  --gold: #f5b942;
  --gold-2: #ffd27a;
  --gold-ink: #2b1d04;
  --coral: #ef7a5a;
  --pearl: #8fe0ea;
  --good: #5fd39a;
  --bad: #ff7a6b;
  --mid: #f3b24d;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --display: "Fraunces", Georgia, serif;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); display: flex; flex-direction: column; min-height: 100vh; font-size: 14px; -webkit-font-smoothing: antialiased; }
::selection { background: var(--gold); color: var(--gold-ink); }

/* ---------- controlli ---------- */
button { font: inherit; font-weight: 650; cursor: pointer; border: 0; border-radius: 10px; padding: 9px 14px; color: var(--gold-ink); background: linear-gradient(180deg, var(--gold-2), var(--gold)); box-shadow: 0 2px 0 #b9832a, 0 6px 14px rgba(245, 185, 66, .18); transition: transform .08s, filter .15s, box-shadow .15s; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
button:hover:not(:disabled) { filter: brightness(1.06); }
button:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 1px 0 #b9832a; }
button:disabled { opacity: .38; cursor: not-allowed; box-shadow: none; }
button.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
button.on { background: var(--card-2); color: var(--gold-2); box-shadow: inset 0 0 0 1.5px var(--gold); }
button.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line-2); }
button.ghost:hover:not(:disabled) { box-shadow: inset 0 0 0 1.5px var(--muted); }
button.danger { background: var(--bad); color: #2a0703; box-shadow: 0 2px 0 #b8473a; }
button.pearl { background: linear-gradient(180deg, #c3f2f7, var(--pearl)); color: #06323a; box-shadow: 0 2px 0 #4fa7b3, 0 6px 14px rgba(143, 224, 234, .15); }
input, textarea { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line-2); background: rgba(4, 14, 20, .55); color: var(--text); min-width: 0; outline: none; transition: border-color .15s; }
input:focus, textarea:focus { border-color: var(--gold); }
h2 { margin: 0 0 4px; font: 700 23px/1.15 var(--display); letter-spacing: -.2px; }
h3 { margin: 0 0 10px; font: 650 15.5px/1.2 var(--display); color: var(--gold-2); letter-spacing: .1px; }
small { font-size: 12px; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.45; }
.up { color: var(--good); font-weight: 650; }
.down { color: var(--bad); }
.ico { width: 18px; height: 18px; flex: none; }
.coin-svg { width: 22px; height: 22px; flex: none; }
.coin-svg.sm { width: 16px; height: 16px; }
.coin-svg.md { width: 20px; height: 20px; vertical-align: -4px; margin-right: 4px; }

/* ---------- barra superiore ---------- */
.topbar { display: flex; align-items: center; gap: 22px; padding: 10px 20px; background: linear-gradient(180deg, #0b1d29, #0a1923); border-bottom: 1px solid var(--line); position: relative; z-index: 2; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo-svg { width: 44px; height: 44px; display: block; filter: drop-shadow(0 4px 10px rgba(0,0,0,.4)); }
.brand-name { font: 800 21px/1 var(--display); letter-spacing: .3px; }
.brand-name::after { content: ""; display: block; width: 26px; height: 2px; background: var(--gold); margin-top: 5px; border-radius: 2px; }
.company { font-size: 12px; color: var(--muted); margin-top: 4px; }
.level { display: flex; align-items: center; gap: 10px; }
.lvl-ring { --p: 0; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--gold) calc(var(--p) * 1%), rgba(255,255,255,.1) 0); }
.lvl-ring span { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #0b1d29; font: 800 16px var(--display); color: var(--gold-2); }
.lvl-txt { display: grid; gap: 2px; }
.lvl-txt b { font-size: 13px; }
.lvl-txt small { color: var(--muted); }
.wallet { display: flex; gap: 10px; margin-left: auto; }
.coin { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; border-radius: 999px; background: rgba(255,255,255,.05); box-shadow: inset 0 0 0 1px var(--line); }
.coin b { font: 750 17px var(--display); font-variant-numeric: tabular-nums; }
.coin small { color: var(--muted); }
.coin-ico { display: grid; }
.coin-ico .coin-svg { width: 26px; height: 26px; }
.reset { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12.5px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; background: rgba(255,255,255,.05); box-shadow: inset 0 0 0 1px var(--line); }
.pill b { color: var(--text); font-variant-numeric: tabular-nums; }
.pill .ico { width: 15px; height: 15px; }
.league-badge { display: inline-flex; align-items: center; gap: 5px; background: linear-gradient(180deg, #c3f2f7, var(--pearl)); color: #06323a; border-radius: 999px; padding: 5px 10px; font-weight: 750; }
.league-badge .ico { width: 14px; height: 14px; }

/* ---------- layout ---------- */
.layout { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) clamp(480px, 46vw, 820px); min-height: 0; }
.sea { position: relative; min-height: 0; overflow: hidden; background: #0c2f42; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.map-hint { position: absolute; left: 16px; bottom: 14px; color: #d7e9ef; font-size: 12px; background: rgba(6, 22, 31, .6); backdrop-filter: blur(6px); padding: 6px 12px; border-radius: 999px; pointer-events: none; box-shadow: inset 0 0 0 1px var(--line); }
.side { background: var(--panel); display: flex; flex-direction: column; min-height: 0; height: calc(100vh - 65px); border-left: 1px solid var(--line); box-shadow: -12px 0 30px rgba(0,0,0,.25); position: relative; z-index: 1; }
.tabs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; padding: 10px; background: linear-gradient(180deg, #0e2231, #0f2332); border-bottom: 1px solid var(--line); }
.tab { flex-direction: column; gap: 3px; background: transparent; color: var(--muted); box-shadow: none; padding: 7px 2px 6px; font-size: 11px; font-weight: 600; position: relative; border-radius: 10px; }
.tab .ico { width: 19px; height: 19px; }
.tab:hover:not(:disabled) { background: rgba(255,255,255,.05); color: var(--text); filter: none; }
.tab.on { background: var(--card-2); color: var(--gold-2); box-shadow: inset 0 0 0 1px rgba(245,185,66,.45); }
.tab .dot { position: absolute; top: 3px; right: 10px; background: var(--coral); color: #fff; font-style: normal; font-size: 10px; min-width: 17px; height: 17px; display: grid; place-items: center; border-radius: 9px; box-shadow: 0 0 0 2px var(--panel); }
.panel { overflow-y: auto; padding: 18px; flex: 1; scrollbar-width: thin; scrollbar-color: var(--card-2) transparent; }
.card { background: linear-gradient(180deg, var(--card), #13293a); border-radius: var(--radius); padding: 14px; margin-top: 14px; box-shadow: inset 0 0 0 1px var(--line), 0 6px 18px rgba(0,0,0,.18); }
.card.row, .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card.row h3 { margin-bottom: 4px; }
.row.wrap { flex-wrap: wrap; justify-content: flex-start; }
.notice { background: linear-gradient(180deg, #3a3017, #2c2512); box-shadow: inset 0 0 0 1px rgba(245,185,66,.4); }
.hotcard { display: flex; align-items: center; gap: 10px; background: linear-gradient(90deg, rgba(239,122,90,.22), rgba(239,122,90,.06)); box-shadow: inset 0 0 0 1px rgba(239,122,90,.45); }
.warn { margin-top: 10px; color: var(--bad); font-size: 13px; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; padding: 6px 6px; border-bottom: 1px solid var(--line-2); }
.tbl td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: rgba(255,255,255,.025); }
.tag { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .3px; padding: 2px 7px; border-radius: 999px; background: rgba(255,255,255,.08); color: var(--muted); margin-left: 5px; white-space: nowrap; vertical-align: 1px; }
.tag.hot { background: rgba(239,122,90,.2); color: #ffb39e; }
.tag.cheap { background: rgba(95,211,154,.16); color: #8fe8bb; }
.tag.want { background: rgba(245,185,66,.16); color: var(--gold-2); }
.qty-pick { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.qty-pick button.sm:not(.on) { background: rgba(255,255,255,.06); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }

/* ---------- nave ---------- */
.ship-svg { width: 76px; height: 46px; flex: none; }
.ship-svg.big { width: 130px; height: 78px; }
.ship-head { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: var(--radius); background: radial-gradient(ellipse at 30% 110%, rgba(64, 160, 190, .45), transparent 65%), linear-gradient(180deg, #17384b, #112a39); box-shadow: inset 0 0 0 1px var(--line); }
.ship-head .ship-svg.big { filter: drop-shadow(0 6px 8px rgba(0,0,0,.35)); animation: bob 3.4s ease-in-out infinite; }
.status { font-size: 13px; margin-top: 6px; font-weight: 600; color: var(--pearl); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.stats > div { background: var(--card); border-radius: 12px; padding: 9px 10px; box-shadow: inset 0 0 0 1px var(--line); }
.stats small { display: block; color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 3px; }
.stats b { font: 700 15px var(--display); }
.bar { height: 7px; background: rgba(255,255,255,.08); border-radius: 99px; overflow: hidden; margin: 6px 0; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); border-radius: 99px; transition: width .4s; }
.bar.big { height: 12px; }
.cond { height: 5px; background: rgba(255,255,255,.08); border-radius: 99px; overflow: hidden; margin-top: 5px; min-width: 56px; }
.cond span { display: block; height: 100%; border-radius: 99px; }
.cond.good span { background: var(--good); } .cond.mid span { background: var(--mid); } .cond.bad span { background: var(--bad); }
.voy { font: 650 16px var(--display); margin-bottom: 6px; }
.dest-list { display: grid; gap: 8px; }
.dest { display: grid; gap: 3px; text-align: left; justify-items: start; background: rgba(255,255,255,.04); color: var(--text); font-weight: 400; box-shadow: inset 0 0 0 1px var(--line-2); padding: 11px 13px; }
.dest b { font: 650 16px var(--display); }
.dest span { font-size: 12.5px; color: var(--muted); }
.dest span.up { color: var(--good); }
.dest:hover:not(:disabled) { background: rgba(245,185,66,.08); box-shadow: inset 0 0 0 1.5px var(--gold); filter: none; }
.ship-row { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; justify-content: flex-start; background: transparent; color: var(--text); font-weight: 400; padding: 8px; box-shadow: none; border-radius: 12px; }
.ship-row .ship-svg { width: 64px; height: 38px; }
.ship-row.on, .ship-row:hover:not(:disabled) { background: rgba(255,255,255,.05); box-shadow: inset 0 0 0 1px var(--line-2); filter: none; }
.ship-row.on { box-shadow: inset 0 0 0 1.5px var(--gold); }
.ship-row .right { margin-left: auto; text-align: right; color: var(--muted); }

/* ---------- cantiere, missioni, banca ---------- */
.yard { display: flex; gap: 14px; align-items: flex-start; }
.yard > .ship-svg { margin-top: 4px; }
.yard.locked { opacity: .55; filter: saturate(.5); }
.yard-body { flex: 1; min-width: 0; }
.yard-title { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.yard-title b { font: 700 17px var(--display); }
.specs { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 10px; }
.specs span { font-size: 11px; background: rgba(255,255,255,.06); border-radius: 6px; padding: 3px 7px; color: #c4d6de; }
.buy { display: flex; gap: 8px; }
.buy button { font-variant-numeric: tabular-nums; }
.mission { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.mission > div { flex: 1; }
.mission b { font-size: 14px; }
.mission small { color: var(--muted); }
.mission.claimed { opacity: .5; }
.perks { margin: 0 0 14px; padding: 0; list-style: none; display: grid; gap: 8px; }
.perks li { padding-left: 26px; position: relative; }
.perks li::before { content: ""; position: absolute; left: 0; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--pearl) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' stroke='%2306323a' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") center/12px no-repeat; }
.packs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.pack { display: grid; gap: 4px; padding: 14px 10px; background: radial-gradient(ellipse at 50% 0, rgba(143,224,234,.25), transparent 70%), rgba(255,255,255,.04); color: var(--text); box-shadow: inset 0 0 0 1px rgba(143,224,234,.35); }
.pack b { font: 700 16px var(--display); display: flex; align-items: center; justify-content: center; }
.pack span { font-size: 12px; color: var(--muted); font-weight: 500; }
.pack:hover:not(:disabled) { box-shadow: inset 0 0 0 1.5px var(--pearl); filter: none; }
.log div { font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--line); line-height: 1.4; }
.log div:last-child { border-bottom: 0; }
.log small { color: var(--gold-2); margin-right: 8px; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.addr { word-break: break-all; background: rgba(4,14,20,.6); border: 1px dashed var(--line-2); border-radius: 10px; padding: 10px; margin: 10px 0 8px; font-size: 13px; }
.pay-box { box-shadow: inset 0 0 0 1.5px var(--gold), 0 6px 18px rgba(0,0,0,.18); }
.pay-box .kv { align-items: center; }
.tbl tr.me td { background: rgba(245,185,66,.1); color: var(--gold-2); font-weight: 650; }

/* ---------- mappa ---------- */
.grid line { stroke: #bfe6f0; stroke-width: 1; opacity: .05; }
.wave { fill: none; stroke: #bfe6f0; stroke-width: 1.6; stroke-linecap: round; opacity: .22; animation: wave 6s ease-in-out infinite; }
@keyframes wave { 0%, 100% { opacity: .08; transform: translateX(0); } 50% { opacity: .32; transform: translateX(8px); } }
.shallow { fill: #4bb3c2; opacity: .28; }
.shallow-ring { fill: none; stroke: #bfeef3; stroke-width: 1.2; stroke-dasharray: 3 5; opacity: .35; }
.sand { fill: url(#sandGrad); stroke: #c5a265; stroke-width: 1.2; }
.land { fill: url(#landGrad); }
.hill { fill: #4f8a4c; opacity: .75; }
.compass .c-outer { fill: rgba(6, 22, 31, .35); stroke: #e9dcb8; stroke-width: 1.2; opacity: .8; }
.compass .c-inner { fill: none; stroke: #e9dcb8; stroke-dasharray: 2 4; opacity: .6; }
.compass .c-ns { fill: #e9dcb8; opacity: .85; }
.compass .c-n { fill: var(--coral); }
.compass .c-ew { fill: #e9dcb8; opacity: .5; }
.compass text { fill: #e9dcb8; font: 700 14px var(--display); text-anchor: middle; }
.cloud { animation: drift linear infinite; }
.cloud ellipse { fill: #fff; opacity: .07; }
@keyframes drift { from { transform: translateX(-250px); } to { transform: translateX(1250px); } }
.route-under { stroke: #06202d; stroke-width: 6; opacity: .25; stroke-linecap: round; }
.route-line { stroke: #e9dcb8; stroke-width: 2; stroke-dasharray: 2 8; stroke-linecap: round; opacity: .55; }
.route-tag rect { fill: rgba(6, 22, 31, .72); stroke: rgba(233,220,184,.25); }
.route-tag text { fill: #d7e9ef; font: 600 10.5px Inter, sans-serif; text-anchor: middle; }
.route.on .route-line { stroke: var(--gold); opacity: 1; stroke-width: 3; stroke-dasharray: 8 7; animation: march 1s linear infinite; }
.route.on .route-tag rect { fill: var(--gold); stroke: none; }
.route.on .route-tag text { fill: var(--gold-ink); font-weight: 750; }
.route.sailing .route-line { stroke: var(--pearl); opacity: .95; stroke-width: 3; stroke-dasharray: 8 7; animation: march 1.4s linear infinite; }
@keyframes march { to { stroke-dashoffset: -15; } }
.port { cursor: pointer; }
.port-hit { fill: transparent; }
.port-ring { fill: none; stroke: transparent; stroke-width: 2; }
.port:hover .port-ring, .port.sel .port-ring { stroke: #fff; stroke-opacity: .6; }
.port.reach .port-ring { stroke: var(--gold); stroke-width: 3; animation: pulse 1.6s ease-in-out infinite; }
.port.here .port-ring { stroke: var(--pearl); stroke-width: 2.5; }
@keyframes pulse { 0%, 100% { stroke-opacity: 1; stroke-width: 3; } 50% { stroke-opacity: .35; stroke-width: 7; } }
.beam { animation: beam 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes beam { 0%, 100% { opacity: .2; transform: scale(.7); } 50% { opacity: 1; transform: scale(1.25); } }
.plaque rect { fill: #f7efdc; stroke: #9b7a45; stroke-width: 1.2; }
.plaque text { fill: #1b2b36; font: 700 12.5px var(--display); text-anchor: middle; }
.port.sel .plaque rect, .port.reach .plaque rect { fill: var(--gold); stroke: #9b6a1a; }
.hot-bubble circle { fill: #fff8ea; stroke: var(--coral); stroke-width: 2; }
.hot-bubble text { font-size: 12.5px; text-anchor: middle; }
.dock-badge circle { fill: var(--pearl); stroke: #0b2a3b; stroke-width: 2; }
.dock-badge text { fill: #06323a; font: 800 11px Inter, sans-serif; text-anchor: middle; }
.boat { cursor: pointer; }
.bob { animation: bob 2.6s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-1.6px) rotate(-1.2deg); } }
.wake { fill: none; stroke: #e6f7fa; stroke-width: 1.6; stroke-linecap: round; opacity: .55; stroke-dasharray: 4 4; animation: march .9s linear infinite; }
.boat-tag rect { fill: rgba(6, 22, 31, .78); stroke: rgba(255,255,255,.18); }
.boat-tag text { fill: #fff; font: 650 11px Inter, sans-serif; text-anchor: middle; }
.boat.sel .boat-tag rect { fill: var(--gold); stroke: none; }
.boat.sel .boat-tag text { fill: var(--gold-ink); }
.boat.other { opacity: .72; }
.boat.other .wake { opacity: .3; }
.other-name { fill: #cfe8ef; font: 600 9px Inter, sans-serif; text-anchor: middle; paint-order: stroke; stroke: #0b2a3b; stroke-width: 3px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.boat.other:hover .other-name { opacity: 1; }
.other-ship { fill: #fff; font: 700 8px Inter, sans-serif; text-anchor: middle; paint-order: stroke; stroke: #0b2a3b; stroke-width: 3px; }
.boat.bot { opacity: .8; }
.boat.bot .other-name { fill: #f3d28a; }

/* ---------- accesso ---------- */
.auth { display: none; }
body.auth-on .auth { display: grid; grid-template-columns: 1fr minmax(320px, 440px); position: fixed; inset: 0; z-index: 20; background: #0b2a3b; }
body.auth-on .layout, body.auth-on .topbar { visibility: hidden; }
.auth-scene { grid-column: 1; grid-row: 1; width: 100%; height: 100%; display: block; }
.scene-cloud ellipse { fill: #ffe6d0; opacity: .32; }
.scene-ship .ship-svg { overflow: visible; }
.scene-ship { animation: bob 4s ease-in-out infinite; }
.scene-ship.s1 { animation-duration: 3.2s; animation-delay: -1s; }
.scene-ship.s2 { animation-duration: 5s; animation-delay: -2s; }
.auth-card { grid-column: 2; grid-row: 1; position: relative; align-self: stretch; display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 40px 38px; background: rgba(8, 22, 31, .88); backdrop-filter: blur(10px); border-left: 1px solid var(--line); box-shadow: -20px 0 50px rgba(0,0,0,.35); }
.auth-card h2 { font-size: 32px; margin-top: 18px; }
.auth-card label { display: grid; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.auth-card button[type=submit] { padding: 12px; font-size: 15px; margin-top: 4px; }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand .logo-svg { width: 48px; height: 48px; }
.auth-brand b { font: 800 22px var(--display); display: block; }
.auth-brand small { color: var(--muted); }
.auth-err { color: var(--bad); font-size: 13px; min-height: 1em; }

/* ---------- notifiche ---------- */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 30; width: min(92vw, 440px); pointer-events: none; }
.toast { background: rgba(16, 37, 52, .96); backdrop-filter: blur(8px); color: var(--text); padding: 12px 16px 12px 40px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line-2), var(--shadow); font-size: 14px; transition: opacity .4s, transform .4s; position: relative; animation: pop .25s ease-out; }
.toast::before { content: ""; position: absolute; left: 14px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 4px rgba(95,211,154,.2); }
.toast.err::before { background: var(--bad); box-shadow: 0 0 0 4px rgba(255,122,107,.2); }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr) 480px; }
  .reset .pill:last-child { display: none; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: 46vh auto; }
  .sea { min-height: 46vh; }
  .side { height: auto; border-left: 0; border-top: 1px solid var(--line); }
  .topbar { gap: 10px 14px; padding: 10px 14px; }
  .brand-name { font-size: 18px; }
  .logo-svg { width: 38px; height: 38px; }
  .level { order: 3; }
  .wallet { margin-left: auto; gap: 6px; }
  .coin { padding: 5px 10px 5px 6px; }
  .coin small { display: none; }
  .reset { order: 4; margin-left: auto; }
  .tabs { position: sticky; top: 0; z-index: 2; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .tbl { font-size: 12.5px; }
  .ship-svg.big { width: 100px; height: 60px; }
  .map-hint { display: none; }
  body.auth-on .auth { grid-template-columns: 1fr; }
  .auth-scene { position: absolute; inset: 0; }
  .auth-card { grid-column: 1; align-self: end; margin: 0 12px 12px; border-radius: 18px; border: 1px solid var(--line); padding: 26px 22px; }
  .auth-card h2 { font-size: 26px; margin-top: 8px; }
}

/* ---------- fondo premi e admin ---------- */
.fund-hero { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; background: radial-gradient(ellipse at 50% 0, rgba(245,185,66,.22), transparent 70%), linear-gradient(180deg, var(--card), #13293a); box-shadow: inset 0 0 0 1px rgba(245,185,66,.4); }
.fund-hero small { display: block; color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.fund-hero b { font: 750 17px var(--display); color: var(--gold-2); }
.balance-big { font: 800 30px var(--display); margin: 2px 0 12px; }
.fld { display: grid; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 600; margin: 10px 0; }
.wd { padding: 10px 0; border-bottom: 1px solid var(--line); }
.wd:last-child { border-bottom: 0; }
.wd .row { margin-top: 8px; }
input.tx { flex: 1; min-width: 180px; font-size: 12px; padding: 6px 9px; }
@media (max-width: 860px) { .fund-hero { grid-template-columns: 1fr 1fr; } }

/* ---------- benvenuto, zoom mappa, conto alla rovescia ---------- */
.auth-card.landing { gap: 14px; }
.auth-card h1 { font: 800 38px/1.08 var(--display); margin: 6px 0 0; letter-spacing: -.5px; }
.auth-card h1 em { font-style: normal; color: var(--gold-2); }
.auth-card .lead { font-size: 15.5px; line-height: 1.5; color: #cfe0e7; margin: 0; }
.gift { align-self: flex-start; display: inline-flex; align-items: center; gap: 7px; margin-top: 14px; padding: 6px 12px; border-radius: 999px; background: rgba(245,185,66,.14); color: var(--gold-2); font-size: 12.5px; font-weight: 650; box-shadow: inset 0 0 0 1px rgba(245,185,66,.45); }
.gift .ico { width: 16px; height: 16px; }
.steps { list-style: none; counter-reset: st; margin: 4px 0; padding: 0; display: grid; gap: 10px; }
.steps li { counter-increment: st; display: grid; grid-template-columns: 30px 1fr; column-gap: 12px; align-items: start; }
.steps li::before { content: counter(st); grid-row: span 2; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 800 14px var(--display); color: var(--gold-ink); background: linear-gradient(180deg, var(--gold-2), var(--gold)); }
.steps b { font: 700 15px var(--display); }
.steps span { color: var(--muted); font-size: 13px; line-height: 1.4; }
.cta { display: flex; gap: 10px; margin-top: 4px; }
.cta button { flex: 1; padding: 13px; font-size: 15px; }
.auth-card .back { align-self: flex-start; background: transparent; box-shadow: none; color: var(--muted); padding: 4px 0; font-weight: 500; }
.auth-card .back:hover { color: var(--text); filter: none; }
#map { cursor: grab; touch-action: none; }
#map.dragging { cursor: grabbing; }
.map-zoom { position: absolute; right: 14px; bottom: 14px; display: grid; gap: 6px; }
.map-zoom button { width: 38px; height: 38px; padding: 0; font-size: 20px; line-height: 1; background: rgba(6, 22, 31, .78); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); backdrop-filter: blur(6px); }
.map-zoom button:hover:not(:disabled) { color: var(--gold-2); filter: none; }
.map-zoom .ico { width: 18px; height: 18px; }
.boat-tag .eta { fill: var(--gold-2); font-variant-numeric: tabular-nums; }
.boat.sel .boat-tag .eta { fill: var(--gold-ink); }
@media (max-width: 860px) { .auth-card h1 { font-size: 28px; } .map-zoom { bottom: 10px; right: 10px; } }

/* ---------- flotta a schede, obiettivi, attività dal vivo ---------- */
.sec-hero { position: relative; padding: 16px; border-radius: var(--radius); background: radial-gradient(ellipse at 100% 0, rgba(245,185,66,.18), transparent 60%), linear-gradient(135deg, #17384b, #0f2635); box-shadow: inset 0 0 0 1px var(--line); display: grid; gap: 6px; justify-items: start; }
.sec-hero small { color: var(--gold); font-size: 10.5px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; }
.sec-hero h2 { font-size: 26px; }
.sec-hero button { margin-top: 6px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.kpis.three { grid-template-columns: repeat(3, 1fr); }
.kpis > div { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; background: var(--card); border-radius: 12px; padding: 9px 10px; box-shadow: inset 0 0 0 1px var(--line); }
.kpis .ico { grid-row: span 2; width: 30px; height: 30px; padding: 6px; border-radius: 9px; background: rgba(255,255,255,.06); color: var(--gold-2); }
.kpis small { color: var(--muted); font-size: 10.5px; line-height: 1.2; }
.kpis b { font: 750 16px var(--display); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 2px; padding: 4px; border-radius: 12px; background: rgba(255,255,255,.04); box-shadow: inset 0 0 0 1px var(--line); width: fit-content; }
.chip { background: transparent; color: var(--muted); box-shadow: none; padding: 6px 12px; font-size: 12.5px; border-radius: 9px; }
.chip.on { background: var(--card-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.chip:hover:not(:disabled) { color: var(--text); filter: none; }
.fleet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-top: 12px; }
.fleet-card { display: block; padding: 0; text-align: left; background: var(--card); color: var(--text); font-weight: 400; border-radius: 14px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.fleet-card:hover:not(:disabled) { box-shadow: inset 0 0 0 1.5px var(--line-2); filter: none; transform: translateY(-1px); }
.fleet-card.on { box-shadow: inset 0 0 0 2px var(--gold); }
.fc-art { position: relative; height: 92px; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 120%, rgba(75, 179, 194, .55), transparent 70%), linear-gradient(180deg, #1c4a60, #143546); }
.fc-art::after { content: ""; position: absolute; left: 0; right: 0; bottom: 14px; height: 2px; background: repeating-linear-gradient(90deg, rgba(255,255,255,.25) 0 10px, transparent 10px 20px); }
.fc-art .ship-svg { width: 118px; height: 70px; position: relative; z-index: 1; filter: drop-shadow(0 4px 6px rgba(0,0,0,.35)); }
.fleet-card.sailing .fc-art .ship-svg { animation: bob 2.8s ease-in-out infinite; }
.fc-num { position: absolute; left: 10px; top: 6px; font: 800 22px var(--display); color: var(--gold-2); opacity: .9; }
.fc-era { position: absolute; right: 8px; top: 8px; font-size: 9.5px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; padding: 3px 7px; border-radius: 6px; background: rgba(0,0,0,.35); box-shadow: inset 0 0 0 1px currentColor; }
.era-sail { color: #e9dcb8; } .era-steam { color: #b8c7d1; } .era-motor { color: #ffb39e; } .era-modern { color: var(--pearl); }
.fc-body { padding: 10px 11px 12px; display: grid; gap: 4px; }
.fc-title b { font: 700 15px var(--display); display: block; }
.fc-title small { color: var(--muted); }
.fc-status { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); margin: 2px 0 4px; }
.fc-status.sea { color: var(--pearl); }
.fc-status .ico { width: 13px; height: 13px; }
.fc-row { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 3px; }
.segs { display: flex; gap: 2px; }
.segs i { flex: 1; height: 5px; border-radius: 2px; background: var(--good); }
.segs i.used { background: rgba(255,255,255,.1); }
.coin-add { width: 22px; height: 22px; padding: 0; border-radius: 50%; font-size: 15px; line-height: 1; margin-left: 2px; }
.pill .live, .feed-item .live { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px rgba(95,211,154,.2); animation: blink 2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .45; } }
.pill.event { font: inherit; font-size: 12.5px; color: var(--muted); font-weight: 500; box-shadow: inset 0 0 0 1px rgba(245,185,66,.45); background: rgba(245,185,66,.08); }
.pill.event:hover:not(:disabled) { color: var(--text); filter: none; }
.pill.event .ico { color: var(--gold-2); }
.feed { position: fixed; left: 16px; bottom: 56px; z-index: 15; display: grid; gap: 8px; width: 290px; pointer-events: none; }
.feed-item { display: grid; grid-template-columns: 62px 1fr; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: rgba(16, 37, 52, .95); backdrop-filter: blur(8px); box-shadow: inset 0 0 0 1px rgba(143,224,234,.35), var(--shadow); font-size: 13px; line-height: 1.35; animation: slidein .35s ease-out; transition: opacity .4s, transform .4s; position: relative; overflow: hidden; }
.feed-item::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; background: var(--pearl); animation: shrink 6.5s linear forwards; }
@keyframes shrink { from { width: 100%; } to { width: 0; } }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } }
.feed-item.out { opacity: 0; transform: translateX(20px); }
.feed-art .ship-svg { width: 62px; height: 38px; }
.feed-item small { display: flex; align-items: center; gap: 6px; color: var(--pearl); font-size: 10px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; }
.feed-item span { display: block; color: var(--muted); font-size: 12px; }

@media (max-width: 860px) { .feed { right: 12px; left: 12px; width: auto; bottom: auto; top: 120px; } .kpis { grid-template-columns: 1fr 1fr; } .fleet-grid { grid-template-columns: 1fr; } }

/* ---------- app installabile ---------- */
.install-pop { position: fixed; z-index: 40; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(94vw, 460px); display: grid; grid-template-columns: 52px 1fr; gap: 12px; align-items: center; padding: 14px; border-radius: 18px; background: rgba(16, 37, 52, .97); backdrop-filter: blur(10px); box-shadow: inset 0 0 0 1px rgba(245,185,66,.45), 0 18px 50px rgba(0,0,0,.5); animation: pop .3s ease-out; }
.install-pop img { border-radius: 12px; }
.ip-text b { display: block; font: 700 16px var(--display); margin-bottom: 3px; }
.ip-text span { color: var(--muted); font-size: 13px; line-height: 1.45; }
.ip-text span b { display: inline; font: inherit; font-weight: 700; color: var(--text); }
.ip-text svg { vertical-align: -2px; }
.ip-actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }
@media (display-mode: standalone) {
  .topbar { padding-top: max(10px, env(safe-area-inset-top)); }
  .side { padding-bottom: env(safe-area-inset-bottom); }
}

/* nomi delle navi degli altri: visibili solo passando sopra, così non coprono i porti */
.boat.other .other-ship { opacity: 0; pointer-events: none; transition: opacity .2s; }
.boat.other:hover .other-ship { opacity: 1; }

/* ---------- tutorial ---------- */
.tour { position: fixed; z-index: 45; right: 24px; bottom: 24px; width: min(92vw, 380px); padding: 18px; border-radius: 18px; background: rgba(16, 37, 52, .98); backdrop-filter: blur(10px); box-shadow: inset 0 0 0 1.5px var(--gold), 0 24px 60px rgba(0,0,0,.55); animation: pop .3s ease-out; }
.tour-top { display: flex; justify-content: space-between; align-items: center; }
.tour-top small { color: var(--gold); font-weight: 800; letter-spacing: 1px; text-transform: uppercase; font-size: 10.5px; }
.tour-x { background: transparent; box-shadow: none; color: var(--muted); font-size: 20px; padding: 0 4px; }
.tour h3 { font-size: 19px; margin: 8px 0 6px; color: var(--text); }
.tour p { margin: 0; color: #cfe0e7; font-size: 14px; line-height: 1.5; }
.tour-dots { display: flex; gap: 5px; margin: 14px 0 12px; }
.tour-dots i { flex: 1; height: 4px; border-radius: 2px; background: rgba(255,255,255,.12); }
.tour-dots i.done { background: rgba(245,185,66,.5); }
.tour-dots i.on { background: var(--gold); }
.tour-actions { display: flex; gap: 8px; justify-content: flex-end; }
.tour-hl { position: relative; z-index: 2; box-shadow: 0 0 0 3px var(--gold), 0 0 0 8px rgba(245,185,66,.25) !important; border-radius: 14px; animation: tourpulse 1.6s ease-in-out infinite; }
@keyframes tourpulse { 50% { box-shadow: 0 0 0 3px var(--gold), 0 0 0 14px rgba(245,185,66,.08); } }
.sea.tour-hl { border-radius: 0; box-shadow: inset 0 0 0 3px var(--gold) !important; animation: none; }
@media (max-width: 860px) { .tour { right: 12px; left: 12px; bottom: 12px; width: auto; } }

/* ---------- QR code pagamento ---------- */
.qr-wrap { display: grid; grid-template-columns: 168px 1fr; gap: 14px; align-items: center; margin: 12px 0 4px; }
.qr { background: #fff; border-radius: 12px; padding: 8px; line-height: 0; }
.qr svg { width: 100%; height: auto; display: block; }
@media (max-width: 860px) { .qr-wrap { grid-template-columns: 1fr; justify-items: center; text-align: center; } .qr { width: 200px; } }

/* ---------- telefono: layout da app ----------
   Intestazione in una riga, mappa in alto, pannello che scorre e barra delle schede in basso. */
@media (max-width: 860px) {
  html, body { height: 100%; }
  body { height: 100dvh; min-height: 0; overflow: hidden; font-size: 14.5px; }
  .topbar { flex-wrap: nowrap; gap: 8px; padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top)); }
  .brand > div { display: none; }
  .logo-svg { width: 34px; height: 34px; }
  .level { order: 0; gap: 6px; }
  .lvl-ring { width: 34px; height: 34px; }
  .lvl-ring span { width: 27px; height: 27px; font-size: 13px; }
  .lvl-txt { display: none; }
  .wallet { margin-left: auto; gap: 6px; }
  .coin { padding: 4px 9px 4px 5px; gap: 5px; }
  .coin b { font-size: 15px; }
  .coin-ico .coin-svg { width: 22px; height: 22px; }
  .coin-add { width: 22px; height: 22px; min-height: 22px; padding: 0; }
  .tour-x { min-height: 0; }
  .reset { order: 0; margin-left: 0; }
  .reset .pill:not(:first-child), .reset .league-badge { display: none; }
  .reset .pill { padding: 5px 8px; }

  .layout { flex: 1; min-height: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(220px, 36dvh) minmax(0, 1fr); }
  .side, .tabs, .panel { min-width: 0; }
  .sea { min-height: 0; }
  .side { height: auto; min-height: 0; border-left: 0; border-top: 1px solid var(--line); box-shadow: 0 -10px 24px rgba(0,0,0,.3); }
  .panel { padding: 14px 12px 18px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }

  /* schede in basso, in una riga che scorre di lato */
  .tabs { order: 2; position: static; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; padding: 6px 6px max(6px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); border-bottom: 0; background: #0b1d29; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; min-width: 64px; min-height: 52px; padding: 6px 4px; font-size: 10.5px; }
  .tab .ico { width: 21px; height: 21px; }
  .tab.on { box-shadow: none; background: rgba(245,185,66,.12); }

  /* tocchi comodi */
  button { min-height: 40px; }
  button.sm, .qty-pick button { min-height: 36px; min-width: 40px; }
  .tbl td button.sm { min-height: 34px; }
  .chip { min-height: 36px; }
  input, textarea { font-size: 16px; } /* evita lo zoom automatico su iPhone */

  .map-zoom { right: 8px; bottom: 8px; gap: 4px; }
  .map-zoom button { width: 34px; height: 34px; min-height: 34px; font-size: 18px; }
  .compass { display: none; }
  .feed { top: auto; bottom: calc(76px + env(safe-area-inset-bottom)); left: 10px; right: 10px; width: auto; }
  .feed-item { padding: 8px 10px; font-size: 12.5px; grid-template-columns: 44px 1fr; }
  .feed-art .ship-svg { width: 44px; height: 28px; }
  .toasts { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .tour { left: 10px; right: 10px; bottom: calc(76px + env(safe-area-inset-bottom)); padding: 14px; border-radius: 16px; }
  .tour h3 { font-size: 17px; margin: 6px 0 4px; }
  .tour p { font-size: 13.5px; }
  .tour-dots { margin: 10px 0 10px; }

  .ship-head { padding: 12px; gap: 10px; }
  .ship-head .ship-svg.big { width: 92px; height: 56px; }
  h2 { font-size: 21px; }
  .sec-hero h2 { font-size: 22px; }
  .stats { gap: 6px; }
  .stats > div { padding: 8px; }
  .card { padding: 12px; margin-top: 12px; }
  .dest { padding: 12px; }
  .yard { flex-direction: column; gap: 6px; }
  .yard > .ship-svg { align-self: center; width: 150px; height: 90px; }
  .buy button { flex: 1; }
  .packs { grid-template-columns: 1fr 1fr; }
  .mission { flex-direction: column; align-items: stretch; }
  .mission button { width: 100%; }
}

/* telefoni e tablet: animazioni più leggere per risparmiare batteria */
@media (max-width: 860px), (pointer: coarse) {
  .wave, .cloud, .beam, .route.on .route-line, .route.sailing .route-line, .wake { animation: none; }
  .clouds { display: none; }
  .sand { filter: none; }
  .bob { animation-duration: 4s; }
}
@media (max-width: 860px) { .pill, .coin { white-space: nowrap; } }
@media (max-width: 370px) { .reset { display: none; } }

/* ---------- dashboard admin ---------- */
.kpis.dash { grid-template-columns: repeat(4, 1fr); }
.bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; align-items: end; height: 130px; }
.bar-col { display: grid; grid-template-rows: 1fr auto auto; height: 100%; align-items: end; text-align: center; }
.bar-col span { display: block; min-height: 2px; background: linear-gradient(180deg, var(--gold-2), var(--gold)); border-radius: 4px 4px 0 0; }
.bar-col small { font-size: 10px; color: var(--text); }
.bar-col em { font-style: normal; font-size: 9.5px; color: var(--muted); }
@media (max-width: 860px) { .kpis.dash { grid-template-columns: 1fr 1fr; } }
