/* px.css: the look of the screens between fights. Every size is a whole number of art pixels: --u is how many CSS
   pixels one art pixel is, set by shell.js from the engine, so a button's edge lands on the same grid as the picture
   behind it. Faces are small canvases; the words stay in the page for a screen reader. */
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; background: #1b1026; }
canvas { image-rendering: crisp-edges; image-rendering: pixelated; }

#ui { --u: 2px; position: fixed; inset: 0; overflow: hidden; pointer-events: none; color: #fffbe0; font: 12px/1 ui-monospace, Menlo, Consolas, monospace;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
#ui canvas { display: block; flex: none; }
#ui h1, #ui h2, #ui p { margin: 0; font: inherit; display: grid; justify-items: center; gap: calc(var(--u) * 3); }
#ui .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#ui .probe { position: absolute; visibility: hidden; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }

#ui button { pointer-events: auto; touch-action: manipulation; box-sizing: border-box; min-width: 44px; min-height: 44px; margin: 0; padding: 0; border: 0; border-radius: 0;
  background: none; color: inherit; font: inherit; cursor: pointer; display: grid; place-items: center; }
#ui button:disabled { cursor: default; }
#ui button:focus { outline: none; }
#ui button:focus-visible { outline: max(3px, var(--u)) solid #fff; outline-offset: max(3px, var(--u)); }

/* a screen fills the picture; the scrim is a checker of dark pixels, not a fog */
#ui .screen { position: absolute; inset: 0; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(var(--u) * 8);
  padding: calc(var(--u) * 4 + env(safe-area-inset-top)) calc(var(--u) * 4 + env(safe-area-inset-right)) calc(var(--u) * 4 + env(safe-area-inset-bottom)) calc(var(--u) * 4 + env(safe-area-inset-left)); }
#ui .scrim { background: repeating-conic-gradient(#1b1026 0 25%, #0000 0 50%) 0 0 / calc(var(--u) * 2) calc(var(--u) * 2), rgba(27, 16, 38, .55); }

/* the yellow button of the trial clearing: flat, with a hard shadow */
#ui .btn { background: #ffd866; padding: calc(var(--u) * 4) calc(var(--u) * 9); margin-bottom: calc(var(--u) * 2); box-shadow: 0 calc(var(--u) * 2) 0 #b3722a, 0 0 0 var(--u) #1b1026, 0 calc(var(--u) * 2) 0 var(--u) #1b1026; }
#ui .btn:active { transform: translateY(var(--u)); box-shadow: 0 var(--u) 0 #b3722a, 0 0 0 var(--u) #1b1026, 0 var(--u) 0 var(--u) #1b1026; }
#ui .btn:disabled { background: #6d679c; transform: none; box-shadow: 0 calc(var(--u) * 2) 0 #3d3668, 0 0 0 var(--u) #1b1026, 0 calc(var(--u) * 2) 0 var(--u) #1b1026; }

/* a dark card that is a button: a hero, or one of three things to take */
#ui .card { background: #2a2140; padding: calc(var(--u) * 3); box-shadow: 0 0 0 var(--u) #6d679c, 0 0 0 calc(var(--u) * 2) #1b1026, 0 calc(var(--u) * 3) 0 var(--u) #1b1026; }
#ui .card:hover, #ui .card:focus-visible { background: #3a2f58; box-shadow: 0 0 0 var(--u) #ffd866, 0 0 0 calc(var(--u) * 2) #1b1026, 0 calc(var(--u) * 3) 0 var(--u) #1b1026; }
#ui .card:active { transform: translateY(var(--u)); }
#ui .card:disabled { background: #1b1430; transform: none; box-shadow: 0 0 0 var(--u) #3d3668, 0 0 0 calc(var(--u) * 2) #1b1026, 0 calc(var(--u) * 3) 0 var(--u) #1b1026; }

/* pause and sound: a small square in the corner */
#ui .tool { position: absolute; z-index: 3; top: calc(8px + env(safe-area-inset-top)); right: calc(8px + env(safe-area-inset-right)); width: max(44px, calc(var(--u) * 13)); height: max(44px, calc(var(--u) * 13)); background: rgba(27, 16, 38, .6); }
#ui a.tool { pointer-events: auto; display: grid; place-items: center; left: calc(8px + env(safe-area-inset-left)); right: auto; }   /* home, in the other corner from the sound */
#ui a.tool:focus { outline: none; }
#ui a.tool:focus-visible { outline: max(3px, var(--u)) solid #fff; outline-offset: max(3px, var(--u)); }

