* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif; color: #0f172a; background: #f7f5f0; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: #64748b; }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.hide-m { }
@media (max-width: 700px) { .hide-m { display: none; } }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; background: #fff; border-bottom: 1px solid #e8e4dc; position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand small { display: block; color: #64748b; font-size: 12px; }
.logo { width: 34px; height: 34px; border-radius: 10px; background: #0284c7; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }
.who { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

main { max-width: 1240px; margin: 0 auto; padding: 18px 16px 60px; }
.card { background: #fff; border: 1px solid #e8e4dc; border-radius: 16px; padding: 16px 18px; margin-bottom: 14px; }
.card.narrow { max-width: 440px; margin: 40px auto; }
h2 { margin: 0 0 6px; font-size: 20px; }
h3 { margin: 0 0 8px; font-size: 15px; }
h4 { margin: 16px 0 6px; font-size: 13px; }

.btn { border: 1px solid #cbd5e1; background: #fff; border-radius: 10px; padding: 7px 14px; cursor: pointer; font-size: 13px; }
.btn:hover:not(:disabled) { background: #f1f5f9; }
.btn.primary { background: #0284c7; border-color: #0284c7; color: #fff; }
.btn.primary:hover:not(:disabled) { background: #0369a1; }
.btn.ok { background: #047857; border-color: #047857; color: #fff; }
.btn.danger { color: #b91c1c; border-color: #fecaca; }
.btn.ghost { border-color: transparent; }
.btn.block { width: 100%; margin-top: 10px; padding: 10px; }
.btn:disabled { opacity: .45; cursor: default; }
.lnk { border: 0; background: none; color: #0284c7; cursor: pointer; padding: 4px 0; }
.links { display: flex; justify-content: space-between; margin-top: 12px; }
label.f { display: block; margin-top: 10px; font-size: 12px; color: #475569; }
label.f input, label.f select, label.f textarea { display: block; width: 100%; margin-top: 4px; }
input, select, textarea { border: 1px solid #cbd5e1; border-radius: 10px; padding: 8px 10px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #0284c7; box-shadow: 0 0 0 3px rgba(2,132,199,.15); }
.code-in { font-size: 22px; letter-spacing: 6px; text-align: center; }
.qr { display: flex; justify-content: center; margin: 10px 0; }
.secret { text-align: center; font-family: ui-monospace, monospace; background: #f1f5f9; border-radius: 8px; padding: 6px; }
.msg { border-radius: 10px; padding: 8px 12px; margin: 10px 0; font-size: 13px; }
.msg.err { background: #fef2f2; color: #991b1b; }
.msg.ok { background: #ecfdf5; color: #065f46; }
.msg.info { background: #eff6ff; color: #1e40af; }

.bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sp { flex: 1; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab { border: 1px solid #e6e1d6; background: #fff; border-radius: 999px; padding: 6px 16px; cursor: pointer; }
.tab.on { background: #0284c7; color: #fff; border-color: #0284c7; }
.tab .n { display: inline-block; margin-left: 6px; min-width: 18px; padding: 0 6px; border-radius: 999px; background: #ef4444; color: #fff; font-size: 11px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid #e2e8f0; background: #fff; border-radius: 999px; padding: 3px 12px; cursor: pointer; font-size: 12px; }
.chip.on { border-color: #0284c7; color: #0284c7; font-weight: 700; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; color: #64748b; font-weight: 600; padding: 6px 8px; border-bottom: 1px solid #e2e8f0; white-space: nowrap; }
td { padding: 8px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
tr.pick { cursor: pointer; }
tr.pick:hover td { background: #f8fafc; }
.thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: #f1f5f9; display: block; }
.pill { display: inline-block; border-radius: 999px; padding: 1px 10px; font-size: 11px; font-weight: 700; color: #fff; white-space: nowrap; }
.grade { display: inline-block; border-radius: 6px; padding: 0 7px; font-size: 12px; font-weight: 700; border: 1px solid currentColor; }
.empty { text-align: center; color: #94a3b8; padding: 24px 0; }

.modal { position: fixed; inset: 0; background: rgba(15,23,42,.35); display: flex; align-items: flex-start; justify-content: center; z-index: 50; overflow: auto; padding: 30px 12px; }
.modal[hidden] { display: none; }
.sheet { background: #fff; border-radius: 16px; width: 100%; max-width: 860px; padding: 20px 22px; position: relative; }
.sheet .x { position: absolute; right: 12px; top: 8px; border: 0; background: none; font-size: 26px; cursor: pointer; color: #64748b; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photo { border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; }
.photo img { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; cursor: zoom-in; }
.photo .cap { font-size: 11px; padding: 4px 8px; color: #475569; display: flex; justify-content: space-between; }
.ai { background: #f8fafc; border-radius: 12px; padding: 12px 14px; }
.ai ul { margin: 6px 0 0 18px; padding: 0; }
.decide { background: #fff7ed; border: 1px solid #fed7aa; border-radius: 12px; padding: 12px 14px; margin-top: 12px; }
.ev { font-size: 12px; border-left: 2px solid #e2e8f0; padding: 2px 0 8px 10px; margin-left: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
@media (max-width: 700px) { .grid2 { grid-template-columns: 1fr; } }
.slider { width: 100%; }
.scale { display: flex; justify-content: space-between; font-size: 11px; color: #94a3b8; }
.note { background: #f1f5f9; border-radius: 10px; padding: 8px 12px; font-size: 13px; margin-top: 8px; }
.rules-layout { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 900px) { .rules-layout { grid-template-columns: 1fr; } }
.chat { display: flex; flex-direction: column; height: 520px; }
.chat .log { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 2px; }
.bubble { max-width: 85%; border-radius: 12px; padding: 8px 12px; white-space: pre-wrap; }
.bubble.me { align-self: flex-end; background: #0284c7; color: #fff; }
.bubble.bot { align-self: flex-start; background: #f1f5f9; }
.proposal { border: 1px solid #bae6fd; background: #f0f9ff; border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.chat form { display: flex; gap: 8px; margin-top: 8px; }
.chat form input { flex: 1; }

.dlg { position: fixed; inset: 0; background: rgba(15,23,42,.35); display: flex; align-items: center; justify-content: center; z-index: 90; padding: 16px; }
.dlg[hidden] { display: none; }
.dlg-card { background: #fff; border-radius: 16px; border: 1px solid #e8e4dc; width: 100%; max-width: 420px; padding: 18px 20px; }
.dlg-title { font-size: 17px; font-weight: 800; }
.dlg-body { color: #64748b; font-size: 13.5px; margin-top: 6px; }
.dlg-card input { width: 100%; margin-top: 12px; }
.dlg-acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.dlg-acts .btn.danger-fill { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: #0f172a; color: #fff; padding: 9px 16px; border-radius: 10px; z-index: 100; font-size: 13px; }
.toast.err { background: #b91c1c; }
.toast[hidden] { display: none; }
