:root {
  --bg: #080a0d;
  --panel: #101319;
  --panel-2: #151923;
  --line: #2a303b;
  --text: #eaf0f7;
  --muted: #8c96a6;
  --accent: #00f2a8;
  --danger: #ff4141;
  --button-size: 28px;
  --button-x: 0px;
  --button-y: 0px;
  --button-opacity: 1;
  --demo-chat-width: 353px;
  --demo-normal-shell-width: min(100%, 1500px);
  --demo-wide-shell-width: 100%;
  --preview-scale: 1;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
  color: var(--text);
  background: var(--bg);
  font: 14px/1.4 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.auth-bar {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 20;
  display: flex;
  gap: 8px;
}

.naver-login-button,
.profile-button {
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  color: #fff;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}

.naver-login-button {
  background: #03c75a;
}

.naver-login-button.is-logged-in {
  color: #07120f;
  background: var(--accent);
}

.profile-button {
  border: 1px solid #34404d;
  background: #151b24;
}

.profile-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.workbench {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: minmax(0, 1.35fr) minmax(0, 0.65fr);
  gap: 10px;
  width: 100vw;
  min-height: 112vh;
  padding: 10px;
}

.quadrant {
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}

.demo-quadrant {
  grid-column: 1 / -1;
  padding: 0;
}

.demo-shell {
  position: relative;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) var(--demo-chat-width);
  grid-template-rows: 35px minmax(0, 1fr) 58px;
  width: var(--demo-normal-shell-width);
  height: 100%;
  background: #0d0f12;
  transform-origin: top left;
  transition:
    width 0.25s ease,
    grid-template-columns 0.25s ease;
}

.demo-shell.wide-on {
  grid-template-columns: 150px minmax(0, 1fr) var(--demo-chat-width);
  width: var(--demo-wide-shell-width);
}

.demo-shell.wide-off {
  width: var(--demo-normal-shell-width);
}

.guide-svg {
  position: absolute;
  inset: 0;
  z-index: 30;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.7s ease;
}

.guide-svg line {
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-opacity: 0.82;
  stroke-dasharray: 6 4;
  stroke-linecap: round;
}

.guide-svg circle {
  fill: var(--accent);
  fill-opacity: 0.9;
  filter: drop-shadow(0 0 8px rgba(0, 242, 168, 0.75));
}

.guide-label {
  position: absolute;
  z-index: 31;
  padding: 4px 8px;
  border: 1px solid rgba(0, 242, 168, 0.55);
  border-radius: 999px;
  color: #06140f;
  background: var(--accent);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -125%);
  pointer-events: none;
  transition: opacity 0.7s ease;
}

.demo-shell.guide-visible .guide-svg,
.demo-shell.guide-visible .guide-label {
  opacity: 1;
}

.demo-topbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 24px 62px minmax(0, max-content) 1fr;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border-bottom: 1px solid #191d24;
  background: #111418;
}

.menu-btn {
  display: grid;
  gap: 3px;
  width: 22px;
  border: 0;
  color: #fff;
  background: transparent;
}

.menu-btn span {
  height: 2px;
  background: currentColor;
}

.demo-logo {
  color: #f4f8fb;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0;
}

.demo-topbar nav {
  display: flex;
  gap: 4px;
  font-weight: 800;
  min-width: 0;
  white-space: nowrap;
}

.demo-topbar nav a {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  color: #c7d0dc;
  font-size: 11px;
  white-space: nowrap;
}

.demo-topbar nav a:first-child {
  color: #05110d;
  background: var(--accent);
}

.demo-topbar input {
  width: 100%;
  height: 24px;
  padding: 0 12px;
  border: 1px solid #343a45;
  border-radius: 14px;
  color: var(--text);
  background: #0f1217;
}

.demo-sidebar {
  grid-column: 1;
  grid-row: 2 / 4;
  display: grid;
  align-content: start;
  gap: 11px;
  padding: 14px 10px;
  border-right: 1px solid #191d24;
  background: #101318;
  font-size: 12px;
  font-weight: 800;
}

.demo-sidebar a {
  color: #dce5ef;
}

.demo-player {
  grid-column: 2;
  grid-row: 2;
  position: relative;
  min-width: 0;
  background: #000;
}

.screen {
  position: absolute;
  inset: 0 0 41px;
  background: #000;
}

.screen span {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 5px;
  border-radius: 4px;
  background: var(--danger);
  font-weight: 900;
  font-size: 10px;
}

.controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 10px 6px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.82), transparent);
}

.controls input[type="range"] {
  height: 12px;
  margin: 0;
  appearance: none;
  accent-color: var(--accent);
  background: transparent;
}

.controls input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
}

.controls input[type="range"]::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  margin-top: -4px;
  border: 0;
  border-radius: 50%;
  appearance: none;
  background: var(--accent);
}

