:root{
  --bg: #0b0e12;
  --panel: #12161c;
  --text: #e8eef5;
  --muted: #9fb0c3;
  --accent: #2ea043;
  --border: #1e2631;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, Noto Sans, 'Apple Color Emoji','Segoe UI Emoji';
  background:var(--bg);
  color:var(--text);
}

.app-header{
  padding:20px 16px 8px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}

.header-left{
  display:flex;
  flex-direction:column;
  gap:4px;
}

.app-header h1{
  margin:0 0 4px;
  font-size:22px;
}
.app-header .sub{
  margin:0;
  color:var(--muted);
  font-size:13px;
}

.header-actions{
  display:flex;
  align-items:center;
  gap:12px;
}

.icon-btn{
  appearance:none;
  border:1px solid transparent;
  background:rgba(18,22,28,0.7);
  border-radius:12px;
  width:40px;
  height:40px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color:var(--muted);
  cursor:pointer;
  transition:color .2s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease;
}

.icon-btn svg{
  width:18px;
  height:18px;
  display:block;
}

.icon-btn:hover{
  color:var(--text);
  border-color:rgba(46,160,67,0.35);
  box-shadow:0 4px 18px rgba(0,0,0,.25);
}

.icon-btn:focus-visible{
  outline:2px solid var(--accent);
  outline-offset:2px;
}

.copy-link-btn{
  background:rgba(18,22,28,0.7);
  border-color:var(--border);
}

.copy-link-btn.has-query{
  color:#fff;
  border-color:rgba(46,160,67,0.6);
  background:rgba(46,160,67,0.2);
}

.reset-btn{
  background:rgba(18,18,24,0.6);
  border-color:var(--border);
}

.reset-btn.has-query{
  color:#fff;
  border-color:rgba(189,95,255,0.65);
  background:rgba(189,95,255,0.2);
}

.lang-switch{
  display:inline-flex;
  border:1px solid var(--border);
  border-radius:999px;
  padding:4px;
  background:rgba(18,22,28,0.7);
  backdrop-filter:blur(8px);
  gap:4px;
}

.lang-btn{
  appearance:none;
  border:0;
  background:transparent;
  color:var(--muted);
  font-weight:600;
  font-size:12px;
  padding:6px 10px;
  border-radius:999px;
  cursor:pointer;
  transition:background 0.2s ease, color 0.2s ease;
}

.lang-btn.is-active{
  background:var(--accent);
  color:#fff;
}

.lang-btn:hover{
  background:rgba(46,160,67,0.12);
  color:var(--text);
}

.container{
  display:grid;
  grid-template-columns: 1.1fr 1fr;
  gap:16px;
  padding:0 16px 24px;
}

.controls{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:12px;
  padding:16px;
}

.control-group{
  margin-bottom:20px;
}

.control-group h2{
  margin:0 0 12px;
  font-size:13px;
  font-weight:600;
  color:var(--text);
}

.control-group + .control-group{
  border-top:1px solid var(--border);
  padding-top:20px;
  margin-top:20px;
}

.preview{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:12px;
  padding:16px;
  display:flex;
  align-items:center;
  justify-content:center;
}

.row{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap:12px 16px;
}

.corner-layout{
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.field-stack{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.field-stack .field{
  margin-bottom:0;
}

.field{display:flex; flex-direction:column; gap:6px; margin-bottom:12px}
.field label{font-size:12px; color:var(--muted)}
.field input[type="text"],
.field textarea,
.field select{
  width:100%;
  background:#0e1218;
  border:1px solid var(--border);
  color:var(--text);
  border-radius:8px;
  padding:10px 12px;
}
.field input[type="range"]{width:100%}
.field input[type="color"]{height:36px; padding:0; border-radius:8px; border:1px solid var(--border); background:#0e1218}

.actions{display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-top:8px}
button{
  appearance:none;
  border:1px solid #23462f;
  background:var(--accent);
  color:#fff;
  padding:10px 14px;
  border-radius:10px;
  cursor:pointer;
  font-weight:600;
}
button.secondary{
  background:#1b2735;
  border-color:#273445;
}
button.link{
  background:transparent;
  color:var(--muted);
  border-color:transparent;
  text-decoration:underline;
}
button:disabled{opacity:.6; cursor:not-allowed}

#canvas{width:100%; max-width:640px}
#canvas canvas,
#canvas svg{width:100%; height:auto; display:block; background:#fff; border-radius:12px}

.app-footer{
  padding:10px 16px 24px; color:var(--muted); font-size:12px;
}

@media (max-width: 960px){
  .container{grid-template-columns: 1fr;}
  .app-header{
    flex-direction:column;
    align-items:flex-start;
  }
  .header-actions{
    width:100%;
    justify-content:flex-start;
    gap:16px;
  }
  .lang-switch{
    align-self:flex-start;
  }
}
