:root {
  color-scheme: dark;
  --bg: #080808;
  --panel: rgba(22, 22, 22, 0.82);
  --panel-strong: rgba(26, 26, 26, 0.96);
  --panel-soft: rgba(255, 255, 255, 0.045);
  --line: rgba(255, 255, 255, 0.1);
  --line-soft: rgba(255, 255, 255, 0.065);
  --text: #f3f3f1;
  --muted: #aaa9a5;
  --muted-2: #777671;
  --accent: #d8d5cc;
  --accent-2: #f0ede4;
  --danger: #ff817a;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 50% 40%, rgba(58, 58, 56, 0.24), transparent 38%),
    radial-gradient(circle at 82% 12%, rgba(92, 89, 82, 0.12), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
select,
textarea {
  font: inherit;
}

input {
  font: inherit;
}

button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
}

button:hover:not(:disabled),
button.selected {
  border-color: var(--accent);
  background: rgba(216, 213, 204, 0.12);
}

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

.app {
  position: relative;
  display: block;
  min-height: 100vh;
}

.system-topbar {
  position: fixed;
  z-index: 8;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 30px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(9, 12, 16, 0.9);
  padding: 3px 12px;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.2);
  opacity: 0.84;
  transform: translateY(calc(-100% + 6px));
  transition:
    opacity 150ms ease,
    transform 180ms ease;
  backdrop-filter: blur(22px) saturate(140%);
}

.system-topbar:hover,
.system-topbar:focus-within {
  opacity: 1;
  transform: translateY(0);
}

.system-menu-group {
  position: relative;
}

.system-menu-item {
  min-height: 24px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  padding: 0 10px;
  color: var(--text);
  font-size: 0.84rem;
}

.system-menu-group:first-child .system-menu-item {
  font-weight: 650;
}

.system-menu-popover {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  display: none;
  min-width: 190px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(18, 23, 29, 0.95);
  padding: 7px;
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(22px) saturate(145%);
}

.system-menu-group.open .system-menu-popover {
  display: grid;
  gap: 6px;
}

.account-widget {
  position: relative;
  z-index: 10;
}

.account-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.28), transparent 34%),
    linear-gradient(135deg, rgba(118, 116, 110, 0.95), rgba(59, 59, 57, 0.82));
  color: #f7f5ef;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.36);
}

.account-avatar:hover,
.account-avatar[aria-expanded="true"] {
  border-color: rgba(255, 255, 255, 0.45);
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.34), transparent 34%),
    linear-gradient(135deg, rgba(150, 147, 139, 0.98), rgba(72, 72, 69, 0.86));
}

.account-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  display: grid;
  width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(16, 20, 27, 0.94);
  overflow: hidden;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(24px) saturate(150%);
}

.account-panel[hidden] {
  display: none;
}

.account-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
}

.account-profile[hidden] {
  display: none;
}

.account-password-section {
  display: grid;
  border-top: 1px solid var(--line-soft);
  padding-top: 14px;
}

.account-password-section[hidden],
.account-password-form[hidden] {
  display: none;
}

.account-password-form {
  display: grid;
  gap: 10px;
  padding: 0 14px 14px;
}

.account-password-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
}

.account-password-form input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(7, 10, 15, 0.5);
  color: var(--text);
  padding: 0 10px;
}

.account-password-form button[type="submit"] {
  justify-content: center;
  min-height: 38px;
}

.account-profile-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.22), transparent 34%),
    linear-gradient(135deg, rgba(118, 116, 110, 0.95), rgba(59, 59, 57, 0.82));
  color: #f7f5ef;
  font-size: 1rem;
  font-weight: 800;
}

.account-profile-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.account-profile-label {
  color: var(--muted);
  font-size: 0.72rem;
}

.account-profile-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-status {
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.auth-status[hidden] {
  display: none;
}

.auth-card > .auth-status {
  margin: 16px 24px 0;
}

.auth-status.error {
  color: var(--danger);
}

.credit-section {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.credit-section[hidden] {
  display: none;
}

.credit-section-label {
  color: var(--muted);
  font-size: 0.72rem;
}

.credit-balance-value {
  color: var(--text);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.credit-low-notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
}

.credit-low-notice[hidden] {
  display: none;
}

.credit-low-notice span {
  flex: 0 0 auto;
  color: var(--text);
}

.credit-menu-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
}

.credit-menu-button[hidden] {
  display: none;
}

.credit-menu-button:hover,
.credit-menu-button[aria-expanded="true"] {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
}

.credit-modal {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}

.credit-modal[hidden] {
  display: none;
}

.credit-modal-backdrop {
  position: absolute;
  inset: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.58);
  cursor: default;
}

