:root {
  --ink: #07111f;
  --indigo: #0a1638;
  --panel: rgba(12, 36, 72, .82);
  --line: rgba(46, 196, 182, .38);
  --foam: #e7fbff;
  --muted: #8eb4c9;
  --tide: #2ec4b6;
  --deep: #123a63;
  --coral: #ff6f61;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--indigo); color: var(--foam); overflow: hidden; }
body {
  background:
    radial-gradient(80% 40% at 50% -10%, #1a4d7a 0%, transparent 60%),
    radial-gradient(50% 30% at 100% 100%, #12324f 0%, transparent 55%),
    linear-gradient(180deg, #0a1638, #07111f);
}
#tide { height: 100%; max-width: 480px; margin: 0 auto; position: relative; }
.pane {
  position: absolute; inset: 0 0 calc(68px + var(--safe-b)) 0;
  padding: calc(12px + var(--safe-t)) 14px 16px;
  display: flex; flex-direction: column; gap: 10px; overflow: auto;
}
.hidden { display: none !important; }
.mast { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mast h2, .brand { margin: 0; font-size: 1.05rem; }
.brand { color: var(--tide); font-weight: 800; letter-spacing: .04em; }
.daychip, .mini { }
.daychip {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); font-size: .8rem; font-weight: 700;
}
.mini { width: 28px; height: 28px; object-fit: contain; }
.hero { text-align: center; }
.logo { width: 96px; height: 96px; object-fit: contain; filter: drop-shadow(0 8px 18px rgba(46,196,182,.35)); }
.hero h1 { margin: 4px 0; font-size: 1.6rem; font-weight: 750; }
.lede, .warn { margin: 0; color: var(--muted); font-size: .86rem; }
.warn { min-height: 1.1em; color: var(--coral); }
.chart-card, .sheet, .compare, .strip, .tog {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 12px;
}
canvas { width: 100%; height: auto; display: block; border-radius: 12px; }
.axis { display: flex; justify-content: space-between; color: var(--muted); font-size: .68rem; margin-top: 4px; }
.kpi { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kpi div {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 10px; text-align: center;
}
.kpi strong { display: block; color: var(--tide); font-size: 1.15rem; }
.kpi span { font-size: .7rem; color: var(--muted); }
.sheet { display: flex; flex-direction: column; gap: 8px; }
.sheet label { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 700; }
.sheet input[type="time"], .sheet input[type="text"] {
  background: #071428; color: var(--foam); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 10px; font: inherit; width: 58%;
}
.kinds, .levels { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.kinds button, .levels button {
  border: 1px solid var(--line); background: transparent; color: var(--foam);
  border-radius: 12px; padding: 6px 8px; font: inherit; font-weight: 800; font-size: .75rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
}
.kinds button img { width: 16px; height: 16px; object-fit: contain; }
.kinds button.on, .levels button.on { background: var(--tide); color: #042028; border-color: var(--tide); }
.kinds button.on.rip, .rip-on { background: var(--coral); color: #2a0c0c; border-color: var(--coral); }
.btn {
  border: 0; border-radius: 16px; padding: 12px 14px; font: inherit; font-weight: 800; cursor: pointer;
}
.btn.tide { background: linear-gradient(135deg, #7ef0e4, var(--tide) 45%, #147a86); color: #042028; }
.btn.ghost { background: transparent; color: var(--foam); border: 1px solid var(--line); }
.btn.danger { color: var(--coral); border-color: rgba(255,111,97,.5); }
.list { display: flex; flex-direction: column; gap: 8px; }
.mark {
  display: grid; grid-template-columns: 36px 1fr auto; gap: 8px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 10px;
}
.mark img { width: 32px; height: 32px; object-fit: contain; }
.mark strong { display: block; }
.mark span { color: var(--muted); font-size: .75rem; }
.mark button { background: none; border: 0; color: var(--coral); font-weight: 800; cursor: pointer; }
.strip { display: grid; grid-template-columns: 52px 1fr; gap: 8px; align-items: center; margin-bottom: 8px; }
.strip canvas { height: 46px; }
.strip b { font-size: .75rem; }
.tog { display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
.dock {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(480px, 100%); display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 8px 4px calc(8px + var(--safe-b)); background: rgba(7, 17, 31, .94);
  border-top: 1px solid var(--line); z-index: 8;
}
.dock button {
  background: none; border: 0; color: var(--muted); font-size: .58rem; font-weight: 700; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-family: inherit;
}
.dock button img { width: 20px; height: 20px; object-fit: contain; }
.dock button.on { color: var(--tide); }
