/* Sloophold — the manifest. Duotone: indigo sea and slate rigging, one mint lamp. Big Shoulders for words, Inter for every figure. */
:root {
  --sea: #141838; --hull: #1C2150; --hull2: #232A5E; --rig: #2B3268; --slate: #8A93C4; --ink: #E6EAFF;
  --lamp: #2FE3B8; --lamp2: #1FB894; --wake: #FF7A59; --quaybg: #0D1030;
  --quay: 66px;
  --display: 'Big Shoulders Display', 'Arial Narrow', Impact, sans-serif; --text: 'Inter', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--sea); color: var(--ink); font-family: var(--text); font-size: 15px; line-height: 1.5; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.display { font-family: var(--display); font-weight: 900; letter-spacing: .01em; text-transform: uppercase; }
.figure { font-family: var(--text); font-variant-numeric: tabular-nums; font-weight: 700; }
.muted { color: var(--slate); }

/* ---------- the deck (page frame) ---------- */
#deck { padding: 14px 16px calc(var(--quay) + 44px); max-width: 680px; margin: 0 auto; display: grid; grid-template-columns: 1fr; gap: 16px; }
.masthead, .board, .side, .keel { min-width: 0; }

/* ---------- masthead ---------- */
.masthead { position: relative; border-radius: 18px; overflow: hidden; border: 1px solid var(--rig); background: var(--hull); min-height: 104px; }
.banner { display: block; width: 100%; height: 104px; object-fit: cover; object-position: left center; opacity: .9; }
.mastcopy { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; padding: 0 18px; background: linear-gradient(90deg, rgba(20,24,56,.35) 0%, rgba(20,24,56,.85) 55%, rgba(20,24,56,.95) 100%); }
.mastcopy h1 { margin: 0; font-size: clamp(30px, 8vw, 44px); line-height: .95; text-align: right; }
.mastline { margin: 4px 0 0; text-align: right; font-size: 13px; color: var(--slate); }

/* ---------- the board ---------- */
.board { border-radius: 18px; border: 1px solid var(--rig); background: var(--hull); overflow: hidden; }
.boardhead { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding: 14px 16px 0; }
.voyage { font-size: clamp(26px, 7vw, 36px); line-height: 1; }
.voyage small { display: block; font-family: var(--text); font-weight: 600; text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--slate); margin-bottom: 4px; }
.phasechip { flex: none; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--rig); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--slate); background: var(--sea); }
.phasechip[data-p="boarding"] { color: var(--lamp); border-color: var(--lamp2); }
.phasechip[data-p="under way"] { color: var(--ink); border-color: var(--slate); }
.phasechip[data-p="in port"] { color: var(--wake); border-color: var(--wake); }

/* passage rail: cast off → gangway → port, the lamp slides along it */
.passage { padding: 14px 16px 6px; }
.passagerail { position: relative; height: 6px; border-radius: 3px; background: var(--rig); }
.passagefill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: linear-gradient(90deg, var(--lamp2), var(--lamp)); width: 0; transition: width .9s linear; }
.passagepin { position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--lamp); box-shadow: 0 0 0 4px rgba(47,227,184,.18), 0 0 18px rgba(47,227,184,.6); transition: left .9s linear; }
.passagepin.dark { background: var(--slate); box-shadow: none; }
.passagemark { position: absolute; top: -5px; width: 2px; height: 16px; background: var(--slate); opacity: .7; }
.clocks { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--slate); }
.clocks b { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 700; }
.clocks .port { text-align: right; }

/* tallies */
.tallies { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px 16px 0; }
.tally.aboard { grid-column: 1 / -1; }
.tally { min-width: 0; padding: 10px 12px; border-radius: 12px; background: var(--sea); border: 1px solid var(--rig); }
.tallylab { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--slate); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tallyfig { font-size: clamp(18px, 5vw, 26px); line-height: 1.2; white-space: nowrap; overflow-wrap: normal; }
.tally.deck .tallyfig { color: var(--lamp); }
.tallynote { font-size: 11px; color: var(--slate); }
.pays { padding: 10px 16px 0; font-size: 13px; color: var(--slate); }
.pays b { color: var(--lamp); font-variant-numeric: tabular-nums; }

