@font-face { font-family: "Pirata One"; src: url("fonts/PirataOne-normal.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "IM Fell English"; src: url("fonts/IMFellEnglish-normal.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "IM Fell English"; font-style: italic; src: url("fonts/IMFellEnglish-italic.woff2") format("woff2"); font-display: swap; }

:root {
  --paper: #f3e7cc;
  --paper-2: #fbf5e6;
  --edge: #c9b48a;
  --ink: #2e1f12;
  --muted: #6b5640;
  --red: #8b1e1a;
  --gold: #a57c1b;
  --shadow: 0 1px 2px rgba(46, 31, 18, .18), 0 6px 18px rgba(46, 31, 18, .12);
  --display: "Pirata One", "IM Fell English", Georgia, serif;
  --fell: "IM Fell English", Georgia, serif;
  --body: Georgia, "Iowan Old Style", "Noto Serif", serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font: 17px/1.55 var(--body);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 250, 235, .9), transparent 60%),
    radial-gradient(ellipse at 50% 120%, rgba(120, 85, 40, .25), transparent 60%),
    var(--paper);
  background-attachment: fixed;
}
.wrap { max-width: 620px; margin: 0 auto; padding: 18px 16px calc(40px + env(safe-area-inset-bottom)); }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-weight: normal; line-height: 1.15; margin: 0; }
.display { font-family: var(--display); letter-spacing: .02em; }

.test-ribbon {
  position: sticky; top: 0; z-index: 10;
  background: var(--red); color: #fff; text-align: center;
  font: 14px/1 var(--fell); letter-spacing: .3em; padding: 7px 0;
}

/* sections */
.section { margin: 30px 0 0; }
.section > h2 {
  font-family: var(--display); font-size: 30px; color: var(--red);
  text-align: center; margin-bottom: 14px;
}
.rule { height: 1px; background: linear-gradient(90deg, transparent, var(--edge), transparent); margin: 26px 0; border: 0; }

/* kit text */
.kit p { margin: 0 0 .7em; }
.kit .h1 { font-family: var(--fell); font-size: 26px; text-align: center; margin: .3em 0 .5em; }
.kit .h2 { font-family: var(--fell); font-size: 21px; margin: 1em 0 .35em; color: var(--red); }
.kit .lg { font-size: 19px; }
.kit.center { text-align: center; }
.kit.small { font-size: 15.5px; color: var(--muted); }

/* invitation */
.cover { width: min(300px, 78%); margin: 4px auto 18px; border-radius: 6px; box-shadow: var(--shadow); }
.details { list-style: none; padding: 0; margin: 18px auto 0; max-width: 420px; }
.details li { display: flex; gap: 12px; padding: 9px 0; border-top: 1px solid var(--edge); }
.details li:last-child { border-bottom: 1px solid var(--edge); }
.details b { font-family: var(--fell); font-weight: normal; color: var(--muted); min-width: 64px; }

/* character cards */
.cards { display: grid; gap: 18px; }
@media (min-width: 640px) { .wrap.wide { max-width: 1000px; } .cards { grid-template-columns: 1fr 1fr; } }
.card {
  background: var(--paper-2); border: 1px solid var(--edge); border-radius: 10px;
  box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column;
}
.card .art { aspect-ratio: 16 / 9; width: 100%; object-fit: cover; background: #e8dab9; }
.card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card .name { font-family: var(--display); font-size: 27px; line-height: 1; }
.card .kit { font-size: 16px; flex: 1; }
.card .kit p:last-child { margin-bottom: 0; }
.card.taken { opacity: .55; }
.card.taken .art { filter: grayscale(.8); }
.card.mine { border-color: var(--red); box-shadow: 0 0 0 2px var(--red), var(--shadow); }
.tag { font: 15px/1.2 var(--fell); color: var(--muted); }
.card.mine .tag { color: var(--red); }

/* buttons and forms */
.btn {
  appearance: none; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--red); color: #fff; font: 18px/1 var(--fell);
  padding: 12px 22px; min-height: 46px;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--edge); }
.btn.small { font-size: 15px; padding: 8px 14px; min-height: 36px; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
input, select {
  font: 17px/1.3 var(--body); color: var(--ink); background: var(--paper-2);
  border: 1px solid var(--edge); border-radius: 8px; padding: 9px 11px; min-height: 42px; width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--gold); outline-offset: 1px; }