/* hearts, stars and what is carried: where the fight draws its own */
#ui .hud { position: absolute; z-index: 2; left: calc(var(--u) * 6 + env(safe-area-inset-left)); top: calc(var(--u) * 6 + env(safe-area-inset-top)); }

/* ---- title */
#ui .title { justify-content: space-between; padding-top: 15vh; padding-bottom: calc(14vh + env(safe-area-inset-bottom)); }
#ui .title .btn { padding: calc(var(--u) * 6) calc(var(--u) * 14); }
#ui .title .starts { display: grid; justify-items: center; gap: calc(var(--u) * 6); }   /* PLAY, or CONTINUE with NEW RUN under it, low on the screen and off the hero */

/* ---- who goes */
#ui .heroes { display: grid; grid-template-columns: repeat(2, auto); gap: calc(var(--u) * 7); }
#ui.wide .heroes { grid-template-columns: repeat(4, auto); }

/* ---- between two acts: its name, its two lands, GO */
#ui .act { gap: calc(var(--u) * 10); }
#ui .act .btn { padding: calc(var(--u) * 6) calc(var(--u) * 16); }


/* ---- pick one of three */
#ui .cards { display: flex; flex-direction: column; gap: calc(var(--u) * 7); }
#ui .cards.cols { flex-direction: row; align-items: stretch; gap: calc(var(--u) * 8); }
#ui .cards .card { padding: calc(var(--u) * 4) calc(var(--u) * 3); }

/* ---- the shrine: its name, then two things you can do */
#ui .shrine { justify-content: flex-end; }
#ui .shrine .place { position: absolute; left: 0; right: 0; top: calc(var(--u) * 36 + env(safe-area-inset-top)); }
#ui.wide .shrine .place { top: calc(var(--u) * 8 + env(safe-area-inset-top)); }
#ui .talk { display: flex; flex-direction: column; align-items: center; gap: calc(var(--u) * 7); margin-bottom: calc(var(--u) * 4); }
#ui .choices { display: flex; flex-direction: column; align-items: stretch; gap: calc(var(--u) * 6); }
#ui.wide .choices, #ui:not(.tall) .choices { flex-direction: row; gap: calc(var(--u) * 10); }

/* ---- the end: the picture and what it says, the numbers */
#ui .end { background: #120d24; gap: calc(var(--u) * 8); }
#ui.wide .end, #ui:not(.tall) .end { flex-direction: row; gap: calc(var(--u) * 14); }
#ui .tale, #ui .tally { display: flex; flex-direction: column; align-items: center; gap: calc(var(--u) * 6); }
#ui .frame { box-shadow: 0 0 0 var(--u) #6d679c, 0 0 0 calc(var(--u) * 2) #1b1026; }
#ui .numbers { gap: calc(var(--u) * 5); }
#ui .end .btn { padding: calc(var(--u) * 5) calc(var(--u) * 12); }

/* ---- a fight: an unseen button over each of the two pads the picture draws. The move's pad is framed while the
   move is full, and the frame steps between two lights (shell.js turns `lit` on the beat; with reduced motion it stays) */
#ui .pad { position: absolute; z-index: 2; background: none; touch-action: none; }
#ui .pad .frame { position: absolute; left: calc(var(--u) * -2); top: calc(var(--u) * -2); display: none; }
#ui .pad.ready:not(.lit) .frame:not(.bright), #ui .pad.ready.lit .frame.bright { display: block; }
#ui .pad .cap { position: absolute; right: calc(100% + var(--u) * 5); top: 50%; transform: translateY(-50%); display: none; }
#ui .pad.ready .cap { display: block; }

/* ---- how to play: the fight a little darker, the one thing it is about left bright, two lines beside it */
#ui .teach { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
#ui .teach.whole { background: rgba(18, 13, 36, .5); }
#ui .hole { position: absolute; box-sizing: border-box; box-shadow: 0 0 0 var(--u) #ffd866, 0 0 0 calc(var(--u) * 2) #1b1026, 0 0 0 200vmax rgba(18, 13, 36, .5); }
#ui .hole.lit { box-shadow: 0 0 0 var(--u) #fffbe0, 0 0 0 calc(var(--u) * 2) #1b1026, 0 0 0 200vmax rgba(18, 13, 36, .5); }
#ui .tip { position: absolute; display: flex; flex-direction: column; align-items: center; gap: calc(var(--u) * 5); margin: var(--u); padding: calc(var(--u) * 6) calc(var(--u) * 7);
  background: #1b1026; box-shadow: 0 0 0 var(--u) #fffbe0, 0 0 0 calc(var(--u) * 2) #1b1026; }
