:root {
  color: #f5f7fa;
  background: #11161c;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}
* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

button,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  width: 100%;
  height: 100%;
}

.editor-pane {
  position: relative;
  min-width: 0;
  background: #fff;
}

.editor-host,
#makecode-editor {
  display: block;
  width: 100%;
  height: 100%;
}

#makecode-editor {
  border: 0;
}

.editor-host[hidden] {
  display: none;
}

.connection-gate {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  padding: 32px;
  color: #f5f7fa;
  background:
    radial-gradient(circle at 20% 15%, rgb(100 172 72 / 24%), transparent 34%),
    linear-gradient(145deg, #172029, #0f151b 64%);
}

.connection-gate[hidden] {
  display: none;
}

.connection-card {
  width: min(680px, 100%);
  padding: clamp(28px, 5vw, 54px);
  border: 1px solid #40505e;
  border-radius: 18px;
  background: rgb(14 21 28 / 88%);
  box-shadow: 0 28px 80px rgb(0 0 0 / 32%);
}

.connection-card h1 {
  margin: 0 0 14px;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  line-height: 1.12;
}

.connection-lead {
  margin: 0 0 24px;
  color: #bdc9d3;
  line-height: 1.55;
}

.command-row,
.reconnect-command {
  display: flex;
  gap: 10px;
  align-items: center;
}

.command-row code,
.reconnect-command code {
  min-width: 0;
  padding: 13px 15px;
  overflow: auto;
  color: #dfffd2;
  border: 1px solid #4d6546;
  border-radius: 9px;
  background: #091108;
  font: 0.95rem/1.35 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: nowrap;
}

.command-row code {
  flex: 1;
}

.copy-feedback {
  min-height: 20px;
  margin: 8px 0 0;
  color: #aebbc8;
  font-size: 0.83rem;
}

.connection-state {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 20px;
  color: #dce5ef;
}

.local-access-help {
  margin-top: 18px;
  padding: 14px;
  color: #f7e8c3;
  border: 1px solid #a57936;
  border-radius: 10px;
  background: rgb(47 36 20 / 78%);
}

.local-access-help[hidden] {
  display: none;
}

.local-access-help p {
  margin: 0 0 12px;
  line-height: 1.45;
}

.connection-indicator {
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #dca53a;
  box-shadow: 0 0 0 5px rgb(220 165 58 / 14%);
}

.connection-gate[data-state="connected"] .connection-indicator {
  background-color: #8ad36b;
}

.connection-gate[data-state="error"] .connection-indicator {
  background-color: #e86e6e;
}

#minecraft-status[data-state="connected"] {
  color: #8ad36b;
}

#minecraft-status[data-state="error"] {
  color: #ff9c9c;
}

.reconnect-banner {
  position: absolute;
  z-index: 3;
  top: 14px;
  right: 14px;
  left: 14px;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  color: #f7e8c3;
  border: 1px solid #a57936;
  border-radius: 11px;
  background: rgb(47 36 20 / 96%);
  box-shadow: 0 8px 28px rgb(0 0 0 / 28%);
}

.reconnect-banner[hidden] {
  display: none;
}

.reconnect-banner strong,
.reconnect-banner span {
  display: block;
}

.reconnect-banner span {
  margin-top: 3px;
  color: #d9caa8;
  font-size: 0.84rem;
}

.reconnect-command code {
  max-width: 300px;
}

.secondary-button {
  color: #ecf4e8;
  border: 1px solid #58704d;
  background: #263a20;
}

.editor-loading {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  place-items: center;
  color: #dce5ef;
  background: #1c252e;
}

.editor-loading[hidden] {
  display: none;
}

.assistant-pane {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  padding: 24px;
  overflow-y: auto;
  border-left: 1px solid #34414e;
  background:
    radial-gradient(circle at top right, rgb(74 128 54 / 20%), transparent 42%),
    #172029;
}

.assistant-pane h1,
.assistant-pane p {
  margin-top: 0;
}

.assistant-pane h1 {
  margin-bottom: 8px;
  font-size: 1.55rem;
}

.eyebrow {
  margin-bottom: 6px;
  color: #8ad36b;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.subtitle,
.privacy-note {
  color: #aebbc8;
  line-height: 1.45;
}

.status-grid {
  display: grid;
  gap: 10px;
  margin: 0;
}

.status-grid div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
}

.status-grid dt {
  color: #8493a1;
}

.status-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
}

#editor-status[data-state="ready"] {
  color: #8ad36b;
}

#editor-status[data-state="error"] {
  color: #ff9c9c;
}

.conversation {
  min-height: 0;
  padding: 16px;
  border: 1px solid #3b4a58;
  border-radius: 12px;
  background: rgb(7 12 17 / 58%);
}

.ai-disabled h2,
.telemetry-card h2,
.download-card h2 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.telemetry-card {
  padding: 16px;
  border: 1px solid #3b4a58;
  border-radius: 12px;
  background: rgb(7 12 17 / 58%);
}

.download-card {
  padding: 16px;
  border: 1px solid #3b4a58;
  border-radius: 12px;
  background: rgb(7 12 17 / 58%);
}

.download-card h2,
.download-card p {
  margin-top: 0;
}

.download-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.download-links a {
  color: #b8eca1;
  font-weight: 700;
}

.telemetry-toggle {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 700;
  line-height: 1.4;
}

.telemetry-toggle input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: #8ad36b;
}

.telemetry-status {
  margin: 12px 0 0;
  color: #aebbc8;
  font-size: 0.82rem;
  line-height: 1.4;
}

.telemetry-card .privacy-note {
  margin-top: 14px;
}

.download-card .privacy-note {
  margin-top: 14px;
}

.conversation p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.55;
}

.assistant-meta {
  margin-top: 12px !important;
  color: #8ad36b;
  font-size: 0.82rem;
}

.proposal {
  min-height: 0;
  border: 1px solid #3b4a58;
  border-radius: 12px;
  overflow: hidden;
  background: #0b1218;
}

.proposal[hidden] {
  display: none;
}

.proposal h2 {
  margin: 0;
  padding: 10px 12px;
  color: #cbd6df;
  border-bottom: 1px solid #3b4a58;
  font-size: 0.9rem;
}

.proposal pre {
  max-height: 240px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  color: #e5edf4;
  font: 0.82rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre;
}

#assistant-form {
  display: grid;
  gap: 10px;
}

#assistant-form label {
  font-weight: 700;
}

button {
  min-height: 44px;
  padding: 10px 14px;
  color: #10160d;
  font-weight: 800;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  background: #8ad36b;
}

button:disabled {
  color: #84909a;
  cursor: not-allowed;
  background: #2d3944;
}

.privacy-note {
  margin-top: auto;
  margin-bottom: 0;
  font-size: 0.82rem;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(420px, 65vh) minmax(0, 1fr);
    overflow-y: auto;
  }

  html,
  body {
    overflow: auto;
  }

  .assistant-pane {
    border-top: 1px solid #34414e;
    border-left: 0;
  }

  .connection-gate {
    padding: 18px;
  }

  .reconnect-banner {
    position: static;
    flex-direction: column;
    align-items: stretch;
    border-radius: 0;
  }

  .reconnect-command code {
    max-width: none;
    flex: 1;
  }
}

@media (max-width: 560px) {
  .command-row {
    align-items: stretch;
    flex-direction: column;
  }
}
