:root {
  --green: #0f6b4a;
  --green-dark: #0a523a;
  --ink: #111827;
  --muted: #4b5263;
  --line: #e5e1d8;
  --bg: #faf8f4;
  --card: #ffffff;
  --red: #a23b12;
  --amber: #8a5a00;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; }
a { color: var(--green); }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .92em; }
h1 { font-size: 1.6rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.2rem; margin: 2rem 0 .6rem; }

.top { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1.6rem; padding: .7rem 1.2rem; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--ink); text-decoration: none; }
.nav { display: flex; flex-wrap: wrap; gap: .2rem; }
.nav a { padding: .35rem .7rem; border-radius: 8px; text-decoration: none; color: var(--muted); }
.nav a[aria-current="page"] { background: #e7f2ed; color: var(--green-dark); font-weight: 600; }
.me { margin-left: auto; display: flex; align-items: center; gap: 1rem; font-size: .92rem; color: var(--muted); }
.codes.warn { color: var(--red); font-weight: 600; }
form.inline { display: inline; margin: 0; }

main { padding: 1.2rem; margin: 0 auto; }
main.wide { max-width: 1280px; }
main.narrow { max-width: 520px; padding-top: 2.5rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.2rem; margin: 0 0 1rem; }
.form { display: flex; flex-direction: column; gap: .4rem; }
.form label { font-weight: 600; margin-top: .4rem; }
input[type="email"], input[type="password"], input[type="text"], input[type="date"], select {
  font: inherit; padding: .5rem .6rem; border: 1px solid #c9c4b8; border-radius: 8px; background: #fff; color: var(--ink);
}
button, .button { font: inherit; font-weight: 600; padding: .55rem 1rem; border: 0; border-radius: 8px; background: var(--green); color: #fff; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .button:hover { background: var(--green-dark); }
button.secondary { background: #e7f2ed; color: var(--green-dark); }
button.link { background: none; color: var(--green); padding: 0; font-weight: 500; text-decoration: underline; }
.button.small { padding: .25rem .6rem; font-size: .9rem; }
.form button { margin-top: .8rem; }
label.check { display: flex; align-items: center; gap: .4rem; font-weight: 500; }
:focus-visible { outline: 3px solid #f2b33d; outline-offset: 2px; }

.msg { padding: .6rem .9rem; border-radius: 8px; margin: 0 0 1rem; }
.msg.info { background: #e7f2ed; color: var(--green-dark); }
.msg.error { background: #fbe9e1; color: var(--red); }
.sub { color: var(--muted); font-size: .9rem; }
.tag { display: inline-block; font-size: .75rem; padding: .05rem .45rem; border-radius: 99px; background: #fff3d6; color: var(--amber); font-weight: 600; }

.setup .qr svg { width: 220px; height: 220px; display: block; margin: 0 auto; background: #fff; }
.secret { font-size: 1.05rem; letter-spacing: .05em; word-break: break-all; }
.codes-list { columns: 2; font-size: 1.1rem; padding-left: 1.6rem; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }

.period { display: flex; flex-wrap: wrap; align-items: end; gap: .6rem 1rem; }
.period label { display: flex; flex-direction: column; font-size: .85rem; color: var(--muted); }
.period .quick { display: flex; gap: .8rem; margin-left: auto; }
.period-label { color: var(--muted); margin: -.4rem 0 1rem; }
.inline-form { display: flex; flex-wrap: wrap; align-items: end; gap: .6rem 1rem; margin: 0 0 1rem; }
.inline-form label { display: flex; flex-direction: column; font-size: .85rem; color: var(--muted); }

.stats { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .7rem 1.1rem; display: flex; flex-direction: column; }
.stat .num { font-size: 1.6rem; font-weight: 700; }
.stat .lbl { color: var(--muted); font-size: .9rem; }
.explain { margin-bottom: 1rem; color: var(--muted); }

.chart { margin: 0 0 1.2rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .6rem; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--green); }
.chart .bar.partial { fill: #7fb69f; }
.chart .bar:hover { fill: var(--green-dark); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .tick { font-size: 11px; fill: var(--muted); }
.chart figcaption { font-size: .85rem; color: var(--muted); text-align: center; }

table.data { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 1.2rem; }
table.data caption { caption-side: top; text-align: left; color: var(--muted); padding: 0 0 .4rem; font-size: .9rem; }
table.data th, table.data td { padding: .45rem .7rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.data th { background: #f3f0e9; font-size: .85rem; color: var(--muted); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tr.partial td, table.data tr.other td { color: var(--muted); }
table.data tr.selected td { background: #e7f2ed; }
table.data tr.now td { background: #fff3d6; }
.url { word-break: break-all; }
.pager { display: flex; gap: 1.2rem; align-items: center; margin: .6rem 0 1rem; }
dl.meta { display: grid; grid-template-columns: max-content 1fr; gap: .2rem 1rem; margin: 0 0 1rem; }
dl.meta dt { color: var(--muted); }
dl.meta dd { margin: 0; }

.player .controls { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin-bottom: .8rem; }
.player .controls label { display: flex; align-items: center; gap: .4rem; }
#rp-seek { flex: 1 1 240px; }
.time { font-variant-numeric: tabular-nums; color: var(--muted); }
.stage-wrap { position: relative; overflow: hidden; background: #e9e6df; border-radius: 8px; }
.stage { position: absolute; left: 0; top: 0; overflow: hidden; background: #fff; transform-origin: 0 0; box-shadow: 0 0 0 1px #c9c4b8; }
.stage iframe { position: absolute; left: 0; top: 0; border: 0; pointer-events: none; transform-origin: 0 0; background: #fff; }
.cursor { position: absolute; left: 0; top: 0; width: 18px; height: 18px; margin: -2px 0 0 -2px; pointer-events: none; z-index: 3;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M2 1l13 7-6 1.5L6 16z' fill='%23111827' stroke='%23fff' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat; }
.click { position: absolute; width: 36px; height: 36px; margin: -18px 0 0 -18px; border-radius: 50%; border: 3px solid #e4572e; background: rgba(228, 87, 46, .25); pointer-events: none; z-index: 2; animation: ck-click .7s ease-out forwards; }
@keyframes ck-click { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }

@media (max-width: 720px) {
  .me { margin-left: 0; width: 100%; justify-content: space-between; }
  .period .quick { margin-left: 0; }
  table.data { display: block; overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) { .click { animation-duration: .01s; } }
