:root {
  --navy: #2673F2; --gold: #c9a84c; --bg: #f6f6f4; --card: #fff; --border: #d8d8d8; --mid: #555; --dark: #1a1a1a;
  --green: #2d7d46; --amber: #c27a00; --red: #b02a37; --faint: #888; --shadow: 0 2px 12px rgba(0,0,0,.06); --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Hiragino Sans", "Noto Sans JP", "Helvetica Neue", sans-serif; background: var(--bg); color: var(--dark); line-height: 1.45; -webkit-font-smoothing: antialiased; padding-bottom: env(safe-area-inset-bottom); }
a { color: var(--navy); text-decoration: none; }
header.topbar { background: var(--navy); color: #fff; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; gap: 10px; }
header.topbar .brand { color: var(--gold); font-weight: 700; font-size: 13px; letter-spacing: .06em; white-space: nowrap; }
header.topbar a { color: #fff; }
header.topbar .left, header.topbar .right { display: flex; gap: 14px; align-items: center; min-width: 0; }
header.topbar .topnav a { font-size: 13px; opacity: .85; border-bottom: 2px solid transparent; padding: 2px 0; }
header.topbar .topnav a[aria-current="page"] { opacity: 1; font-weight: 600; border-bottom-color: var(--gold); }
header.topbar .who { font-size: 12px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
main { max-width: 760px; margin: 0 auto; padding: 14px 14px 40px; }
h1 { font-size: 20px; margin: 6px 0 12px; }
h2 { font-size: 15px; margin: 18px 0 8px; color: var(--mid); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.card.tap { cursor: pointer; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 160px; }
label { display: block; font-size: 12px; color: var(--mid); margin-bottom: 4px; }
input, select, textarea { width: 100%; font-size: 16px; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; font-family: inherit; color: var(--dark); }
textarea { min-height: 90px; resize: vertical; }
input[type=checkbox] { width: auto; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 18px; border-radius: 12px; border: 1px solid var(--navy); background: var(--navy); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit; text-decoration: none; line-height: 1.2; }
.btn.secondary { background: #fff; color: var(--navy); }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--mid); }
.btn.danger { background: #fff; border-color: var(--red); color: var(--red); }
.btn.big { width: 100%; padding: 16px; font-size: 17px; }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.muted { color: var(--mid); font-size: 13px; }
.faint { color: var(--faint); font-size: 12px; }
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #eee; color: var(--mid); font-weight: 600; vertical-align: middle; }
.badge.draft { background: #fff3d6; color: var(--amber); }
.badge.submitted { background: #e2f3e7; color: var(--green); }
.badge.watched { background: #e6efff; color: var(--navy); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 9px 13px; border-radius: 999px; border: 1px solid var(--border); background: #fff; font-size: 14px; cursor: pointer; user-select: none; }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photo { position: relative; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; }
.photo img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: #eee; }
.photo .meta { padding: 6px; display: flex; flex-direction: column; gap: 5px; }
.photo select, .photo input { font-size: 13px; padding: 6px 8px; border-radius: 8px; }
.photo .x { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; border: 0; font-size: 16px; cursor: pointer; line-height: 1; }
.photo .n { position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 999px; }
.list .item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--border); }
.list .item:first-child { border-top: 0; }
.list .item .t { font-weight: 600; }
.list .item .s { font-size: 12px; color: var(--mid); }
.bar { height: 8px; border-radius: 999px; background: #e6e6e6; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--green); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1a1a1a; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 50; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 90vw; }
.toast.err { background: var(--red); }
.savestate { font-size: 12px; color: var(--faint); text-align: right; min-height: 16px; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 14px 0 6px; display: flex; gap: 10px; }
.sticky-actions .btn { flex: 1; }
pre.msg { white-space: pre-wrap; font-family: inherit; font-size: 13px; background: #f3f3f3; border-radius: 10px; padding: 12px; margin: 8px 0; }
.err-box { background: #fdecee; color: var(--red); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 8px 0; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; font-size: 14px; }
.kv b { color: var(--mid); font-weight: 500; }
.login { max-width: 380px; margin: 60px auto; }
.center { text-align: center; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
@media (max-width: 480px) { .kv { grid-template-columns: 90px 1fr; } header.topbar .topnav a { font-size: 12px; } }