/* the gangplank: the one action, an inline field on the board */
.gangplank { margin: 12px 16px 0; padding: 12px; border-radius: 14px; background: var(--sea); border: 1px solid var(--rig); display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-width: 0; }
.gangrow { display: flex; gap: 8px; align-items: stretch; }
.stakefield { flex: 1 1 0; width: 0; min-width: 0; height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--rig); background: var(--hull); font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; outline: none; }
.stakefield:focus { border-color: var(--lamp2); }
.stakefield::placeholder { color: var(--slate); font-weight: 500; font-size: 14px; }
.boardbtn { flex: none; height: 48px; padding: 0 20px; border-radius: 12px; border: 0; background: var(--lamp); color: #0B1A17; font-family: var(--display); font-weight: 900; font-size: 20px; letter-spacing: .04em; text-transform: uppercase; }
.boardbtn:disabled { background: var(--rig); color: var(--slate); cursor: default; }
.gangnote { font-size: 12px; color: var(--slate); }
.gangnote b { color: var(--ink); }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.quick button { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--rig); background: transparent; font-size: 12px; color: var(--slate); }
.quick button:hover { color: var(--ink); border-color: var(--slate); }
.mine { margin: 10px 16px 0; padding: 10px 12px; border-radius: 12px; background: rgba(47,227,184,.08); border: 1px solid var(--lamp2); display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; }
.mine b { color: var(--lamp); font-variant-numeric: tabular-nums; }
.jumpbtn { flex: none; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--wake); background: transparent; color: var(--wake); font-weight: 700; font-size: 13px; }
.jumpbtn:disabled { opacity: .5; cursor: default; }

