:root { --bg: #f5f4f0; --card: #ffffff; --ink: #1b1d2a; --muted: #6b6f80; --accent: #4d96ff; --danger: #ff6b6b; --line: #e6e4dd; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.4 system-ui, -apple-system, sans-serif; }
a { color: var(--accent); text-decoration: none; }
main { max-width: 520px; margin: 0 auto; padding: 0 12px 60px; }
.top { display: flex; justify-content: space-between; align-items: center; max-width: 520px; margin: 0 auto; padding: 12px; }
.logo { font-weight: 800; font-size: 22px; color: var(--ink); letter-spacing: -0.5px; }
.me { color: var(--muted); }
button, .btn { font: inherit; border: 0; border-radius: 999px; padding: 8px 16px; background: var(--ink); color: #fff; cursor: pointer; }
.btn { display: inline-block; }
button.danger { background: transparent; color: var(--danger); padding: 8px 4px; }
.composer { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px; margin: 8px 0 20px; }
.composer textarea { width: 100%; border: 0; resize: none; font: inherit; font-size: 18px; outline: none; background: transparent; }
.composer .row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; color: var(--muted); font-size: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 16px; }
.card header { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; }
.card header b { color: var(--ink); }
.prompt { font-size: 20px; margin: 6px 0 4px; font-weight: 600; line-height: 1.25; }
.prompt a { color: var(--ink); }
.lineage { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.game { position: relative; width: 100%; aspect-ratio: 3 / 4; max-height: 560px; border-radius: 12px; overflow: hidden; background: #1b1d2a; display: flex; align-items: center; justify-content: center; margin: 8px 0; }
.game iframe { width: 100%; height: 100%; border: 0; display: block; }
.game .play { font-size: 18px; padding: 12px 28px; background: #fff; color: var(--ink); }
.game.pending { color: #cfd3e6; gap: 10px; }
.game.failed { flex-direction: column; background: #fff3f3; color: var(--danger); gap: 8px; padding: 12px; }
.game.failed pre { white-space: pre-wrap; font-size: 12px; margin: 0; max-height: 200px; overflow: auto; width: 100%; }
.crash { position: absolute; bottom: 8px; left: 8px; background: rgba(0,0,0,0.7); color: #fff; padding: 4px 10px; border-radius: 8px; font-size: 13px; }
.spinner { width: 18px; height: 18px; border: 3px solid #555a75; border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.card footer { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 6px; font-size: 14px; }
.card footer .count { color: var(--muted); }
.inline { display: inline; margin-left: auto; }
.join { max-width: 360px; margin: 60px auto; display: flex; flex-direction: column; gap: 12px; }
.join input { font: inherit; font-size: 18px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; }
.error { color: var(--danger); margin: 0; }
.empty { color: var(--muted); text-align: center; }
.section { color: var(--muted); font-weight: 600; margin: 24px 0 8px; }
.hint { color: var(--muted); margin: 0; }
.comments { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 20px; scroll-margin-top: 12px; }
.comments > .section { margin: 0 0 4px; color: var(--ink); }
.comment { border-bottom: 1px solid var(--line); padding: 14px 0; scroll-margin-top: 12px; }
.comment header { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; }
.comment .time { color: var(--muted); margin-left: auto; }
.comment p { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-form { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.comment-form label { font-weight: 600; }
.comment-form .hint { font-size: 13px; }
.comment-form textarea { display: block; width: 100%; min-height: 96px; resize: vertical; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.comment-form textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.comment-form button { align-self: flex-end; }

.attachment { margin: 0; }
.composer-tools { display: flex; align-items: center; gap: 8px; }
.composer .image-button { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; background: transparent; color: var(--accent); border-radius: 50%; }
.composer .image-button[hidden] { display: none; }
.composer .image-button:hover { background: var(--bg); }
.composer .image-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#image-preview { margin-top: 10px; }
#image-preview[hidden] { display: none; }
#preview-image { display: block; max-width: 100%; max-height: 180px; border-radius: 8px; margin-bottom: 6px; }
.reference-thumbnail { max-width: 100%; width: auto; max-height: 100px; border-radius: 6px; margin-bottom: 10px; }
#image-error { color: #c44; }

.card .like-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; min-height: 44px; padding: 4px 8px; background: transparent; color: var(--muted); }
.card .like-button[aria-pressed="true"] { color: #d94c75; }
.card .like-button[aria-pressed="true"] svg { fill: currentColor; }
.card .like-button:hover { background: var(--bg); }
.card .like-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card .like-button:disabled { cursor: wait; opacity: 0.6; }
.card .feedback-error { margin: 8px 0 0; font-size: 13px; }

.image-hint { margin: 6px 0 10px; font-size: 13px; color: var(--muted); }
.image-reference { margin: 8px 0; }
.image-reference .reference-thumbnail { display: block; margin-bottom: 4px; }
.image-reference figcaption { font-size: 13px; color: var(--muted); }

.game-prompt { margin: 0 0 12px; color: var(--muted); font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }

.comment-preview { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 8px; font-size: 14px; }
.comment-preview p { margin: 6px 0; overflow-wrap: anywhere; }
.comment-preview p a { color: var(--ink); white-space: pre-wrap; }
.comment-preview .all-comments { display: inline-block; margin-top: 4px; color: var(--muted); }

.join form { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.join label { font-size: 14px; }
.join form button { align-self: flex-start; }
.account-hint, .guest-invite { font-size: 14px; margin: 0 0 16px; color: var(--muted); }
