:root { --blue: #1F5999; --bg: #F7F5F0; --line: #D8DCE2; --ink: #1E1E1E; --sub: #5A6270; --hl: #FFE58A; --pro: #B26B00; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Meiryo", sans-serif; color: var(--ink); background: var(--bg); -webkit-text-size-adjust: 100%; display: flex; flex-direction: column; }
button { font: inherit; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 12px; min-height: 40px; color: var(--ink); }
button.pri { background: var(--blue); color: #fff; border-color: var(--blue); font-weight: 700; }
button.ghost { background: transparent; }
button:disabled { opacity: .45; }
#bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top)); background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
#fname { flex: 1; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#btnMenu { width: 44px; font-size: 20px; padding: 0; }

#home { padding: 24px 20px 40px; max-width: 560px; margin: 0 auto; width: 100%; }
#home h1 { font-size: 26px; line-height: 1.35; margin: 8px 0 10px; }
.lead { color: var(--sub); line-height: 1.7; margin: 0 0 20px; }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 2px dashed var(--blue); border-radius: 16px; background: #fff; padding: 34px 10px; cursor: pointer; }
.drop input { display: none; }
.drop .big { font-size: 20px; font-weight: 700; color: var(--blue); }
.drop .sm { color: var(--sub); font-size: 13px; }
#btnDemo { width: 100%; margin-top: 12px; }
.feat { padding-left: 1.2em; line-height: 1.9; color: #333; margin-top: 22px; }
.tip { color: var(--sub); font-size: 13px; }

#viewer { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#tools { display: flex; gap: 8px; padding: 8px 10px; background: #fff; border-bottom: 1px solid var(--line); }
#q { flex: 1; font: inherit; font-size: 16px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
#info { font-size: 12.5px; color: var(--sub); padding: 6px 12px; }
#wrap { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; background: #fff; }
table { border-collapse: separate; border-spacing: 0; font-size: 14px; }
th, td { border-right: 1px solid #E6E9EE; border-bottom: 1px solid #E6E9EE; padding: 8px 10px; max-width: 14em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
thead th { position: sticky; top: 0; background: #EEF3F9; z-index: 2; font-weight: 700; cursor: pointer; user-select: none; }
thead th .arr { color: var(--blue); margin-left: 4px; font-size: 11px; }
th.no, td.no { position: sticky; left: 0; background: #F6F7F9; color: #8A919C; text-align: right; min-width: 3.2em; font-size: 12px; z-index: 1; }
thead th.no { z-index: 3; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:active td { background: #EAF2FF; }
mark { background: var(--hl); color: inherit; padding: 0; }
#sentinel { height: 1px; }
.more { padding: 14px; text-align: center; color: var(--sub); font-size: 13px; }

#shade { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 10; }
#sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 82vh; overflow: auto; background: #fff; border-radius: 18px 18px 0 0; z-index: 11; padding: 6px 16px max(18px, env(safe-area-inset-bottom)); box-shadow: 0 -4px 20px rgba(0,0,0,.15); }
.grip { width: 44px; height: 5px; border-radius: 3px; background: #CDD2D9; margin: 6px auto 10px; }
#sheet h2 { font-size: 18px; margin: 4px 0 12px; }
#sheet h3 { font-size: 14px; margin: 16px 0 6px; color: var(--sub); }
.kv { display: grid; grid-template-columns: minmax(6em, 38%) 1fr; border-top: 1px solid #EEF0F3; }
.kv div { padding: 9px 4px; border-bottom: 1px solid #EEF0F3; word-break: break-all; white-space: pre-wrap; }
.kv .k { color: var(--sub); font-size: 13px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.row > * { flex: 1; }
.list label { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid #EEF0F3; }
.list input[type=checkbox] { width: 20px; height: 20px; }
.list .stat { margin-left: auto; font-size: 13px; color: var(--blue); border: 0; background: none; min-height: 0; padding: 4px 6px; }
.menu button { width: 100%; text-align: left; margin: 4px 0; display: flex; justify-content: space-between; align-items: center; }
.badge { font-size: 11px; color: #fff; background: var(--pro); border-radius: 6px; padding: 2px 6px; }
select { font: inherit; padding: 8px; border-radius: 10px; border: 1px solid var(--line); background: #fff; min-height: 40px; }
.field { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; }
.note { color: var(--sub); font-size: 12.5px; line-height: 1.6; }
.stats td, .stats th { white-space: normal; max-width: none; font-size: 13.5px; }
.stats { width: 100%; }
.bar { display: inline-block; height: 8px; background: #9DB8DA; border-radius: 3px; vertical-align: middle; margin-left: 6px; }
#toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #222; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 20; font-size: 14px; max-width: 90vw; }