.controls input[type="range"].has-image::-webkit-slider-thumb {
  width: var(--demo-thumb-box-size, 20px);
  height: var(--demo-thumb-box-size, 20px);
  margin-top: calc((4px - var(--demo-thumb-box-size, 20px)) / 2);
  border-radius: 0;
  background-color: transparent;
  background-image: var(--demo-image, var(--custom-image));
  background-repeat: no-repeat;
  background-position: calc(50% + var(--demo-x, 0px)) calc(50% + var(--demo-y, 0px));
  background-size: var(--demo-size, var(--button-size)) var(--demo-size, var(--button-size));
  opacity: var(--demo-opacity, 1);
}

.controls > input {
  width: 100%;
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
}

.control-row > div {
  display: flex;
  align-items: center;
  gap: 5px;
}

.control-row button {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  color: #edf4ff;
  background: transparent;
}

.demo-shell .is-target {
  outline: 2px solid transparent;
  border-radius: 6px;
  box-shadow: none;
  transition:
    color 0.7s ease,
    outline-color 0.7s ease,
    box-shadow 0.7s ease,
    filter 0.7s ease;
}

.demo-shell.guide-visible .is-target {
  color: var(--accent);
  outline-color: rgba(0, 242, 168, 0.65);
  box-shadow: 0 0 14px rgba(0, 242, 168, 0.28);
}

.control-row button.has-image {
  color: transparent;
  background-image: var(--demo-image, var(--custom-image));
  background-repeat: no-repeat;
  background-position: calc(50% + var(--demo-x, var(--button-x))) calc(50% + var(--demo-y, var(--button-y)));
  background-size: var(--demo-size, var(--button-size)) var(--demo-size, var(--button-size));
  opacity: var(--demo-opacity, 1);
}

[data-guide-target="volume"] {
  width: 48px;
}

.controls input.is-target {
  outline: 0;
  filter: none;
}

.demo-shell.guide-visible .controls input.is-target {
  filter: drop-shadow(0 0 8px rgba(0, 242, 168, 0.8));
}

.live {
  width: auto !important;
  color: #fff !important;
  font-size: 11px;
  font-weight: 800;
}

.demo-chat {
  grid-column: 3;
  grid-row: 2 / 4;
  position: relative;
  display: grid;
  grid-template-rows: 34px 1fr 44px;
  overflow: hidden;
  border-left: 1px solid #191d24;
  background: #0d0f12;
}

.demo-chat > * {
  position: relative;
  z-index: 1;
}

.demo-chat header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-bottom: 1px solid var(--line);
  font-weight: 900;
}

.demo-chat header button {
  position: absolute;
  right: 8px;
  border: 0;
  color: var(--muted);
  background: transparent;
}

.chat-body {
  background: repeating-linear-gradient(180deg, transparent, transparent 22px, rgba(255, 255, 255, 0.015) 23px);
}

.demo-chat footer {
  display: flex;
  align-items: center;
  margin: 8px;
  padding: 0 10px;
  border-radius: 7px;
  color: var(--muted);
  background: #252a32;
  font-size: 11px;
}

.demo-info {
  grid-column: 2;
  grid-row: 3;
  padding: 10px 16px;
  background: #0d0f12;
}

.demo-info h1 {
  margin: 0;
  font-size: 17px;
}

.tool-panel {
  position: relative;
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 22px;
}

.image-panel {
  gap: 12px;
  padding-bottom: 14px;
}

.tool-panel header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tool-panel header span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #07120f;
  background: var(--accent);
  font-weight: 900;
}

.tool-panel h2 {
  margin: 0;
  font-size: 22px;
}

.top-actions {
  position: absolute;
  top: 22px;
  right: 22px;
  display: flex;
  gap: 8px;
}

.top-actions button {
  min-width: 104px;
}

.bottom-actions {
  display: flex;
  justify-content: flex-end;
}

.image-panel .bottom-actions {
  margin-top: -8px;
}

.bottom-actions button {
  min-width: 132px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: var(--muted);
  font-weight: 800;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
}

.field input,
.field select {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid #37404d;
  border-radius: 6px;
  color: var(--text);
  background: #0d1016;
}

.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: stretch;
}

.compressed-preview {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 112px;
  padding: 12px;
  border: 1px solid #303846;
  border-radius: 8px;
  color: var(--muted);
  background-color: #090c11;
  background-image: none;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  text-align: center;
}

.compressed-preview.has-image {
  color: transparent;
  background-image: var(--custom-image);
}

.compressed-preview strong,
.compressed-preview span {
  font-size: 12px;
}

.dropzone {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 112px;
  border: 1px dashed #495262;
  border-radius: 8px;
  color: var(--text);
  background: #0d1016;
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    background-color 0.18s ease,
    box-shadow 0.18s ease;
}

.dropzone.compact {
  min-height: 88px;
}

