:root { color-scheme: light; --paper:#f5ecd6; --card:#fbf5e4; --ink:#3a2f22; --muted:#8a7a62; --line:#dccfae; --accent:#6b8f3c; --accent-ink:#fff; --warn:#b5532e; --gold:#c79a2e; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 Georgia, "Iowan Old Style", serif; -webkit-tap-highlight-color: transparent; }
a { color: #4d6e24; }
code { background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 4px; font-size: .88em; }
#app { max-width: 760px; margin: 0 auto; padding: 0 14px 28px; }
.topbar { display: flex; gap: 12px; align-items: baseline; padding: 16px 2px 8px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 22px; letter-spacing: .01em; }
.who { font-size: 13px; color: var(--muted); margin-left: auto; }
.save-state { font-size: 12px; color: var(--muted); }
.save-state.err { color: var(--warn); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 10px 0; box-shadow: 0 1px 0 rgba(0,0,0,.03); }
.card h1 { margin: 0 0 8px; font-size: 28px; font-style: italic; }
.card p { margin: 0 0 10px; }
.fine { font-size: 13px; color: var(--muted); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
input[type=text], #handle-input { flex: 1 1 220px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: inherit; color: var(--ink); }
.btn { font: inherit; font-size: 15px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.status { min-height: 1.3em; font-size: 14px; color: var(--muted); }
.status.error { color: var(--warn); }

.dateline { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.manor-name { font-size: 20px; font-weight: 700; }
.date-line { color: var(--ink); }
.weather-line { font-size: 14px; color: var(--muted); font-style: italic; }
.omen-line { font-size: 13px; color: var(--muted); max-width: 260px; }
.omen-line b { color: var(--ink); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 8px; margin: 10px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; }
.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat .v { font-size: 20px; font-weight: 700; }
.meter { height: 5px; border-radius: 3px; background: rgba(0,0,0,.08); margin-top: 3px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); }
.meter.warn i { background: var(--warn); }

.tabs { display: flex; gap: 4px; margin: 12px 0 4px; border-bottom: 1px solid var(--line); }
.tab { font: inherit; background: none; border: none; padding: 8px 14px; cursor: pointer; color: var(--muted); border-bottom: 3px solid transparent; }
.tab.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 700; }

.dice-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-weight: 700; margin-bottom: 8px; }
.push { font-weight: 400; font-size: 13px; color: var(--muted); }
.dice { display: flex; gap: 10px; flex-wrap: wrap; }
.die { width: 54px; height: 54px; border-radius: 12px; border: 2px solid var(--ink); background: #fff; font: 700 26px Georgia, serif; color: var(--ink); cursor: pointer; transition: transform .12s; }
.die:hover:not(:disabled) { transform: translateY(-2px) rotate(-3deg); }
.die.sel { background: var(--gold); border-color: #7a5a10; transform: translateY(-4px); }
.die:disabled { opacity: .3; border-style: dashed; cursor: default; }
.matters { display: grid; gap: 10px; }
.matters .card { margin: 0; }
.m-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.m-title { font-weight: 700; font-size: 17px; }
.chips { display: flex; gap: 6px; font-size: 12px; }
.chip { padding: 1px 8px; border-radius: 999px; background: rgba(0,0,0,.06); color: var(--muted); }
.chip.risk-1 { background: #f2e2b3; color: #7a5a10; }
.chip.risk-2 { background: #f0cdbd; color: #8a3a1a; }
.m-text { margin: 6px 0 8px; }
.preview { font-size: 14px; color: var(--muted); margin: 0 8px 0 0; }
.m-done { border-left: 4px solid var(--accent); }
.m-done.b0 { border-left-color: var(--warn); }
.m-done.b1 { border-left-color: var(--muted); }
.m-done.b3 { border-left-color: var(--gold); }
.band { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.fxline { font-size: 13px; color: var(--muted); }
.result { border-color: var(--gold); background: #fff8e0; }
.sub { margin: 16px 0 6px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.end-row { justify-content: flex-end; margin-top: 16px; }

.imps { display: grid; gap: 10px; }
.imp { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.imp .em { font-size: 28px; }
.imp .nm { font-weight: 700; }
.imp .lv { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 6px; }
.journal { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; }
.journal li { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 15px; }
.journal .jd { font-size: 12px; color: var(--muted); margin-right: 6px; }
.skillrow { display: grid; grid-template-columns: 90px 1fr; gap: 10px; align-items: center; margin: 6px 0; }
.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 999px; font-size: 14px; z-index: 50; max-width: 90vw; text-align: center; }
.foot { margin-top: 26px; font-size: 12px; color: var(--muted); text-align: center; }
@media (max-width: 480px) { .die { width: 48px; height: 48px; } .card h1 { font-size: 24px; } }
