/* Biu Wui app: phone first, one column; on desktop the circle view spreads into two. */
html, body { min-height: 100%; }
body { overscroll-behavior-y: none; }
body.sheet-open { overflow: hidden; }
button { -webkit-user-select: none; user-select: none; touch-action: manipulation; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; justify-self: center; }
.fine { color: var(--muted); font-size: 13px; line-height: 1.5; }
.fine a { color: var(--ink-2); }
.kicker { color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: 0.01em; }
.kicker.red { color: var(--red-deep); }
.link { color: var(--ink-2); font-size: 14px; font-weight: 600; text-decoration: underline; text-decoration-color: rgba(70, 45, 20, 0.25); text-underline-offset: 3px; }
.link:hover { color: var(--red-deep); }
.spinner { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 2.4px solid rgba(70, 45, 20, 0.15); border-top-color: var(--ink); animation: spin 0.8s linear infinite; vertical-align: -4px; }
.spinner.light { border-color: rgba(255, 255, 255, 0.35); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.boot { display: grid; place-items: center; min-height: 30svh; color: var(--muted); gap: 10px; text-align: center; padding: 20px; }
.boot a { color: var(--red-deep); }

/* ---------------------------------------------------------------- top bar */
.topbar { position: fixed; z-index: 30; top: 0; left: 0; right: 0; padding: calc(env(safe-area-inset-top) + 10px) 12px 0; pointer-events: none; }
.topbar-in { pointer-events: auto; max-width: 1120px; margin: 0 auto; display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 999px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 650; font-size: 17px; text-decoration: none; letter-spacing: -0.02em; margin-right: auto; }
.site-link { font-size: 14px; color: var(--ink-2); text-decoration: none; padding: 8px 10px; border-radius: 99px; }
.site-link:hover { background: rgba(255, 255, 255, 0.6); }
.wallet-pill { display: inline-flex; align-items: center; gap: 7px; height: 42px; padding: 0 14px; border-radius: 999px; font-size: 14px; font-weight: 600; background: rgba(255, 252, 247, 0.92); box-shadow: inset 0 1px 0 #fff, 0 2px 8px rgba(60, 30, 10, 0.08); transition: transform 0.18s var(--spring); }
.wallet-pill:active { transform: scale(0.96); }
.wallet-pill small { color: var(--muted); font-weight: 500; font-size: 12px; }
.wallet-pill .w-addr { color: var(--muted); font-weight: 500; font-size: 12px; padding-left: 7px; border-left: 1px solid var(--line); }
.w-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px rgba(207, 58, 36, 0.15); }
.w-dot.off { background: var(--faint); box-shadow: none; }
@media (max-width: 420px) { .wallet-pill .w-addr, .site-link { display: none; } }

.screen { max-width: 1120px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 84px) 14px calc(env(safe-area-inset-bottom) + 40px); }
@media (min-width: 960px) { .screen { padding-top: 100px; } }

/* ---------------------------------------------------------------- welcome */
.welcome { max-width: 440px; margin: 0 auto; display: grid; gap: 12px; text-align: center; padding-top: 12px; }
.welcome-mark { display: grid; place-items: center; margin: 4px 0 8px; }
.hero-chop { --chop: 58px; transform: rotate(-6deg); filter: drop-shadow(0 8px 14px rgba(165, 42, 23, 0.25)); }
.welcome h1 { font-size: 34px; line-height: 1.08; font-weight: 700; letter-spacing: -0.045em; margin: 0 0 6px; }
.points { list-style: none; display: grid; gap: 8px; text-align: left; margin-bottom: 8px; }
.points li { padding: 14px 16px; border-radius: 20px; font-size: 15px; line-height: 1.45; color: var(--ink-2); }
.points b { color: var(--ink); }
.welcome .btn-red, .welcome .btn-glass { min-height: 54px; font-size: 16px; }

