@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@400;500;600&display=swap');
:root { --bg: #0e0f13; --panel: #17181e; --panel2: #1f2028; --line: #2c2d38; --text: #ecedf2; --muted: #9a9cab; --pink: #ff2d6f; --ok: #2bd38a; --warn: #ffb020; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: 'Kanit', system-ui, sans-serif; font-size: 15px; }
a { color: inherit; }
.pink { color: var(--pink); }
.muted { color: var(--muted); }
.err { color: #ff6b6b; min-height: 1.2em; }
.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.login { width: min(360px, 100%); display: grid; gap: 12px; }
.login h1 { margin: 0; }
input, select, textarea { width: 100%; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 9px 11px; font: inherit; }
input[type=color] { padding: 2px; height: 38px; }
input[type=checkbox] { width: auto; transform: scale(1.3); }
textarea { min-height: 80px; resize: vertical; }
.btn { background: var(--panel2); border: 1px solid var(--line); color: var(--text); padding: 8px 14px; border-radius: 9px; cursor: pointer; font: inherit; white-space: nowrap; }
.btn:hover { border-color: #555; }
.btn.primary { background: var(--pink); border-color: var(--pink); color: #fff; font-weight: 600; }
.btn.sm { padding: 5px 10px; font-size: 13px; }

header { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 5; }
header h1 { font-size: 22px; margin: 0; flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); font-size: 14px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #666; }
.dot.connected { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.connecting, .dot.offline { background: var(--warn); }
.dot.error { background: #ff4d4d; }

.layout { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 60px); }
nav { border-right: 1px solid var(--line); padding: 14px 10px; }
nav button { display: flex; width: 100%; gap: 10px; align-items: center; background: none; border: 0; color: var(--text); padding: 10px 12px; border-radius: 9px; cursor: pointer; font: inherit; text-align: left; }
nav button.on { background: #2a1520; color: var(--pink); }
main { padding: 20px; min-width: 0; }
h2 { margin: 0 0 14px; font-size: 22px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.sim { display: flex; gap: 8px; flex-wrap: wrap; }
.log { height: 300px; overflow: auto; font-size: 14px; background: var(--panel2); border-radius: 10px; padding: 8px 12px; }
.log div { padding: 3px 0; border-bottom: 1px dashed #2a2b35; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }
.ov h3 { margin: 0 0 4px; display: flex; gap: 8px; align-items: center; font-size: 18px; }
.ov .desc { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.preview { position: relative; aspect-ratio: 9/16; height: 440px; max-width: 100%; border-radius: 10px; overflow: hidden; margin: 0 auto 12px; border: 1px solid var(--line);
  background-color: #1a1b22; background-image: linear-gradient(45deg,#22232c 25%,transparent 25%,transparent 75%,#22232c 75%),linear-gradient(45deg,#22232c 25%,transparent 25%,transparent 75%,#22232c 75%); background-size: 24px 24px; background-position: 0 0, 12px 12px; }
.preview iframe { position: absolute; top: 0; left: 0; width: 1080px; height: 1920px; border: 0; transform-origin: 0 0; }
.try { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 10px; font-size: 14px; }
.trybtns { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 6px; margin-top: 8px; }
.t-red { color: #ff6b6b; } .t-blue { color: #5cc8ff; } .t-green { color: #5ee08a; } .t-yellow { color: #ffd84d; }
.link { display: flex; gap: 6px; margin-bottom: 10px; }
.link input { font-size: 12px; }
details summary { cursor: pointer; padding: 6px 0; color: var(--muted); }
.fields { display: grid; gap: 10px; margin-top: 8px; }
.fields label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.fields label.cb { display: flex; align-items: center; gap: 10px; color: var(--text); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ok); color: #000; padding: 8px 16px; border-radius: 9px; opacity: 0; transition: .3s; pointer-events: none; }
.toast.show { opacity: 1; }

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  nav { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 16px; }
  nav button { width: auto; }
  main { padding: 16px; }
  .grid2 { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
}
