:root{
  --bg:#FFF7E8; --panel:#FFFDF6; --ink:#2B2118; --muted:#7A6A58;
  --navy:#1F3A5F; --shu:#D93A4E; --wood:#B07D4F; --wood-d:#8A5A33;
  --gold:#E9A820; --gold-l:#FFD94D; --line:#E4D5BC;
  --ok:#3FA34D; --danger:#C22E3E;
  --shadow:0 4px 14px rgba(90,60,20,.18);
  color-scheme:light dark;
}
@media (prefers-color-scheme:dark){
  :root{
    --bg:#1C1712; --panel:#2A221B; --ink:#F3E9D8; --muted:#B7A68E;
    --navy:#7FA8D9; --line:#4A3B2C;
    --shadow:0 4px 14px rgba(0,0,0,.5);
  }
}
*{box-sizing:border-box}
html,body{margin:0;padding:0;height:100%}
body{
  /* the page itself never scrolls. On phone-width viewports the game fills
     the screen edge to edge; on PC / tablet widths the flex centring below
     places the phone-shaped frame (see the min-width media query at #app)
     in the middle of this dark surround, as the game was always shown there */
  overflow:hidden;
  display:flex; align-items:center; justify-content:center;
  background:#261A12;
  color:var(--ink);
  font-family:"M PLUS Rounded 1c","Hiragino Maru Gothic ProN","Hiragino Sans","Yu Gothic UI","Yu Gothic",Meiryo,sans-serif;
  -webkit-tap-highlight-color:transparent;
}
button{font-family:inherit; cursor:pointer; min-height:44px; min-width:44px;}
/* on a phone the game fills the screen: #app IS the viewport, with no
   letterbox frame and no dark surround. The upper shop scene takes the top
   61% of the screen and the puzzle board the rest, and every scene layer
   inside the stage is either percentage-positioned or an SVG with
   preserveAspectRatio="none", so the whole shop stretches to whatever
   phone it is shown on — Pixel, iPhone, any model — with the ceiling beam
   pinned to the top edge of the stage and the counter's front face to its
   bottom edge, and no empty space ever visible.
   cqw units below are 1/100 of the #app width. */
#app{
  position:relative; container-type:inline-size;
  width:100%; height:100dvh;
  padding:0; overflow:hidden;
  background:#4E3422;
}
/* PC and tablets keep the smartphone-frame presentation the game has always
   had on wide screens: the playfield is the reference's 450x800 phone frame,
   centred in the viewport with the dark surround around it, and the stretch
   above applies only INSIDE that frame. Because every size inside is a
   percentage or a cqw of #app, the whole game simply scales with the frame;
   only the stage cut-in band, which is viewport-fixed, needs the frame
   width restated so it spans the frame and not the whole window. */
@media (min-width:600px){
  :root{ --frame-w:min(500px, calc(100dvh * 450 / 800)); }
  #app{
    width:var(--frame-w); height:calc(var(--frame-w) * 800 / 450); flex:none;
    border-radius:18px;
    box-shadow:0 0 0 2px #170D05, 0 24px 64px rgba(0,0,0,.6);
  }
  .cutin-band{width:var(--frame-w)}
  #toast{max-width:min(92vw, 460px)}
}
#gameScreen{height:100%; min-height:0; display:flex; flex-direction:column;}
h1,h2,h3{margin:0}
