/* The phone page of Mazu in pixel style: one dark world. At home her place fills the whole screen (the canvas);
   on the other panes a solid surface lies over it. */
/* The pixel fonts are with the page itself (no request to another address). Both: SIL Open Font License. */
@font-face { font-family: "Pixelify Sans"; src: url("pixelifysans.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Press Start 2P"; src: url("pressstart2p.woff2") format("woff2"); font-weight: 400; font-display: swap; }
:root {
  --head: "Press Start 2P", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --bg: #2a2139; --deep: #171021; --surface: #3b2f52; --edge: #4a3b68; --ink: #fff4d6; --muted: #a99bc4;
  --red: #c44a2c; --orange: #ff7a59; --yellow: #ffd24a; --mint: #7bd0c1; --paper: #fff4d6; --dark-ink: #2b1a22;
  --good: #58d68d; --gone: #6f6585;
  --px: "Pixelify Sans", ui-monospace, "SF Mono", Menlo, Consolas, "Courier New", monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
/* The view is fixed: the page itself never scrolls, only the conversation and the timeline scroll inside their pane. */
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body { margin: 0; position: fixed; inset: 0; background: var(--deep); color: var(--ink); font: 16px/1.4 var(--px);
  -webkit-text-size-adjust: 100%; touch-action: manipulation; }
.app { max-width: 520px; height: var(--height, 100%); margin: 0 auto; display: flex; flex-direction: column; position: relative; overflow: hidden;
  background: var(--bg); padding: env(safe-area-inset-top, 0) 0 0; }
#world { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; }
#world[hidden] { display: none; }

header { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px 0; }
h1 { margin: 0; font-size: 15px; letter-spacing: 0.12em; text-transform: uppercase; background: var(--deep); padding: 5px 9px; font-weight: 600; }
.status { display: flex; align-items: center; gap: 7px; min-width: 0; background: var(--deep); padding: 5px 9px; color: var(--yellow); font-size: 14px; }
.status span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; background: var(--gone); flex: none; }
.dot.here { background: var(--good); }

.pane { position: relative; flex: 1; min-height: 0; overflow-y: auto; padding: 12px 14px; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain; touch-action: pan-y; }
.pane > * { flex: none; }  /* nothing shrinks: what does not fit, scrolls */
.pane[hidden], .your[hidden] { display: none !important; }
.pane.full { background: var(--bg); margin-top: 10px; border-top: 4px solid var(--deep); }

/* turning notifications on */
.notify { position: relative; display: flex; align-items: center; gap: 8px; margin: 10px 14px 0; padding: 9px 10px; background: var(--deep);
  border: 3px solid var(--yellow); font-size: 14px; }
.notify[hidden] { display: none; }
.notify span { flex: 1; min-width: 0; }
.notify button { flex: none; min-height: 36px; padding: 0 12px; border: 0; font: inherit; font-size: 14px; background: var(--yellow); color: var(--deep); }
.notify button[hidden] { display: none; }
.notify button.silent { background: none; color: var(--muted); padding: 0 4px; }

/* home: what you said and what she says, at the bottom over her place */
#home { display: flex; flex-direction: column; justify-content: flex-end; gap: 10px; overflow: hidden; padding-bottom: 8px; touch-action: none; }
/* her current thought, at the top as in her interface on the PC */
.thought { margin-bottom: auto; background: rgba(23, 16, 33, 0.86); border: 3px solid var(--mint); padding: 7px 10px 8px;
  max-height: 30%; overflow: hidden; font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.thought[hidden] { display: none; }
.thought b { display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--mint); margin-bottom: 2px; }
.your { align-self: flex-end; max-width: 84%; max-height: 4.4em; overflow: hidden; background: var(--mint); color: var(--dark-ink);
  border: 4px solid var(--deep); padding: 6px 10px; box-shadow: 4px 4px 0 rgba(23, 16, 33, 0.5); overflow-wrap: anywhere; }
.your.wait { opacity: 0.75; }
.your small, .says small { display: block; font-size: 12px; opacity: 0.75; margin-top: 2px; }
.says { position: relative; background: var(--paper); color: var(--dark-ink); border: 4px solid var(--deep); padding: 16px 12px 10px;
  min-height: 84px; max-height: 38%; box-shadow: 4px 4px 0 rgba(23, 16, 33, 0.5); display: flex; flex-direction: column; }
.says em { position: absolute; top: -14px; left: 10px; font-style: normal; font-size: 12px; letter-spacing: 0.1em; background: var(--red);
  color: var(--paper); padding: 2px 8px; border: 4px solid var(--deep); text-transform: uppercase; }
.says p { margin: 0; overflow-y: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 17px; line-height: 1.35; }

/* the whole conversation */
#chat { display: flex; flex-direction: column; gap: 9px; }
.msg { max-width: 86%; padding: 7px 11px; white-space: pre-wrap; overflow-wrap: anywhere; border: 3px solid var(--deep); }
.msg.you { align-self: flex-end; background: var(--mint); color: var(--dark-ink); box-shadow: -3px 3px 0 var(--deep); }
.msg.she { align-self: flex-start; background: var(--paper); color: var(--dark-ink); box-shadow: 3px 3px 0 var(--deep); }
.msg.wait { opacity: 0.6; }
.msg small { display: block; margin-top: 3px; font-size: 12px; opacity: 0.75; }
.day { align-self: center; font-size: 13px; color: var(--muted); margin: 8px 0 2px; }
.empty { color: var(--muted); font-size: 15px; margin: auto; text-align: center; max-width: 30ch; }

/* timeline */
.day_header { margin: 22px 0 8px; font-size: 13px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--yellow); }
.day_header:first-child { margin-top: 4px; }
.moment { position: relative; margin-left: 6px; padding: 2px 0 20px 20px; border-left: 4px solid var(--edge); }
.moment::before { content: ""; position: absolute; left: -8px; top: 8px; width: 12px; height: 12px; background: var(--bg); border: 3px solid var(--orange); }
.moment.own::before { background: var(--orange); }
.meta { display: flex; gap: 10px; align-items: baseline; font-size: 13px; color: var(--muted); }
.kind { letter-spacing: 0.06em; text-transform: uppercase; color: var(--orange); font-weight: 600; }
.fact { margin: 3px 0 0; overflow-wrap: anywhere; }
.words { margin: 10px 0 0; padding: 9px 12px; background: var(--paper); color: var(--dark-ink); border: 3px solid var(--deep);
  box-shadow: 3px 3px 0 var(--deep); font-size: 17px; overflow-wrap: anywhere; }