#ui .tip.side { flex-direction: row; gap: calc(var(--u) * 6); }
#ui .tip .said { display: flex; flex-direction: column; align-items: center; gap: calc(var(--u) * 5); }

/* ---- the pause: what the hero carries, in a list that scrolls when it is long, and RESUME and END */
#ui .pause { gap: calc(var(--u) * 7); padding-top: calc(var(--u) * 14 + env(safe-area-inset-top)); padding-bottom: calc(var(--u) * 10 + env(safe-area-inset-bottom)); }
#ui .build { pointer-events: auto; touch-action: pan-y; overflow-y: auto; overscroll-behavior: contain; flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; gap: calc(var(--u) * 6);
  padding: calc(var(--u) * 5); background: #1b1026; box-shadow: 0 0 0 var(--u) #6d679c, 0 0 0 calc(var(--u) * 2) #1b1026; scrollbar-width: thin; scrollbar-color: #6d679c #1b1026; }
#ui .build:empty { display: none; }
#ui .build .row { display: grid; }
#ui .build .row + .row { border-top: var(--u) solid #3d3668; padding-top: calc(var(--u) * 5); }
#ui .acts { display: flex; align-items: center; gap: calc(var(--u) * 10); }
#ui:not(.tall) .pause { padding-top: calc(var(--u) * 6 + env(safe-area-inset-top)); padding-bottom: calc(var(--u) * 6 + env(safe-area-inset-bottom)); display: grid; grid-template: "t b" auto "a b" auto / auto auto; justify-content: center; align-content: center; justify-items: center; column-gap: calc(var(--u) * 16); row-gap: calc(var(--u) * 8); }
#ui:not(.tall) .pause h2 { grid-area: t; align-self: end; }
#ui:not(.tall) .pause .acts { grid-area: a; align-self: start; flex-direction: column; gap: calc(var(--u) * 7); }
#ui:not(.tall) .pause .build { grid-area: b; align-self: center; max-height: calc(100vh - var(--u) * 28); }

#ui .grid { display: grid; grid-template-columns: repeat(2, auto); gap: calc(var(--u) * 6); }

/* ---- the page a player can write on: five stars, and the one place in the game where words are typed */
#ui .feedback { gap: calc(var(--u) * 7); }
#ui .fbhead, #ui .fbbody { display: flex; flex-direction: column; align-items: center; gap: calc(var(--u) * 7); max-width: 100%; }
#ui:not(.tall) .feedback { flex-direction: row; flex-wrap: wrap; align-content: center; gap: calc(var(--u) * 6) calc(var(--u) * 12); }
#ui:not(.tall) .fbbody { gap: calc(var(--u) * 5); }
#ui:not(.tall) .note { height: calc(var(--u) * 30); min-height: 44px; }
#ui .pause .btn + .btn { padding: calc(var(--u) * 3) calc(var(--u) * 8); }
#ui .rate { display: flex; gap: calc(var(--u) * 2); }
#ui .star { width: max(44px, calc(var(--u) * 24)); height: max(44px, calc(var(--u) * 24)); }
#ui .note { pointer-events: auto; -webkit-user-select: text; user-select: text; box-sizing: border-box; width: min(calc(var(--u) * 150), 100%); height: calc(var(--u) * 46); min-height: 88px; margin: 0; padding: calc(var(--u) * 3);
  border: 0; border-radius: 0; resize: none; background: #1b1026; color: #fffbe0; caret-color: #ffd866; font: max(16px, calc(var(--u) * 5))/1.35 ui-monospace, Menlo, Consolas, monospace; box-shadow: 0 0 0 var(--u) #fffbe0, 0 0 0 calc(var(--u) * 2) #1b1026; }
#ui .note:focus { outline: none; box-shadow: 0 0 0 var(--u) #ffd866, 0 0 0 calc(var(--u) * 2) #1b1026; }
#ui .end .tally .btn + .btn { padding: calc(var(--u) * 4) calc(var(--u) * 9); }

/* SKIP under the three: smaller than a card, the move's mark beside the word */
#ui .pick .skip { padding: calc(var(--u) * 2) calc(var(--u) * 6); }
#ui .tale-skip { position: absolute; z-index: 3; right: calc(8px + env(safe-area-inset-right)); bottom: calc(8px + env(safe-area-inset-bottom)); min-width: 44px; min-height: 44px; margin: 0; padding: calc(var(--u) * 3) calc(var(--u) * 8); }   /* a scene of the story: SKIP in the corner, over the bar along the foot */
/* the endings seen, and what the next run opens */
#ui .endings, #ui .opens { gap: calc(var(--u) * 2); }
