:root {
  color-scheme: dark;
  --ink: #030507;
  --panel: rgba(12, 17, 23, 0.86);
  --panel-border: rgba(255, 255, 255, 0.1);
  --muted: #82909d;
  --text: #f3f7f8;
  --aqua: #58f5e2;
  --blue: #3a9dff;
}

* {
  box-sizing: border-box;
}

.native-app--silk-weave {
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.silk-studio {
  position: relative;
  width: 100%;
  min-height: min(820px, 88vh);
  height: auto;
  max-height: none;
  display: grid;
  grid-template-rows: 70px minmax(0, 1fr);
  overflow: visible;
  background:
    radial-gradient(circle at 72% 42%, rgba(31, 152, 180, 0.09), transparent 30%),
    #030507;
}

.silk-studio:fullscreen,
.silk-studio:-webkit-full-screen {
  width: 100vw;
  height: 100dvh;
  min-height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

.silk-studio.is-native-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 100000;
  width: 100vw;
  height: 100dvh;
  min-height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

.silk-studio:fullscreen .workspace,
.silk-studio:-webkit-full-screen .workspace {
  min-height: 0;
  height: calc(100dvh - 70px);
}

.silk-studio.is-native-fullscreen .workspace {
  min-height: 0;
  height: calc(100dvh - 70px);
}

.silk-studio:fullscreen .canvas-stage,
.silk-studio:-webkit-full-screen .canvas-stage {
  height: 100%;
}

.silk-studio.is-native-fullscreen .canvas-stage {
  height: 100%;
}

.topbar {
  position: relative;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-width: 0;
  padding: 0 22px;
  border-radius: 20px 20px 0 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(4, 7, 10, 0.88);
  backdrop-filter: blur(20px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  width: max-content;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(91, 242, 229, 0.23);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(83, 242, 226, 0.13), rgba(59, 131, 255, 0.04));
  box-shadow: inset 0 0 18px rgba(61, 236, 218, 0.06), 0 0 20px rgba(44, 184, 197, 0.08);
}

.brand-mark i {
  position: absolute;
  width: 19px;
  height: 7px;
  border: 1px solid var(--aqua);
  border-radius: 50%;
  opacity: 0.9;
  transform: rotate(28deg);
  box-shadow: 0 0 7px rgba(88, 245, 226, 0.55);
}

.brand-mark i:nth-child(2) { transform: rotate(90deg); }
.brand-mark i:nth-child(3) { transform: rotate(152deg); }

.brand-copy {
  display: grid;
  line-height: 1;
}

.brand-copy strong {
  font-size: 15px;
  font-weight: 660;
  letter-spacing: 0.01em;
}

.brand-copy small {
  margin-top: 6px;
  color: #71808c;
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.topbar-center {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #81909b;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.live-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--aqua);
  box-shadow: 0 0 8px var(--aqua);
}

.quick-actions {
  display: flex;
  justify-self: end;
  align-items: center;
  gap: 4px;
}

.icon-button {
  display: grid;
  grid-template-columns: 22px auto;
  align-items: center;
  min-width: 54px;
  height: 42px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #a5b0b8;
  cursor: pointer;
  transition: 160ms ease;
}

.icon-button:hover {
  border-color: rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.045);
  color: white;
}

.icon-button:focus-visible,
.palette-swatch:focus-visible,
.new-canvas-button:focus-visible,
.mobile-dock button:focus-visible {
  outline: 2px solid var(--aqua);
  outline-offset: 2px;
}

.icon-button:disabled {
  opacity: 0.28;
  cursor: default;
}

.icon-button > span:first-child {
  font-size: 18px;
  line-height: 1;
}

.icon-button em {
  font-size: 10px;
  font-style: normal;
  font-weight: 600;
}

.record-glyph {
  display: block;
  width: 10px;
  height: 10px;
  margin: auto;
  border-radius: 50%;
  background: #ff5263;
  box-shadow: 0 0 0 3px rgba(255, 82, 99, 0.13);
}

.record-button.is-recording {
  color: #ff7c88;
  background: rgba(255, 82, 99, 0.08);
}

.record-button.is-recording .record-glyph,
.mobile-dock .is-recording .record-glyph {
  border-radius: 2px;
  animation: recordPulse 1.15s infinite;
}

.fullscreen-glyph {
  position: relative;
  width: 13px;
  height: 13px;
  margin: auto;
  border: 1px solid currentColor;
  clip-path: polygon(0 0, 38% 0, 38% 10%, 10% 10%, 10% 38%, 0 38%, 0 0, 100% 0, 100% 38%, 90% 38%, 90% 10%, 62% 10%, 62% 0, 100% 0, 100% 100%, 62% 100%, 62% 90%, 90% 90%, 90% 62%, 100% 62%, 100% 100%, 0 100%, 0 62%, 10% 62%, 10% 90%, 38% 90%, 38% 100%, 0 100%);
}

.workspace {
  position: relative;
  min-height: min(730px, 84vh);
  height: 100%;
  overflow: visible;
}

.canvas-stage,
.canvas-stage canvas,
.canvas-grid {
  position: absolute;
  inset: 0;
}

.canvas-stage {
  overflow: hidden;
  background: #030507;
}

.canvas-stage canvas {
  z-index: 3;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

.canvas-grid {
  z-index: 2;
  pointer-events: none;
  opacity: 0.34;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.014) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.014) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(circle at center, black, transparent 72%);
}

.control-panel {
  position: absolute;
  z-index: 18;
  top: 18px;
  left: 18px;
  bottom: 18px;
  width: 286px;
  display: flex;
  flex-direction: column;
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(24px) saturate(130%);
  scrollbar-width: none;
  transition: opacity 220ms ease, transform 300ms cubic-bezier(0.2, 0.75, 0.25, 1);
}

.control-panel::-webkit-scrollbar { display: none; }

.control-panel[data-collapsed="true"] {
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(-100% - 26px));
}

