  :root { --bg:#0a0c10; --panel:#12151d; --panel2:#181d28; --line:#242b3a;
    --ink:#e8ebf1; --mut:#8b93a3; --past:#f0b35e; --future:#6fd3e7; --present:#8be09a; }
  html { -webkit-text-size-adjust:100%; }
  * { box-sizing:border-box; }
  body { background:var(--bg); background-image:linear-gradient(180deg,#0e1624 0,var(--bg) 260px);
    color:var(--ink); font:15px/1.55 system-ui, sans-serif; margin:0; }
  main { max-width:720px; margin:0 auto; padding:0 16px calc(56px + env(safe-area-inset-bottom)); }
  .top { position:sticky; top:0; z-index:5; margin:0 -16px; padding:14px 16px 12px;
    background:rgba(10,12,16,.85); backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px);
    border-bottom:1px solid var(--line); }
  h1 { font-size:21px; font-weight:650; margin:0; letter-spacing:.01em; }
  .flow { color:var(--mut); font-family:ui-monospace, Menlo, monospace; font-size:11px;
    letter-spacing:.16em; text-transform:uppercase; margin-top:3px; }
  .flow .fp { color:var(--past); } .flow .ff { color:var(--future); }
  h2 { font-size:12px; font-weight:600; letter-spacing:.14em; text-transform:uppercase;
    color:var(--mut); margin:28px 0 10px; }
  .sub { color:var(--mut); }
  .panel { background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:16px; }
  label.k { display:block; margin:0 0 2px; }
  .k { color:var(--mut); font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:.1em; }
  input, textarea, select { width:100%; background:var(--panel2); color:var(--ink);
    border:1px solid var(--line); border-radius:10px; padding:11px 12px;
    margin:4px 0 14px; font:inherit; font-size:16px; }
  textarea { resize:vertical; }
  input { max-width:100%; }
  .dtline { display:flex; gap:10px; }
  .dtfield { flex:1 1 0; min-width:0; }
  .dtfield .k { display:block; margin-bottom:2px; }
  .dtbox { background:var(--panel2); border:1px solid var(--line); border-radius:10px;
    height:49px; display:flex; align-items:center; padding:0 12px; overflow:hidden; margin-bottom:14px; }
  .dtbox:focus-within { outline:2px solid rgba(111,211,231,.45); }
  .dtbox input { background:transparent; border:none; border-radius:0; padding:0; margin:0; width:100%; font-size:16px; }
  input[type=date]::-webkit-date-and-time-value, input[type=time]::-webkit-date-and-time-value { min-width:0; margin:0; text-align:left; }
  input:focus, textarea:focus, select:focus { outline:2px solid rgba(111,211,231,.45); border-color:transparent; }
  input[type=range] { padding:0; border:none; background:transparent; accent-color:var(--future); height:32px; margin:0; }
  .conf { display:flex; align-items:center; gap:14px; margin:2px 0 10px; }
  .conf input[type=range] { flex:1; }
  .confnum { display:flex; align-items:baseline; gap:1px; }
  .confnum input { width:58px; text-align:right; font:600 26px ui-monospace, Menlo, monospace;
    background:transparent; border:none; padding:0; margin:0; }
  .confnum span { font:600 18px ui-monospace, Menlo, monospace; color:var(--mut); }
  button { background:var(--panel2); color:var(--ink); border:1px solid var(--line);
    border-radius:10px; padding:10px 16px; min-height:48px; cursor:pointer; font:inherit;
    -webkit-tap-highlight-color:transparent; }
  button:active { transform:translateY(1px); }
  button.primary { background:var(--future); border-color:transparent; color:#07242c; font-weight:650; }
  #enter, #create { width:100%; }
  .msg { color:var(--mut); display:inline-block; margin-top:8px; }
  .row { display:flex; gap:12px; } .row > div { flex:1; min-width:0; }
  #gate { max-width:400px; margin:0 auto; padding:0 16px; min-height:100dvh; min-height:100svh;
    display:flex; flex-direction:column; justify-content:center; }
  #gate-msg { margin:10px 0 0; } #gate-msg:empty { margin:0; }
  .gatecard { background:var(--panel); border:1px solid var(--line); border-radius:16px; padding:26px 20px 20px; }
  .gatecard h1, .gatecard .flow { text-align:center; }
  .rule { height:2px; border-radius:2px; margin:16px 0 6px;
    background:linear-gradient(90deg, var(--past), rgba(255,255,255,.07) 50%, var(--future)); }
  .gatecard .sub { text-align:center; margin:8px 0 18px; }
  .gatefoot { text-align:center; color:#565e6c; font-size:12px; margin-top:16px; }
  .card { background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:16px; margin:14px 0; }
  .pill { display:inline-block; padding:3px 10px; border-radius:999px; font-size:11px; font-weight:600;
    letter-spacing:.1em; text-transform:uppercase; border:1px solid var(--line); color:var(--mut); }
  .st-COMMITTED { color:var(--past); border-color:rgba(240,179,94,.5); }
  .st-EVENT_WINDOW_OPEN { color:var(--future); border-color:rgba(111,211,231,.5); }
  .st-OUTCOME_REPORTED { color:#c4a6f0; border-color:rgba(196,166,240,.5); }
  .st-FUTURE_SELF_RESPONSE { color:var(--future); border-color:rgba(111,211,231,.5); }
  .st-CONVERGED { color:var(--present); border-color:rgba(139,224,154,.5); }
  .meta { color:var(--mut); font-family:ui-monospace, Menlo, monospace; font-size:12px; margin-top:8px; }
  .voice { border-left:3px solid var(--line); padding:1px 0 1px 12px; margin:14px 0; }
  .voice .vtext { white-space:pre-wrap; margin-top:2px; }
  .v-past { border-left-color:rgba(240,179,94,.55); } .v-past .k { color:var(--past); }
  .v-future { border-left-color:rgba(111,211,231,.55); } .v-future .k { color:var(--future); }
  .v-present { border-left-color:rgba(139,224,154,.55); } .v-present .k { color:var(--present); }
  .v-out { border-left-color:#3a4358; }
  .seal { color:#6d7482; font-family:ui-monospace, Menlo, monospace; font-size:11px; word-break:break-all; margin-top:10px; }
  @media (max-width:640px) {
    main { padding:0 12px calc(48px + env(safe-area-inset-bottom)); }
    .top { margin:0 -12px; padding:12px; }
    h1 { font-size:19px; }
    .row { flex-direction:column; gap:0; }
    .card { padding:14px 12px; }
    .card button { width:100%; }
    #gate { padding:0 12px; }
  }

/* Two-column layout (desktop) / ledger pane (mobile).
   Desktop: New Intuition and The Ledger sit side by side.
   Mobile: the ledger becomes a slide-over pane opened from the
   button at the top left of the header. */
#ledger-btn, #ledger-close { display:none; }
#scrim { display:none; }
.ledgerhead { display:flex; align-items:flex-start; justify-content:space-between; }
.ledgerhead h2 { margin:28px 0 10px; }
@media (min-width:900px) {
  main { max-width:1340px; height:100vh; height:100dvh; padding-bottom:24px; display:grid; grid-template-columns:560px minmax(0,1fr); grid-template-rows:auto auto auto 1fr; column-gap:28px; }
  .top { grid-column:1 / -1; grid-row:1; }
  main > .sub { grid-column:1 / -1; grid-row:2; }
  .formcol { grid-column:1; grid-row:3 / span 2; align-self:start; }
  body { overflow:hidden; }
  #ledger { grid-column:2; grid-row:3 / span 2; min-width:0; min-height:0; overflow-y:auto; overscroll-behavior:contain; }
  #ledger .ledgerhead { position:sticky; top:0; z-index:2; background:linear-gradient(180deg,#0e1624 0,var(--bg) 260px); padding-top:28px; }
  #ledger .ledgerhead h2 { margin:0 0 10px; }
  #ledger .card:first-child { margin-top:0; }
}
@media (max-width:899px) {
  .top { display:flex; gap:10px; align-items:flex-start; }
  .toptext { min-width:0; }
  #ledger-btn { display:inline-flex; align-items:center; justify-content:center; flex:none; min-height:40px; padding:6px 12px; line-height:1; margin-top:1px; }
  #ledger { position:fixed; top:0; left:0; z-index:20; width:min(88vw,400px); height:100dvh; height:100svh;
    background:var(--bg); border-right:1px solid var(--line);
    padding:14px 14px calc(24px + env(safe-area-inset-bottom)); overflow-y:auto;
    transform:translateX(-105%); transition:transform .22s ease; }
  body.ledger-open #ledger { transform:none; box-shadow:24px 0 48px rgba(0,0,0,.5); }
  body.ledger-open #scrim { display:block; position:fixed; inset:0; z-index:15; background:rgba(4,6,10,.55); }
  .ledgerhead h2 { margin:6px 0 10px; }
  #ledger-close { display:block; flex:none; min-height:40px; padding:6px 12px; font-size:17px; line-height:1; }
}
@media (prefers-reduced-motion:reduce) {
  #ledger { transition:none; }
}
