/* Frontend and admin preview; fully scoped to avoid theme collisions. */
.hmg-system-game,.hmg-system-game *{box-sizing:border-box}
.hmg-system-game{width:100%;max-width:960px;margin:22px auto;padding:clamp(14px,3vw,28px);border-radius:17px;background:#0b2637;color:#edf8ff;border:1px solid #3b7182;font:400 15px/1.7 system-ui,"Noto Sans Thai",sans-serif;overflow:hidden}
.hmg-system-game h3{font-size:clamp(19px,3vw,28px)!important;color:#f3ffff!important;margin:4px 0 10px;line-height:1.35}
.hmg-system-game p{margin:10px 0;line-height:1.65;color:inherit}
.hmg-system-game a{color:#83ebe3;text-decoration:underline;overflow-wrap:anywhere}
.hmg-system-game .hmg-system-kicker{font-size:11px;font-weight:750;letter-spacing:.09em;color:#78e0d6}
.hmg-system-game .hmg-system-preset{font-weight:650;color:#f0d89a}
.hmg-system-game .hmg-system-play{background:#143b4e;border:1px solid #456b7c;padding:clamp(10px,2vw,18px);margin:15px 0;border-radius:12px;min-width:0}
.hmg-system-game .hmg-sys-score{font-size:clamp(13px,2vw,16px);font-weight:650;color:#c9fbf4;overflow-wrap:anywhere;margin:9px 0}
.hmg-system-game .hmg-sys-status{background:#0e3142;border-left:3px solid #69e2db;color:#d0f6f2;padding:10px;border-radius:6px;font-size:14px}
.hmg-system-game .hmg-sys-controls{display:flex;flex-wrap:wrap;gap:8px;margin:13px 0}
.hmg-system-game .hmg-system-button{border-radius:9px;border:1px solid #78b2b8;min-height:44px;background:#235d69;color:#fff;cursor:pointer;font:inherit;font-size:14px;padding:8px 12px;max-width:100%}
.hmg-system-game .hmg-system-button:disabled{opacity:.55;cursor:default}
.hmg-system-game button:focus-visible{outline:3px solid #f6cb70;outline-offset:2px}
.hmg-system-game .hmg-sys-hex-map{display:flex;flex-direction:column;align-items:center;gap:2px;max-width:100%;overflow:visible}
.hmg-system-game .hmg-sys-hex-row{display:flex;justify-content:center;gap:2px}
.hmg-system-game .hmg-sys-hex-row:not(:first-child){margin-top:-6px}
.hmg-system-game .hmg-sys-hex{border:1px solid #68a7b0;cursor:pointer;background:#1d5362;color:#f2fbfe;flex:0 0 auto;width:clamp(32px,7.8vw,48px);height:clamp(32px,7.8vw,48px);padding:0;min-width:0;min-height:0;font:700 16px/1 system-ui;clip-path:polygon(50% 0,100% 25%,100% 75%,50% 100%,0 75%,0 25%)}
.hmg-system-game .hmg-sys-hex.is-wall{background:#38414f;color:#b6bdc5;cursor:not-allowed}
.hmg-system-game .hmg-sys-hex.is-start{border:2px solid #ffd38c}
.hmg-system-game .hmg-sys-hex.is-goal{background:#0e8574;color:#fff}
.hmg-system-game .hmg-sys-hex.is-visited{box-shadow:inset 0 0 0 2px #76d8cc}
.hmg-system-game .hmg-sys-hex.is-current{background:#ffca74;color:#13333b;border-color:#fff}
.hmg-system-game .hmg-sys-memory-map{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:4px;max-width:500px;margin:12px auto}
.hmg-system-game .hmg-sys-memory-cell{display:flex;justify-content:center;align-items:center;min-height:37px;border-radius:7px;background:#255266;color:#dcefff;font-size:12px;min-width:0;overflow:hidden}
.hmg-system-game .hmg-sys-memory-cell.has-resource{color:#ffcf80}
.hmg-system-game .hmg-sys-memory-cell.has-resource.is-known{background:#227466;color:#fff}
.hmg-system-game .hmg-sys-memory-cell.has-agent{background:#4278ab;color:#fff;font-weight:750}
.hmg-system-game .hmg-sys-hint{font-size:12px!important;color:#bad9e4!important}
.hmg-system-game .hmg-sys-log{padding-left:20px;margin:9px 0;max-height:320px;overflow-y:auto;font-size:13px}
.hmg-system-game .hmg-sys-log li{margin:5px 0}
.hmg-system-game .hmg-system-disclaimer{background:#1e3e4a;padding:11px;border-left:3px solid #facb76;border-radius:7px;font-size:13px}
.hmg-system-game .hmg-system-source{color:#b8d7e1;font-size:12px}
.hmg-system-library{max-width:1300px;color:#1d3038}
.hmg-system-library .hmg-sys-warning{background:#fff5d8;padding:12px;border-left:4px solid #e4ab40}
.hmg-system-library .hmg-system-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr));gap:14px;margin:15px 0 24px}
.hmg-system-library .hmg-system-card,.hmg-system-library .hmg-system-source-card{background:#fff;padding:17px;border:1px solid #cddcdf;border-radius:12px;min-width:0}
.hmg-system-library .hmg-system-card h3,.hmg-system-library .hmg-system-source-card h3{margin:0 0 8px;font-size:17px}
.hmg-system-library .hmg-system-tag{color:#146a61;font-weight:700}
.hmg-system-library .hmg-system-source-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,330px),1fr));gap:12px}
.hmg-system-library .hmg-system-source-actions{display:flex;flex-wrap:wrap;gap:14px;align-items:center}
.hmg-system-library .hmg-system-source-actions form{margin:0}
@media(max-width:400px){.hmg-system-game{padding:12px}.hmg-system-game .hmg-sys-hex{width:clamp(31px,9vw,36px);height:clamp(31px,9vw,36px);font-size:13px}.hmg-system-game .hmg-sys-controls button{flex:1 1 135px}}
@media(prefers-reduced-motion:reduce){.hmg-system-game *{animation:none!important;transition:none!important}}

/* New v0.4.1 agent-architecture & incident challenges — scoped to Game Lab only. */
.hmg-system-game .hmg-sys-architect-form{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr));gap:12px;margin:13px 0}
.hmg-system-game .hmg-sys-architect-field{display:flex;flex-direction:column;gap:5px;min-width:0;font-size:14px;color:#e9f6f9}
.hmg-system-game .hmg-sys-architect-label{font-weight:700}
.hmg-system-game .hmg-sys-select{width:100%;max-width:100%;padding:10px 9px;min-height:44px;background:#eef9fc;border:1px solid #7fabb9;border-radius:8px;color:#112f40;font:inherit;font-size:14px}
.hmg-system-game .hmg-sys-select:focus-visible{outline:3px solid #ffdc83;outline-offset:2px}
.hmg-system-game .hmg-sys-evaluation{padding:10px 0}
.hmg-system-game .hmg-sys-grade{font-size:clamp(17px,3vw,21px);color:#b0f8e8}
.hmg-system-game .hmg-sys-alert{background:#643d30;border-left:3px solid #ffd075;padding:10px;border-radius:6px;color:#fff2dc;font-weight:600}
.hmg-system-game .hmg-sys-correct{background:#1e6752;border-left:3px solid #95edc6;padding:10px;border-radius:6px;color:#f2fffa;font-weight:600}
.hmg-system-game .hmg-sys-choice-list{display:grid;grid-template-columns:1fr;gap:10px;max-width:100%}
.hmg-system-game .hmg-sys-choice-list .hmg-sys-choice{text-align:left;white-space:normal;overflow-wrap:anywhere;min-width:0;height:auto;padding:10px 14px}
.hmg-system-game .hmg-sys-choice.is-correct{background:#237c62;border-color:#a3f4d5}
.hmg-system-game .hmg-sys-choice.is-wrong{background:#854337;border-color:#ffd5a9}
.hmg-system-game .hmg-sys-choice:disabled{opacity:1;cursor:default}
.hmg-system-game .hmg-sys-question{font-size:clamp(16px,2.5vw,19px);color:#f3ffff;margin:10px 0}
.hmg-system-game .hmg-sys-controls [hidden]{display:none!important}
@media(max-width:400px){.hmg-system-game .hmg-sys-architect-form{grid-template-columns:1fr}.hmg-system-game .hmg-sys-choice{width:100%}}


/* Hybrid Mind AI Automation Manager v1 — scoped Game Lab extension. */
.hmg-system-game .hmg-am{color:#eef9ff;isolation:isolate}
.hmg-system-game .hmg-am *{box-sizing:border-box}
.hmg-system-game .hmg-am-intro{font-size:15px;line-height:1.75;color:#cfdfed!important}
.hmg-system-game .hmg-am-head{display:flex;flex-wrap:wrap;gap:9px;align-items:center;justify-content:space-between;background:linear-gradient(90deg,#0e4059,#113044);padding:11px 12px;border:1px solid #4b839d;border-radius:10px;margin:12px 0}
.hmg-system-game .hmg-am-phase{font-size:13px;font-weight:800;letter-spacing:1px;color:#70f0fc}
.hmg-system-game .hmg-am-event{color:#e2f0fa;font-size:12px}
.hmg-system-game .hmg-am-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
.hmg-system-game .hmg-am-card{background:#082639;border:1px solid #42718b;border-radius:12px;padding:11px;min-width:0;display:flex;flex-direction:column;gap:4px}
.hmg-system-game .hmg-am-card strong{color:#e9fdff;font-size:15px;overflow-wrap:anywhere}
.hmg-system-game .hmg-am-card small{font-size:11px;color:#b9d2e5}
.hmg-system-game .hmg-am-label{display:flex;flex-direction:column;gap:5px;font-size:12px;font-weight:700;color:#d6e8f4}
.hmg-system-game .hmg-am-select{background:#092236!important;border:1px solid #74a9c1!important;color:#effcff!important;min-width:0;width:100%;font:inherit;font-size:13px;min-height:44px;border-radius:8px;padding:8px}
.hmg-system-game .hmg-am-controls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;border:1px solid #37677e;background:#0a293b;padding:12px;margin:12px 0;border-radius:12px}
.hmg-system-game .hmg-am-toggle{display:flex;align-items:center;gap:9px;color:#e1eff6;font-size:13px;cursor:pointer}
.hmg-system-game .hmg-am-toggle input{accent-color:#54e2fd;min-width:19px;min-height:19px}
.hmg-system-game .hmg-am-toggle input:disabled{opacity:.5}
.hmg-system-game .hmg-am-actions{display:flex;flex-wrap:wrap;gap:9px;margin:14px 0}
.hmg-system-game .hmg-am-play{background:linear-gradient(90deg,#0d9fbf,#147bd0)!important;font-weight:800!important;border-color:#9aefff!important}
.hmg-system-game .hmg-am-status{font-size:13px!important;color:#d1e7ef!important;border-left:3px solid #66e5eb;background:#102e40;padding:9px 12px;border-radius:5px}
.hmg-system-game .hmg-am-board{margin:13px 0;padding:14px;border:1px solid #468ba3;background:#061c2a;border-radius:12px}
.hmg-system-game .hmg-am-board[hidden]{display:none}
.hmg-system-game .hmg-am-result-title{font-size:18px;color:#fff!important;margin:1px 0 10px!important}
.hmg-system-game .hmg-am-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;margin:12px 0}
.hmg-system-game .hmg-am-stat{background:#12394c;padding:8px;border:1px solid #3c6e84;border-radius:8px;min-width:0;display:grid;gap:2px}
.hmg-system-game .hmg-am-stat span{font-size:11px;color:#c5dbe7}
.hmg-system-game .hmg-am-stat strong{font-size:clamp(13px,2vw,18px);color:#68e4ed;overflow-wrap:anywhere}
.hmg-system-game .hmg-am-hours{min-width:0;overflow-x:auto;display:grid;grid-template-columns:repeat(24,minmax(20px,1fr));gap:4px;align-items:end;border:1px solid #37677e;padding:10px;border-radius:9px;background:#091b2c}
.hmg-system-game .hmg-am-hour{display:flex;flex-direction:column;align-items:center;justify-content:end;gap:5px;min-width:20px}
.hmg-system-game .hmg-am-hourbar{display:block;min-height:10px;width:100%;border-radius:3px}
.hmg-system-game .hmg-am-hourbar.is-ok{background:#48dfce}
.hmg-system-game .hmg-am-hourbar.is-failed{background:#fb878d}
.hmg-system-game .hmg-am-hourbar.is-idle{background:#264e66}
.hmg-system-game .hmg-am-hourlabel{font-size:10px;color:#abc8d6}
.hmg-system-game .hmg-am-messages{padding-left:21px;margin:11px 0;font-size:13px;color:#d5e8f0;line-height:1.65}
.hmg-system-game .hmg-am-messages li{margin:4px 0;color:inherit}
.hmg-system-game .hmg-am-event-detail{font-weight:800}
.hmg-system-game .hmg-am-finale{color:#99fff0!important;font-weight:800}
.hmg-system-game .hmg-am-foot{font-size:12px!important;color:#accada!important;border-top:1px solid #3d6577;padding-top:11px}
@media(max-width:560px){.hmg-system-game .hmg-am-grid,.hmg-system-game .hmg-am-controls{grid-template-columns:1fr}.hmg-system-game .hmg-am-stats{grid-template-columns:repeat(2,minmax(0,1fr))}.hmg-system-game .hmg-am-hours{grid-template-columns:repeat(24,minmax(20px,1fr));}.hmg-system-game .hmg-am-actions .hmg-system-button{flex:1 1 145px}}