.who { display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--red); margin-bottom: 4px; }
.reaction { margin: 10px 0 0 auto; max-width: 88%; width: fit-content; padding: 7px 11px; background: var(--mint); color: var(--dark-ink);
  border: 3px solid var(--deep); overflow-wrap: anywhere; }
.reaction .who { color: var(--dark-ink); opacity: 0.7; margin-bottom: 2px; }
.add { margin-top: 10px; background: none; border: 0; padding: 4px 0; color: var(--muted); font: inherit; font-size: 14px;
  text-decoration: underline; text-underline-offset: 3px; }
.moment form { display: flex; gap: 8px; margin-top: 10px; }

/* explanation */
.explanation h2 { font-size: 18px; margin: 18px 0 8px; color: var(--yellow); }
.explanation p { max-width: 42ch; margin: 0 0 10px; }
.small { color: var(--muted); font-size: 14px; }

/* input and tabs: a solid surface at the bottom */
.bottom { position: relative; background: var(--deep); padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 10px; }
#input { display: flex; gap: 8px; }
#input[hidden] { display: none; }
input[type=text] { flex: 1; min-width: 0; padding: 11px 12px; border: 3px solid var(--edge); border-radius: 0; background: var(--bg);
  color: var(--ink); font: inherit; font-size: 16px; }
input[type=text]::placeholder { color: var(--muted); }
form button { padding: 0 16px; min-height: 46px; border: 0; border-radius: 0; background: var(--yellow); color: var(--deep); font: inherit;
  font-size: 15px; font-weight: 600; box-shadow: 0 4px 0 var(--edge); }
