:root {
  --bg: #0e1219;
  --bg-2: #0b0f15;
  --panel: #121826;
  --panel-2: #161d2b;
  --line: #232c3d;
  --text: #e6edf3;
  --muted: #8b95a5;
  --accent: #3b82f6;
  --accent-2: #60a5fa;
  --danger: #f87171;
  --ok: #4ade80;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  font-size: 15px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  overflow-x: hidden;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1000px 500px at 80% -10%, rgba(59,130,246,.12), transparent 60%),
    radial-gradient(800px 400px at -10% 110%, rgba(79,70,229,.12), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "Pyidaungsu", "Noto Sans Myanmar", "Myanmar Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; color: var(--text); }

/* ---------- Header ---------- */
.app-head {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(18,24,38,.85);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(6px);
}

.app-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.app-logo {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(59,130,246,.4);
}

.app-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.app-brand-text strong { font-size: 15px; letter-spacing: .2px; }
.app-brand-text span { font-size: 11.5px; color: var(--muted); }

.app-head-actions { display: flex; align-items: center; gap: 12px; }
.head-note { font-size: 12px; color: var(--muted); display: none; }
@media (min-width: 1080px) { .head-note { display: inline; } }

/* ---------- Footer ---------- */
.app-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: rgba(18,24,38,.85);
  font-size: 12.5px;
  color: var(--muted);
}
.foot-brand { color: var(--text); font-weight: 700; letter-spacing: .3px; }
.app-foot a {
  color: var(--accent-2);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.app-foot a:hover { text-decoration: underline; }

/* ---------- Buttons ---------- */
.btn-primary {
  border: none;
  background: linear-gradient(135deg, var(--accent), #2563eb);
  color: #fff;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(59,130,246,.35);
  transition: transform .06s ease, filter .15s ease;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:active { transform: translateY(1px); }

.btn-ghost {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 13px;
  transition: border-color .15s ease, background .15s ease;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-2); }
.btn-ghost.g-on { border-color: var(--accent); color: var(--accent-2); background: rgba(59,130,246,.12); }

.btn-small { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; margin-top: 14px; }

/* ---------- Layout ---------- */
.app-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 360px;
  flex: 0 0 360px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.sidenav {
  display: flex;
  gap: 2px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  flex: 0 0 auto;
}

.nav-btn {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.nav-btn:hover { background: var(--panel-2); color: var(--text); }
.nav-btn.nav-active { background: rgba(59,130,246,.16); color: var(--accent-2); font-weight: 600; }

.panel-wrap { flex: 1 1 auto; overflow-y: auto; }

.panel { display: none; padding: 16px 16px 34px; }
.panel.el-active { display: block; }

.panel-title { margin: 0 0 4px; font-size: 17px; }
.panel-hint { margin: 0 0 14px; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.panel-hint.tip {
  margin-top: 16px;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: rgba(59,130,246,.08);
  border-radius: 0 8px 8px 0;
}
.panel-hint code { background: rgba(255,255,255,.1); padding: 1px 5px; border-radius: 5px; font-size: 12px; }

.panel-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.panel-title-row .panel-title { margin: 0; }

.group-title {
  margin: 22px 0 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}

/* ---------- Fields ---------- */
.fld { display: block; margin-bottom: 12px; }
.fld + .fld { margin-top: 12px; }

.fld-label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }

.fld input[type="text"], .fld select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-2);
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 13.5px;
  outline: none;
  transition: border-color .15s ease;
}
.fld input[type="text"]:focus, .fld select:focus { border-color: var(--accent); }
.fld-note { display: block; margin-top: 5px; font-size: 11.5px; color: var(--muted); }

.fld-colorrow { display: flex; align-items: center; gap: 8px; }
.fld-colorrow input[type="color"] {
  width: 44px; height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-2);
  padding: 3px;
  cursor: pointer;
}
.fld-hex {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
}

.fld-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.fld-grid .fld { margin-bottom: 10px; }

.fld-check { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; font-size: 13.5px; cursor: pointer; }
.fld-check input { width: 16px; height: 16px; accent-color: var(--accent); }

.radio-row { display: flex; gap: 14px; font-size: 13.5px; }
.radio-row label { display: flex; align-items: center; gap: 5px; }
.radio-row input { accent-color: var(--accent); }

.fld-range { }
.fld-range input { width: 100%; accent-color: var(--accent); }

.fld input[type="file"] {
  width: 100%;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Theme gallery ---------- */
.theme-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }

.theme-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  overflow: hidden;
  cursor: pointer;
  transition: transform .1s ease, border-color .15s ease, box-shadow .15s ease;
  text-align: left;
  color: var(--text);
  padding: 0;
}
.theme-card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow); }

