@font-face { font-family: Pix; src: local('Press Start 2P'); }
:root {
  --bg: #2b2140; --card: #fff8ea; --ink: #2a2235; --muted: #7a6f86; --accent: #ff7a59; --accent2: #5ec27a;
  --line: #2a2235; --err: #d23a4a;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body.phone {
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Crect width='2' height='2' fill='%23ffffff12'/%3E%3C/svg%3E");
  color: var(--ink); font: 16px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; min-height: 100vh;
}
#app { max-width: 460px; margin: 0 auto; padding: 16px 16px 40px; }
.top { text-align: center; padding: 8px 0 14px; }
.logo { display: inline-block; color: #fff; font: 900 22px/1.05 ui-monospace, 'Courier New', monospace; letter-spacing: 3px; text-shadow: 3px 3px 0 var(--accent), 6px 6px 0 #0004; }
.card { background: var(--card); border: 3px solid var(--line); box-shadow: 6px 6px 0 #0006; padding: 18px; border-radius: 4px; }
.hidden { display: none !important; }
.center { text-align: center; }
h1 { font-size: 22px; margin: 0 0 6px; }
h3 { margin: 18px 0 8px; font-size: 15px; }
.muted { color: var(--muted); margin: 0 0 12px; }
.tiny { font-size: 12px; color: var(--muted); }
label { display: block; font-weight: 700; margin: 12px 0 0; font-size: 14px; }
input, textarea, select {
  width: 100%; margin-top: 6px; font: inherit; padding: 11px 12px; border: 2px solid var(--line); border-radius: 3px; background: #fff; color: var(--ink);
}
textarea { resize: vertical; }
.row { display: flex; gap: 8px; } .row select { flex: 1; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.seg button { font: inherit; font-size: 14px; padding: 10px 4px; border: 2px solid var(--line); background: #fff; border-radius: 3px; color: var(--ink); }
.seg button.on { background: var(--ink); color: #fff; }
.or { text-align: center; color: var(--muted); margin: 10px 0 4px; font-size: 14px; }
.photo-btn { text-align: center; border: 2px dashed var(--line); padding: 14px; border-radius: 3px; cursor: pointer; background: #fff; margin: 0; }
#photo-prev { text-align: center; margin-top: 8px; }
#photo-prev img { max-width: 120px; max-height: 120px; border: 2px solid var(--line); display: block; margin: 0 auto 4px; }
.big {
  display: block; width: 100%; margin-top: 16px; font: 800 18px/1 system-ui, sans-serif; padding: 16px; color: #fff; background: var(--accent);
  border: 3px solid var(--line); border-radius: 3px; box-shadow: 0 5px 0 var(--line); cursor: pointer;
}
.big:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--line); }
.big:disabled { opacity: .6; }
.link { background: none; border: 0; color: var(--muted); font: inherit; font-size: 14px; text-decoration: underline; padding: 8px 0; cursor: pointer; display: block; margin: 6px auto 0; }
.err { color: var(--err); font-weight: 700; min-height: 1em; margin: 10px 0 0; text-align: center; }
.ok { color: #2d8a4a; font-weight: 700; font-size: 14px; }
.spinner { width: 48px; height: 48px; margin: 20px auto; background: var(--accent); animation: sp 1s steps(4) infinite; box-shadow: 0 0 0 3px var(--line); }
@keyframes sp { to { transform: rotate(360deg); } }
#preview { display: block; margin: 6px auto; image-rendering: pixelated; background: radial-gradient(circle at 50% 85%, #0002 0 22%, transparent 23%), #d9f2c6; border: 3px solid var(--line); width: 192px; height: 240px; }
#tweaks { display: grid; gap: 6px; }
.tw { display: grid; grid-template-columns: 1fr 40px 110px 40px; align-items: center; gap: 4px; font-size: 14px; }
.tw b { font-weight: 600; }
.tw button { height: 36px; border: 2px solid var(--line); background: #fff; border-radius: 3px; font-size: 14px; color: var(--ink); }
.tw span { text-align: center; }
.tw span i { display: inline-block; width: 28px; height: 20px; border: 2px solid var(--line); vertical-align: middle; }
.me { display: flex; gap: 14px; align-items: center; }
#me-c { image-rendering: pixelated; background: #d9f2c6; border: 3px solid var(--line); width: 96px; height: 120px; flex: none; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.grid button { font-size: 30px; padding: 12px 4px 10px; border: 3px solid var(--line); background: #fff; border-radius: 4px; box-shadow: 0 4px 0 var(--line); color: var(--ink); }
.grid button span { display: block; font-size: 12px; font-weight: 700; margin-top: 4px; }
.grid button[data-a="find"] { background: #ffe58a; }
.grid button:active, .phrases button:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.phrases { display: flex; flex-wrap: wrap; gap: 6px; }
.phrases button { font: inherit; font-size: 14px; padding: 9px 11px; border: 2px solid var(--line); background: #fff; border-radius: 999px; box-shadow: 0 3px 0 var(--line); color: var(--ink); }
body.cooling .grid button, body.cooling .phrases button { opacity: .45; }
.cooldown { height: 10px; border: 2px solid var(--line); margin-top: 14px; background: #fff; }
.cooldown div { height: 100%; background: var(--accent2); width: 100%; }
