:root {
  --bg: #f6f3f3; --card: #fff; --ink: #221a1c; --muted: #85797c; --line: #e9dfe1;
  --accent: #c81e3a; --accent-ink: #fff; --soft: #f9e3e7; --ok: #2b8a3e; --bad: #c92a2a; --red: #d0263f; --warn: #fff3bf; --warn-ink: #5c4400;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #141012; --card: #211a1d; --ink: #f2eaec; --muted: #a2959a; --line: #3a2f33; --accent: #ff5470; --accent-ink: #1d060b; --soft: #3a2027; --ok: #69db7c; --bad: #ff8787; --red: #ff6b81; --warn: #3d3410; --warn-ink: #ffe8a1; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body {
  margin: 0; color: var(--ink); background: var(--bg);
  font: 17px/1.45 -apple-system, system-ui, sans-serif;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
main, #app { max-width: 600px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
h1 { margin: 0; font-size: 24px; line-height: 1.15; flex: 1; }
h2 { margin: 0; font-size: 19px; }
h3 { margin: 10px 0 0; font-size: 17px; }
.arrow { color: var(--accent); }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: 14px; }
p { margin: 0; }
.head { display: flex; align-items: center; gap: 10px; }
.logo { width: 44px; height: 44px; border-radius: 10px; }

.card { background: var(--card); border-radius: 18px; padding: 14px 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; box-shadow: 0 1px 0 var(--line); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lbl { font-weight: 600; }

input[type=text], textarea {
  font: inherit; font-size: 17px; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; min-height: 44px; padding: 8px 12px; width: 100%;
}
textarea { resize: vertical; font-size: 16px; word-break: break-all; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.btn { font: inherit; font-weight: 700; min-height: 48px; border: 0; border-radius: 14px; background: var(--soft); color: var(--accent); padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.big { min-height: 58px; font-size: 19px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .55; }
.btn.google { background: #fff; color: #1f1f1f; border: 1px solid #dadce0; font-weight: 600; }
.link { font: inherit; background: none; border: 0; color: var(--accent); padding: 0 4px; min-height: 44px; min-width: 44px; }
.link.danger { color: var(--bad); }
.icon-btn { font: inherit; background: none; border: 0; color: inherit; min-width: 44px; min-height: 44px; }

.msg { padding: 10px 12px; border-radius: 12px; background: var(--soft); font-size: 15px; }
.msg.bad { color: var(--bad); }

/* result */
.sum { display: flex; align-items: center; gap: 12px; }
.sum-main { flex: 1; min-width: 0; }
.cards { display: flex; gap: 4px; }
.card-c { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 52px; padding: 0 4px; border-radius: 8px; background: #fff; color: #1b1b1b; border: 1px solid #d9d2d4; font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; }
.card-c.r { color: #d0263f; }
.board .c { font-weight: 700; margin-right: 3px; white-space: nowrap; }
.c.r { color: var(--red); }
.net { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.net.up { color: var(--ok); }
.net.down { color: var(--bad); }
.warn { margin: 0; padding: 10px 12px 10px 30px; border-radius: 12px; background: var(--warn); color: var(--warn-ink); font-size: 15px; }
details summary { font-weight: 700; min-height: 44px; display: flex; align-items: center; cursor: pointer; }
pre { margin: 0; padding: 10px; border-radius: 10px; background: var(--bg); font: 12px/1.4 ui-monospace, Menlo, monospace; white-space: pre; overflow: auto; max-height: 50vh; -webkit-user-select: text; user-select: text; }

/* session */
.hands { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
.hands li { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); min-height: 56px; }
.hands li:first-child { border-top: 0; }
.hands .h-main { flex: 1; min-width: 0; padding: 6px 0; }
.hands .h-top { font-weight: 700; }
.hands .h-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hands .net { font-size: 16px; }
.hands .icon-btn { color: var(--muted); }
.hands .copy1 { color: var(--accent); font-weight: 700; font-size: 15px; }

/* settings */
.keybox { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 10px; border-radius: 12px; background: var(--soft); }
.keybox input { font: 14px ui-monospace, Menlo, monospace; font-size: 16px; }
.steps { margin: 4px 0 0; padding-left: 22px; display: grid; gap: 6px; }
code { font: 13px ui-monospace, Menlo, monospace; word-break: break-all; background: var(--bg); padding: 1px 4px; border-radius: 5px; }

.hint { display: flex; align-items: center; gap: 8px; background: var(--soft); border-radius: 14px; padding: 6px 6px 6px 14px; font-size: 15px; }
.hint span { flex: 1; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(20px, env(safe-area-inset-bottom)); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-size: 15px; max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.25); z-index: 10; }
[hidden] { display: none !important; }