.credit-modal-card {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  width: min(460px, calc(100vw - 48px));
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(16, 20, 27, 0.98);
  padding: 18px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(24px) saturate(150%);
}

.credit-modal-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: start;
}

.credit-modal-eyebrow {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.credit-modal-header h2 {
  margin: 0;
  color: var(--text);
  font-size: 1.45rem;
}

.credit-modal-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.credit-modal-close {
  display: grid;
  place-items: center;
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  border-radius: 999px;
  padding: 0;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
}

.credit-pack-list {
  display: grid;
  gap: 8px;
}

.credit-pack-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  border-radius: 12px;
  padding: 10px 12px;
  text-align: left;
}

.credit-pack-button:hover {
  background: rgba(255, 255, 255, 0.06);
}

.credit-pack-button span {
  display: grid;
  gap: 1px;
}

.credit-pack-button strong {
  font-size: 0.82rem;
}

.credit-pack-button small {
  color: var(--muted);
  font-size: 0.7rem;
}

.credit-pack-button b {
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 650;
}

.account-row-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(100% - 28px);
  min-height: 40px;
  margin: 0 14px 14px;
  padding: 0 12px;
  font-size: 0.92rem;
  font-weight: 650;
}

.auth-card {
  display: grid;
}

.auth-card[hidden] {
  display: none;
}

.auth-card-header {
  display: grid;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 24px 24px 26px;
}

.auth-card-header h2 {
  margin: 0;
  color: var(--text);
  font-size: 1.55rem;
  line-height: 1.1;
}

.auth-card-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.35;
}

.auth-form {
  display: grid;
  gap: 16px;
  padding: 22px 24px 24px;
}

.auth-form[hidden] {
  display: none;
}

.auth-form-secondary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.auth-form-secondary button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
}

.auth-form-secondary button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.auth-form label {
  display: grid;
  gap: 9px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 650;
}

.auth-form input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(7, 10, 15, 0.5);
  color: var(--text);
  padding: 0 14px;
  font-size: 1rem;
}

.auth-form input:focus {
  border-color: rgba(128, 166, 255, 0.75);
  box-shadow: 0 0 0 3px rgba(128, 166, 255, 0.16);
  outline: none;
}

