:root {
  /* 三文鱼色系:主色块用三文鱼色配深棕字,页面底色是极浅的三文鱼白 */
  --brand: #F58B76;
  --on-brand: #3A1A14;
  --on-brand-muted: #5F271E;
  --brand-field: rgba(255, 255, 255, .5);
  --accent: #C24A36;
  --chalk: #FFF6F2;
  --surface: #FFFFFF;
  --ink: #2F1915;
  --muted: #8C6B63;
  --line: #F5DDD5;
  --yellow: #FFD21F;
  --yellow-ink: #3D3000;
  --red: #D4202C;
  --ok: #1E7A5E;
  --primary-bg: #2F1915;
  --primary-fg: #FFFFFF;
  --num: "DIN Condensed", "DIN Alternate", "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", sans-serif;
  --text: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --tabs-h: 56px;
  --sab: env(safe-area-inset-bottom, 0px);
  --sat: env(safe-area-inset-top, 0px);
  --spring: cubic-bezier(.2, .9, .25, 1.08);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #5C2A21;
    --on-brand: #FFECE6;
    --on-brand-muted: #E3AEA1;
    --brand-field: rgba(255, 255, 255, .1);
    --accent: #FF9C89;
    --chalk: #1A100D;
    --surface: #271915;
    --ink: #FBEAE5;
    --muted: #B3958D;
    --line: #3A2620;
    --red: #EF4B55;
    --ok: #5CCBA0;
    --primary-bg: #F58B76;
    --primary-fg: #2F1915;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--chalk);
  color: var(--ink);
  font: 16px/1.5 var(--text);
  min-height: 100dvh;
  overscroll-behavior-y: none;
}
button, input, textarea { font: inherit; color: inherit; }
button { touch-action: manipulation; cursor: pointer; border: 0; background: none; padding: 0; }
h1, h2, p { margin: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* 牌:整个界面的记号 */
.pc {
  display: inline-grid; place-items: center;
  width: 30px; height: 42px; border-radius: 5px;
  font: 700 24px/1 var(--num); font-style: normal;
  padding-top: 3px;
  flex: none;
}
.pc.yellow { background: var(--yellow); color: var(--yellow-ink); }
.pc.red { background: var(--red); color: #fff; }
.pc.empty { background: none; border: 2px dashed var(--on-brand-muted); opacity: .5; }
/* 色块上的牌加白边,红牌在三文鱼色上才分得清 */
.login-cards .pc { box-shadow: 0 0 0 2.5px #fff, 0 5px 12px rgba(90, 30, 15, .22); }
.pc.gone { background: var(--line); color: var(--muted); }

/* ---------- 登录 ---------- */
.login {
  min-height: 100dvh;
  background: var(--brand);
  color: var(--on-brand);
  padding: calc(var(--sat) + 12dvh) 28px calc(var(--sab) + 32px);
  display: flex; flex-direction: column;
}
.login-cards { position: relative; height: 96px; }
.login-cards .pc { position: absolute; width: 60px; height: 84px; border-radius: 9px; left: 0; top: 6px; }
.login-cards .red { transform: translateX(26px) rotate(14deg); }
.login-cards .yellow { transform: rotate(-8deg); }
.login h1 { font-size: 44px; font-weight: 800; letter-spacing: .04em; margin-top: 20px; }
.login-sub { color: var(--on-brand-muted); margin-top: 6px; }
.login form { margin-top: 40px; display: grid; gap: 14px; max-width: 420px; }
.who { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.who input { position: absolute; opacity: 0; pointer-events: none; }
.who span { justify-content: center; min-height: 56px;
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px 16px; border-radius: 14px;
  border: 2px solid color-mix(in srgb, var(--on-brand) 28%, transparent);
  transition: transform .15s, background .15s, border-color .15s;
}
.who b { font-size: 18px; }
.who small { color: var(--on-brand-muted); font-size: 13px; }
.who input:checked + span { background: var(--on-brand); border-color: var(--on-brand); color: var(--brand); }
.who input:checked + span small { color: inherit; opacity: .7; }
.who input:focus-visible + span { outline: 3px solid var(--on-brand); outline-offset: 2px; }
.who label:active span { transform: scale(.97); }
.login .field { background: var(--brand-field); border-color: transparent; color: var(--on-brand); }
.login .field::placeholder { color: var(--on-brand-muted); }
.login .btn.primary { background: var(--on-brand); color: var(--brand); }
.form-err { color: var(--on-brand); font-weight: 600; font-size: 14px; min-height: 21px; }
.page .form-err { color: var(--red); font-weight: 400; }

/* ---------- 通用控件 ---------- */
.field {
  width: 100%; min-height: 52px; padding: 13px 16px;
  border: 1.5px solid var(--line); border-radius: 14px;
  background: var(--surface); font-size: 17px;
  -webkit-appearance: none; appearance: none;
}
textarea.field { resize: none; line-height: 1.45; }
.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.login .field:focus { border-color: var(--on-brand); box-shadow: none; }
.btn {
  min-height: 52px; padding: 0 20px; border-radius: 14px;
  font-weight: 650; font-size: 17px; width: 100%;
  background: var(--line); color: var(--ink);
  transition: transform .12s, opacity .12s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; }
.btn.primary { background: var(--primary-bg); color: var(--primary-fg); }
.btn.yellow { background: var(--yellow); color: var(--yellow-ink); }
.btn.red { background: var(--red); color: #fff; }
.btn.ghost { background: none; color: var(--red); }
.btn.small { min-height: 44px; width: auto; font-size: 15px; padding: 0 16px; border-radius: 12px; }

/* ---------- 看板:球场区 ---------- */
.view { padding-bottom: calc(var(--tabs-h) + var(--sab) + 96px); min-height: 100dvh; }
.hero {
  background: var(--brand); color: var(--on-brand);
  padding: calc(var(--sat) + 18px) 20px 22px;
  border-radius: 0 0 26px 26px;
}
.hero-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; color: var(--on-brand-muted); }
.count-num { font: 700 88px/.8 var(--num); letter-spacing: -.01em; padding-top: 18px; margin-top: 8px; }
.verdict { margin-top: 14px; font-size: 17px; font-weight: 600; }
.money { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 18px; border-top: 1px solid color-mix(in srgb, var(--on-brand) 20%, transparent); padding-top: 14px; }
.money div { display: flex; flex-direction: column; }
.money dt, .money span { font-size: 13px; color: var(--on-brand-muted); }
.money b { font: 700 28px/1.1 var(--num); padding-top: 4px; }

/* ---------- 分段 + 横滑分栏 ---------- */
.seg {
  position: sticky; top: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  margin: 14px 16px 0; padding: 4px;
  background: var(--line); border-radius: 14px;
}
.seg button { min-height: 44px; border-radius: 10px; font-size: 14px; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15; transition: background .2s, color .2s; }
.seg button b { font: 700 19px/1 var(--num); padding-top: 3px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(90, 40, 25, .14); }
.pager {
  display: flex; align-items: flex-start;
  overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.pager::-webkit-scrollbar { display: none; }
.col { flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always; padding: 14px 16px 0; display: grid; gap: 10px; align-content: start; }
.col-title { display: none; }

.card {
  background: var(--surface); border-radius: 16px; padding: 14px;
  display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid var(--line);
}
.card .pc { transform: rotate(-5deg); margin-top: 2px; }
.card-body { flex: 1; min-width: 0; }
.card-text { font-size: 17px; line-height: 1.4; overflow-wrap: anywhere; }
.card-meta { font-size: 13px; color: var(--muted); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.tag { font-size: 12px; font-weight: 650; padding: 2px 8px; border-radius: 99px; background: var(--line); color: var(--muted); }
.tag.due { background: var(--red); color: #fff; }
.tag.wait { background: var(--yellow); color: var(--yellow-ink); }
.tag.done { background: none; color: var(--ok); padding-left: 0; }
.more { width: 44px; height: 44px; margin: -8px -8px -8px 0; border-radius: 12px; display: grid; place-items: center; color: var(--muted); font-size: 22px; line-height: 1; flex: none; }
.more:active { background: var(--line); }
.fine-amt { font: 700 34px/1 var(--num); padding-top: 4px; }
.fine-amt.settled { color: var(--ok); }
.card-actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
/* 牌(一件事):标题 + 次数,一排小牌,操作 */
.card.issue { display: grid; gap: 10px; }
.issue-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.issue-head .card-text { font-size: 19px; font-weight: 650; }
.issue-n { font: 700 34px/.9 var(--num); padding-top: 5px; flex: none; }
.issue-n small { font-size: 18px; color: var(--muted); margin-left: 2px; }
.issue-n.over { color: var(--red); }
.slots { display: flex; flex-wrap: wrap; gap: 7px; padding: 2px 2px 0; }
.pc.sm { width: 22px; height: 31px; border-radius: 4px; }
.slots .pc:nth-child(odd) { transform: rotate(-4deg); }
.slots .pc:nth-child(even) { transform: rotate(3deg); }
.slots .pc.empty { border: 1.5px dashed var(--muted); opacity: .45; }
.slots .pc.pop { animation: pop .42s var(--spring) both; }
@keyframes pop { from { transform: translateY(-16px) scale(1.7) rotate(14deg); opacity: 0; } }
.card.issue .card-meta { margin-top: 0; }
.card-meta .warn { color: var(--red); font-weight: 650; }
.card.issue .card-actions { margin-top: 2px; align-items: center; justify-content: space-between; }
.card.issue .more { margin: 0 -6px 0 0; }
.card.deal { animation: deal .5s var(--spring) both; }
@keyframes deal { from { transform: translateY(46vh) rotate(9deg) scale(.82); opacity: 0; } }
.empty-col { text-align: center; color: var(--muted); padding: 44px 24px; font-size: 15px; }
.empty-col b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }

/* ---------- 记录 / 设置 ---------- */
.bar { padding: calc(var(--sat) + 18px) 20px 6px; }
.bar h2 { font-size: 30px; font-weight: 800; }
.page { padding: 8px 16px 0; display: grid; gap: 10px; max-width: 640px; }
.round-h { font-size: 14px; color: var(--muted); margin: 14px 4px 0; display: flex; justify-content: space-between; }
.card.revoked .card-text { text-decoration: line-through; color: var(--muted); }
.group { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: grid; gap: 12px; }
.group h3 { margin: 0; font-size: 17px; }
.group p { font-size: 14px; color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lbl { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }

/* ---------- 发牌按钮 / 底部导航 ---------- */
.fab {
  position: fixed; right: 16px; bottom: calc(var(--tabs-h) + var(--sab) + 16px); z-index: 20;
  display: flex; align-items: center; gap: 10px;
  height: 60px; padding: 0 22px 0 16px; border-radius: 30px;
  background: var(--ink); color: var(--chalk); font-weight: 700; font-size: 18px;
  box-shadow: 0 10px 26px rgba(70, 25, 12, .3);
  transition: transform .14s;
}
.fab .pc { width: 24px; height: 34px; transform: rotate(-10deg); }
.fab:active { transform: scale(.94); }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  display: grid; grid-template-columns: repeat(3, 1fr);
  height: calc(var(--tabs-h) + var(--sab)); padding-bottom: var(--sab);
  background: color-mix(in srgb, var(--chalk) 78%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--line);
}
.tabs button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; color: var(--muted); }
.tabs svg { width: 24px; height: 24px; fill: currentColor; stroke: currentColor; }
.tabs button.on { color: var(--accent); font-weight: 650; }

/* ---------- 底部弹层 ---------- */
.scrim { position: fixed; inset: 0; z-index: 30; background: rgba(40, 16, 10, .5); opacity: 0; transition: opacity .25s; }
.scrim.on { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: var(--kb, 0px); z-index: 31;
  max-width: 560px; margin: 0 auto;
  background: var(--chalk); border-radius: 24px 24px 0 0;
  padding: 10px 18px calc(var(--sab) + 18px);
  max-height: calc(100dvh - var(--kb, 0px) - var(--sat) - 20px); overflow-y: auto;
  transform: translateY(105%); transition: transform .38s var(--spring);
  display: grid; gap: 12px;
}
.sheet.on { transform: none; }
.sheet::before { content: ""; width: 38px; height: 5px; border-radius: 3px; background: var(--line); justify-self: center; }
.sheet h3 { margin: 4px 0 0; font-size: 20px; }
.sheet p { color: var(--muted); font-size: 15px; }
.next { display: flex; gap: 12px; align-items: center; }
.next .pc { transform: rotate(-5deg); }
.next b { display: block; font-size: 18px; }
.next span { font-size: 14px; color: var(--muted); }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -18px; padding: 0 18px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; min-height: 40px; padding: 0 14px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); font-size: 15px; }
.chips button:active { background: var(--line); }

.toast {
  position: fixed; left: 50%; top: calc(var(--sat) + 14px); z-index: 50;
  transform: translate(-50%, -160%); transition: transform .3s var(--spring);
  background: var(--ink); color: var(--chalk); padding: 11px 18px; border-radius: 14px;
  font-size: 15px; max-width: calc(100vw - 32px); text-align: center; pointer-events: none;
}
.toast.on { transform: translate(-50%, 0); }

.skel { height: 78px; border-radius: 16px; background: var(--line); animation: pulse 1.2s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: .45; } }

/* ---------- 大屏:四栏并排 ---------- */
@media (min-width: 900px) {
  .view { max-width: 1180px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }
  .hero { border-radius: 26px; margin-top: 20px; padding: 28px 32px; }
  .seg { display: none; }
  .pager { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; overflow: visible; margin-top: 20px; }
  .col { padding: 0; }
  .col-title { display: flex; justify-content: space-between; font-weight: 700; padding: 0 4px; }
  .col-title b { font: 700 20px/1.2 var(--num); color: var(--muted); }
  .tabs { left: 50%; right: auto; transform: translateX(-50%); width: 360px; bottom: 16px; border: 1px solid var(--line); border-radius: 20px; }
  .fab { right: max(24px, calc(50vw - 570px)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