/* the manifest: crew ranked by stake */
.manifest { padding: 14px 16px 4px; }
.manifesthead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.manifesthead h2 { margin: 0; font-size: 22px; }
.manifesthead span { font-size: 12px; color: var(--slate); }
.mrow { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 9px 0; border-top: 1px solid var(--rig); font-size: 13px; }
.mrow:first-of-type { border-top: 0; }
.mrow.you { background: linear-gradient(90deg, rgba(47,227,184,.10), transparent); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 8px; }
.mrank { font-family: var(--display); font-weight: 800; font-size: 18px; color: var(--slate); }
.mrow.you .mrank { color: var(--lamp); }
.mwho { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mwho small { display: block; font-size: 11px; color: var(--slate); }
.mstake { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.mstake small { display: block; font-size: 11px; font-weight: 500; color: var(--slate); }
.mcut { text-align: right; font-variant-numeric: tabular-nums; color: var(--lamp); font-weight: 700; min-width: 64px; }
.mcut small { display: block; font-size: 11px; font-weight: 500; color: var(--slate); }
.youtag { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: var(--lamp); color: #0B1A17; font-size: 10px; font-weight: 800; letter-spacing: .08em; vertical-align: middle; }
.nobody { padding: 14px 0; font-size: 13px; color: var(--slate); border-top: 1px solid var(--rig); }

/* the jumped: struck through */
.jumped { padding: 8px 16px 16px; }
.jumped h3 { margin: 8px 0 4px; font-size: 18px; color: var(--wake); }
.jrow { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--rig); font-size: 13px; color: var(--slate); }
.jrow .strike { text-decoration: line-through; text-decoration-color: var(--wake); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jrow .kept { text-align: right; font-variant-numeric: tabular-nums; }
.jrow .dropped { text-align: right; font-variant-numeric: tabular-nums; color: var(--wake); font-weight: 700; }
.jrow small { display: block; font-size: 11px; font-weight: 500; color: var(--slate); }

/* ---------- side column ---------- */
.side { display: grid; gap: 14px; align-content: start; }
.primer, .logbook, .movetape, .stats { border-radius: 16px; border: 1px solid var(--rig); background: var(--hull); padding: 14px 16px; }
.primer h3, .logbook h3, .movetape h3, .stats h3 { margin: 0 0 8px; font-size: 20px; }
.primerrule { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; padding: 6px 0; font-size: 13px; color: var(--slate); }
.primerrule b { color: var(--ink); }
.primerrule i { font-style: normal; font-family: var(--display); font-weight: 800; font-size: 16px; color: var(--lamp); }
.carrynote { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(47,227,184,.08); font-size: 12px; color: var(--ink); }
.carrynote b { color: var(--lamp); font-variant-numeric: tabular-nums; }
.logrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--rig); font-size: 13px; }
.logrow:first-of-type { border-top: 0; }
.logrow .logno { font-family: var(--display); font-weight: 800; font-size: 18px; color: var(--slate); }
.logrow .logwhat { min-width: 0; color: var(--slate); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logrow .logwhat b { color: var(--ink); }
.logrow .logdeck { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--lamp); white-space: nowrap; }
.logrow .logdeck small { display: block; font-size: 11px; font-weight: 500; color: var(--slate); }
.moverow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 7px 0; border-top: 1px solid var(--rig); font-size: 12px; }
.moverow:first-of-type { border-top: 0; }
.movekind { padding: 2px 7px; border-radius: 6px; font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.movekind[data-k="board"] { background: rgba(47,227,184,.15); color: var(--lamp); }
.movekind[data-k="jump"] { background: rgba(255,122,89,.15); color: var(--wake); }
.movewho { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--slate); }
.movewho b { color: var(--ink); font-variant-numeric: tabular-nums; }
.movewhen { color: var(--slate); white-space: nowrap; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.stats h3 { grid-column: 1 / -1; }
.statcell { min-width: 0; }
.statcell .tallylab { margin-bottom: 2px; }
.statcell .tallyfig { font-size: 20px; }
.quiet { font-size: 13px; color: var(--slate); padding: 4px 0; }

/* ---------- other views inside the board ---------- */
.sheetpad { padding: 16px; }
.sheetpad h2 { margin: 0 0 6px; font-size: 26px; }
.sheetpad p { margin: 0 0 12px; color: var(--slate); font-size: 14px; }
.sheetpad h3 { margin: 16px 0 4px; font-size: 18px; }
.sheetpad code { font-size: 12px; word-break: break-all; color: var(--ink); }
.berthcard { margin-top: 10px; padding: 12px; border-radius: 12px; background: var(--sea); border: 1px solid var(--rig); }
.berthhead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.berthhead .display { font-size: 20px; }
.berthkv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; }
.berthkv span { color: var(--slate); }
.berthkv b { text-align: right; font-variant-numeric: tabular-nums; }
.landbtn { margin-top: 10px; height: 40px; padding: 0 16px; border-radius: 10px; border: 0; background: var(--lamp); color: #0B1A17; font-weight: 800; font-size: 14px; width: 100%; }
.logtable .mrow { grid-template-columns: 34px minmax(0, 1fr) auto auto; }

/* ---------- keel (footer) ---------- */
.keel { padding: 6px 4px 0; font-size: 12px; color: var(--slate); display: grid; gap: 6px; }
.keel .ca { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.keel code { font-size: 11px; word-break: break-all; color: var(--ink); }
.keel .copyca { padding: 2px 8px; border-radius: 6px; border: 1px solid var(--rig); background: transparent; font-size: 11px; color: var(--slate); }
.keel a { color: var(--slate); text-decoration: underline; text-decoration-color: var(--rig); }
.keelline { color: var(--slate); }

/* ---------- the quay ---------- */
#quay { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: rgba(13,16,48,.96); backdrop-filter: blur(12px); border-top: 1px solid var(--rig);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)); }
.quayin { max-width: 1180px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.routes { order: -1; flex: 1 1 100%; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.routes::-webkit-scrollbar { display: none; }
.routes a { padding: 3px 10px; border-radius: 999px; font-family: var(--display); font-weight: 800; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--slate); white-space: nowrap; }
.routes a[data-on="1"] { color: var(--lamp); background: var(--hull); }
.berthmark { display: flex; align-items: center; gap: 8px; flex: none; }
.berthmark img { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--rig); }
.berthmark span { display: none; font-family: var(--display); font-weight: 800; font-size: 18px; letter-spacing: .06em; text-transform: uppercase; }
.trade { flex: 1 1 0; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--rig); background: var(--hull); font-size: 12px; white-space: nowrap; overflow: hidden; }
.trade em { font-style: normal; font-weight: 800; color: var(--lamp); }
.trade b { font-weight: 500; color: var(--slate); overflow: hidden; text-overflow: ellipsis; }
.trade[data-live="1"] { background: var(--lamp); border-color: var(--lamp); }
.trade[data-live="1"] em, .trade[data-live="1"] b { color: #0B1A17; font-weight: 800; }
.helm { flex: none; height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--lamp2); background: transparent; font-size: 13px; font-weight: 700; color: var(--lamp); white-space: nowrap; }
.helm[data-on="1"] { border-color: var(--rig); color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- hatch (modal) + hail (toast) ---------- */
#hatch { position: fixed; inset: 0; z-index: 60; background: rgba(8,10,30,.7); display: flex; align-items: flex-end; justify-content: center; padding: 12px; }
.hatchcard { width: 100%; max-width: 440px; border-radius: 18px; background: var(--hull); border: 1px solid var(--rig); box-shadow: 0 20px 60px rgba(0,0,0,.5); overflow: hidden; }
.hatchhead { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--rig); font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: .04em; text-transform: uppercase; }
.hatchshut { border: 0; background: transparent; font-size: 22px; line-height: 1; color: var(--slate); }
.hatchbody { padding: 14px 16px 16px; display: grid; gap: 12px; font-size: 14px; color: var(--slate); }
.hatchbody b { color: var(--ink); font-variant-numeric: tabular-nums; }
.hatchbody b.lamp { color: var(--lamp); }
.hatchbody b.wake { color: var(--wake); }
.confirmbtn { height: 46px; border-radius: 12px; border: 0; background: var(--wake); color: #1A0B06; font-family: var(--display); font-weight: 900; font-size: 20px; letter-spacing: .04em; text-transform: uppercase; }
.confirmbtn:disabled { opacity: .5; cursor: default; }
.walletpick { display: grid; gap: 8px; }
.walletpick button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--rig); background: var(--sea); text-align: left; }
.walletpick img { width: 24px; height: 24px; border-radius: 6px; }
.hail { position: fixed; left: 50%; bottom: calc(var(--quay) + 40px); transform: translateX(-50%); z-index: 70; padding: 10px 16px; border-radius: 12px; background: var(--quaybg); border: 1px solid var(--lamp2); color: var(--ink); font-size: 13px; max-width: calc(100vw - 32px); box-shadow: 0 10px 30px rgba(0,0,0,.5); }