.control-panel-toggle {
  position: absolute;
  z-index: 19;
  top: 34px;
  left: 304px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(88, 245, 226, 0.2);
  border-radius: 0 11px 11px 0;
  background: rgba(12, 17, 23, 0.9);
  box-shadow: 8px 10px 28px rgba(0, 0, 0, 0.28);
  color: var(--aqua);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(18px);
  transition: left 300ms cubic-bezier(0.2, 0.75, 0.25, 1), background 160ms ease;
}

.control-panel-toggle:hover {
  background: rgba(21, 31, 38, 0.96);
}

.control-panel-toggle:focus-visible {
  outline: 2px solid var(--aqua);
  outline-offset: 2px;
}

.control-panel-toggle[data-collapsed="true"] {
  left: 0;
}

.panel-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  padding-bottom: 16px;
}

.eyebrow {
  color: var(--aqua);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.panel-heading h1 {
  margin: 5px 0 0;
  font-size: 20px;
  font-weight: 580;
  letter-spacing: -0.02em;
}

.panel-close {
  display: none;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: #8c99a2;
  font-size: 22px;
}

.control-section {
  padding: 16px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.control-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  color: #dce4e7;
  font-size: 11px;
  font-weight: 610;
}

.control-label small {
  color: var(--aqua);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 9px;
}

.palette-swatch {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  box-shadow: inset 0 0 12px rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: 160ms ease;
}

.palette-swatch:hover { transform: scale(1.08); }

.palette-swatch[data-active="true"] {
  border-color: white;
  box-shadow: 0 0 0 2px rgba(88, 245, 226, 0.2), 0 0 18px rgba(88, 245, 226, 0.18);
}

.custom-colors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.custom-colors label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 8px 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 9px;
  color: #7f8d96;
  font-size: 9px;
}

.custom-colors input {
  width: 21px;
  height: 21px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 50%;
  background: transparent;
}

.custom-colors input::-webkit-color-swatch-wrapper { padding: 0; }
.custom-colors input::-webkit-color-swatch { border: 0; border-radius: 50%; }

.range-controls {
  display: grid;
  gap: 18px;
}

.range-control {
  display: block;
}