/* character page */
.hero { border-radius: 10px; box-shadow: var(--shadow); width: 100%; }
.hero-name { font-family: var(--display); font-size: 42px; text-align: center; margin: 16px 0 2px; }
.who { text-align: center; color: var(--muted); font-family: var(--fell); font-size: 18px; }
.page { background: var(--paper-2); border: 1px solid var(--edge); border-radius: 10px; padding: 18px 18px 8px; box-shadow: var(--shadow); }
.page + .page { margin-top: 16px; }

/* confirm sheet */
.sheet {
  border: 0; border-radius: 14px; padding: 0 0 18px; width: min(420px, 92vw);
  background: var(--paper-2); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
.sheet::backdrop { background: rgba(30, 20, 10, .55); }
.sheet img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.sheet .display { font-size: 30px; text-align: center; margin: 14px 12px; }

.center-msg { text-align: center; margin-top: 30vh; font-family: var(--fell); font-size: 22px; color: var(--muted); }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 999px;
  font: 16px/1.2 var(--fell); z-index: 20;
}

/* game master */
.gm .wrap { max-width: 760px; }
.gm h1 { font-family: var(--display); font-size: 36px; text-align: center; margin: 6px 0 4px; }
.gm .section > h2 { font-size: 26px; text-align: left; }
.panel { background: var(--paper-2); border: 1px solid var(--edge); border-radius: 10px; box-shadow: var(--shadow); }
.guest { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; padding: 12px 14px; border-top: 1px solid var(--edge); }
.guest:first-child { border-top: 0; }
.guest .acts { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.guest .seen { font: 14px/1.2 var(--fell); color: var(--muted); margin-left: auto; }
.form { display: grid; gap: 10px; padding: 14px; }
.form label { display: grid; gap: 4px; font: 15px/1.2 var(--fell); color: var(--muted); }
.switch { display: flex; align-items: center; justify-content: space-between; padding: 14px; font-family: var(--fell); font-size: 19px; }
.switch input { width: 52px; height: 30px; min-height: 0; accent-color: var(--red); }
.pin { max-width: 260px; margin: 22vh auto 0; display: grid; gap: 12px; text-align: center; }
.pin input { text-align: center; font-size: 26px; letter-spacing: .3em; }

/* ---- at the party ---- */
.game { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 5; margin: -18px -16px 6px; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: rgba(46, 31, 18, .94); color: var(--paper);
  font-family: var(--fell); font-size: 18px; backdrop-filter: blur(6px);
}
.topbar .timer { font: 22px/1 var(--display); letter-spacing: .04em; }
.topbar .timer.over { color: #ffb4a8; }
.offline { flex-basis: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #ffd9a0; }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex;
  background: rgba(46, 31, 18, .97); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
}
.tabs button {
  flex: 1; appearance: none; border: 0; background: transparent; color: #d9c7a3;
  font: 16px/1 var(--fell); padding: 12px 2px; border-radius: 8px; min-height: 48px;
}
.tabs button.on { color: #fff; background: rgba(255, 255, 255, .12); }
.btn.big { font-size: 26px; padding: 18px 42px; min-height: 64px; }
textarea {
  font: 17px/1.45 var(--body); color: var(--ink); background: var(--paper-2);
  border: 1px solid var(--edge); border-radius: 8px; padding: 10px 12px; width: 100%; resize: vertical;
}
textarea.notes { min-height: 58vh; }
.page.form { display: grid; gap: 12px; padding-bottom: 18px; }
.page.form label { display: grid; gap: 4px; font: 16px/1.2 var(--fell); color: var(--muted); }
.cardbox { border: 2px solid var(--red); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 14px; }
.chip {
  font: 15px/1 var(--fell); color: var(--ink); text-decoration: none; padding: 7px 11px;
  border: 1px solid var(--edge); border-radius: 999px; background: var(--paper-2);
}
.pageno { text-align: right; font: 14px/1 var(--fell); color: var(--muted); margin-bottom: 4px; }
.page { scroll-margin-top: 64px; }
.speaking {
  margin: 14px 0 0; padding: 12px 16px; border-radius: 10px; background: var(--ink); color: var(--paper);
  display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; font-family: var(--fell); font-size: 18px;
}
.speaking b { font-weight: normal; font-family: var(--display); font-size: 24px; }

/* wanted poster */
.poster {
  position: relative; max-width: 330px; margin: 0 auto; padding: 18px 20px 20px; text-align: center;
  background: radial-gradient(ellipse at 50% 40%, #f6ead0, #e2cfa6 70%, #c9ad7a);
  border-radius: 4px; box-shadow: var(--shadow), inset 0 0 40px rgba(110, 70, 20, .35);
  color: #2a1a0c;
}
.poster .wanted { font: 64px/0.9 var(--display); letter-spacing: .04em; }
.poster .frame { margin: 12px auto 10px; border: 3px solid #2a1a0c; padding: 4px; background: #2a1a0c; }
.poster .frame img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.poster .pname { font: 30px/1 var(--display); }
.poster .pguest { font: 17px/1.3 var(--fell); color: #5a4128; margin-top: 4px; }
.poster .reward { font: 17px/1.2 var(--fell); letter-spacing: .12em; margin-top: 8px; color: #6b3d10; }
.stamp {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%) rotate(-14deg);
  font: 64px/1 var(--display); color: #b3140f; letter-spacing: .06em; padding: 4px 18px;
  border: 6px solid #b3140f; border-radius: 8px; opacity: .88; mix-blend-mode: multiply;
}
.award { margin-top: 26px; }
.award h2 { font-family: var(--display); font-size: 30px; color: var(--red); text-align: center; margin-bottom: 10px; }
.winners { display: grid; gap: 14px; }

/* evidence */
.evgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ev { display: grid; gap: 6px; text-decoration: none; color: var(--ink); font-family: var(--fell); text-align: center; }
.ev img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; box-shadow: var(--shadow); }
.board { display: grid; gap: 12px; }
.clue { background: var(--paper-2); border: 1px solid var(--edge); border-radius: 10px; padding: 12px; box-shadow: var(--shadow); }
.clue img { width: 100%; border-radius: 6px; margin-bottom: 8px; }
.clue p { margin: 0 0 6px; }
.photogrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 14px; }
.photogrid img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.checkin { padding-top: 10px; }
.mugsheet { width: min(460px, 94vw); padding-top: 14px; }
.mug-preview canvas { width: 100%; height: auto; display: block; }
.mug-preview:empty { aspect-ratio: 3 / 4; background: #e8dab9; }
.mugsheet .row { margin-top: 14px; }
/* ---- game master extras ---- */
.panel.show { padding: 16px; display: grid; gap: 14px; margin-top: 14px; }
.show .now { display: flex; justify-content: space-between; align-items: baseline; font: 24px/1.1 var(--display); }
.show .now .timer { font-size: 30px; }
.show .now .timer.over { color: var(--red); }
.btn.huge { font-size: 26px; min-height: 76px; width: 100%; border-radius: 14px; }
.statements { display: grid; gap: 10px; }
.statements .speaking { margin: 0; }
label.killer { display: grid; gap: 4px; font: 16px/1.2 var(--fell); color: var(--muted); }
details.fold { margin-top: 18px; }
details.fold > summary {
  cursor: pointer; list-style: none; font: 24px/1.2 var(--display); color: var(--red);
  padding: 8px 2px; border-bottom: 1px solid var(--edge);
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: " +"; color: var(--muted); }
details.fold[open] > summary::after { content: " -"; }
details.fold > .panel, details.fold > .page { margin-top: 10px; }
.thumb { width: 100%; max-height: 120px; object-fit: cover; border-radius: 6px; }
.linkrow { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--edge); }
.linkrow:first-child { border-top: 0; }
.linkrow > span { flex: 1; font-family: var(--fell); }
.ph { position: relative; }
.ph button { position: absolute; right: 4px; bottom: 4px; }
label.here { display: flex; align-items: center; gap: 6px; font: 16px/1 var(--fell); }
label.here input { width: 22px; height: 22px; min-height: 0; }
.panel.form { padding: 14px; display: grid; gap: 10px; }
.viewer { position: fixed; inset: 0; z-index: 30; background: rgba(20, 12, 6, .94); display: grid; place-items: center; overflow: auto; }
.viewer img { max-width: 100%; max-height: 100%; touch-action: pinch-zoom; }
.poster .frame.wide img { aspect-ratio: 16 / 9; }
