:root{
  --bg: #f6f7fb;
  --text: #0f172a;
  --muted: rgba(15,23,42,.55);
  --border: rgba(15,23,42,.12);
  --hair: rgba(15,23,42,.10);
  --radius: 18px;
}

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

body{
  margin:0;
  font-family: 'IBM Plex Mono', monospace;
  background: radial-gradient(900px 600px at 20% 10%, #fff, var(--bg));
  color: var(--text);
}

.app{
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px;
}

/* ==========================
   Topbar
   ========================== */
.topbar{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:16px;
  padding: 12px 14px;
  background: rgba(255,255,255,.70);
  backdrop-filter: blur(10px);
  width: 100%;
}

.topbar > div:first-child{
  display:flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
}

.actions{
  display:flex;
  gap:10px;
  align-items:center;
  flex: 0 0 auto;
}

.topbar h1{ margin:0; font-size:18px; letter-spacing:.2px; }
.topbar p{ margin:6px 0 0; color: var(--muted); font-size:13px; }

.btn{
  appearance:none;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.75);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 999px;
  cursor:pointer;
  font-size: 13px;
}
.btn:hover{ transform: translateY(-1px); }
.btn:active{ transform: translateY(0px); }
.btn-ghost{ background: transparent; }

.layout{
  margin-top: 14px;
  display:grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
  align-items: stretch;
  min-height: calc(100vh - 120px);
}

/* ==========================
   Stage + Canvas (keep perfect circle)
   ========================== */
.stage{
  border: 0;
  border-radius: 0;
  background: transparent;

  width: 100%;
  max-width: 620px;

  aspect-ratio: 1 / 1;
  height: auto;

  padding: 30px;
  margin: 0 auto;

  display: grid;
  place-items: center;

  overflow: visible;
}

canvas{
  display: block;

  width: 100%;
  height: auto;

  aspect-ratio: 1 / 1;

  border-radius: 50%;
  background: #fff;

  overflow: hidden;
}

.panel{
  align-self: stretch;
  height: 100%;
  padding: 4px 2px;
}

.row{
  padding: 10px 0 12px;
  border-bottom: 1px solid var(--hair);
}

.label{
  display:flex;
  justify-content:space-between;
  gap:12px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}
.value{
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.range{
  width:100%;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  height: 22px;
}
.range::-webkit-slider-runnable-track{
  height: 2px;
  background: rgba(15,23,42,.18);
  border-radius: 999px;
}
.range::-moz-range-track{
  height: 2px;
  background: rgba(15,23,42,.18);
  border-radius: 999px;
}
.range::-webkit-slider-thumb{
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  margin-top: -4px;
  border-radius: 999px;
  background: rgba(15,23,42,.85);
  border: 1px solid rgba(15,23,42,.22);
}
.range::-moz-range-thumb{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(15,23,42,.85);
  border: 1px solid rgba(15,23,42,.22);
}

.toggle{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--hair);
  font-size: 12.5px;
  color: var(--muted);
  user-select:none;
}
.toggle input{ position:absolute; opacity:0; pointer-events:none; }
.toggle-ui{
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: rgba(15,23,42,.10);
  border: 1px solid rgba(15,23,42,.14);
  position:relative;
  flex: 0 0 auto;
}
.toggle-ui::after{
  content:"";
  position:absolute;
  top: 50%;
  left: 4px;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  border-radius: 999px;
  background: #fff;
  border: 1px solid rgba(15,23,42,.14);
  transition: left .18s ease;
}
.toggle input:checked + .toggle-ui::after{ left: 18px; }

.hint{
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

/* ==========================
   Responsive
   ========================== */
@media (max-width: 940px){
  .layout{
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .stage{
    max-width: 100%;
    padding: clamp(14px, 5vw, 30px);
  }

  .topbar{
    flex-direction: column;
    align-items: flex-start;
  }

  .actions{
    width: 100%;
    flex-wrap: wrap;
  }
}