form button:disabled { opacity: 0.5; }
/* the button for a photo: a little camera in blocks */
form button.photo { padding: 0; width: 46px; background: var(--mint); display: grid; place-items: center; }
form button.photo i { width: 22px; height: 14px; background: var(--deep); position: relative; display: block; margin-top: 4px; }
form button.photo i::before { content: ""; position: absolute; left: 6px; top: -4px; width: 8px; height: 4px; background: var(--deep); }
form button.photo i::after { content: ""; position: absolute; left: 8px; top: 4px; width: 6px; height: 6px; background: var(--mint); }
#photo-pick { display: none; }
nav { display: flex; gap: 4px; }
nav button { flex: 1; min-height: 40px; background: var(--surface); border: 0; border-radius: 0; color: var(--muted); font: inherit; font-size: 13px;
  letter-spacing: 0.08em; text-transform: uppercase; }
nav button.on { background: var(--red); color: var(--paper); font-weight: 600; }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }

/* the block letters for names and buttons */
h1, .says em, nav button, .thought b { font-family: var(--head); font-weight: 400; }
h1 { font-size: 11px; padding: 7px 9px; }
.says em { font-size: 9px; padding: 4px 8px; top: -16px; }
nav button { font-size: 8px; letter-spacing: 0; padding: 0; }  /* five panes next to each other */
.thought b { font-size: 8px; margin-bottom: 5px; }

/* playing */
.game-head { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.game-head canvas { width: 72px; height: 68px; flex: none; image-rendering: pixelated; image-rendering: crisp-edges; border: 3px solid var(--deep); background: var(--surface); }
.game-head b { display: block; color: var(--yellow); font-weight: 600; }
.game-head span { color: var(--muted); font-size: 14px; }
.game-head > div { flex: 1 1 auto; min-width: 0; }
#game-back { flex: none; align-self: flex-start; min-height: 44px; padding: 0 12px; border: 0; border-radius: 0; background: var(--surface); color: var(--ink);
  font: inherit; font-size: 15px; font-weight: 600; box-shadow: 0 4px 0 var(--deep); }
#game h2 { font-family: var(--head); font-size: 10px; font-weight: 400; color: var(--mint); margin: 18px 0 6px; text-transform: uppercase; }
#game [hidden] { display: none !important; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.row button { flex: 1 1 auto; min-height: 44px; padding: 0 12px; border: 0; border-radius: 0; background: var(--yellow); color: var(--deep);
  font: inherit; font-size: 15px; font-weight: 600; box-shadow: 0 4px 0 var(--deep); }
.row button.calm { background: var(--surface); color: var(--ink); flex: 0 1 auto; }
.row button:disabled { opacity: 0.45; }
#board { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; background: var(--edge); border: 4px solid var(--deep); padding: 6px; }
#board button { display: grid; gap: 4px; padding: 0; border: 0; background: none; }
#board button:disabled { opacity: 1; }
#board button.can:active i:not(.you):not(.mazu) { background: var(--muted); }
#board i { display: block; aspect-ratio: 1; background: var(--deep); }
#board i.you { background: var(--mint); box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.25); }
#board i.mazu { background: var(--red); box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.25); }
#board i.wins { outline: 3px solid var(--yellow); outline-offset: -3px; }
#game-log { display: grid; gap: 7px; margin-top: 12px; }
#game-log p { margin: 0; padding: 6px 10px; border: 3px solid var(--deep); overflow-wrap: anywhere; max-width: 90%; }
#game-log p.she { background: var(--paper); color: var(--dark-ink); justify-self: start; }
#game-log p.you { background: var(--mint); color: var(--dark-ink); justify-self: end; }
#game-log p.info { border: 0; padding: 0; color: var(--muted); font-size: 14px; }
nav button { min-width: 0; }
form button[hidden] { display: none !important; }

/* the game cards */
.game-card { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 3px solid var(--deep); padding: 10px; margin-bottom: 10px; }
.game-card canvas { width: 60px; height: 60px; flex: none; image-rendering: pixelated; image-rendering: crisp-edges; border: 3px solid var(--deep); }
.game-card > div { flex: 1; min-width: 0; }
.game-card h2 { margin: 2px 0 4px !important; }
.game-card .row { margin: 8px 0 0; }
.game-card .small { margin: 0; }

