/* Shinoble: a lord's compound by night. Washi paper and ink at dusk (light), indigo night and lantern light (dark).
   The board is drawn on a canvas; its colours are the --c-* tokens below (game.js reads them). house.css loads first. */
@font-face { font-family: "Young Serif"; font-display: swap; src: url(../fonts/young-serif-latin-400-normal.woff2) format("woff2"); }

:root {
  --bg: #EFE8DC; --panel: #FBF7F0; --panel-2: #EDE4D5; --line: #DCCFBA; --text: #1F2233; --muted: #6E6A72;
  --accent: #C8323C; --accent-ink: #FFFFFF; --gold: #B8862F; --indigo: #2E3A6B;
  --display: "Young Serif", Georgia, serif;
  --sky: radial-gradient(120% 80% at 50% 0%, rgba(255, 236, 205, .9), transparent 65%), linear-gradient(#F6EEDF, #E9DCC6);
  /* the board */
  --c-floor: #D9CCB4; --c-floor-2: #D2C4AA; --c-floor-line: rgba(90, 70, 40, .16);
  --c-tatami: #CFC58F; --c-tatami-line: rgba(90, 80, 30, .3);
  --c-slab: #A8977B; --c-slab-2: #8D7C62;
  --c-wall-top: #F4EEE2; --c-wall-l: #E2D8C6; --c-wall-r: #CFC3AE; --c-cap: #3E4253; --c-cap-2: #2C2F3D;
  --c-roof-top: #4C5468; --c-roof-l: #8E7A62; --c-roof-r: #786652; --c-roof-line: rgba(255, 255, 255, .12); --c-ridge: #2B3040;
  --c-water: #7FB3BF; --c-water-2: #5E98A8; --c-water-hi: rgba(255, 255, 255, .55);
  --c-grass: #6E9A4E; --c-grass-2: #4F7A36; --c-grass-hi: #9CC26E;
  --c-dark: rgba(30, 35, 70, .17); --c-lit: rgba(255, 196, 92, .40); --c-lit-core: rgba(255, 214, 140, .55);
  --c-cone: rgba(214, 48, 58, .42); --c-cone-edge: rgba(180, 28, 40, .75); --c-next: rgba(200, 40, 50, .7);
  --c-ninja: #262A3D; --c-ninja-2: #3A3F58; --c-scarf: #D2353F; --c-eye: #F6E9C8;
  --c-guard: #33417A; --c-guard-2: #24305E; --c-hat: #3B3B44; --c-spear: #8A6A3E; --c-tip: #D8D8E0;
  --c-ronin: #6B4A3A; --c-ronin-2: #503628; --c-straw: #D8B865;
  --c-lord: #7D3C8C; --c-lord-2: #5C2A69; --c-eboshi: #1B1B22;
  --c-servant: #D9C9A3; --c-servant-2: #B9A57C;
  --c-scroll: #F3E6C2; --c-scroll-rod: #8B2F2F; --c-glow: rgba(255, 210, 110, .55);
  --c-gate: #B5342F; --c-gate-2: #8E2724;
  --c-target: rgba(46, 58, 107, .85); --c-target-fill: rgba(46, 58, 107, .14);
  --c-move: rgba(31, 34, 51, .16);
  --c-smoke: 236, 232, 226; --c-shadow: rgba(30, 20, 10, .28);
  --c-lantern: #9C958A; --c-lantern-2: #7D766B; --c-flame: #FFB547;
  --c-vent: #4A4A50; --c-vent-bar: #8C8C94;
  --c-key: #C9952E; --c-door: #7A5534; --c-door-2: #5E3F25;
  --c-body: #6A6F86;
  --h-bg: var(--panel-2); --h-panel: var(--panel); --h-panel2: var(--panel-2); --h-line: var(--line); --h-text: var(--text); --h-muted: var(--muted);
  --h-serif: var(--display);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0E1220; --panel: #171C2E; --panel-2: #1F2539; --line: #2C3350; --text: #EDE8DD; --muted: #9AA0B8;
  --accent: #FF5A63; --accent-ink: #12060A; --gold: #E2B25A; --indigo: #9FB0F0;
  --sky: radial-gradient(90% 60% at 80% 0%, rgba(160, 180, 255, .16), transparent 60%), linear-gradient(#141A2E, #0B0F1B);
  --c-floor: #2B3149; --c-floor-2: #283046; --c-floor-line: rgba(0, 0, 0, .25);
  --c-tatami: #3A3D3A; --c-tatami-line: rgba(0, 0, 0, .35);
  --c-slab: #1A1F31; --c-slab-2: #121626;
  --c-wall-top: #5D6584; --c-wall-l: #464D69; --c-wall-r: #3A4059; --c-cap: #1B1F2E; --c-cap-2: #111420;
  --c-roof-top: #232A42; --c-roof-l: #3B3446; --c-roof-r: #2F2939; --c-roof-line: rgba(160, 180, 255, .1); --c-ridge: #12162A;
  --c-water: #1F3A55; --c-water-2: #183048; --c-water-hi: rgba(180, 210, 255, .35);
  --c-grass: #2F4A35; --c-grass-2: #223829; --c-grass-hi: #4E7254;
  --c-dark: rgba(4, 6, 16, .30); --c-lit: rgba(255, 170, 70, .34); --c-lit-core: rgba(255, 196, 110, .5);
  --c-cone: rgba(255, 70, 80, .40); --c-cone-edge: rgba(255, 110, 120, .8); --c-next: rgba(255, 110, 120, .8);
  --c-ninja: #0C0E18; --c-ninja-2: #262B42; --c-scarf: #FF4D57; --c-eye: #FFE7B0;
  --c-guard: #4A5CA8; --c-guard-2: #33437F; --c-hat: #222430; --c-spear: #9C7A4A; --c-tip: #E8E8F2;
  --c-ronin: #7E5A47; --c-ronin-2: #5C3F30; --c-straw: #C9A954;
  --c-lord: #9450A6; --c-lord-2: #6B3479; --c-eboshi: #0B0B10;
  --c-servant: #BDAE8A; --c-servant-2: #9C8D6A;
  --c-scroll: #F3E6C2; --c-scroll-rod: #B33E3E; --c-glow: rgba(255, 200, 100, .5);
  --c-gate: #D9443C; --c-gate-2: #A3312C;
  --c-target: rgba(190, 205, 255, .9); --c-target-fill: rgba(160, 180, 255, .16);
  --c-move: rgba(220, 230, 255, .14);
  --c-smoke: 150, 158, 180; --c-shadow: rgba(0, 0, 0, .45);
  --c-lantern: #6F6B66; --c-lantern-2: #55514D; --c-flame: #FFB547;
  --c-vent: #15161C; --c-vent-bar: #5C5E6A;
  --c-key: #E2B25A; --c-door: #5E412A; --c-door-2: #47301E;
  --c-body: #5A607C;
  --h-on: #0E1220;
  --h-bg: var(--panel-2); --h-panel: var(--panel); --h-panel2: var(--panel-2); --h-line: var(--line); --h-text: var(--text); --h-muted: var(--muted);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--h-sans); line-height: 1.45; min-height: 100vh; min-height: 100dvh; overflow-x: hidden; }
a { color: inherit; }
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.layout { max-width: 600px; margin: 0 auto; padding: 0 16px; }
#sn-fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }

/* header */
.hbrand .logo { font-family: var(--display); font-weight: 400; font-size: 30px; letter-spacing: -.01em; }
.hbrand .logo .mark { width: 30px; height: 30px; flex: none; overflow: visible; }
.mark .m-moon { fill: var(--gold); opacity: .85; }
.mark .m-hood { fill: var(--c-ninja); }
.mark .m-tail { fill: var(--c-scarf); }
.mark .m-band { fill: var(--c-eye); }
.mark .m-eye { fill: var(--c-ninja); }
:root[data-theme="dark"] .mark .m-hood { fill: #2B3252; stroke: #7682B8; stroke-width: 1; }
:root[data-theme="dark"] .mark .m-eye { fill: #12152A; }
.dayline { margin: 0 0 8px; color: var(--muted); font-size: .95rem; }
@media (max-width: 440px) { .hbrand .logo { font-size: 24px; gap: 5px; } .hbrand .logo .mark { width: 22px; height: 22px; } .hbar { gap: 6px; } }
@media (max-width: 380px) { .hbrand .logo { font-size: 21px; } .hicons { gap: 4px; } .hicon { width: 32px; height: 32px; } }

/* scoreboard */
.scoreboard { display: grid; grid-template-columns: 1fr 1.7fr 1fr; gap: 8px; margin-bottom: 8px; }
.sb { position: relative; height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 14px;
  background: linear-gradient(var(--panel), var(--panel-2)); border: 1px solid var(--line); box-shadow: 0 6px 16px -12px rgba(20, 20, 40, .5); }
.sb-k { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); font-weight: 700; line-height: 1; }
.sb b { font: 400 1.4rem/1.1 var(--display); font-variant-numeric: tabular-nums; margin-top: 3px; }
.sb b.over { color: var(--accent); }
.sb b.bump { animation: bump .3s var(--h-spring); }
@keyframes bump { 40% { transform: scale(1.28); } }
.job { display: flex; align-items: center; gap: 6px; margin-top: 5px; font-weight: 700; font-size: .86rem; white-space: nowrap; }
.job svg { width: 18px; height: 18px; flex: none; }
/* "Lord down: to the gate" ran past its box on narrow phones */
@media (max-width: 400px) { .scoreboard { grid-template-columns: .75fr 2.5fr .75fr; } .job { font-size: .8rem; gap: 5px; } }
.job .j-done { color: var(--gold); }
.job .ck { fill: none; stroke: var(--gold); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.job .sc-p { fill: var(--c-scroll); stroke: var(--c-scroll-rod); stroke-width: 1.2; }
.job .sc-r { fill: var(--c-scroll-rod); }
.job .lo-b { fill: var(--c-lord); } .job .lo-h { fill: var(--c-eboshi); } .job .lo-f { fill: #F1D7B6; }
.job .gt-p { fill: var(--c-gate); }

/* the stage */
.stage { position: relative; border-radius: 20px; overflow: hidden; background: var(--sky);
  box-shadow: 0 0 0 1px var(--line), 0 22px 40px -26px rgba(20, 20, 50, .6); }
.stage.shake { animation: shake .3s ease-out; }
@keyframes shake { 20% { transform: translate(-4px, 1px); } 45% { transform: translate(4px, -1px); } 70% { transform: translate(-2px, 0); } }
#board { display: block; width: 100%; touch-action: manipulation; cursor: pointer; }
.caught { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); background: var(--accent); color: var(--accent-ink); border-radius: 12px;
  padding: 5px 12px 6px; text-align: center; box-shadow: 0 10px 24px -10px rgba(120, 0, 10, .6); animation: drop .35s var(--h-spring); pointer-events: none; white-space: nowrap; }
.caught b { display: block; font: 400 .98rem/1.2 var(--display); }
.caught span { font-size: .72rem; font-weight: 600; opacity: .92; }
@keyframes drop { from { transform: translate(-50%, -14px); opacity: 0; } }
.msg { color: var(--muted); font-size: .86rem; text-align: center; margin: 0; height: 2.7em; line-height: 1.3; display: flex; align-items: center; justify-content: center; padding: 0 8px; }
.msg.two { height: 5.4em; }   /* a day that introduces two things at once */
.msg.hot { color: var(--accent); font-weight: 700; }

/* gadgets and the vent */
.kit { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; min-height: 0; }
.kit:empty { display: none; }
.gad { position: relative; height: 46px; min-width: 0; flex: 1 1 0; max-width: 150px; display: flex; align-items: center; gap: 7px; padding: 0 10px 0 8px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 700; font-size: .84rem; transition: transform .15s, background .2s, border-color .2s; text-align: left; }
.gad svg { width: 26px; height: 26px; flex: none; }
.gad .nm { line-height: 1.05; overflow: hidden; text-overflow: ellipsis; }
.gad .ct { position: absolute; right: 6px; bottom: 3px; font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.gad .key { position: absolute; left: 5px; top: 3px; font-size: .6rem; color: var(--muted); opacity: .7; }
.gad:not(:disabled):active { transform: scale(.95); }
.gad:disabled { opacity: .4; cursor: default; }
.gad.on { background: var(--indigo); color: var(--panel); border-color: var(--indigo); }
.gad.on .ct, .gad.on .key { color: var(--panel); }
.gad.new::after { content: "New"; position: absolute; right: -4px; top: -8px; background: var(--accent); color: var(--accent-ink); font-size: .62rem; padding: 2px 6px; border-radius: 99px; letter-spacing: .05em; }
@media (max-width: 380px) { .gad { padding: 0 6px; gap: 5px; font-size: .78rem; } .gad svg { width: 22px; height: 22px; } }
.gi .s1 { fill: rgba(var(--c-smoke), 1); stroke: var(--muted); stroke-width: 1.2; }
.gi .st { fill: var(--muted); }
.gi .ln { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.gi .fl { fill: currentColor; }
.gi .vt { fill: var(--c-vent); } .gi .vb { stroke: var(--c-vent-bar); stroke-width: 1.6; }

/* controls */
.controls { display: grid; grid-template-columns: auto 1fr 1fr; gap: 8px; margin-top: 8px; align-items: stretch; }
.pad { display: grid; grid-template-columns: 50px 50px; grid-template-rows: 46px 46px; gap: 6px; }
.mv { border: 1px solid var(--line); background: var(--panel); border-radius: 14px; cursor: pointer; display: grid; place-items: center; transition: transform .12s; padding: 0; }
.mv svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.mv:not(:disabled):active { transform: scale(.92); }
.tool { min-height: 46px; display: flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); border-radius: 14px; font-weight: 700; font-size: .88rem; cursor: pointer; transition: transform .15s; padding: 0 6px; }
.tool svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tool:not(:disabled):active { transform: scale(.95); }
.tool.wait { flex-direction: column; gap: 3px; }
.tool.wait svg { width: 22px; height: 22px; }
.small { display: grid; grid-template-rows: 1fr 1fr; gap: 6px; }
.mv:disabled, .tool:disabled { opacity: .45; cursor: default; }
.tool.hint { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
.table.is-done .controls, .table.is-done .kit { display: none; }

/* end card extras */
.hsum { margin-top: 12px; }
.hsum .big small { font: 600 1rem var(--h-sans); color: var(--muted); letter-spacing: 0; }
.ways { margin-top: 14px; }
.ways-h { margin: 0 0 8px; color: var(--muted); font-size: .85rem; }
.ways-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.way { border: 1px solid var(--line); background: var(--bg); border-radius: 99px; padding: 7px 12px; font-size: .82rem; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.way small { color: var(--muted); font-weight: 600; }
.way.on { background: var(--indigo); color: var(--panel); border-color: var(--indigo); }
.way.on small { color: var(--panel); }
.way.mine { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 28%, transparent); }
.way .yours { color: var(--accent); font-weight: 800; text-transform: uppercase; letter-spacing: .04em; font-size: .68rem; }
.way.on .yours { color: var(--panel); }
.hsum .res-ways { max-width: 34em; margin-left: auto; margin-right: auto; }
.hsum .res-ways:empty { display: none; }

/* ad + footer */
.ad-inline { margin-top: 26px; }
.ad-slot { display: block; margin: 0 auto; overflow: hidden; }
.ad-banner { width: 100%; max-width: 728px; min-height: 100px; }
.ad-slot.placeholder { border: 1.5px dashed var(--line); border-radius: 12px; display: grid; place-items: center; color: var(--muted); font-size: 0.85rem; }
.ad-slot.placeholder::before { content: "Ad space " attr(data-size); }
.ad-slot.collapsed { min-height: 0; }
.ad-slot ins[data-ad-status="unfilled"] { display: none !important; }
.foot { display: flex; justify-content: center; gap: 22px; padding: 26px 0 40px; color: var(--muted); font-size: .9rem; }

/* dialogs */
.dlg { border: 1px solid var(--line); border-radius: 22px; padding: 22px; width: min(460px, calc(100vw - 24px)); background: var(--panel); color: var(--text); }
.dlg::backdrop { background: rgba(8, 10, 24, .6); }
.dlg h2 { font-family: var(--display); font-weight: 400; margin: 0 0 10px; font-size: 1.6rem; }
.dlg h3 { font: 400 1.1rem/1.2 var(--display); margin: 14px 0 8px; color: var(--text); }
.dlg p, .dlg li { color: var(--muted); font-size: .92rem; }
.dlg b { color: var(--text); }
.dlg .x { position: absolute; right: 10px; top: 8px; border: 0; background: transparent; font-size: 26px; cursor: pointer; color: var(--muted); width: 40px; height: 40px; }
.dlg .hcta { margin-top: 6px; }
.help { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.help li { display: grid; grid-template-columns: 66px 1fr; gap: 10px; align-items: center; }
.help svg { width: 66px; height: 44px; }
.keys { font-size: .82rem !important; }
.h-floor { fill: var(--c-floor); stroke: var(--c-floor-line); }
.h-cone { fill: var(--c-cone); }
.h-next { fill: none; stroke: var(--c-next); stroke-width: 1.4; stroke-dasharray: 1.5 2.5; stroke-linecap: round; }
.h-guard { fill: var(--c-guard); } .h-ronin { fill: var(--c-ronin); } .h-hat { fill: var(--c-straw); }
.h-lit { fill: var(--c-lit-core); }
.h-lantern { fill: var(--c-lantern-2); }
.h-grass { fill: none; stroke: var(--c-grass); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.h-vent { fill: var(--c-vent); } .h-bars { stroke: var(--c-vent-bar); stroke-width: 1.4; }
.h-arrow { fill: none; stroke: var(--c-ninja); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.h-face { stroke: var(--c-cone-edge); stroke-width: 2; stroke-linecap: round; }
.h-door { fill: var(--c-door); stroke: var(--c-door-2); } .h-knob { fill: var(--c-key); }
.h-robe { fill: var(--c-servant); stroke: var(--c-servant-2); } .h-sash { stroke: var(--c-scarf); stroke-width: 1.6; }
.h-ring { fill: none; stroke: var(--gold); stroke-width: 1.4; }
.h-smoke { fill: rgba(var(--c-smoke), .9); stroke: var(--muted); stroke-width: .8; }
.h-arc { fill: none; stroke: var(--muted); stroke-width: 1.4; stroke-dasharray: 2 3; } .h-stone { fill: var(--muted); }
.h-rope { stroke: var(--gold); stroke-width: 1.8; } .h-hook { fill: none; stroke: var(--text); stroke-width: 1.8; stroke-linecap: round; }
.h-dart { fill: none; stroke: var(--text); stroke-width: 1.6; stroke-linejoin: round; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 0; }
.stats div { display: flex; flex-direction: column-reverse; background: var(--panel-2); border-radius: 12px; padding: 10px; }
.stats dt { color: var(--muted); font-size: .85rem; }
.stats dd { margin: 0; font: 400 1.5rem/1.2 var(--display); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .stage.shake, .caught, .sb b.bump { animation: none; } }

/* mobile pass: the close button is 44px and stays in the corner while a tall dialog (landscape phones) scrolls under it */
.dlg > form:first-child { position: sticky; top: 22px; height: 0; z-index: 3; background: inherit; }
.dlg .x { top: -16px; right: -14px; width: 44px; height: 44px; border-radius: 50%; background: inherit; touch-action: manipulation; }
/* mobile pass: undo this game's own smaller phone icons: they wrap under the logo anyway, so they get house/house.css's 40px */
@media (min-width: 340px) and (max-width: 420px) { .hicons { gap: 4px; } .hicon { width: 40px; height: 40px; border-radius: 12px; } .hicon svg { width: 19px; height: 19px; } }
/* mobile pass: viewport-fit=cover lets the page run under a landscape notch; keep the content clear of it */
body { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
/* mobile pass: a phone on its side shows the level beside the cards and controls instead of a screen and a half above them */
@media (orientation: landscape) and (max-height: 520px) and (min-width: 600px) {
  .layout { max-width: 920px; }
  .table { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); column-gap: 14px; align-items: start; }
  .table > * { grid-column: 2; min-width: 0; }
  .table > .stage { grid-column: 1; grid-row: 1 / span 6; width: 100%; max-width: calc((100svh - 24px) * 4 / 3); justify-self: center; }
}
/* mobile pass: quick repeated taps on game buttons must not double-tap-zoom the page (pinch zoom still works) */
html { touch-action: manipulation; }
/* mobile pass: the end-card Leaderboard link is a 40px tap target */
.hlink { min-height: 40px; padding: 10px 8px; }
.lede{font-style:italic;opacity:.82;line-height:1.55}
