.topic-game-attachment { margin:0 0 28px; border:1px solid #bfd9e9; border-radius:10px; background:#f6fbff; overflow:hidden; }
.topic-game-row { display:flex; gap:24px; align-items:center; padding:22px; }
.topic-game-row > img { width:clamp(160px,25%,280px); height:110px; object-fit:contain; flex-shrink:0; border:1px solid #cde0ec; border-radius:7px; background:#fff; }
.topic-game-copy { flex:1; min-width:0; }
.topic-game-copy > span { font-size:11px; font-weight:600; color:#006ba7; }
.topic-game-copy h3 { margin:6px 0 8px; color:#073e63; font:700 24px/1.3 "Trebuchet MS","Segoe UI",sans-serif; }
.topic-game-copy p { margin:0; color:#476778; font-size:14px; line-height:1.6; }
.topic-game-copy small { display:block; margin-top:8px; color:#526e80; overflow-wrap:anywhere; }
.topic-game-actions { display:grid; gap:9px; flex-shrink:0; }
.topic-game-actions button,.topic-game-admin button { display:inline-flex; gap:18px; align-items:center; justify-content:center; padding:12px 17px; border:1px solid #0071bc; border-radius:6px; color:#fff; background:#0071bc; font:600 14px/1.4 "Segoe UI",sans-serif; cursor:pointer; }
.topic-game-actions a { color:#0068a2; font-size:12px; text-align:center; }
.topic-game-actions [data-game-export] { color:#0068a2; background:#fff; border-color:#bcd7e8; font-size:12px; padding:8px 12px; }
.topic-game-actions button:disabled,.topic-game-admin button:disabled { opacity:.55; cursor:wait; }
.topic-game-load { margin:0; padding:0 22px 18px; font-size:13px; color:#526b7d; }
.topic-game-load button { margin-left:10px; padding:5px 12px; border:1px solid #bdd7e7; border-radius:4px; color:#0065a1; background:white; cursor:pointer; }
.topic-game-admin { border-top:1px solid #cfe1ed; background:#fff; }
.topic-game-admin summary { padding:15px 22px; color:#145474; font-size:13px; cursor:pointer; }
.topic-game-admin form { padding:0 22px 22px; display:grid; gap:14px; }
.topic-game-admin form > p { margin:0; font-size:13px; line-height:1.6; color:#4b6474; }
.topic-game-admin label { display:grid; gap:7px; font-size:13px; color:#244e67; }
.topic-game-admin input { max-width:100%; width:100%; padding:10px; border:1px solid #bed7e7; border-radius:5px; background:#f8fbfe; box-sizing:border-box; }
.topic-game-admin form > div { display:flex; flex-wrap:wrap; gap:10px; }
.topic-game-admin [data-game-restore] { color:#22536c; background:#fff; border-color:#b8d0e0; }
.topic-game-admin [data-game-status] { color:#086444; }
.topic-game-admin [data-game-status].is-error { color:#a22233; }
.topic-game-attachment :is(button,a,summary,input):focus-visible { outline:3px solid #00a6e0; outline-offset:3px; }
.topic-game-dialog { width:calc(100vw - 28px); height:calc(100dvh - 28px); max-width:none; max-height:none; margin:auto; padding:0; border:1px solid #c5d7e3; border-radius:10px; background:#eef3f8; color:#123e5a; }
.topic-game-dialog::backdrop { background:#082a46c9; }
.topic-game-shell { display:flex; flex-direction:column; width:100%; height:100%; min-height:0; background:#eef3f8; }
.topic-game-shell:fullscreen { width:100vw; height:100dvh; }
.topic-game-shell > header { display:flex; align-items:center; gap:10px; flex:none; min-height:48px; padding:6px 14px; box-sizing:border-box; border-bottom:1px solid #c9dae8; background:white; }
.topic-game-shell > header strong { flex:1; font-size:14px; }
.topic-game-shell > header a { color:#0068a2; font-size:13px; }
.topic-game-shell > header button { padding:8px 12px; border:1px solid #bdd3e1; border-radius:5px; background:#fff; color:#174968; cursor:pointer; }
.topic-game-shell > header button:focus-visible { outline:3px solid #0071bc; outline-offset:2px; }
.topic-game-shell iframe { flex:1; min-height:0; width:100%; border:0; background:#eef3f8; }
@media(max-width:950px) { .topic-game-row { flex-wrap:wrap; gap:16px; } .topic-game-actions { display:flex; align-items:center; flex-wrap:wrap; } }
@media(max-width:600px) { .topic-game-row { padding:17px; gap:14px; } .topic-game-row > img { width:100%; height:auto; max-height:120px; } .topic-game-copy { flex-basis:100%; } .topic-game-copy h3 { font-size:23px; } .topic-game-dialog { width:100vw; height:100dvh; border:0; border-radius:0; } .topic-game-shell > header { flex-wrap:wrap; } .topic-game-shell > header strong { flex-basis:100%; } }

.topic-game-row > .topic-game-cover { height:150px; aspect-ratio:16/9; object-fit:contain; padding:6px; box-sizing:border-box; }
.topic-game-cover-preview { display:block; max-width:100%; width:280px; height:158px; object-fit:contain; border:1px solid #bed7e7; border-radius:7px; padding:6px; background:#f6fbff; box-sizing:border-box; }
.topic-game-cover-preview[hidden] { display:none; }
@media(max-width:600px) { .topic-game-row > .topic-game-cover { height:auto; max-height:200px; width:100%; } }
/* Guided game editor: keep file selection and destructive actions distinct. */
.topic-game-admin summary { font-size:16px; font-weight:600; background:#eaf5fc; border-bottom:1px solid #cfe1ed; }
.topic-game-admin form { padding:18px 22px 22px; gap:16px; }
.topic-game-admin .game-editor-context { color:#005e98; background:#f1f8fd; padding:10px 14px; border-radius:6px; }
.topic-game-admin .game-editor-context span { color:#4b6474; }
.topic-game-admin form > .game-editor-step { display:grid; gap:9px; padding:16px; border:1px solid #d6e5ef; border-radius:8px; background:#fbfdff; }
.topic-game-admin .game-editor-step label { font-size:14px; font-weight:600; }
.topic-game-admin .game-editor-step label small { font-size:12px; font-weight:400; color:#5c7485; }
.topic-game-admin .game-editor-step p { margin:0; font-size:13px; line-height:1.6; color:#536d7e; }
.topic-game-admin .game-current-file { overflow-wrap:anywhere; color:#005e98; padding:8px 10px; background:#eaf5fc; border-radius:4px; }
.topic-game-admin input[type=file] { background:white; font-size:13px; }
.topic-game-admin .game-editor-actions { justify-content:space-between; border-top:1px solid #dbe8f0; padding-top:16px; }
.topic-game-admin [data-game-restore],.topic-game-admin [data-game-delete-confirm] { color:#a42e3b; background:#fff5f5; border-color:#dbaeb5; }
.topic-game-admin .game-delete-confirm { margin:0; padding:16px; border:1px solid #dbaeb5; border-radius:8px; background:#fff8f8; }
.topic-game-admin .game-delete-confirm[hidden] { display:none; }
.topic-game-admin .game-delete-confirm p { margin:0 0 8px; line-height:1.6; font-size:14px; color:#76333c; }
.topic-game-admin .game-delete-confirm strong { display:block; margin-bottom:14px; overflow-wrap:anywhere; }
.topic-game-admin .game-delete-confirm > div { display:flex; flex-wrap:wrap; gap:10px; }
.topic-game-admin [data-game-delete-cancel] { background:#fff; color:#214b65; border-color:#bcd3e2; }
@media(max-width:600px) { .topic-game-admin form { padding:14px; } .topic-game-admin form > .game-editor-step { padding:12px; } }
.topic-game-opening { flex:none; margin:0; padding:12px 18px; background:#e7f4fc; color:#005c96; font-size:14px; }
.topic-game-opening[hidden] { display:none; }
/* Keep the HTML's empty template hidden until its saved data and scripts load. */
.topic-game-shell { position:relative; }
.topic-game-shell.is-loading iframe { visibility:hidden; }
.topic-game-shell.is-loading .topic-game-opening { position:absolute; inset:60px 0 0; z-index:2; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:18px; padding:24px; text-align:center; background:#eef5fa; font-size:17px; }
.topic-game-shell.is-loading .topic-game-opening::before { content:''; width:36px; height:36px; border:4px solid #c4deee; border-top-color:#0071bc; border-radius:50%; animation:topic-game-spin 1s linear infinite; }
@keyframes topic-game-spin { to { transform:rotate(360deg); } }
@media(prefers-reduced-motion:reduce) { .topic-game-shell.is-loading .topic-game-opening::before { animation:none; } }