/* ---------------------------------------------------------------- home */
.home { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.col-a, .col-b { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-content: start; min-width: 0; }
@media (min-width: 960px) { .home { grid-template-columns: 420px minmax(0, 1fr); column-gap: 24px; } }
.wallet-card { padding: 22px; border-radius: 30px; }
.big { font-size: 44px; font-weight: 550; letter-spacing: -0.04em; margin-top: 6px; line-height: 1.1; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.wallet-card .fine { margin-top: 12px; }
.practice { padding: 24px 22px 22px; border-radius: 30px; overflow: hidden; box-shadow: 0 0 0 2px rgba(207, 58, 36, 0.55), var(--glass-shadow); }
.practice-art { position: absolute; right: 18px; top: 18px; transform: rotate(8deg); opacity: 0.9; }
.practice-art .chop { --chop: 38px; }
.practice h2 { font-size: 23px; line-height: 1.18; letter-spacing: -0.03em; margin: 8px 56px 0 0; }
.practice p { color: var(--ink-2); font-size: 15px; line-height: 1.5; margin: 10px 0 18px; }
.practice .btn-red { min-height: 54px; font-size: 16px; }
.card-pad { padding: 20px 22px; border-radius: 28px; }
.card-pad h3, .list-card h3 { font-size: 17px; letter-spacing: -0.02em; }
.card-pad .muted { font-size: 14px; margin-top: 4px; }
.join-link { display: flex; gap: 8px; margin-top: 12px; }
.join-link input { flex: 1; min-width: 0; height: 48px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.75); }
.list-card { padding: 16px 10px 10px; border-radius: 28px; }
.list-card > header { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 0 10px 8px; }
.clist { list-style: none; display: grid; }
.clist li.empty { color: var(--muted); font-size: 14px; padding: 10px; }
.clist a { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px; border-radius: 18px; text-decoration: none; transition: background 0.15s ease; }
.clist a:hover { background: rgba(255, 255, 255, 0.65); }
.c-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; color: var(--ink-2); background: linear-gradient(150deg, #fffaf1, #eadbc4); box-shadow: inset 0 0 0 1px var(--line); }
.c-ico.live { color: #fff; background: linear-gradient(150deg, #db4a31, var(--red-deep)); box-shadow: none; }
.c-name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-name small { display: block; color: var(--muted); font-weight: 400; font-size: 13px; margin-top: 2px; }
.c-go { color: var(--faint); font-size: 22px; }

/* ---------------------------------------------------------------- forms */
.narrow { max-width: 620px; margin: 0 auto; }
.back { display: inline-flex; align-items: center; height: 36px; padding: 0 12px; margin: 0 0 10px -4px; border-radius: 99px; text-decoration: none; color: var(--ink-2); font-size: 14px; font-weight: 600; }
.back:hover { background: rgba(255, 255, 255, 0.6); }
.title { font-size: 34px; font-weight: 700; letter-spacing: -0.045em; }
.sub { margin: 6px 0 16px; font-size: 15px; }
.form-card { padding: 22px; border-radius: 28px; display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input, .field select { width: 100%; height: 50px; padding: 0 16px; border-radius: 16px; border: 1px solid rgba(70, 45, 20, 0.16); background: rgba(255, 255, 255, 0.85); font-variant-numeric: tabular-nums; }
.field input:focus { outline: 2px solid rgba(207, 58, 36, 0.45); outline-offset: 0; border-color: transparent; }
.field input:disabled { opacity: 0.6; }
.field small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 380px) { .field-row { grid-template-columns: 1fr; } }
.err { color: var(--red-deep); background: var(--red-soft); padding: 12px 14px; border-radius: 14px; font-size: 14px; line-height: 1.45; font-weight: 500; }
.err[hidden] { display: none; }
.warn { color: #6b3c0a; background: var(--gold-soft); padding: 12px 14px; border-radius: 14px; font-size: 14px; line-height: 1.45; margin-top: 12px; }

/* ---------------------------------------------------------------- the circle view */
.cview { display: grid; gap: 14px; }
.cview .back { margin-bottom: -4px; }
.c-head { padding: 20px 22px; border-radius: 30px; display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.c-title h1 { font-size: clamp(24px, 4vw, 34px); line-height: 1.12; letter-spacing: -0.04em; margin-top: 8px; overflow-wrap: anywhere; }
.c-title p { margin-top: 6px; font-size: 14px; }
.c-head-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.c-head-btns .btn-glass { min-height: 42px; font-size: 14px; padding: 0 16px; }
.phase { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 700; color: #fff; background: var(--muted); }
.phase.p0 { background: var(--gold); }
.phase.p1 { background: var(--red); }
.phase.p2 { background: var(--ink-2); }

.banner { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 22px; font-size: 14px; line-height: 1.45; color: var(--ink-2); background: rgba(255, 251, 244, 0.8); border: 1px solid rgba(255, 255, 255, 0.85); box-shadow: var(--glass-shadow); }
.banner + .banner { margin-top: 10px; }
.banner > div { flex: 1; min-width: 0; }
.banner .btn-ink, .banner .btn-red { min-height: 40px; font-size: 14px; padding: 0 16px; }
.b-ic { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--gold-soft); font-size: 16px; }
.banner.warn { margin-top: 0; color: #5c1a0e; background: linear-gradient(180deg, #fde3da, #f9d2c5); border-color: rgba(207, 58, 36, 0.35); box-shadow: 0 0 0 2px rgba(207, 58, 36, 0.25), 0 10px 24px -14px rgba(165, 42, 23, 0.5); }
.banner.warn .b-ic { background: var(--red); color: #fff; font-weight: 800; }
.banner.warn + .banner { margin-top: 10px; }
#c-banners:empty { display: none; }

.c-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.c-side { display: grid; gap: 14px; align-content: start; }
@media (min-width: 960px) { .c-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.ring-card { padding: 18px; border-radius: 30px; }
.ring-card > header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ring-card h2 { font-size: 16px; }
.timer { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--red-deep); background: rgba(255, 255, 255, 0.75); }
.timer:empty { display: none; }
.ring-wrap { display: flex; justify-content: center; padding: 22px 0 14px; }
#c-ring { --ring: min(340px, 76vw); }
.ring-legend { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 10px; color: var(--muted); font-size: 12px; }
.lg { display: inline-grid; place-items: center; width: 12px; height: 12px; border-radius: 50%; margin-right: -4px; font-size: 8px; color: #fff; }
.lg.paid { background: var(--gold-2); }
.lg.win { background: var(--red); }
.lg.won { background: var(--ink-2); }
.lg.tick { background: var(--gold); }

.moves { padding: 22px; border-radius: 30px; }
.moves h2 { font-size: 21px; line-height: 1.25; letter-spacing: -0.03em; margin: 6px 0 16px; }
.move-list { display: grid; gap: 10px; }
.move-list:empty { display: none; }
.move { display: grid !important; justify-items: start; text-align: left; gap: 2px; width: 100%; min-height: 64px !important; padding: 12px 20px !important; border-radius: 22px !important; white-space: normal !important; }
.move span { font-size: 17px; font-weight: 650; letter-spacing: -0.02em; }
.move small { font-size: 13px; font-weight: 500; opacity: 0.8; }
.facts { padding: 6px 20px; border-radius: 26px; }
.rows > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.rows > div:last-child { border-bottom: 0; }
.rows dt { color: var(--muted); font-size: 14px; flex: 0 0 auto; }
.rows dd { font-size: 14px; font-weight: 550; text-align: right; overflow-wrap: anywhere; }
.rows dd a { text-decoration: none; color: var(--red-deep); }

.people { list-style: none; display: grid; gap: 4px; }
.people li { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px; border-radius: 18px; }
.people li:hover { background: rgba(255, 255, 255, 0.5); }
.people li.empty { display: block; color: var(--muted); font-size: 14px; }
.pav { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 15px; color: var(--ink-2); background: linear-gradient(150deg, #fffaf1, #eadbc4); box-shadow: 0 0 0 2px #fff, 0 4px 10px -6px rgba(60, 30, 10, 0.4); }
.pav.me { color: #fff; font-size: 12px; background: linear-gradient(150deg, #4a3d33, var(--ink)); }
.pav.bot { background: linear-gradient(150deg, #f6e7c2, #e2c48a); }
.pname { font-weight: 650; font-size: 15px; min-width: 0; }
.pname em { font-style: normal; font-size: 11px; color: var(--red-deep); font-weight: 700; margin-left: 4px; }
.pname small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; margin-top: 2px; font-family: var(--mono); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 99px; font-size: 11px; font-weight: 700; color: var(--ink-2); background: rgba(70, 45, 20, 0.08); }
.tag.gold { color: #6b4a0e; background: var(--gold-soft); }
.tag.red { color: #fff; background: var(--red); }
.tag.soft { color: var(--muted); }
.tag.warn { color: #fff; background: var(--red-deep); }

.feed { list-style: none; max-height: 520px; overflow-y: auto; overscroll-behavior: contain; }
.feed li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 10px; border-radius: 16px; }
.feed .ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; color: var(--ink-2); background: rgba(255, 255, 255, 0.85); }
.feed li.gold .ic { background: var(--gold-soft); color: #6b4a0e; }
.feed li.warn .ic { background: var(--red); color: #fff; }
.feed .what { font-size: 14px; line-height: 1.4; }
.feed .when { color: var(--muted); font-size: 12px; text-decoration: none; white-space: nowrap; }
.feed .when:hover { color: var(--red-deep); }
.feed li.empty { display: block; color: var(--muted); font-size: 14px; }

/* ---------------------------------------------------------------- sheets */
.sheet-root { position: fixed; inset: 0; z-index: 60; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(40, 20, 10, 0.24); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity 0.28s ease; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 92svh; overflow-y: auto; overscroll-behavior: contain; border-radius: 30px 30px 0 0; padding: 8px 20px calc(env(safe-area-inset-bottom) + 22px); transform: translateY(100%); transition: transform 0.42s var(--spring); }
.sheet-root.open .sheet-backdrop { opacity: 1; }
.sheet-root.open .sheet { transform: translateY(0); }
.sheet-root.closing .sheet { transform: translateY(100%); transition-duration: 0.26s; }
.sheet-root.closing .sheet-backdrop { opacity: 0; }
.sheet-grab { width: 40px; height: 5px; border-radius: 99px; background: rgba(70, 45, 20, 0.18); margin: 2px auto 6px; }
.sheet-top { display: flex; justify-content: flex-end; min-height: 36px; }
.sheet-top button { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(70, 45, 20, 0.07); color: var(--ink-2); }
@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; top: 50%; bottom: auto; width: min(500px, 92vw); max-height: 88svh; border-radius: 32px; padding: 12px 26px 26px; transform: translate(-50%, -46%) scale(0.97); opacity: 0; transition: transform 0.38s var(--spring), opacity 0.25s ease; }
  .sheet-root.open .sheet { transform: translate(-50%, -50%); opacity: 1; }
  .sheet-root.closing .sheet { transform: translate(-50%, -48%) scale(0.98); opacity: 0; }
  .sheet-grab { display: none; }
}
@media (prefers-reduced-motion: reduce) { .sheet, .sheet-backdrop { transition: none !important; } }
.tx, .info { display: grid; gap: 4px; }
.tx h2, .info h2 { font-size: 25px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.15; margin: 0 0 6px; }
.lead { color: var(--ink-2); font-size: 15px; line-height: 1.55; margin: 2px 0 10px; }
.lead b { color: var(--ink); }
.rows.glass { border-radius: 20px; padding: 2px 16px; margin: 4px 0 8px; box-shadow: none; }
.fields { display: grid; gap: 12px; margin: 6px 0 4px; }
.pad { display: flex; justify-content: center; gap: 14px; padding: 16px 0 6px; }
.pad .stamp-pad { width: 74px; height: 104px; border-radius: 14px; background: repeating-linear-gradient(0deg, rgba(120, 80, 40, 0.05) 0 1px, transparent 1px 7px); box-shadow: inset 0 0 0 1px var(--line); }
.pad .chop { --chop: 46px; }
.stamp-pad.waiting .chop { opacity: 0.13; transform: rotate(-7deg); filter: grayscale(0.3); }
.stamp-pad.asking { box-shadow: inset 0 0 0 2px rgba(207, 58, 36, 0.55); }
@media (prefers-reduced-motion: no-preference) { .stamp-pad.asking .chop { animation: hover 1.2s ease-in-out infinite; } }
@keyframes hover { 50% { opacity: 0.3; transform: translateY(-4px) rotate(-7deg) scale(1.05); } }
.progress { list-style: none; display: grid; gap: 8px; margin: 10px 0 4px; font-size: 14px; }
.progress:empty { display: none; }
.progress li { display: flex; gap: 10px; align-items: flex-start; line-height: 1.4; color: var(--ink-2); }
.progress li .tick { flex: 0 0 auto; width: 18px; height: 18px; border-radius: 50%; margin-top: 1px; box-shadow: inset 0 0 0 1.6px var(--faint); }
.progress li.busy .tick { box-shadow: none; border: 2.2px solid rgba(207, 58, 36, 0.2); border-top-color: var(--red); animation: spin 0.8s linear infinite; }
.progress li.done .tick { box-shadow: none; background: var(--red) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M4.5 8.3l2.2 2.2 4.8-5' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/100% no-repeat; }
.progress li.failed .tick { box-shadow: none; background: var(--ink-2) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M5.5 5.5l5 5M10.5 5.5l-5 5' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round'/></svg>") center/100% no-repeat; }
.progress li.note { color: var(--red-deep); font-weight: 600; padding-left: 28px; }
.progress a { color: var(--red-deep); font-weight: 600; text-decoration: none; }
.tx-actions { display: grid; gap: 10px; margin-top: 14px; }
.tx-actions .btn-red, .tx-actions .btn-glass { min-height: 54px; font-size: 16px; }
.key { margin-top: 12px; padding: 12px; border-radius: 14px; background: rgba(70, 45, 20, 0.07); font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-all; }
.key[hidden] { display: none; }

.toast { position: fixed; z-index: 80; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 22px); transform: translate(-50%, 20px); opacity: 0; padding: 12px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; max-width: calc(100vw - 32px); transition: transform 0.35s var(--spring), opacity 0.25s ease; }
.toast.in { transform: translate(-50%, 0); opacity: 1; }
@media (max-width: 600px) { .field-row .field > span { min-height: 2.6em; display: flex; align-items: flex-end; } }