.auth-password-field {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-password-field input {
  padding-right: 68px;
}

.auth-password-field button {
  position: absolute;
  right: 8px;
  min-height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 0 8px;
  color: var(--muted);
  font-size: 0.76rem;
}

.auth-password-field button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.auth-primary {
  min-height: 50px;
  border: 1px solid rgba(190, 210, 255, 0.64);
  border-radius: 12px;
  background: linear-gradient(180deg, #93b8ff, #77a2f1);
  color: #101723;
  font-size: 1rem;
  font-weight: 750;
  box-shadow: 0 12px 36px rgba(92, 136, 224, 0.28);
}

.auth-primary:hover {
  background: linear-gradient(180deg, #a3c4ff, #86adf5);
}

.auth-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 0.86rem;
}

.auth-divider::before,
.auth-divider::after {
  height: 1px;
  background: var(--line-soft);
  content: "";
}

.auth-terms {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.auth-terms a {
  color: #9fbfff;
  text-decoration: none;
}

.auth-terms a:hover {
  text-decoration: underline;
}

.account-secondary {
  justify-content: center;
  width: 100%;
}

.system-menu-popover button,
.system-menu-popover .load-project {
  justify-content: start;
  width: 100%;
  min-height: 32px;
  padding: 0 10px;
  text-align: left;
}

.studio {
  position: fixed;
  z-index: 5;
  top: 68px;
  left: 12px;
  display: grid;
  align-content: start;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(330px, calc(100vw - 32px));
  max-height: calc(100vh - 88px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
  box-shadow: 0 24px 82px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(26px) saturate(150%);
}

.studio.collapsed {
  display: none;
}

.studio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  border-bottom: 1px solid var(--line-soft);
  padding: 0 14px;
}

.studio-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.layers-mark {
  position: relative;
  width: 17px;
  height: 15px;
}

.layers-mark::before,
.layers-mark::after,
.layers-mark {
  background:
    linear-gradient(135deg, transparent 0 35%, currentColor 36% 64%, transparent 65%),
    linear-gradient(45deg, transparent 0 35%, currentColor 36% 64%, transparent 65%);
  color: var(--text);
}

.layers-mark::before,
.layers-mark::after {
  position: absolute;
  left: 0;
  width: 17px;
  height: 15px;
  content: "";
}

.layers-mark::before {
  top: -5px;
  opacity: 0.75;
}

.layers-mark::after {
  top: 5px;
  opacity: 0.75;
}

.prompt span,
.readout span {
  display: block;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 650;
  line-height: 1.04;
}

.tab-button {
  border: 0;
  background: transparent;
  color: var(--muted-2);
  font-size: 0.9rem;
  padding: 0 2px;
}

.icon-button,
.expand-sidebar {
  display: grid;
  place-items: center;
  min-width: 32px;
  min-height: 32px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.expand-sidebar {
  position: fixed;
  z-index: 6;
  top: 68px;
  left: 12px;
  border: 1px solid var(--line);
  background: rgba(18, 23, 29, 0.82);
  padding: 0 14px;
  box-shadow: 0 20px 64px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(22px);
}

.expand-sidebar[hidden] {
  display: none;
}

.prompt textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 12, 17, 0.62);
  color: var(--text);
  line-height: 1.45;
  padding: 12px;
}

.actions,
.readout,
.mode,
.view-actions {
  display: grid;
  gap: 10px;
}

.actions {
  grid-template-columns: 1fr 1fr;
}

.actions button:first-child {
  border-color: rgba(216, 213, 204, 0.42);
  background: rgba(216, 213, 204, 0.14);
  color: var(--text);
  font-weight: 650;
}

.readout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.load-project {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
}

.load-project:hover {
  border-color: var(--accent);
  background: rgba(216, 213, 204, 0.12);
}

.load-project span {
  pointer-events: none;
}

.load-project input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.outline-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.outline-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.readout div {
  min-width: 64px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  padding: 8px;
}

.readout strong {
  font-size: 0.9rem;
  font-weight: 650;
}

.layers {
  display: grid;
  align-content: start;
  gap: 8px;
  margin: 0;
  min-height: 110px;
  overflow: auto;
  padding: 12px;
  list-style: none;
}

.browser-current {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  border-bottom: 1px solid var(--line-soft);
  padding: 0 0 12px;
}

.browser-back {
  justify-self: start;
  min-height: 30px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
}

.browser-breadcrumb {
  grid-column: 1 / -1;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browser-preview {
  grid-column: 1 / -1;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.browser-current strong {
  overflow: hidden;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browser-current > span {
  color: var(--muted-2);
  font-size: 0.72rem;
  text-align: right;
}

.portal-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto 24px 22px;
  align-items: center;
  gap: 8px;
  min-height: 50px;
  border-radius: 8px;
  padding: 6px;
}

.portal-row:hover,
.portal-row.selected {
  background: rgba(255, 255, 255, 0.055);
}

.portal-thumb {
  width: 58px;
  height: 38px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
}

.portal-body {
  display: grid;
  gap: 3px;
  min-width: 0;
  min-height: 38px;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
}

.portal-body:hover:not(:disabled) {
  border-color: transparent;
  background: transparent;
}

.portal-body span,
.portal-body small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-body span {
  color: var(--text);
  font-size: 0.78rem;
}

.portal-body small {
  color: var(--muted-2);
  font-size: 0.68rem;
}

.portal-versions {
  display: flex;
  align-items: center;
  gap: 2px;
  color: var(--muted);
  font-size: 0.68rem;
}

.portal-versions button,
.portal-icon,
.portal-delete {
  min-width: 22px;
  min-height: 26px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
}

.portal-delete {
  color: var(--danger);
}

.portal-empty {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
  padding: 10px 4px;
}

.status {
  min-height: 38px;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.status.error {
  color: var(--danger);
}

.canvas-shell {
  position: relative;
  min-width: 0;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(45deg, #121212 25%, transparent 25%) 0 0 / 28px 28px,
    linear-gradient(-45deg, #121212 25%, transparent 25%) 0 14px / 28px 28px,
    linear-gradient(45deg, transparent 75%, #121212 75%) 14px -14px / 28px 28px,
    linear-gradient(-45deg, transparent 75%, #121212 75%) -14px 0 / 28px 28px,
    #0c0c0c;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.canvas-action-bar {
  position: fixed;
  z-index: 6;
  top: 68px;
  left: 50%;
  display: flex;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(18, 23, 29, 0.82);
  padding: 4px;
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.34);
  transform: translateX(-50%);
  backdrop-filter: blur(22px) saturate(145%);
}

.tool-button {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 92px;
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
}

.tool-button span {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  color: currentColor;
  font-size: 1rem;
  line-height: 1;
}

.tool-button strong {
  color: currentColor;
  font-size: 0.82rem;
  font-weight: 550;
}

.tool-button.selected {
  border-color: transparent;
  background: rgba(216, 213, 204, 0.14);
  color: #f7f5ef;
}

.marquee-ratio {
  position: absolute;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(110px, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(11, 15, 20, 0.94);
  color: var(--muted);
  padding: 7px 8px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.28);
}

.region-versions {
  position: absolute;
  z-index: 3;
  display: grid;
  grid-template-columns: 28px auto 28px;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(18, 22, 27, 0.86);
  color: var(--text);
  padding: 4px 6px;
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(18px) saturate(145%);
}

.region-versions[hidden] {
  display: none;
}

.region-versions button {
  min-width: 28px;
  min-height: 28px;
  border: 0;
  background: transparent;
  color: var(--text);
}

.region-versions strong {
  min-width: 36px;
  font-size: 0.76rem;
  text-align: center;
}

.marquee-ratio[hidden] {
  display: none;
}

.marquee-ratio span {
  font-size: 0.78rem;
  text-transform: uppercase;
}

.marquee-ratio select {
  min-width: 0;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-strong);
  color: var(--text);
  padding: 0 8px;
}

.canvas-hint {
  position: absolute;
  right: 24px;
  bottom: 24px;
  max-width: calc(100% - 36px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 23, 29, 0.74);
  color: var(--muted);
  padding: 10px 12px;
  pointer-events: none;
  backdrop-filter: blur(16px);
  transition: opacity 240ms ease;
}

.canvas-hint.dismissed {
  opacity: 0;
}

.layer-editor {
  position: fixed;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: min(680px, calc(100vw - 28px));
  min-height: 62px;
  right: auto;
  bottom: 34px;
  left: 50%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 15px;
  background: rgba(18, 22, 27, 0.88);
  padding: 10px;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
  transform: translateX(-50%);
  backdrop-filter: blur(22px) saturate(145%);
}

.layer-editor[hidden] {
  display: none;
}

.prompt textarea {
  display: block;
  height: 44px;
  max-height: 132px;
  min-height: 44px;
  overflow-y: auto;
  outline: none;
  border: 0;
  background: transparent;
  color: #eef3f8;
  font-size: 0.92rem;
  line-height: 1.45;
  padding: 10px 6px 10px 12px;
  align-content: center;
  resize: none;
}

.prompt textarea:focus {
  outline: none;
  box-shadow: none;
}

.prompt textarea::placeholder {
  color: rgba(238, 243, 248, 0.46);
}

.prompt {
  display: block;
  min-width: 0;
  grid-column: 1;
  grid-row: 1;
}

.prompt-meta {
  display: none;
  grid-column: 1;
  grid-row: 2;
  align-items: center;
  gap: 8px;
  min-height: 20px;
  color: var(--muted);
  font-size: 0.72rem;
}

.prompt-region {
  overflow: hidden;
  max-width: 290px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-meta #variant-count {
  display: none;
  min-width: 28px;
  font-weight: 500;
  text-align: center;
}

.prompt-actions {
  display: flex;
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  justify-content: flex-end;
}

#generate-button {
  min-width: 124px;
  min-height: 48px;
  border-color: rgba(216, 213, 204, 0.5);
  border-radius: 10px;
  background: #d8d5cc;
  color: #111;
  font-weight: 500;
}

#generate-button::before {
  margin-right: 8px;
  content: "✦";
}

.canvas-status {
  position: fixed;
  z-index: 3;
  bottom: 104px;
  left: 50%;
  max-width: min(620px, calc(100vw - 32px));
  margin: 0;
  transform: translateX(-50%);
  pointer-events: none;
}

.mask-panel {
  position: absolute;
  z-index: 4;
  right: 58px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: center;
  width: min(238px, calc(100% - 64px));
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--muted);
  padding: 14px;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(22px) saturate(145%);
}

.mask-panel[hidden] {
  display: none;
}

.mask-panel.collapsed {
  gap: 0;
  width: auto;
}

.mask-panel.collapsed > :not(.panel-header) {
  display: none;
}

.mask-panel label {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  font-size: 0.82rem;
}

.mask-panel label input {
  grid-column: 1 / -1;
}

.mask-panel input {
  width: 100%;
  accent-color: var(--accent);
}

.mask-panel button.selected {
  border-color: var(--accent);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -2px 0 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.mask-panel.collapsed .panel-header {
  margin: -2px 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.panel-header button {
  min-width: 26px;
  min-height: 26px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
}

.panel-header strong {
  font-size: 0.9rem;
  font-weight: 500;
}

.brush-tools {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.brush-tools p {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  color: #d8dde4;
  font-size: 0.82rem;
}

.round-tool {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-height: auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
}

.round-tool span {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: #e8edf3;
  font-size: 1.2rem;
}

.round-tool.selected span {
  border-color: var(--accent);
  color: var(--accent);
}

.round-tool small {
  color: #d3d8df;
  font-size: 0.66rem;
  font-weight: 400;
}

@media (max-width: 780px) {
  .canvas-action-bar {
    top: 62px;
  }

  .tool-button {
    min-width: 78px;
    padding: 0 10px;
  }

  .studio {
    top: 68px;
    left: 12px;
    width: calc(100vw - 24px);
    max-height: calc(100vh - 88px);
  }

  .expand-sidebar {
    top: 68px;
  }

  .canvas-shell {
    min-height: 100vh;
  }

  .mask-panel {
    top: auto;
    left: 12px;
    right: 12px;
    bottom: 78px;
    transform: none;
    grid-template-columns: 1fr;
    width: auto;
  }
}

.app-header {
  position: fixed;
  z-index: 9;
  top: 0;
  right: 0;
  left: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  min-height: 56px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(9, 12, 16, 0.94);
  padding: 8px 16px;
  backdrop-filter: blur(22px) saturate(140%);
}

.app-header-left,
.app-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-header-right {
  justify-content: flex-end;
}

.app-mark {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--accent), #77746c);
}

.app-header-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.app-header-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.env-pill {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  border-radius: 999px;
  padding: 0 7px;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  border: 1px solid transparent;
}

.env-pill.dev {
  background: rgba(77, 163, 255, 0.16);
  border-color: rgba(77, 163, 255, 0.35);
  color: #7ec0ff;
}

.env-pill.preview {
  background: rgba(255, 149, 77, 0.16);
  border-color: rgba(255, 149, 77, 0.35);
  color: #ffb07a;
}

.env-pill.prod {
  background: rgba(88, 214, 141, 0.16);
  border-color: rgba(88, 214, 141, 0.35);
  color: #72e0a8;
}

.app-header-title strong {
  font-size: 0.92rem;
}

.header-project-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-project-name {
  color: var(--muted);
  font-size: 0.78rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 0.66rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-pill.draft {
  background: rgba(255, 193, 77, 0.14);
  color: #ffc14d;
}

.status-pill.saved {
  background: rgba(216, 213, 204, 0.12);
  color: #d8d5cc;
}

.status-pill.archived {
  background: rgba(168, 175, 185, 0.14);
  color: var(--muted);
}

.header-menu-wrap {
  position: relative;
}

.header-menu-button,
.header-action {
  min-height: 34px;
  border-radius: 999px;
  padding: 0 14px;
  font-size: 0.82rem;
}

.header-menu-button,
.header-action.subtle {
  background: rgba(255, 255, 255, 0.04);
}

.header-menu-button {
  min-width: 36px;
  padding: 0 10px;
  font-size: 1rem;
  line-height: 1;
}

.header-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  gap: 6px;
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(18, 23, 29, 0.96);
  padding: 8px;
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(22px) saturate(145%);
}

.header-menu[hidden],
.header-room-actions[hidden] {
  display: none;
}

.header-menu button {
  justify-content: flex-start;
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  text-align: left;
}

.header-menu-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border-radius: 8px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 0.86rem;
}

.header-menu-check:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.header-menu-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.header-room-actions {
  display: grid;
  gap: 6px;
  border-top: 1px solid var(--line-soft);
  padding-top: 6px;
}

.account-host {
  display: grid;
  place-items: center;
}

.presence-host,
.presence-bar {
  display: flex;
  align-items: center;
  gap: 4px;
}

.presence-avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid rgba(9, 12, 16, 0.85);
  border-radius: 999px;
  color: #081018;
  font-size: 0.68rem;
  font-weight: 700;
}

.presence-more,
.presence-empty {
  color: var(--muted);
  font-size: 0.72rem;
}

.app.lobby-mode .studio,
.app.lobby-mode .canvas-action-bar,
.app.lobby-mode .layer-editor,
.app.lobby-mode .mask-panel,
.app.lobby-mode .region-versions,
.app.lobby-mode .marquee-ratio,
.app.lobby-mode .expand-sidebar {
  opacity: 0.35;
  pointer-events: none;
}

.app.lobby-mode .canvas-shell {
  filter: saturate(0.7) brightness(0.72);
}

.rooms-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
}

.rooms-modal[hidden] {
  display: none;
}

.rooms-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 7, 11, 0.72);
  backdrop-filter: blur(8px);
}

.rooms-card {
  position: relative;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  width: min(760px, calc(100vw - 32px));
  max-height: min(640px, calc(100vh - 48px));
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(16, 20, 26, 0.98);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.rooms-header,
.rooms-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
}

.rooms-header {
  border-bottom: 1px solid var(--line-soft);
}

.rooms-footer {
  border-top: 1px solid var(--line-soft);
}

.rooms-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.rooms-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.rooms-close {
  min-width: 36px;
  min-height: 36px;
  border-radius: 999px;
}

.rooms-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 20px 0;
}

