:root { --ink:#1d2433; --bg:#14213d; --panel:#fff; --accent:#fca311; --line:#c7cedb; --good:#2e9e5b; --bad:#c0392b; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font: 18px/1.4 system-ui, "Segoe UI", Arial, sans-serif; }
[hidden] { display: none !important; }
.cbar { display: flex; align-items: center; gap: 14px; padding: 10px 16px; color: #fff; }
.cbar h1 { flex: 1; margin: 0; font-size: 1.2rem; text-align: center; }
.cbar .back { color: #fff; text-decoration: none; font-weight: 600; }
.cmain { max-width: 760px; margin: 0 auto; padding: 8px 14px 60px; }
.center { text-align: center; }
.muted { color: #667085; }
.cmain > .muted { color: #c7cedb; }
button { font: inherit; font-weight: 700; padding: 10px 16px; border: none; border-radius: 10px; background: var(--accent); color: var(--ink); cursor: pointer; }
button.secondary { background: #eef1f6; font-weight: 600; }
button.danger { background: #fdecea; color: #a02a1e; font-weight: 600; }
button.rec { background: var(--bad); color: #fff; }
button.good { background: var(--good); color: #fff; }
button:disabled { opacity: .5; cursor: default; }
.panel { background: var(--panel); border-radius: 16px; padding: 18px; margin: 12px 0; }
.panel h2 { margin: 0 0 6px; font-size: 1.15rem; }

/* choosing a friend */
.cast { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 12px; }
.pick { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px; border: 3px solid var(--line); border-radius: 14px; background: #fff; font-weight: 600; }
.pick canvas { width: 96px; height: 96px; image-rendering: pixelated; border-radius: 12px; }
.pick small { font-weight: 400; color: #667085; }

/* the conversation */
.friend { display: flex; align-items: center; gap: 12px; color: #fff; margin: 4px 0 10px; }
.friend canvas { width: 80px; height: 80px; image-rendering: pixelated; border-radius: 14px; flex: none; }
.friend .who { flex: 1; }
.friend .who b { display: block; font-size: 1.1rem; }
.friend button { padding: 6px 12px; font-size: .85rem; }
.meter { height: 10px; background: rgba(255,255,255,.2); border-radius: 6px; overflow: hidden; margin-top: 6px; }
.meter span { display: block; height: 100%; background: var(--accent); }
.line { background: var(--panel); border-radius: 16px; padding: 14px; margin: 12px 0; }
.line.locked { background: rgba(255,255,255,.12); color: #c7cedb; }
.line.done { border-left: 8px solid var(--good); }
.line .n { font-size: .8rem; font-weight: 700; color: #667085; text-transform: uppercase; letter-spacing: .04em; }
.bubble { display: flex; align-items: center; gap: 10px; margin: 8px 0; padding: 10px 12px; border-radius: 14px; background: #eef1f6; }
.bubble.me { background: #fff4d6; }
.bubble .txt { flex: 1; }
.bubble .fr { font-weight: 600; }
.bubble .en { font-size: .85rem; color: #667085; margin-top: 2px; }
.bubble button { flex: none; padding: 6px 12px; }
.tpl { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.tpl input, .tpl select { font: inherit; padding: 6px 8px; border: 2px solid var(--line); border-radius: 8px; max-width: 100%; }
.tpl input { width: 11ch; }
.tpl input.bad, .tpl select.bad { border-color: var(--bad); }
.controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; align-items: center; }
.status { font-size: .9rem; color: #667085; }
.status.ok { color: var(--good); font-weight: 600; }
.timer { font-weight: 700; color: var(--bad); min-width: 3ch; }
.level { width: 80px; height: 10px; background: #eef1f6; border-radius: 5px; overflow: hidden; }
.level span { display: block; height: 100%; width: 0; background: var(--good); }
.note { padding: 10px 12px; border-radius: 10px; background: #fff4d6; margin: 8px 0; font-size: .95rem; }
.error { background: #fdecea; color: #a02a1e; padding: 10px 12px; border-radius: 8px; margin: 8px 0; }
.all { display: flex; justify-content: center; margin: 16px 0; }

.bubble .pr { font-size: .95rem; color: #7a4b00; margin-top: 2px; font-style: italic; }
.pronnote { color: #c7cedb; font-size: .85rem; margin: 0 4px 6px; }

.bubble canvas.ava { width: 64px; height: 64px; image-rendering: pixelated; border-radius: 12px; flex: none; }
.mebox { flex: none; width: 72px; height: 72px; padding: 2px; border: 3px solid #f0c060; border-radius: 14px; background: #fff; }
.mebox canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.unitpick { color: #fff; margin: 4px 4px 8px; font-size: .95rem; }
.unitpick select { font: inherit; padding: 4px 8px; border-radius: 8px; border: 2px solid var(--line); }
