* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

header {
  height: 64px;
}
footer,
.footer {
  height: 48px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial;
  color: #e9ecf1;
  background: linear-gradient(180deg, #0b0f1d, #0f1221 35%);
}

header {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  background: linear-gradient(
    90deg,
    rgba(96, 165, 250, 0.06),
    rgba(125, 211, 252, 0.04)
  );
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
}
.brand .logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #fff2;
  margin-right: 10px;
}
.title {
  font-weight: 700;
  font-size: 18px;
}

main {
  width: 100%;
  max-width: 1516px;
  margin: 12px auto;
  padding: 0 18px;
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 16px;
  height: calc(100vh - 64px - 48px);
}

@media (max-width: 1000px) {
  main {
    grid-template-columns: 1fr;
    height: auto;
  }
}

.card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.panel {
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.text {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #e9ecf1;
  padding: 8px;
  border-radius: 8px;
}
textarea.text {
  width: 100%;
  min-height: 120px;
  resize: vertical;
}
.muted {
  color: #9aa0b4;
  font-size: 13px;
}
.kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #0b1220;
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 6px;
}

#webEditors {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.tabs {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.tab {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: transparent;
  color: inherit;
  font-weight: 700;
  cursor: pointer;
}
.tab.active {
  background: rgba(96, 165, 250, 0.14);
}

.card.panel.stack > .editor-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.editor-wrap {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: #08101a;
  display: flex;
  flex-direction: column;
}
.editor {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.editor .ace_editor,
.editor .ace_scroller,
.editor .ace_content {
  height: 100% !important;
  width: 100% !important;
}
.editor .ace_gutter {
  height: 100% !important;
}

.preview {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 6px;
  display: block;
}
.card.panel.stack > .editor-wrap > iframe.preview {
  flex: 1 1 auto;
}

.out {
  background: #070916;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 12px;
  color: #e9ecf1;
  overflow: auto;
}

.btn {
  appearance: none;
  border: none;
  background: linear-gradient(180deg, #60a5fa, #7dd3fc);
  color: #071122;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}
.btn.secondary {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: inherit;
}
.btn.ok {
  background: linear-gradient(180deg, #34d399, #22c55e);
}
.btn.warn {
  background: linear-gradient(180deg, #f59e0b, #eab308);
}

.footer {
  height: 48px;
  line-height: 48px;
  text-align: center;
  font-size: 12px;
  opacity: 0.85;
  border-top: 1px solid rgba(255, 255, 255, 0.02);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.01), transparent);
}

.btn:focus-visible,
.tab:focus-visible,
.editor-wrap:focus-visible {
  outline: 3px solid rgba(96, 165, 250, 0.22);
  outline-offset: 2px;
}

body.light {
  color: #0b1220;
  background: linear-gradient(180deg, #f8fafc, #eef2ff 35%);
}
body.light .card {
  background: #fff;
  border-color: #e6eef8;
  color: #0b1220;
}
body.light .editor-wrap {
  background: #fff;
  border-color: #e6eef8;
}
body.light .out {
  background: #fbfdff;
  color: #0b1220;
}

@media (max-width: 1000px) {
  .brand .logo {
    display: none;
  }
  .title {
    font-size: 16px;
  }
  .tabs {
    flex-wrap: wrap;
  }
  .card {
    box-shadow: none;
    border-radius: 8px;
  }
  .footer {
    position: static;
  }
}