.rooms-tab {
  min-height: 32px;
  border-radius: 999px;
  background: transparent;
}

.rooms-tab.selected {
  background: rgba(216, 213, 204, 0.12);
}

.rooms-list,
.rooms-members {
  overflow: auto;
  padding: 12px 20px 20px;
}

.rooms-row {
  display: grid;
  grid-template-columns: 56px 1fr auto auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  padding: 10px;
}

.rooms-row + .rooms-row {
  margin-top: 8px;
}

.rooms-row.current {
  border-color: rgba(216, 213, 204, 0.38);
}

.rooms-thumb {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.rooms-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rooms-row-body strong {
  display: block;
}

.rooms-row-meta,
.rooms-row-fork,
.rooms-loading,
.rooms-empty,
.rooms-error {
  color: var(--muted);
  font-size: 0.78rem;
}

.rooms-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rooms-menu {
  position: relative;
}

.rooms-menu summary {
  list-style: none;
  cursor: pointer;
  min-width: 34px;
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.rooms-menu-body {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 2;
  display: grid;
  gap: 4px;
  min-width: 140px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(18, 23, 29, 0.98);
  padding: 6px;
}

.rooms-menu-body button {
  justify-content: flex-start;
  width: 100%;
}

.rooms-primary,
.rooms-secondary {
  min-height: 36px;
  border-radius: 999px;
  padding: 0 16px;
}

.rooms-primary {
  background: rgba(216, 213, 204, 0.16);
  border-color: rgba(216, 213, 204, 0.42);
}

.rooms-secondary {
  background: transparent;
}

.rooms-share-link,
.rooms-invite,
.rooms-visibility {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.rooms-share-link input,
.rooms-invite input {
  flex: 1;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 0 10px;
}

.rooms-member-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.rooms-member-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 10px;
}

.rooms-member-row strong {
  display: block;
}

.rooms-member-row span {
  color: var(--muted);
  font-size: 0.78rem;
}

.rooms-back-tab {
  margin-bottom: 12px;
}
