:root {
  --navy: #0b2545;
  --deep: #13315c;
  --ice: #8ecae6;
  --frost: #e8f1f8;
  --gold: #f4c430;     /* Gull beer gold */
  --amber: #e8a317;
  --rock: #3a3f4b;
  --good: #2a9d8f;
  --bad: #e76f51;
  --card: #ffffff;
  --text: #1b2430;
  --muted: #6b7785;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--frost);
  -webkit-text-size-adjust: 100%;
}

/* ---------------- Hero / scenery ---------------- */
.hero { position: relative; overflow: hidden; color: #fff; }
.scenery { position: relative; height: 200px; background: linear-gradient(180deg, #07112a 0%, #0b2545 45%, #13315c 100%); }
.aurora {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 80% at 20% 0%, rgba(46,204,113,0.35), transparent 55%),
    radial-gradient(120% 80% at 80% 10%, rgba(142,202,230,0.35), transparent 55%),
    radial-gradient(140% 90% at 50% -10%, rgba(155,89,182,0.30), transparent 60%);
  filter: blur(6px);
  animation: drift 12s ease-in-out infinite alternate;
}
@keyframes drift { from { transform: translateX(-4%); } to { transform: translateX(4%); } }
.mountains {
  position: absolute; bottom: 38px; left: -5%; right: -5%; height: 110px;
  background:
    linear-gradient(135deg, transparent 49%, #14233f 50%) repeat-x,
    linear-gradient(225deg, transparent 49%, #14233f 50%) repeat-x;
  background-size: 160px 110px, 160px 110px;
  background-position: 0 0, 80px 0;
  clip-path: polygon(0 100%, 8% 30%, 16% 70%, 26% 18%, 38% 72%, 50% 22%, 62% 68%, 74% 14%, 86% 66%, 96% 34%, 100% 100%);
  opacity: 0.92;
}
.mountains::after {
  content: ""; position: absolute; inset: 0;
  clip-path: polygon(0 100%, 8% 30%, 16% 70%, 26% 18%, 38% 72%, 50% 22%, 62% 68%, 74% 14%, 86% 66%, 96% 34%, 100% 100%);
  background: linear-gradient(180deg, #fff 0%, transparent 30%); opacity: 0.5;
}
.sea {
  position: absolute; bottom: 0; left: 0; right: 0; height: 42px;
  background: linear-gradient(180deg, #1d5b8a, #0f3a5c);
}

/* Seagulls */
.gull { position: absolute; width: 46px; color: #f4f8fb; opacity: 0.95; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.25)); }
.gull.foot { position: static; width: 26px; color: var(--navy); vertical-align: middle; opacity: 0.7; }
.g1 { top: 26px; left: -60px; animation: fly1 14s linear infinite; }
.g2 { top: 60px; left: -60px; width: 34px; animation: fly1 18s linear infinite 3s; }
.g3 { top: 18px; left: -60px; width: 28px; animation: fly1 22s linear infinite 6s; }
.g4 { top: 80px; left: -60px; width: 40px; animation: fly1 16s linear infinite 9s; }
.g5 { top: 44px; left: -60px; width: 22px; animation: fly1 20s linear infinite 12s; }
@keyframes fly1 {
  0%   { transform: translateX(0) translateY(0); }
  50%  { transform: translateX(55vw) translateY(-10px); }
  100% { transform: translateX(115vw) translateY(6px); }
}

.hero-text { padding: 14px 18px 18px; background: var(--navy); }
.hero-text h1 { margin: 0; font-size: 1.7rem; letter-spacing: 0.5px; }
.tagline { margin: 4px 0 10px; color: var(--ice); font-size: 0.95rem; }

/* Gull beer badge */
.beer-badge { display: flex; align-items: center; gap: 10px; }
.can { position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 64px; border-radius: 8px;
  background: linear-gradient(180deg, var(--gold), var(--amber));
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.4), 0 3px 6px rgba(0,0,0,0.4); }
.can-top { position: absolute; top: -5px; width: 34px; height: 8px; border-radius: 6px;
  background: linear-gradient(180deg, #d9dde2, #aab2bb); }
.can-label { display: flex; flex-direction: column; align-items: center; line-height: 1; transform: rotate(0deg); }
.can-label b { color: #5a3b00; font-size: 0.78rem; letter-spacing: 1px; }
.can-label i { color: #6b4a00; font-size: 0.42rem; font-style: normal; letter-spacing: 0.5px; margin-top: 2px; }
.cheers { font-weight: 600; color: var(--gold); }

/* ---------------- Rate strip ---------------- */
.rate-strip { display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--deep); color: var(--frost); font-size: 0.85rem; padding: 7px 10px; }
.link-btn { background: none; border: none; color: var(--gold); cursor: pointer; font: inherit; text-decoration: underline; }

/* ---------------- Tabs ---------------- */
.tabs { display: flex; position: sticky; top: 0; z-index: 5;
  background: var(--card); box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
.tab { flex: 1; padding: 12px 4px; border: none; background: none; font-size: 0.9rem; cursor: pointer;
  color: var(--muted); border-bottom: 3px solid transparent; }
.tab.active { color: var(--navy); border-bottom-color: var(--gold); font-weight: 700; }

main { max-width: 720px; margin: 0 auto; padding: 16px; position: relative; z-index: 1; }
.panel { display: none; }
.panel.active { display: block; }
h2 { color: var(--navy); margin: 6px 0 14px; display: flex; align-items: center; justify-content: center; gap: 10px; }

/* gull decorations */
.gull-deco { width: 22px; height: 14px; color: var(--ice); opacity: 0.85; flex: none; }
h2 .gull-deco { color: var(--deep); }
.gull-deco.tiny { width: 18px; opacity: 0.55; color: var(--ice); margin-top: 2px; }
.gull-divider { display: flex; gap: 16px; justify-content: center; align-items: center; margin: 14px 0 4px; }
.gull-divider .gull-deco { color: #9fb6c9; width: 26px; }

/* background drifting gulls */
.bg-gulls { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.gull.bg { position: absolute; color: #c2d4e2; opacity: 0.22; }
.b1 { top: 30%; left: -8%; width: 70px; animation: glide 38s linear infinite; }
.b2 { top: 52%; left: -8%; width: 44px; animation: glide 50s linear infinite 6s; }
.b3 { top: 68%; left: -8%; width: 90px; animation: glide 60s linear infinite 12s; }
.b4 { top: 18%; left: -8%; width: 36px; animation: glide 44s linear infinite 20s; }
.b5 { top: 80%; left: -8%; width: 56px; animation: glide 54s linear infinite 3s; }
.b6 { top: 42%; left: -8%; width: 30px; animation: glide 64s linear infinite 28s; }
@keyframes glide {
  0%   { transform: translateX(0) translateY(0) rotate(-2deg); }
  50%  { transform: translateX(60vw) translateY(-16px) rotate(2deg); }
  100% { transform: translateX(125vw) translateY(8px) rotate(-2deg); }
}

/* ---------------- Forms / cards ---------------- */
.card { background: var(--card); border-radius: 14px; padding: 16px; box-shadow: 0 4px 14px rgba(11,37,69,0.08); }
label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 12px; font-weight: 600; }
input, select { width: 100%; padding: 12px; margin-top: 5px; border: 1px solid #cdd6df; border-radius: 10px;
  font-size: 1rem; background: #fff; color: var(--text); }
input:focus, select:focus { outline: 2px solid var(--ice); border-color: var(--ice); }
.row { display: flex; gap: 12px; }
.amount-field { flex: 2; } .cur-field { flex: 1; }
.hint { color: var(--muted); font-size: 0.8rem; margin: 2px 0 12px; }
.formmsg { font-size: 0.9rem; margin: 8px 0 0; min-height: 1.1em; }
.formmsg.ok { color: var(--good); } .formmsg.err { color: var(--bad); }

.splitters { border: 1px solid #e1e8ef; border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; }
.splitters legend { color: var(--navy); font-weight: 700; font-size: 0.85rem; padding: 0 6px; }
.check { display: flex; align-items: center; gap: 10px; margin: 0; font-weight: 600; color: var(--text); }
.check input { width: auto; margin: 0; }

/* split mode toggle */
.split-mode { display: inline-flex; background: var(--frost); border-radius: 10px; padding: 3px; margin-bottom: 10px; }
.seg { border: none; background: none; padding: 7px 16px; border-radius: 8px; font-size: 0.85rem; font-weight: 700;
  color: var(--muted); cursor: pointer; }
.seg.active { background: var(--navy); color: #fff; box-shadow: 0 2px 6px rgba(11,37,69,0.25); }

/* participant rows */
.prow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed #e6ecf2; }
.prow:last-child { border-bottom: none; }
.pshare { display: none; align-items: center; gap: 6px; }
.splitters.custom .pshare { display: flex; }
.pshare .cursym { color: var(--muted); font-size: 0.85rem; font-weight: 700; }
.pshare .pamt { width: 110px; margin: 0; padding: 8px 10px; }
/* in percentage mode the % reads better after the number */
.splitters.pct .pshare .cursym { order: 2; }

.split-hint { font-size: 0.82rem; margin: 8px 2px 0; color: var(--muted); font-weight: 600; }
.split-hint.good { color: var(--good); }
.split-hint.bad { color: var(--bad); }

button.primary { width: 100%; padding: 14px; border: none; border-radius: 12px; cursor: pointer;
  background: linear-gradient(180deg, var(--gold), var(--amber)); color: #3a2700; font-size: 1.05rem; font-weight: 800;
  box-shadow: 0 4px 10px rgba(232,163,23,0.4); }
button.primary:active { transform: translateY(1px); }

/* ---------------- Balances ---------------- */
.bal-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #eef2f6; }
.bal-row:last-child { border-bottom: none; }
.bal-name { font-weight: 700; color: var(--navy); }
.bal-sub { font-size: 0.78rem; color: var(--muted); }
.pos { color: var(--good); font-weight: 800; }
.neg { color: var(--bad); font-weight: 800; }
.settle { margin-top: 16px; }
.settle h3 { color: var(--navy); margin: 0 0 8px; }
.settle-item { background: var(--frost); border-left: 4px solid var(--gold); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 8px; font-weight: 600; }
.settle-item b { color: var(--navy); }
.total-line { margin-top: 14px; text-align: center; color: var(--muted); font-size: 0.85rem; }

/* ---------------- History ---------------- */
.exp { background: var(--card); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(11,37,69,0.07); display: flex; gap: 12px; align-items: flex-start; }
.exp-main { flex: 1; }
.exp-title { font-weight: 700; color: var(--navy); }
.exp-meta { font-size: 0.78rem; color: var(--muted); margin-top: 3px; }
.exp-amt { text-align: right; white-space: nowrap; }
.exp-gbp { font-weight: 800; color: var(--navy); }
.exp-orig { font-size: 0.75rem; color: var(--muted); }
.tag { display: inline-block; background: var(--frost); color: var(--deep); border-radius: 20px;
  padding: 1px 9px; font-size: 0.72rem; margin-right: 4px; }
.tag.rental { background: #fff3d6; color: #8a5a00; }
.exp-actions { display: flex; gap: 2px; justify-content: flex-end; margin-top: 2px; }
.edit { background: none; border: none; color: var(--deep); cursor: pointer; font-size: 1.05rem; padding: 2px 6px; }
.del { background: none; border: none; color: var(--bad); cursor: pointer; font-size: 1.1rem; padding: 2px 6px; }

/* edit-in-progress banner on the Add form */
.edit-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #fff3d6; border: 1px solid #f0d28a; color: #8a5a00; border-radius: 10px;
  padding: 9px 12px; margin-bottom: 14px; font-size: 0.85rem; font-weight: 600; }
.link-btn.dark { color: #8a5a00; }

footer { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 22px 16px 34px; }

@media (min-width: 560px) {
  .hero-text h1 { font-size: 2rem; }
}
