/* 13th Chamber Game Studio — terminal-teal theme */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #070b10; --panel: #0b1219; --line: #123a42; --teal: #2de2ff;
  --magenta: #ff2d8a; --text: #c8d8dc; --dim: #5f7a84; --good: #3dff9a;
}
html, body { height: 100%; }
body {
  background: radial-gradient(ellipse at 50% -20%, #0d1b26 0%, var(--bg) 60%);
  color: var(--text); font-family: 'Courier New', ui-monospace, monospace;
  display: flex; flex-direction: column; min-height: 100vh;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; border-bottom: 1px solid var(--line);
  background: rgba(7, 11, 16, 0.9); position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(8px);
}
.brand { font-size: 18px; letter-spacing: 2px; color: #eaf6f8; font-weight: bold; }
.brand .thirteen { color: var(--teal); }
.brand .divider { color: var(--magenta); padding: 0 6px; }
.topnav a { color: var(--dim); text-decoration: none; margin-left: 18px; font-size: 13px; letter-spacing: 1px; }
.topnav a:hover { color: var(--teal); }

main { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 24px; display: grid; gap: 24px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 14px; letter-spacing: 3px; color: var(--teal); font-weight: bold; }
.badge { font-size: 11px; color: var(--dim); letter-spacing: 1px; }

/* Live screen */
.screen-wrap { position: relative; padding: 12px; background: #05080c; }
#game-frame { width: 100%; height: 560px; border: 1px solid var(--line); border-radius: 6px; background: #000; display: block; }
.screen-hint { padding: 10px 4px 4px; font-size: 12px; color: var(--dim); letter-spacing: 1px; }

/* Builder */
.builder-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 0; }
.builder-left { padding: 20px; border-right: 1px solid var(--line); }
.builder-right { display: grid; gap: 0; align-content: start; }
.field-label { display: block; font-size: 11px; letter-spacing: 2px; color: var(--teal); margin-bottom: 6px; }
textarea, select, input {
  width: 100%; background: #050a0f; color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 10px 12px; font-family: inherit; font-size: 14px;
}
textarea:focus, select:focus, input:focus { outline: none; border-color: var(--teal); }
textarea { resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin: 16px 0; }
.field { min-width: 0; }

.run-row { display: flex; align-items: center; gap: 12px; margin: 8px 0 14px; flex-wrap: wrap; }
button {
  font-family: inherit; font-size: 13px; letter-spacing: 1px; cursor: pointer;
  border-radius: 6px; padding: 11px 20px; border: 1px solid transparent;
}
button.primary { background: linear-gradient(135deg, #0e6d7d, #0a4a56); color: #eaffff; border-color: var(--teal); }
button.primary:hover { background: linear-gradient(135deg, #12839a, #0c5b6b); }
button.danger { background: #3a0f1c; color: #ff8fb0; border-color: var(--magenta); }
button.danger:disabled, button.primary:disabled { opacity: 0.4; cursor: not-allowed; }
button.ghost { background: transparent; color: var(--teal); border-color: var(--line); }
button.ghost:hover { border-color: var(--teal); }
button.wide { width: 100%; margin-bottom: 10px; }
.status { font-size: 12px; color: var(--dim); letter-spacing: 1px; }
.status.running { color: var(--good); animation: pulse 1.5s infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }

.meter { height: 6px; background: #050a0f; border-radius: 3px; overflow: hidden; border: 1px solid var(--line); }
.meter-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--teal), var(--magenta)); transition: width 1s; }
.progress-line { margin-top: 8px; font-size: 12px; color: var(--dim); }

.subpanel { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.subpanel:last-child { border-bottom: none; }
.subpanel h3 { font-size: 12px; letter-spacing: 2px; color: var(--teal); margin-bottom: 10px; }
.log { height: 220px; overflow-y: auto; background: #050a0f; border: 1px solid var(--line); border-radius: 6px; padding: 10px; font-size: 12px; line-height: 1.7; }
.log-line { word-break: break-word; }
.log-line.sys { color: var(--dim); }
.log-line.ok { color: var(--good); }
.log-line.ai { color: var(--teal); }
.log-line.err { color: var(--magenta); }

/* Downloads */
.dl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding: 20px; }
.dl-card { border: 1px solid var(--line); border-radius: 8px; padding: 18px; background: #050a0f; }
.dl-card h3 { font-size: 13px; color: var(--teal); letter-spacing: 1px; margin-bottom: 8px; }
.dl-card p { font-size: 12px; color: var(--dim); margin-bottom: 14px; line-height: 1.6; }

/* MCP */
.mcp-intro { padding: 16px 20px 4px; font-size: 12px; color: var(--dim); line-height: 1.7; }
.mcp-grid { display: grid; grid-template-columns: 1fr 2fr auto; gap: 12px; padding: 12px 20px 4px; align-items: end; }
.mcp-list { padding: 10px 20px; }
.mcp-entry {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; margin: 8px 0;
  font-size: 13px; background: #050a0f;
}
.mcp-entry .mcp-name { color: var(--teal); letter-spacing: 1px; }
.mcp-entry .mcp-url { color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.mcp-entry button { padding: 4px 10px; font-size: 11px; }
.mcp-help { padding: 10px 20px 18px; font-size: 12px; color: var(--dim); }
.mcp-help summary { cursor: pointer; color: var(--teal); margin-bottom: 6px; }
.mcp-help a { color: var(--teal); }

.footer { padding: 18px 24px; border-top: 1px solid var(--line); font-size: 12px; color: var(--dim); text-align: center; letter-spacing: 1px; }
.footer a { color: var(--teal); text-decoration: none; }

@media (max-width: 900px) {
  .builder-grid, .dl-grid { grid-template-columns: 1fr; }
  .builder-left { border-right: none; border-bottom: 1px solid var(--line); }
  .field-row { grid-template-columns: 1fr; }
  .mcp-grid { grid-template-columns: 1fr; }
  #game-frame { height: 380px; }
}
