/* Dojima on the web. Colors come from tokens.css (the iOS app's Primer palette); system fonts only. */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg-default); color: var(--fg-default);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
a { color: var(--fg-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--fg-accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; z-index: 50; background: var(--bg-default); padding: 8px; }
.ico { display: inline-flex; width: 16px; height: 16px; flex: none; }
.ico svg { width: 100%; height: 100%; fill: currentColor; }
.muted { color: var(--fg-muted); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--fg-success); }
.neg { color: var(--fg-danger); }
.loading { color: var(--fg-muted); padding: 32px 0; text-align: center; }

/* ---------- frame */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--bg-default); border-bottom: 1px solid var(--border-muted); }
.topbar-in { max-width: 720px; margin: 0 auto; padding: 0 16px; height: 56px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; color: var(--fg-default); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 24px; height: 24px; display: block; flex: none; }
.brand-mark .l2 { fill: var(--contribution2); } .brand-mark .l3 { fill: var(--contribution3); } .brand-mark .l4 { fill: var(--contribution4); }
.topnav { display: none; gap: 4px; margin-left: auto; }
/* Backing Dojima: on every screen, next to the main navigation. */
.fund-btn { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 12px;
  border: 1px solid var(--border-default); border-radius: 999px; color: var(--fg-default); font-size: 14px; font-weight: 600;
  white-space: nowrap; }
.fund-btn:hover { background: var(--control-bg-rest); text-decoration: none; }
.fund-btn .ico { display: inline-flex; color: var(--fg-danger); }
.fund-btn .ico svg { width: 14px; height: 14px; fill: currentColor; }
.topnav a { color: var(--fg-default); padding: 6px 10px; border-radius: 6px; font-size: 15px; }
.topnav a:hover { background: var(--control-bg-rest); text-decoration: none; }
.topnav a.on { font-weight: 600; box-shadow: inset 0 -2px 0 var(--underline-nav-active); border-radius: 0; }
main { max-width: 720px; margin: 0 auto; padding: 16px 16px 32px; outline: none; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: space-around;
  background: var(--bg-default); border-top: 1px solid var(--border-muted); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--fg-muted); min-width: 56px; padding: 4px; }
.tabbar a .ico { width: 24px; height: 24px; }
.tabbar a.on { color: var(--fg-accent); }
.tabbar a:hover { text-decoration: none; }
@media (min-width: 760px) {
  body { padding-bottom: 0; }
  .topnav { display: flex; }
  .topbar-in .fund-btn { margin-left: 0; }
  .tabbar { display: none; }
  main { padding-top: 24px; }
}

/* ---------- type */
h1 { font-size: 28px; line-height: 1.25; margin: 8px 0 16px; font-weight: 700; }
h2 { font-size: 20px; margin: 28px 0 10px; font-weight: 600; }
h3 { font-size: 16px; margin: 0; font-weight: 600; }
.qtitle { font-size: 18px; font-weight: 600; line-height: 1.35; margin: 0; overflow-wrap: anywhere; }
.caption { font-size: 14px; color: var(--fg-muted); margin: 20px 0 8px; }
.section-label { display: flex; align-items: center; gap: 8px; font-weight: 600; margin: 20px 0 8px; }

/* ---------- boxes */
.box { border: 1px solid var(--border-default); border-radius: 6px; background: var(--bg-default); margin: 0 0 16px; overflow: hidden; }
.box.featured { border-color: var(--fg-accent); }
.box-h { background: var(--bg-muted); border-bottom: 1px solid var(--border-default); padding: 10px 16px;
         display: flex; align-items: center; gap: 8px; min-height: 52px; flex-wrap: wrap; }
.box-b { padding: 16px; }
.box-b + .box-b, .box-row + .box-row { border-top: 1px solid var(--border-default); }
.box-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: var(--fg-default); }
a.box-row:hover { background: var(--bg-muted); text-decoration: none; }
.box-row .grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.empty { padding: 24px 16px; color: var(--fg-muted); text-align: center; }