/* four in a row: a blue board with round holes, yellow and red discs that drop into it */
.four-case { background: #1f5fd0; border: 4px solid #0b2a66; border-radius: 14px; padding: 8px; box-shadow: inset 0 -6px 0 #164aa8, 0 6px 0 var(--deep); overflow: hidden; }
#board { grid-template-columns: repeat(7, 1fr); gap: 0; background: none; border: 0; padding: 0; }
#board button { gap: 0; border-radius: 8px; }
#board button.can:active { background: rgba(255, 255, 255, 0.18); }
#board i { position: relative; margin: 6%; aspect-ratio: 1; border-radius: 50%; background: #0b2a66; box-shadow: inset 0 3px 0 #071d49; overflow: visible; }
#board i.you, #board i.mazu { background: #0b2a66; box-shadow: inset 0 3px 0 #071d49; }
#board b { position: absolute; inset: 0; border-radius: 50%; display: block; }
#board b.you { background: #ffd23f; box-shadow: inset 0 -4px 0 #d9a514, inset 0 3px 0 #fff0a8; }
#board b.mazu { background: #e63946; box-shadow: inset 0 -4px 0 #a81f2b, inset 0 3px 0 #ff8a92; }
#board b.new { animation: drop 0.38s cubic-bezier(0.5, 0, 0.9, 0.6); }
#board b.wins { animation: wins 0.7s steps(2) infinite; }
@keyframes drop { from { transform: translateY(var(--drop, -500%)); } 80% { transform: translateY(0); } 90% { transform: translateY(-9%); } to { transform: translateY(0); } }
@keyframes wins { 50% { box-shadow: 0 0 0 4px #ffffff, inset 0 -4px 0 rgba(0, 0, 0, 0.2); } }

/* chess */
#chessboard { width: 100%; height: auto; display: block; image-rendering: pixelated; image-rendering: crisp-edges; border: 4px solid var(--deep);
  box-shadow: 0 0 0 4px #6b452a, 0 6px 0 4px var(--deep); margin: 8px 0; touch-action: manipulation; }
.captured { width: 100%; height: auto; display: block; image-rendering: pixelated; image-rendering: crisp-edges; min-height: 20px; }

/* battleship */
.sea-head { margin: 12px 0 6px; font-family: var(--head); font-size: 9px; color: var(--mint); text-transform: uppercase; }
.sea-head span { font-family: var(--px); font-size: 14px; color: var(--muted); text-transform: none; }
.sea { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; background: #0b2a66; border: 4px solid var(--deep); padding: 2px; }
.sea.small { width: 62%; }
.sea button { aspect-ratio: 1; border: 0; border-radius: 0; padding: 0; background: #2a6fb0; position: relative;
  background-image: linear-gradient(#4a8fd0, #4a8fd0); background-size: 50% 2px; background-repeat: no-repeat; background-position: 20% 65%; }
.sea button:disabled { opacity: 1; }
.sea button:not(:disabled):active { background-color: #6fb0e8; }
.sea button.ship { background: #9aa3ad; box-shadow: inset 0 -3px 0 #6f7882; }
.sea button.ship.was { opacity: 0.55; }
.sea button.miss::after { content: ""; position: absolute; inset: 36%; background: #fffaf0; }
.sea button.hit { background: #ff7a59; box-shadow: inset 0 0 0 3px #e0352b; }
.sea button.hit::after { content: ""; position: absolute; inset: 30%; background: #ffd24a; }
.sea button.sunk { background: #5a1f24; box-shadow: inset 0 0 0 3px #2b1a22; }
.sea button.sunk::after { content: ""; position: absolute; inset: 34%; background: #e0352b; }
.sea button.last { outline: 3px solid var(--yellow); outline-offset: -3px; z-index: 1; }
@media (prefers-reduced-motion: reduce) { #board b { animation: none !important; } }

/* extra components: what your computer can download itself */
.extra_card { background: var(--surface); border: 3px solid var(--deep); box-shadow: 3px 3px 0 var(--deep); padding: 10px 12px; margin: 10px 0; }
.extra_card h2 { margin: 0 0 6px; font-size: 16px; color: var(--yellow); }
.extra_card p { margin: 0 0 6px; overflow-wrap: anywhere; }
.extra_state { color: var(--mint); }
