:root {
  --paper: #fbfaf7;
  --ink: #1c1c1a;
  --muted: #6f6e68;
  --rule: #e2dfd7;
  --link: #1f56a3;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --st: env(safe-area-inset-top, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
  --sl: env(safe-area-inset-left, 0px);
  --sr: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: rgba(0,0,0,.05); }
html, body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.45 var(--sans); }
body { -webkit-text-size-adjust: 100%; touch-action: manipulation; }
a { color: var(--link); text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
[hidden] { display: none !important; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 calc(20px + var(--sr)) 0 calc(20px + var(--sl)); }

/* masthead */
.mast { padding-top: calc(18px + var(--st)); border-bottom: 1px solid var(--ink); }
.mast-row { display: flex; align-items: flex-end; gap: 20px; padding-bottom: 12px; }
.brand { font: 700 32px/1 var(--serif); color: var(--ink); letter-spacing: -.3px; white-space: nowrap; }
.search { margin-left: auto; flex: 0 1 320px; }
.search input { width: 100%; height: 40px; padding: 0 12px; font: inherit; font-size: 16px; color: var(--ink); background: #fff; border: 1px solid #cfccc3; border-radius: 4px; outline: none; -webkit-appearance: none; }
.search input:focus { border-color: var(--ink); }
.nav { display: flex; gap: 2px 18px; flex-wrap: wrap; padding: 4px 0 10px; font-size: 15px; }
.nav a { color: var(--muted); padding: 4px 0; white-space: nowrap; }
.nav a.on { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--ink); }
.nav .n { font-size: 12px; margin-left: 3px; }
.tools { display: flex; align-items: center; gap: 16px; padding: 10px 0; font-size: 14px; color: var(--muted); border-bottom: 1px solid var(--rule); }
.tools a { color: var(--muted); }
.tools a:hover { color: var(--ink); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; -webkit-user-select: none; margin-left: auto; }
.switch input { appearance: none; -webkit-appearance: none; width: 38px; height: 22px; border-radius: 11px; background: #cfccc3; position: relative; margin: 0; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--ink); }
.switch input:checked::after { transform: translateX(16px); }

/* sections */
section { padding: 22px 0 6px; }
h1, h2 { font-family: var(--serif); font-weight: 700; letter-spacing: -.2px; }
h1 { font-size: 28px; margin: 22px 0 4px; }
h2 { font-size: 22px; margin: 0 0 12px; display: flex; align-items: baseline; gap: 10px; }
h2 small, h1 + .count { font: 400 14px var(--sans); color: var(--muted); }
h2 a.more { margin-left: auto; font: 400 14px var(--sans); }
.count { margin: 0 0 14px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px 16px; }
.card { display: block; color: var(--ink); min-width: 0; }
.pic { display: block; position: relative; aspect-ratio: 4 / 3; background: #ece9e1; border: 1px solid var(--rule); border-radius: 3px; overflow: hidden; }
.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .name { display: block; margin-top: 6px; font-size: 15px; font-weight: 600; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .sub { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card:active .pic { opacity: .8; }
@media (hover: hover) { .card:hover .name { text-decoration: underline; } }
.lc { position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 10px; font: 700 17px/1.15 var(--serif); color: #fff; background: hsl(var(--h, 210), 32%, 38%); }
.feature { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.feature .card .name { font-size: 16px; }
.empty { padding: 40px 0; color: var(--muted); }
.foot { margin: 40px 0 0; padding: 18px 0 calc(30px + var(--sb)); border-top: 1px solid var(--rule); font-size: 13px; color: var(--muted); }
.foot a { color: var(--muted); text-decoration: underline; }
@media (max-width: 700px) {
  .mast-row { flex-wrap: wrap; }
  .search { flex: 1 1 100%; margin: 0; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px 12px; }
  .feature { grid-template-columns: repeat(2, 1fr); }
}

/* play page */
body.play { position: fixed; inset: 0; display: flex; flex-direction: column; overflow: hidden; overscroll-behavior: none; }
.bar { flex: none; display: flex; align-items: center; gap: 4px; height: calc(48px + var(--st)); padding: var(--st) calc(8px + var(--sr)) 0 calc(8px + var(--sl)); background: var(--paper); border-bottom: 1px solid #cfccc3; font-size: 15px; }
.bar .home { font: 700 18px var(--serif); color: var(--ink); padding: 0 10px 0 6px; white-space: nowrap; }
.bar .title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.bar .title b { color: var(--ink); font-weight: 600; }
.tb { height: 36px; padding: 0 10px; border: 0; border-radius: 4px; background: none; color: var(--ink); white-space: nowrap; }
.tb:active { background: #ece9e1; }
.tb.on { font-weight: 700; }
.stage { position: relative; flex: 1; min-height: 0; background: #111; }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #111; }
.stage .wait { position: absolute; inset: 0; display: grid; place-items: center; color: #aaa; font-size: 15px; pointer-events: none; transition: opacity .3s; }
.stage .wait.gone { opacity: 0; }
.panel { position: fixed; top: calc(48px + var(--st)); right: 0; bottom: 0; width: min(380px, 100%); z-index: 20; background: var(--paper); border-left: 1px solid #cfccc3; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 16px calc(18px + var(--sr)) calc(24px + var(--sb)) 18px; }
.panel h3 { font: 700 22px var(--serif); margin: 0 0 8px; }
.panel p { margin: 8px 0; color: #45443f; font-size: 15px; }
.panel .meta { font-size: 13px; color: var(--muted); }
.panel h4 { font: 700 16px var(--serif); margin: 20px 0 10px; }
.panel .grid { grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.adnote { font-size: 13px; background: #f3efe4; border: 1px solid var(--rule); padding: 8px 10px; border-radius: 3px; color: #5b584f; }

/* credits */
.credits table { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 20px; }
.credits td, .credits th { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.credits th { font-weight: 600; color: var(--muted); }
