.sea { display: grid; grid-template-columns: minmax(0, 1fr) 430px; height: calc(100dvh - 57px); }
#map { height: 100%; min-height: 300px; z-index: 0; }
.panel { overflow-y: auto; padding: 12px 16px 40px; border-left: 1px solid var(--line); background: var(--bg); }
/* phones: the map stays at the top, the panel is an opaque sheet below/over it — never content under the map */
@media (max-width: 820px) {
  .sea { display: block; height: auto; }
  #map { position: sticky; top: var(--header-h, 57px); height: 42vh; min-height: 230px; z-index: 0; }
  .panel { position: relative; z-index: 1; border-left: 0; border-radius: 16px 16px 0 0; margin-top: -14px; padding-top: 20px;
    box-shadow: 0 -6px 18px #0004; min-height: 60vh; overflow: visible; }
  .panel::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: -6px auto 14px; }
}
.panel h1 { font-size: 20px; margin: 4px 0; } .row { display: flex; gap: 8px; align-items: center; } .grow { flex: 1; min-width: 0; }
.panel input { height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; font: inherit; background: var(--surface); color: var(--text); width: 100%; box-sizing: border-box; }
.btn { height: 40px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 0 12px; cursor: pointer; font: inherit; text-decoration: none; display: inline-grid; place-items: center; white-space: nowrap; }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 700; }
.f { display: block; font-size: 13px; color: var(--muted); margin-top: 8px; } .f input { margin-top: 4px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 10px; }
.sw { position: relative; } .sugg { position: absolute; left: 0; right: 48px; top: 64px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; z-index: 1000; box-shadow: 0 6px 20px #0003; }
.sugg div { padding: 9px 12px; cursor: pointer; } .sugg div:hover { background: var(--accent-soft); }
.muted { color: var(--muted); } .small { font-size: 13px; } .err { color: #c0392b; } .warn { color: var(--warn); margin-top: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 12px; }
.sum { font-size: 22px; font-weight: 800; } table.legs { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 6px; }
table.legs td, table.legs th { padding: 5px 4px; border-top: 1px solid var(--line); text-align: left; } table.legs th { color: var(--muted); font-weight: 600; }
.opt { padding: 8px 0; border-top: 1px solid var(--line); cursor: pointer; } .opt:hover, .opt.sel { background: var(--accent-soft); }
.opt b { font-size: 16px; } .tag { font-size: 12px; background: var(--surface-2); border-radius: 99px; padding: 2px 8px; margin-left: 4px; }
.warrow { display: inline-block; font-weight: 700; }
.windrow { display: flex; gap: 4px; overflow-x: auto; margin-top: 8px; } .windrow div { flex: none; text-align: center; font-size: 12px; background: var(--surface-2); border-radius: 8px; padding: 4px 6px; min-width: 42px; }
.panel select { height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; font: inherit; background: var(--surface); color: var(--text); width: 100%; margin-top: 4px; }
.f.chk { display: flex; align-items: center; gap: 6px; padding-top: 22px; color: var(--text); } .f.chk input { width: auto; height: auto; margin: 0; }
.rchips { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.rchip { display: flex; gap: 8px; align-items: center; text-align: left; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); padding: 8px 10px; cursor: pointer; font: inherit; }
.rchip.sel { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; } .rchip .x { font-weight: 400; color: var(--muted); font-size: 13px; }
.dot { width: 12px; height: 12px; border-radius: 99px; flex: none; display: inline-block; }
.showing { margin-top: 12px; font-weight: 700; } .rough { color: #c0392b; }
.legend { background: var(--surface); color: var(--text); border-radius: 8px; padding: 6px 9px; box-shadow: 0 2px 10px #0003; font-size: 13px; line-height: 1.6; }
.legend div { cursor: pointer; display: flex; gap: 6px; align-items: center; } .legend .sel { font-weight: 800; }
#pacebox { gap: 12px; flex-wrap: wrap; margin-top: 6px; } #pacebox label { display: flex; gap: 5px; align-items: center; cursor: pointer; }
#pacebox input { width: auto; height: auto; margin: 0; }
.legend:empty { display: none; }
.sw.dest input { height: 48px; font-size: 17px; border-width: 2px; } .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.fromline { display: flex; align-items: center; gap: 8px; margin: 6px 2px 2px; } .linkbtn { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }
#opts { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: var(--surface); }
#opts summary { cursor: pointer; font-weight: 600; } .btn.big { width: 100%; height: 46px; margin-top: 10px; font-size: 16px; }
.hb-icon { font-size: 18px; line-height: 26px; text-align: center; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px #0006; }
.hb-pop b { font-size: 15px; } .hb-pop .fac { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; } .hb-pop .fac span { background: #eef2f7; color: #1f2937; border-radius: 99px; padding: 1px 7px; font-size: 12px; }
.hb-pop .acts { display: flex; gap: 6px; margin-top: 8px; } .hb-pop .acts button { flex: 1; height: 32px; border-radius: 7px; border: 1px solid #cbd5e1; background: #fff; cursor: pointer; font: inherit; font-size: 13px; }
.hb-pop .acts button.go { background: #14532d; color: #fff; border-color: #14532d; }
.wind-btn { background: #fff; color: #111; border-radius: 8px; padding: 6px 10px; box-shadow: 0 2px 10px #0003; cursor: pointer; font-size: 14px; border: 0; }
.wind-btn.on { background: #1d4ed8; color: #fff; }
.wind-bar { background: var(--surface); color: var(--text); border-radius: 10px; padding: 6px 10px; box-shadow: 0 2px 12px #0004; display: flex; gap: 8px; align-items: center; font-size: 13px; min-width: 260px; }
.wind-bar input { flex: 1; height: auto; padding: 0; border: 0; } .wind-arrow { position: relative; width: 18px; height: 18px; } .wind-arrow svg { display: block; filter: drop-shadow(0 0 1px #0005); }
.wind-arrow span { position: absolute; left: 50%; top: 100%; transform: translate(-50%, -1px); font: 700 10px/1 system-ui, sans-serif; color: #1f2937; text-shadow: 0 0 2px #fff, 0 0 2px #fff, 0 0 1px #fff; }
.wind-bar select { height: 28px; width: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; font-size: 12px; padding: 0 4px; }
.hb-icon { position: relative; } .hb-user { position: absolute; right: -2px; top: -2px; width: 9px; height: 9px; border-radius: 50%; background: #16a34a; border: 2px solid #fff; }
.hb-pop .tips { margin-top: 8px; border-top: 1px solid #e2e8f0; padding-top: 6px; max-height: 180px; overflow-y: auto; }
.hb-pop .tip { padding: 4px 0; border-bottom: 1px dashed #e2e8f0; font-size: 13px; } .hb-pop small { opacity: .7; }
.hb-pop textarea, .hb-pop input:not([type=checkbox]), .hb-pop select { width: 100%; box-sizing: border-box; border: 1px solid #cbd5e1; border-radius: 6px; padding: 5px 7px; font: inherit; font-size: 13px; margin-top: 4px; }
.hb-pop .small input, .hb-pop .small select { width: auto; display: inline-block; }
.dchip { display: inline-flex; align-items: center; gap: 3px; border: 1px solid #cbd5e1; border-radius: 99px; padding: 1px 7px; margin: 2px 2px 0 0; font-size: 12px; cursor: pointer; background: #fff; color: #111; }
.dchip input { margin: 0; width: auto !important; }
.pf { display: flex; flex-direction: column; gap: 6px; } .pf-panel { background: var(--surface); color: var(--text); border-radius: 10px; padding: 8px; box-shadow: 0 2px 12px #0004; max-width: 300px; max-height: 50vh; overflow-y: auto; }
.pf-panel input[type=search] { width: 100%; box-sizing: border-box; height: 34px; border: 1px solid var(--line); border-radius: 7px; padding: 0 8px; font: inherit; background: var(--surface); color: var(--text); }
.pf-row { margin-top: 6px; } .wind-btn.on { background: #1d4ed8; color: #fff; }
.gm-item { display: none !important; } #map.gm-open .gm-item { display: flex !important; } #map.gm-open button.gm-item { display: block !important; }
.gear-btn { width: 34px; height: 34px; padding: 0; font-size: 17px; border-radius: 4px; border: 2px solid rgba(0,0,0,.2); background-clip: padding-box; }

/* friends' live positions */
.friend-pos { position: relative; width: 30px; height: 30px; border-radius: 50%; background: #f59e0b; color: #1c1917; border: 2px solid #fff;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 4px #0006; font-size: 14px; }
.friend-pos .fp-arrow { position: absolute; top: -12px; left: 0; right: 0; text-align: center; font-size: 11px; color: #f59e0b; transform-origin: 50% 27px; }

.ais-ship { filter: drop-shadow(0 1px 2px #0007); }
.ais-ship.danger { filter: drop-shadow(0 0 6px #ef4444) drop-shadow(0 0 2px #fff); }

/* new place: the pin on the map and the form in the panel */
.newpin { font-size: 34px; line-height: 34px; text-align: center; filter: drop-shadow(0 2px 3px #0009); position: relative; }
.newpin span { position: absolute; left: 50%; bottom: -3px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: #ef444488; border: 2px solid #ef4444; animation: newpin 1.6s ease-out infinite; z-index: -1; }
@keyframes newpin { from { transform: scale(.6); opacity: 1; } to { transform: scale(2.6); opacity: 0; } }
#addcard .addpos { margin: 8px 0; padding: 8px 10px; border-radius: 8px; background: #7f1d1d33; border: 1px solid #ef444466; }
#addcard .f { display: block; margin-top: 8px; }
#addcard .f > input, #addcard .f > select, #addcard textarea { width: 100%; box-sizing: border-box; margin-top: 3px; }
#addcard .dchip { margin: 3px 4px 0 0; padding: 4px 9px; font-size: 13px; }
#addcard button.big { width: 100%; margin-top: 12px; }

.shallow { background: #fde4e1; border: 1px solid #f3b8b0; border-radius: 10px; padding: 8px 10px; margin: 8px 0; font-size: 14px; } .shallow ul { margin: 4px 0 6px; padding-left: 18px; }
.okdepth { margin: 6px 0; }
@media (prefers-color-scheme: dark) { .shallow { background: #3d1c18; border-color: #74342c; } }
.shallow.unk { background: #fdecd2; border-color: #f0c98a; } @media (prefers-color-scheme: dark) { .shallow.unk { background: #3a2c14; border-color: #6b5324; } }

.legsbox { margin-top: 6px; } .legsbox > summary { cursor: pointer; color: var(--muted); font-size: 13.5px; }
.map-credits { max-width: 760px; margin: 10px auto 0; padding: 0 16px; color: var(--muted); font-size: 12px; } .map-credits a { color: inherit; }

/* Från is the main start (big, like the destination); Via is optional (small) */
.fromline { font-size: 18px; margin: 8px 2px 4px; } .fromline b { font-size: 20px; } .fromline .linkbtn { font-size: 14px; }
#from-box input { height: 48px; font-size: 17px; }
.sw.via input { height: 36px; font-size: 14px; } .sw.via .btn { height: 36px; padding: 0 10px; } .sw.via .sugg { top: 44px; }

/* "Till" / "Från" / "Via" in front of the inputs */
.sw .lbl { flex: none; width: 42px; font-weight: 600; color: var(--muted); font-size: 14px; }
.sw.dest .lbl { font-size: 17px; color: var(--text); width: 36px; } #from-box .lbl { font-size: 17px; color: var(--text); width: 46px; }
.sw .sugg { left: 42px; } .sw.dest .sugg { left: 36px; } #from-box .sugg { left: 46px; }
.dn { font: 700 11px/1 system-ui, sans-serif; color: #0b3a6b; text-shadow: 0 0 2px #fff, 0 0 2px #fff, 0 0 3px #fff; white-space: nowrap; text-align: center; }
.dn.shallow { color: #b91c1c; } .dn.mid { color: #b45309; }

/* full-screen map while planning (the ⛶ button on the map) */
body.mapfull { overflow: hidden; } body.mapfull .site-header { display: none; }
body.mapfull #map { position: fixed !important; inset: 0 !important; width: 100vw !important; height: 100dvh !important; min-height: 0 !important; z-index: 1000 !important; }