/* ---------- buttons and controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px;
  border-radius: 6px; border: 1px solid var(--border-default); background: var(--control-bg-rest); color: var(--control-fg);
  font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--control-bg-active); text-decoration: none; }
.btn:disabled { cursor: not-allowed; color: var(--fg-disabled); }
.btn.primary { background: var(--button-primary-bg); border-color: var(--border-translucent); color: #fff; }
.btn.primary:hover { background: var(--button-primary-bg-active); }
.btn.primary:disabled { background: var(--button-primary-bg-disabled); color: var(--button-primary-fg-disabled); }
.btn.danger { color: var(--button-danger-fg); }
.btn.danger:hover { background: var(--button-danger-bg-active); color: var(--button-danger-fg-active); }
.btn.wide { width: 100%; }
.btn.sm { min-height: 32px; padding: 4px 12px; font-size: 14px; }
.btn.link { border: 0; background: none; color: var(--fg-accent); padding: 4px 6px; min-height: 32px; font-weight: 500; }
.btn.link:hover { text-decoration: underline; background: none; }
.iconbtn { border: 0; background: none; cursor: pointer; color: var(--fg-muted); padding: 6px; border-radius: 6px; display: inline-flex; }
.iconbtn:hover { background: var(--control-bg-active); color: var(--fg-default); }
.iconbtn.on { color: var(--fg-attention); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 16px; }
.stack > * + * { margin-top: 12px; }
input[type=text], input[type=search], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--border-default); border-radius: 6px;
  background: var(--bg-default);
}
textarea { min-height: 96px; resize: vertical; }
label.field { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.hint { font-size: 13px; color: var(--fg-muted); margin-top: 4px; }
.check { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-weight: 400; }
.check input { width: 18px; height: 18px; }

.seg { display: flex; background: var(--control-bg-rest); border: 1px solid var(--border-default); border-radius: 6px; padding: 2px; margin: 0 0 16px; }
.seg > * {
  flex: 1; border: 0; background: none; padding: 8px 6px; border-radius: 5px; font-size: 16px; color: var(--fg-default);
  cursor: pointer; text-align: center; min-height: 40px;
}
.seg > *:hover { text-decoration: none; }
.seg > .on { background: var(--bg-default); box-shadow: 0 0 0 1px var(--border-default); font-weight: 600; }
.seg.inbox { margin: 0; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; margin: 0 0 4px; scrollbar-width: none; }
.chip {
  border: 1px solid var(--border-default); background: var(--bg-default); border-radius: 999px; padding: 4px 14px;
  font-size: 15px; white-space: nowrap; cursor: pointer; color: var(--fg-default); display: inline-flex; gap: 4px; align-items: center;
}
.chip.on { background: var(--bg-accent-muted); border-color: var(--fg-accent); color: var(--fg-accent); font-weight: 600; }
.label {
  display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--border-default); border-radius: 999px;
  padding: 0 10px; font-size: 13px; font-weight: 500; color: var(--fg-muted); line-height: 22px; white-space: nowrap;
}
.label.ok { background: var(--bg-success-emphasis); border-color: transparent; color: #fff; }
.label.bad { background: var(--bg-danger-emphasis); border-color: transparent; color: #fff; }
.label.dark { background: var(--bg-neutral-emphasis); border-color: transparent; color: #fff; }
.label.accent { color: var(--fg-accent); border-color: var(--fg-accent); }
.meta { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--fg-muted); white-space: nowrap; }
.meta.soon { color: var(--fg-attention); }

.banner { border: 1px solid var(--border-accent-muted); background: var(--bg-accent-muted); border-radius: 6px; padding: 10px 12px; font-size: 14px; }
.banner.err { border-color: var(--border-danger-muted); background: var(--bg-danger-muted); color: var(--fg-danger); }
.banner.ok { border-color: var(--border-success-muted); background: var(--bg-success-muted); }

/* ---------- board */
.calls-left { display: flex; align-items: center; gap: 10px; }
.sq { display: inline-flex; gap: 4px; }
.sq i { width: 16px; height: 16px; border-radius: 3px; background: var(--contribution0); border: 1px solid var(--contribution-border); display: block; }
.sq i.used { background: var(--bg-accent-emphasis); border-color: transparent; }
.odds { display: grid; grid-template-columns: 34px 1fr 44px; gap: 6px 10px; align-items: center; font-size: 15px; margin-top: 12px; }
.odds .bar { height: 10px; border-radius: 5px; background: var(--bg-neutral-muted); overflow: hidden; }
.odds .bar b { display: block; height: 100%; border-radius: 5px; }
.odds .yes b { background: var(--bg-success-emphasis); }
.odds .no b { background: var(--bg-danger-emphasis); }
.odds .pct { text-align: right; font-variant-numeric: tabular-nums; }
.yesno { display: flex; background: var(--control-bg-rest); border: 1px solid var(--border-default); border-radius: 6px; padding: 2px; }
.yesno button { flex: 1; border: 0; background: none; border-radius: 5px; min-height: 44px; font-size: 17px; cursor: pointer; }
.yesno button.on { background: var(--bg-default); box-shadow: 0 0 0 1px var(--border-default); font-weight: 600; }
.ifright { text-align: center; color: var(--fg-muted); }
.ifright b { color: var(--fg-success); font-weight: 600; }
.saved { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.friendcalls { background: var(--bg-muted); border-radius: 6px; padding: 10px 12px; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 15px; }
.friendcalls .side { font-weight: 600; }
.friendcalls .side.y { color: var(--fg-success); } .friendcalls .side.n { color: var(--fg-danger); }
.people { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.person { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- avatars */
.av { display: inline-block; border-radius: 50%; background: var(--bg-muted); box-shadow: inset 0 0 0 1px var(--border-translucent); flex: none; overflow: hidden; }
.av svg { display: block; width: 100%; height: 100%; }
.avs { display: inline-flex; }
.avs .av + .av { margin-left: -8px; }
.avs .more { margin-left: 4px; font-size: 13px; color: var(--fg-muted); align-self: center; background: var(--bg-muted); border-radius: 999px; padding: 0 8px; }

/* ---------- results */
.net { font-size: 48px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.marks { display: inline-flex; gap: 4px; }
.marks i { width: 14px; height: 14px; border-radius: 3px; display: block; }
.marks .right { background: var(--bg-success-emphasis); }
.marks .wrong { background: var(--bg-danger-emphasis); }
.marks .pending { background: var(--bg-attention-muted); box-shadow: inset 0 0 0 1px var(--fg-attention); }
.marks .void, .marks .skipped { background: var(--bg-neutral-muted); }
.rrow { display: grid; grid-template-columns: 22px 1fr auto; gap: 4px 12px; padding: 14px 16px; align-items: start; }
.rrow + .rrow { border-top: 1px solid var(--border-default); }
.rrow .res { padding-top: 2px; }
.rrow .t { font-weight: 500; overflow-wrap: anywhere; }
.rrow .p { font-weight: 600; font-size: 18px; font-variant-numeric: tabular-nums; }
.res.right { color: var(--fg-success); } .res.wrong { color: var(--fg-danger); } .res.pending, .res.void { color: var(--fg-muted); }
.clip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- profile */
.strip { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.strip button { aspect-ratio: 1; border-radius: 4px; border: 1px solid transparent; padding: 0; cursor: pointer; min-height: 22px; }
.strip .none { background: transparent; border-color: var(--border-default); }
.strip .even, .strip .pending { background: var(--bg-neutral-muted); }
.strip .won { background: var(--contribution2); }
.strip .bigWin { background: var(--contribution4); }
.strip .lost { background: color-mix(in srgb, var(--bg-danger-emphasis) 55%, transparent); }
.strip .bigLoss { background: var(--bg-danger-emphasis); }
.strip button.sel { outline: 2px solid var(--fg-accent); outline-offset: 2px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--fg-muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 16px; }
.tile { background: var(--bg-muted); border-radius: 6px; padding: 12px; min-width: 0; }
.tile .k { font-size: 13px; color: var(--fg-muted); }
.tile .v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.statrow { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.statrow + .statrow { border-top: 1px solid var(--border-default); }
.statrow .v { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- leagues */
.underline-nav { display: flex; gap: 4px; border-bottom: 1px solid var(--border-default); margin: 8px 0 16px; overflow-x: auto; }
.underline-nav a { padding: 10px 12px; color: var(--fg-muted); white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.underline-nav a.on { color: var(--fg-default); font-weight: 600; box-shadow: inset 0 -2px 0 var(--underline-nav-active); }
.underline-nav a:hover { text-decoration: none; color: var(--fg-default); }
.counter { background: var(--bg-neutral-muted); border-radius: 999px; padding: 0 7px; font-size: 12px; font-weight: 600; color: var(--fg-default); }
.me-row { background: var(--bg-accent-muted); }
.rank { width: 22px; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.reactions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.react { border: 1px solid var(--border-default); background: var(--bg-default); border-radius: 999px; padding: 2px 10px; cursor: pointer; font-size: 14px; min-height: 32px; }
.react.on { background: var(--bg-accent-muted); border-color: var(--fg-accent); }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; font-size: 18px; letter-spacing: 1px; }

/* ---------- toast and dialog */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 40;
  background: var(--bg-emphasis); color: var(--fg-on-emphasis); padding: 10px 16px; border-radius: 8px; font-size: 15px;
  max-width: calc(100vw - 32px); box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
@media (min-width: 760px) { .toast { bottom: 24px; } }
.dialog {
  border: 1px solid var(--border-default); border-radius: 12px; padding: 0; width: min(520px, calc(100vw - 32px));
  background: var(--bg-default); color: var(--fg-default); max-height: calc(100vh - 64px);
}
.dialog::backdrop { background: rgba(0,0,0,.4); }
.dialog .dh { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border-default); }
.dialog .db { padding: 16px; overflow: auto; }
.dialog .df { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--border-default); }

/* ---------- sign-in */
.welcome { max-width: 420px; margin: 8vh auto 0; text-align: center; }
.welcome .brand-mark { width: 64px; height: 64px; margin: 0 auto 20px; }
.welcome h1 { font-size: 40px; margin: 0; }
.welcome p.lead { font-size: 18px; color: var(--fg-muted); margin: 8px 0 32px; }
.apple-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; border-radius: 8px;
  background: #000; color: #fff; border: 1px solid #000; font-size: 17px; font-weight: 600; cursor: pointer;
}
:root[data-theme="dark"] .apple-btn { background: #fff; color: #000; border-color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .apple-btn { background: #fff; color: #000; border-color: #fff; } }
.apple-btn svg { width: 18px; height: 18px; fill: currentColor; }
.fine { font-size: 13px; color: var(--fg-muted); margin-top: 24px; }
.left { text-align: left; }