/* ---------- wider ---------- */
@media (min-width: 720px) {
  .tallies { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tally.aboard { grid-column: auto; }
  #deck { max-width: 820px; padding: 22px 24px calc(var(--quay) + 44px); gap: 20px; }
  .banner, .masthead { height: 150px; min-height: 150px; }
  .mastcopy h1 { font-size: 60px; }
  .mastline { font-size: 15px; }
  .voyage { font-size: 42px; }
  .tallyfig { font-size: 30px; }
  .berthmark span { display: inline; }
  .routes { flex: 0 0 auto; order: 0; }
  .trade { flex: 0 1 auto; padding: 0 16px; margin-left: auto; }
  .stats .tallyfig { font-size: 24px; }
}
@media (min-width: 1000px) {
  /* the board recomposes: the crossing in a primary column, the side column beside it, the keel spanning */
  #deck { max-width: 1180px; grid-template-columns: minmax(0, 1fr) 360px; grid-template-areas: "mast mast" "board side" "keel keel"; align-items: start; gap: 22px; padding: 26px 28px calc(var(--quay) + 48px); }
  .masthead { grid-area: mast; }
  .board { grid-area: board; }
  .side { grid-area: side; position: sticky; top: 18px; }
  .keel { grid-area: keel; }
  .banner, .masthead { height: 190px; min-height: 190px; }
  .mastcopy h1 { font-size: 76px; }
  .voyage { font-size: 52px; }
  .tallyfig { font-size: 36px; }
  .mrow { font-size: 14px; padding: 11px 0; grid-template-columns: 34px minmax(0, 1fr) auto auto; }
  .mrank { font-size: 22px; }
  .stakefield { font-size: 22px; height: 54px; }
  .boardbtn { height: 54px; font-size: 24px; padding: 0 28px; }
  #hatch { align-items: center; }
}
