/* AI Dungeon Master Lite — Dark theme with purple accent */
:root{
  --bg: #0f1115;
  --panel: #161a22;
  --panel-2: #1b2230;
  --text: #e6e6eb;
  --muted: #a0a4b8;
  --accent: #8b5cf6;
  --accent-2: #6d28d9;
  --danger: #ef4444;
  --ok: #10b981;
  --warn: #f59e0b;
  --border: #242b3a;
  --shadow: rgba(0,0,0,0.4);
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: radial-gradient(1200px 800px at 10% -10%, #151827, transparent), var(--bg);
  color: var(--text);
}
a{color: var(--text)}

.site-header{
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 20px; border-bottom:1px solid var(--border);
  background: linear-gradient(180deg, rgba(139,92,246,0.06), transparent), var(--panel);
  position:sticky; top:0; z-index:10; backdrop-filter: blur(6px);
}
.brand{display:flex; align-items:center; gap:12px}
.logo{display:block}
.app-title{font-size:18px; margin:0}
.app-sub{font-size:12px; color:var(--muted)}
.status .tag{margin-left:8px}

.container{max-width:1100px; margin:24px auto; padding:0 16px}
.grid{display:grid; grid-template-columns: 1fr 1fr; gap:16px}
.card{
  background: var(--panel);
  border:1px solid var(--border);
  border-radius:12px;
  box-shadow: 0 10px 20px var(--shadow);
  padding:16px;
}
.card.wide{grid-column: 1 / -1}
.card h2, .card h3{margin:0 0 12px 0}

.form .field{margin-bottom:12px}
.field.two{display:grid; grid-template-columns: 1fr 1fr; gap:12px}
label{display:block; font-size:14px; color:var(--muted); margin-bottom:6px}
input[type=text], input[type=number], select{
  width:100%; padding:10px 12px; border-radius:8px; border:1px solid var(--border);
  background: var(--panel-2); color: var(--text);
}
input::placeholder{color:#707796}
.input-row{display:flex; gap:8px}
.hint{color:var(--muted)}

.btn{
  padding:10px 14px; border-radius:8px; border:1px solid transparent; cursor:pointer; color:white;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}
.btn:hover{filter:brightness(1.05)}
.btn:focus{outline:2px solid #c4b5fd; outline-offset:2px}
.btn.ghost{background:transparent; border-color:var(--border); color:var(--text)}
.btn.danger{background: linear-gradient(180deg, var(--danger), #b91c1c)}
.btn.choice{background:transparent; border-color:var(--accent); color:#d9ccff}

.actions-row{display:flex; gap:8px; flex-wrap:wrap; margin-top:6px}
.choices{display:flex; gap:8px; flex-wrap:wrap; margin-top:8px}

.alert{padding:12px 14px; border-radius:8px; margin-bottom:16px}
.alert.error{background:#2a1c1e; border:1px solid #4b1c1c}

.state .bar{display:grid; grid-template-columns: 40px 1fr auto; gap:8px; align-items:center; margin-bottom:8px}
.progress{height:10px; background:#0e1320; border-radius:6px; overflow:hidden; border:1px solid var(--border)}
.progress .fill{height:100%; background: linear-gradient(90deg,#6d28d9,#8b5cf6)}
.progress.alt .fill{background: linear-gradient(90deg,#ef4444,#f59e0b)}
.stats{display:flex; gap:12px; color:#cdd0df; font-size:14px}

.encounter .enc-head{display:flex; justify-content:space-between; align-items:center; margin-bottom:6px}
.enemy{font-weight:600}
.tag{display:inline-block; padding:4px 8px; border-radius:999px; font-size:12px; border:1px solid var(--border); color:#d1d5e7}
.tag.small{font-size:11px; padding:2px 8px}
.tag.ok{border-color:#065f46; color:#a7f3d0}
.tag.warn{border-color:#7c2d12; color:#fed7aa}

.history{display:flex; flex-direction:column; gap:12px; max-height:520px; overflow:auto; padding-right:6px}
.turn{background: var(--panel-2); border:1px solid var(--border); border-radius:10px; padding:12px}
.turn-head{display:flex; gap:10px; align-items:center; justify-content:space-between}
.turn-no{font-weight:600}
.action{color:#d1c4ff}
.muted{color:var(--muted)}
.narration{white-space:pre-wrap; line-height:1.4}

.site-footer{display:flex; justify-content:space-between; padding:16px 20px; border-top:1px solid var(--border); color:var(--muted)}

@media (max-width: 900px){
  .grid{grid-template-columns: 1fr}
  .card.wide{grid-column: 1/2}
}