.theme-swatch { height: 84px; position: relative; }
.theme-swatch::after {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(90px 60px at 18% 30%, rgba(255,255,255,.55), transparent 70%),
    radial-gradient(70px 50px at 85% 80%, rgba(255,255,255,.35), transparent 70%);
}
.theme-swatch .sw-chip {
  position: absolute;
  right: 12px; bottom: 12px;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 4px 10px rgba(0,0,0,.25);
}

.theme-body { padding: 11px 13px; }
.theme-body strong { display: block; font-size: 14px; }
.theme-body span { font-size: 12px; color: var(--muted); line-height: 1.5; display: block; margin-top: 2px; }

/* ---------- Stage / preview ---------- */
.stage {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-2);
}

.stage-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.seg {
  display: flex;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 13px;
  white-space: nowrap;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.seg-active { background: var(--accent); color: #fff; font-weight: 600; }
#dev-seg .seg-btn.seg-active:last-child { background: #2563eb; }

.stage-tools { margin-left: auto; display: flex; gap: 8px; }

.stage-viewport {
  flex: 1 1 auto;
  min-height: 0;
  padding: 22px;
  display: flex;
  justify-content: center;
  overflow: auto;
}

.stage-viewport iframe {
  width: 100%;
  max-width: 1100px;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
  transition: max-width .2s ease;
}
[data-device-vp="tablet"] iframe { max-width: 768px; }
[data-device-vp="phone"] iframe { max-width: 390px; }

/* ---------- Export list ---------- */
.export-list { display: flex; flex-direction: column; gap: 10px; }

.exp-file {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  padding: 9px 11px;
}
.exp-icon {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 8px;
  font-size: 15px;
  flex: 0 0 auto;
}
.exp-icon.html { background: rgba(240,101,41,.18); }
.exp-icon.css { background: rgba(38,119,245,.18); }
.exp-meta { flex: 1 1 auto; min-width: 0; }
.exp-meta strong { display: block; font-size: 13px; font-family: "Cascadia Mono", Consolas, monospace; }
.exp-meta span { font-size: 11.5px; color: var(--muted); }
.exp-meta .bytes { color: var(--ok); }

.exp-actions { display: flex; gap: 6px; }

.install-box {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  padding: 14px 16px;
}
.install-box h4 { margin: 0 0 8px; font-size: 14px; }
.install-box ol { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); line-height: 1.75; }
.install-box li { margin-bottom: 6px; }
.install-box code { background: rgba(255,255,255,.1); padding: 1px 5px; border-radius: 5px; font-size: 12px; color: var(--accent-2); }
.install-box b { color: var(--text); }

/* ---------- Scrollbars ---------- */
.panel-wrap::-webkit-scrollbar, .stage-viewport::-webkit-scrollbar { width: 10px; height: 10px; }
.panel-wrap::-webkit-scrollbar-thumb, .stage-viewport::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; border: 2px solid var(--panel); }

/* ---------- Responsive app ---------- */
@media (max-width: 900px) {
  .app-body { flex-direction: column; height: auto; }
  .sidebar { width: 100%; flex: none; max-height: 52vh; overflow: hidden; }
  .panel-wrap { min-height: 0; }
  .stage { height: 60vh; min-height: 420px; }
  .head-note { display: none; }
  .stage-tools { margin-left: 0; }
  #dev-seg { overflow-x: auto; }
  .theme-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .app-head { padding: 0 10px; }
  .app-brand-text span { display: none; }
  .theme-grid { grid-template-columns: 1fr; }
  .stage { height: 54vh; min-height: 380px; }
  .stage-head { padding: 8px 10px; gap: 8px; }
  .seg-btn { padding: 5px 9px; font-size: 12px; }
  .stage-tools { flex-wrap: wrap; gap: 6px; }
  .stage-viewport { padding: 12px; }
  .fld-grid { grid-template-columns: 1fr; }
  .panel { padding: 12px 12px 26px; }
  .theme-swatch { height: 72px; }
  .btn-primary { padding: 7px 13px; font-size: 12.5px; }
}

@media (max-width: 380px) {
  .app-logo { width: 30px; height: 30px; font-size: 15px; }
  .app-brand-text strong { font-size: 13px; }
  .sidenav { padding: 6px; }
  .nav-btn { padding: 7px 9px; font-size: 12px; }
  .radio-row { flex-direction: column; gap: 6px; }
}