.range-control input {
  width: 100%;
  height: 3px;
  border-radius: 99px;
  appearance: none;
  background: linear-gradient(90deg, rgba(88, 245, 226, 0.75), rgba(60, 122, 255, 0.34));
  outline: none;
}

.range-control input::-webkit-slider-thumb {
  width: 15px;
  height: 15px;
  border: 3px solid #12191f;
  border-radius: 50%;
  appearance: none;
  background: var(--aqua);
  box-shadow: 0 0 0 1px rgba(88, 245, 226, 0.65), 0 0 10px rgba(88, 245, 226, 0.45);
}

.range-control input::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: 3px solid #12191f;
  border-radius: 50%;
  background: var(--aqua);
}

.range-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  color: #55626c;
  font-size: 8px;
}

.range-scale i { font-style: normal; }

.toggles {
  display: grid;
  gap: 16px;
}

.toggle-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.toggle-row > span {
  display: grid;
  gap: 4px;
}

.toggle-row strong {
  color: #dce4e7;
  font-size: 11px;
  font-weight: 600;
}

.toggle-row small {
  color: #65727c;
  font-size: 9px;
}

.toggle-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-ui {
  position: relative;
  flex: 0 0 auto;
  width: 34px;
  height: 19px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 99px;
  background: #161d23;
  transition: 180ms ease;
}

.toggle-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #66737c;
  transition: 180ms ease;
}

.toggle-row input:checked + .toggle-ui {
  border-color: rgba(88, 245, 226, 0.36);
  background: rgba(88, 245, 226, 0.12);
}

.toggle-row input:checked + .toggle-ui::after {
  left: 18px;
  background: var(--aqua);
  box-shadow: 0 0 9px rgba(88, 245, 226, 0.6);
}

.new-canvas-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  margin-top: auto;
  border: 1px solid rgba(88, 245, 226, 0.18);
  border-radius: 11px;
  background: linear-gradient(100deg, rgba(88, 245, 226, 0.11), rgba(58, 157, 255, 0.08));
  color: #dffcf8;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
  transition: 160ms ease;
}

.new-canvas-button:hover {
  border-color: rgba(88, 245, 226, 0.35);
  background: linear-gradient(100deg, rgba(88, 245, 226, 0.17), rgba(58, 157, 255, 0.13));
}

.shortcut-note {
  margin: 10px 0 0;
  color: #58656e;
  font-size: 8px;
  line-height: 1.5;
  text-align: center;
}

