/* 1-Bit RPG - Dark Theme with CRT effect */
:root {
  color-scheme: dark;
  --bg: #0b0f10;
  --bg-panel: #12171a;
  --text: #E8F1E3;
  --muted: #9AA6A0;
  --accent: #78FF6C;
  --danger: #ff6b6b;
  --ok: #00d084;
  --shadow: rgba(0,0,0,0.6);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, sans-serif; }
img { max-width: 100%; display: inline-block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header, .site-footer { max-width: 1100px; margin: 0 auto; padding: 16px 16px; display: flex; align-items: center; justify-content: space-between; }
.site-footer { opacity: 0.8; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 18px; margin: 0; letter-spacing: 0.5px; }
.actions { display: flex; gap: 8px; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 16px 32px; display: grid; grid-template-columns: 1fr; gap: 16px; }

.panel { background: var(--bg-panel); border: 1px solid #1b2124; border-radius: 10px; padding: 16px; box-shadow: 0 8px 20px var(--shadow); }
.panel h2 { margin: 0 0 8px; font-size: 16px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.checkbox { flex-direction: row; align-items: center; gap: 8px; }
.field.actions { display: flex; gap: 8px; align-items: center; }
label { font-size: 13px; color: var(--muted); }
input[type="text"], input[type="number"], select { background: #0f1417; border: 1px solid #232a2f; color: var(--text); border-radius: 8px; padding: 10px 12px; outline: none; transition: border-color .2s ease; }
input:focus, select:focus { border-color: var(--accent); }

.btn { background: #1b2124; border: 1px solid #263036; padding: 10px 12px; border-radius: 8px; color: var(--text); cursor: pointer; transition: background .2s ease, border-color .2s ease, transform .02s ease; }
.btn:hover { background: #222a2f; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #08210a; border-color: #52d44a; }
.btn.primary:hover { background: #6bff60; }
.btn.ghost { background: transparent; border-color: #2b3439; }

.alert { border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.alert.ok { background: #0e2417; border: 1px solid #1b6f42; }
.alert.error { background: #261216; border: 1px solid #6f1b2b; }
.note { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }

.game { display: grid; grid-template-columns: 1fr; gap: 12px; }
.hud { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stats { display: flex; gap: 14px; align-items: center; }
.stat { background: #0f1417; border: 1px solid #232a2f; border-radius: 8px; padding: 8px 10px; display: flex; gap: 8px; align-items: center; }
.stat span { font-size: 11px; color: var(--muted); }
.stat strong { font-size: 16px; letter-spacing: 1px; }

.screen { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid #1b2124; background: #010203; }
.screen canvas { width: 100%; height: auto; display: block; image-rendering: pixelated; }

/* CRT effect */
.crt { filter: contrast(1.05) saturate(0) brightness(1.05); }
.crt::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(255,255,255,0.04), rgba(255,255,255,0.04) 1px, rgba(0,0,0,0.0) 2px, rgba(0,0,0,0.0) 3px); mix-blend-mode: overlay; pointer-events: none; }
.crt::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 50% 50%, rgba(120,255,108,0.08), rgba(0,0,0,0) 60%); animation: flicker 3s infinite; pointer-events: none; }
@keyframes flicker { 0% { opacity: .4; } 50% { opacity: .65; } 100% { opacity: .4; } }

.log { background: #0f1417; border: 1px solid #232a2f; border-radius: 8px; padding: 8px 10px; max-height: 160px; overflow: auto; }
.log p { margin: 4px 0; }
.help { color: var(--muted); font-size: 12px; }

.history { list-style: none; padding: 0; margin: 0; }
.history li { padding: 6px 0; border-bottom: 1px dashed #23313a; }
.history li:last-child { border-bottom: 0; }

.toast { position: fixed; left: 50%; transform: translateX(-50%) translateY(8px); bottom: 18px; background: #111; color: var(--text); border: 1px solid #2b3439; border-radius: 8px; padding: 8px 12px; opacity: 0; transition: opacity .2s ease, transform .2s ease; z-index: 999; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 960px) { .container { grid-template-columns: 1.1fr 1fr; } .game { grid-column: 1 / -1; } }