.dropzone input {
  display: none;
}

.dropzone small {
  color: var(--muted);
}

.dropzone.is-dragging {
  border-color: var(--accent);
  background: rgba(0, 242, 168, 0.08);
  box-shadow: inset 0 0 0 1px rgba(0, 242, 168, 0.35);
}

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

.image-panel .size-hint {
  margin-top: -22px;
}

.upload-message {
  min-height: 18px;
  margin: -12px 0 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.image-panel .upload-message {
  margin-top: -24px;
}

.upload-message.is-error {
  color: var(--danger);
}

.preview-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(80px, auto) 1fr;
  align-items: center;
  gap: 18px;
  padding: 42px 16px 16px;
  border-radius: 8px;
  background: var(--panel-2);
}

.preview-card span {
  color: var(--muted);
  font-weight: 800;
}

.preview-zoom-button {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 76px;
  height: 26px;
  padding: 0 10px;
  border: 1px solid #37404d;
  border-radius: 6px;
  color: var(--text);
  background: #0d1016;
  font-size: 12px;
  font-weight: 900;
}

.asset-preview,
#dialogAssetPreview {
  display: grid;
  place-items: center;
  justify-self: center;
  width: var(--preview-width, 22px);
  height: var(--preview-height, 22px);
  border: 1px solid var(--line);
  border-radius: 6px;
  background-color: #07090d;
  background-image: var(--custom-image);
  background-repeat: no-repeat;
  background-position: calc(50% + var(--button-x)) calc(50% + var(--button-y));
  background-size: var(--preview-button-size, var(--button-size)) var(--preview-button-size, var(--button-size));
  font-size: var(--preview-font-size, 28px);
}

.asset-preview.has-image,
#dialogAssetPreview.has-image {
  color: transparent;
  opacity: var(--button-opacity);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 56px;
  align-items: end;
  gap: 14px;
}

output {
  height: 38px;
  padding-top: 9px;
  color: var(--accent);
  font-weight: 900;
  text-align: right;
}

button {
  cursor: pointer;
}

.primary {
  border-color: transparent !important;
  color: #07120f !important;
  background: var(--accent) !important;
  font-weight: 900;
}

.success {
  border-color: transparent !important;
  color: #07120f !important;
  background: var(--accent) !important;
  font-weight: 900;
}

.danger {
  border-color: transparent !important;
  color: #fff !important;
  background: #d83a3a !important;
  font-weight: 900;
}

.danger:hover {
  background: #ef4444 !important;
}

.tool-panel button {
  height: 40px;
  border: 1px solid #3d4654;
  border-radius: 7px;
  color: var(--text);
  background: #1a202a;
}

.save-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

pre {
  min-height: 136px;
  max-height: 220px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #b8c4d5;
  background: #07090d;
  white-space: pre-wrap;
}

.preset-list {
  display: grid;
  gap: 10px;
  max-height: 340px;
  overflow: auto;
}

.preset-list-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #090c11;
}

.preset-list-item small {
  color: var(--muted);
}

.preset-list-item div {
  grid-row: 1 / 3;
  grid-column: 2;
  display: flex;
  gap: 8px;
}

.preset-list-item button {
  min-width: 72px;
  height: 34px;
  border: 1px solid #3d4654;
  border-radius: 7px;
  color: var(--text);
  background: #1a202a;
}

.preset-list-item button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.preset-list-item.is-locked {
  border-color: rgba(0, 242, 168, 0.36);
}

body.is-locked-preset .dropzone,
body.is-locked-preset .success,
body.is-locked-preset #saveButton {
  opacity: 0.55;
}

.preset-empty {
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #090c11;
  text-align: center;
}

dialog {
  width: 430px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: var(--panel);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
}

dialog header,
dialog menu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  margin: 0 0 16px;
}

dialog p {
  margin: 0 0 18px;
  color: var(--text);
}

dialog header button {
  width: 30px;
  height: 30px;
  border: 0;
  color: var(--text);
  background: transparent;
  font-size: 22px;
}

.profile-dialog label {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.profile-dialog input {
  height: 38px;
  padding: 0 10px;
  border: 1px solid #37404d;
  border-radius: 7px;
  color: var(--text);
  background: #0d1016;
}

.profile-message {
  min-height: 20px;
  margin-top: 10px;
  color: var(--accent);
}

.dialog-preview {
  display: grid;
  place-items: center;
  height: 130px;
  margin-bottom: 16px;
  border-radius: 8px;
  background: #07090d;
}

dialog .preview-card {
  margin-bottom: 16px;
}

dialog menu {
  gap: 10px;
  margin-top: 18px;
}

dialog menu button {
  flex: 1;
  height: 38px;
  border: 1px solid #3d4654;
  border-radius: 7px;
  color: var(--text);
  background: #1a202a;
}