.start-prompt {
  position: absolute;
  z-index: 7;
  top: 50%;
  left: calc(50% + 120px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: 500ms ease;
}

.start-prompt.is-hidden {
  opacity: 0;
  transform: translate(-50%, -44%) scale(0.95);
}

.prompt-orbit {
  position: relative;
  width: 82px;
  height: 82px;
  border: 1px solid rgba(88, 245, 226, 0.13);
  border-radius: 50%;
  box-shadow: 0 0 60px rgba(51, 185, 202, 0.09), inset 0 0 35px rgba(51, 185, 202, 0.05);
}

.prompt-orbit::after {
  content: "";
  position: absolute;
  inset: 33px;
  border-radius: 50%;
  background: var(--aqua);
  box-shadow: 0 0 18px var(--aqua);
}

.prompt-orbit i {
  position: absolute;
  inset: 16px 4px;
  border: 1px solid rgba(88, 245, 226, 0.36);
  border-radius: 50%;
  transform: rotate(60deg);
  animation: orbit 8s linear infinite;
}

.prompt-orbit i:nth-child(2) { transform: rotate(120deg); animation-delay: -2.6s; }
.prompt-orbit i:nth-child(3) { transform: rotate(180deg); animation-delay: -5.2s; }

.start-prompt p {
  display: grid;
  gap: 7px;
  margin: 0;
  text-align: center;
}

.start-prompt strong {
  font-size: 13px;
  font-weight: 560;
  letter-spacing: 0.01em;
}

.start-prompt small {
  color: #697781;
  font-size: 10px;
}

.canvas-meta {
  position: absolute;
  z-index: 7;
  right: 20px;
  bottom: 16px;
  display: flex;
  gap: 16px;
  color: rgba(159, 174, 184, 0.47);
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  pointer-events: none;
}

.canvas-meta span + span::before {
  content: "·";
  margin-right: 16px;
  color: rgba(88, 245, 226, 0.5);
}

.toast {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: 28px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 99px;
  background: rgba(16, 23, 29, 0.94);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.32);
  color: #dbe5e7;
  font-size: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: 220ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.mobile-dock { display: none; }

@keyframes orbit {
  to { rotate: 360deg; }
}

@keyframes recordPulse {
  50% { opacity: 0.4; transform: scale(0.82); }
}

@media (max-width: 980px) {
  .topbar { grid-template-columns: 1fr auto; }
  .topbar-center { display: none; }
  .icon-button { grid-template-columns: 22px; min-width: 38px; padding: 0 8px; }
  .icon-button em { display: none; }
}

@media (max-width: 720px) {
  .silk-studio { grid-template-rows: 58px minmax(0, 1fr) 68px; }
  .topbar { padding: 0 14px; }
  .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
  .brand-copy strong { font-size: 14px; }
  .brand-copy small { display: none; }
  .quick-actions .icon-button:nth-child(-n + 3),
  .quick-actions .record-button { display: none; }
  .icon-button { width: 38px; height: 38px; }

  .control-panel {
    position: absolute;
    top: auto;
    right: 10px;
    bottom: 76px;
    left: 10px;
    width: auto;
    max-height: min(68vh, 590px);
    padding: 18px;
    border-radius: 19px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(calc(100% + 90px));
    transition: opacity 220ms ease, transform 300ms cubic-bezier(0.2, 0.75, 0.25, 1);
  }

  .control-panel[data-open="true"] {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .control-panel-toggle { display: none; }

  .panel-close { display: block; }
  .palette-grid { gap: 14px; }
  .palette-swatch { max-width: 36px; }
  .start-prompt { left: 50%; top: 46%; }
  .prompt-orbit { width: 70px; height: 70px; }
  .prompt-orbit::after { inset: 28px; }
  .canvas-meta { right: 12px; bottom: 10px; gap: 8px; }
  .canvas-meta span + span::before { margin-right: 8px; }

  .mobile-dock {
    position: relative;
    z-index: 32;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    padding: 5px 8px max(5px, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(6, 10, 13, 0.96);
    backdrop-filter: blur(22px);
  }

  .mobile-dock button {
    display: grid;
    place-items: center;
    gap: 4px;
    min-width: 0;
    height: 54px;
    border: 0;
    background: transparent;
    color: #87949d;
  }

  .mobile-dock button:disabled { opacity: 0.3; }
  .mobile-dock button > span { font-size: 19px; line-height: 1; }
  .mobile-dock button small { font-size: 8px; font-weight: 650; }

  .mobile-dock .mobile-draw-button {
    width: 58px;
    height: 58px;
    justify-self: center;
    margin-top: -20px;
    border: 1px solid rgba(88, 245, 226, 0.28);
    border-radius: 50%;
    background: linear-gradient(145deg, rgba(88, 245, 226, 0.18), rgba(58, 157, 255, 0.12));
    color: var(--aqua);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  }

  .mobile-dock .record-glyph { width: 10px; height: 10px; }
  .toast { bottom: 84px; white-space: nowrap; }
}

@media (max-width: 720px) {
  .silk-studio:fullscreen,
  .silk-studio:-webkit-full-screen {
    height: 100dvh;
    min-height: 100dvh;
    max-height: 100dvh;
  }

  .silk-studio.is-native-fullscreen {
    height: 100dvh;
    min-height: 100dvh;
    max-height: 100dvh;
  }

  .silk-studio:fullscreen .workspace,
  .silk-studio:-webkit-full-screen .workspace {
    min-height: 0;
    height: calc(100dvh - 58px);
  }

  .silk-studio.is-native-fullscreen .workspace {
    min-height: 0;
    height: calc(100dvh - 58px);
  }
}

@media (max-width: 430px) {
  .brand { gap: 8px; }
  .brand-copy strong { font-size: 13px; }
  .canvas-meta span:nth-child(2) { display: none; }
  .custom-colors { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
