:root {
  color-scheme: light;
  --ink: #18211f;
  --muted: #5c6966;
  --soft: #eef4f0;
  --surface: #ffffff;
  --line: #d8e2dd;
  --dark: #101716;
  --teal: #0b7c6d;
  --teal-strong: #00695c;
  --amber: #d88a1d;
  --green: #2f8a4e;
  --red: #bc3f31;
  --shadow: 0 18px 50px rgba(18, 31, 28, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(11, 124, 109, 0.08), transparent 42%),
    linear-gradient(215deg, rgba(216, 138, 29, 0.12), transparent 46%),
    #f7faf8;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

img {
  display: block;
  max-width: 100%;
}

.shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 3vw, 34px);
  border-bottom: 1px solid rgba(216, 226, 221, 0.82);
  background: rgba(247, 250, 248, 0.92);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--dark), var(--teal));
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

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

.link-button {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.studio {
  display: grid;
  grid-template-columns: minmax(320px, 0.42fr) minmax(0, 0.58fr);
  gap: clamp(18px, 3vw, 30px);
  max-width: 1480px;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 34px);
}

.access-panel,
.generator-panel,
.result-box,
.fine-tune {
  border: 1px solid rgba(216, 226, 221, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.access-panel {
  align-self: start;
  display: grid;
  gap: 18px;
  padding: 18px;
}

.visual-wrap {
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(216, 226, 221, 0.8);
  background: var(--dark);
}

.studio-visual {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.section-kicker {
  display: block;
  margin-bottom: 7px;
  color: var(--teal-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(28px, 4vw, 52px);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(22px, 2.4vw, 32px);
  line-height: 1.05;
}

h3 {
  margin-bottom: 0;
  font-size: 19px;
}

p {
  color: var(--muted);
  line-height: 1.6;
}

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

.status-grid > div {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf9;
}

.status-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-grid strong {
  overflow-wrap: anywhere;
}

.auth-box,
.pay-box,
.admin-box {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.google-slot:empty {
  display: none;
}

.fallback-login {
  display: grid;
  gap: 8px;
}

.fallback-login label,
.field span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.inline-field {
  display: flex;
  gap: 8px;
}

.inline-field input {
  min-width: 0;
  flex: 1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd9d3;
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

input,
select {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  min-height: 148px;
  padding: 12px;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(11, 124, 109, 0.13);
}

input[type="range"] {
  padding: 0;
  accent-color: var(--teal);
}

.setup-note {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.pay-actions,
.toolbar,
.chip-row,
.icon-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button,
.chip,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.button {
  padding: 0 14px;
}

.button:hover,
.chip:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.button:disabled,
.chip:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
  transform: none;
}

.button-dark {
  color: #fff;
  background: var(--dark);
}

.button-primary {
  color: #fff;
  background: var(--teal);
  box-shadow: 0 10px 24px rgba(11, 124, 109, 0.26);
}

.button-pay {
  color: #17100a;
  background: #f0b04f;
  box-shadow: 0 10px 24px rgba(216, 138, 29, 0.22);
}

.button-light,
.chip,
.icon-button {
  color: var(--ink);
  border-color: var(--line);
  background: #fff;
}

.button svg,
.chip svg,
.icon-button svg,
.upload-copy svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.4;
}

.generator-panel {
  min-width: 0;
  padding: clamp(16px, 2.3vw, 26px);
}

.panel-header,
.result-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(84px, 1fr));
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f3f8f5;
}

.tab {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.tab.is-active {
  color: #fff;
  background: var(--dark);
}

.gate-message {
  display: grid;
  gap: 3px;
  margin-bottom: 16px;
  padding: 13px 14px;
  border: 1px solid rgba(188, 63, 49, 0.25);
  border-radius: 8px;
  color: #6c2119;
  background: #fff5f2;
}

.gate-message span {
  color: #7b5149;
  font-size: 14px;
}

.prompt-form {
  display: grid;
  gap: 15px;
}

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

.field-wide {
  grid-column: 1 / -1;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.upload-zone {
  position: relative;
  display: grid;
  min-height: 116px;
  place-items: center;
  padding: 18px;
  border: 1.5px dashed #abc5bb;
  border-radius: 8px;
  background: #f7fbf9;
}

.upload-zone input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  opacity: 0;
}

.upload-copy {
  display: grid;
  justify-items: center;
  gap: 7px;
  text-align: center;
}

.upload-copy small {
  color: var(--muted);
  line-height: 1.35;
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}

.thumb {
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.thumb img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.thumb figcaption {
  overflow: hidden;
  padding: 7px;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.results-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(280px, 0.88fr);
  gap: 14px;
  margin-top: 18px;
}

.result-box,
.fine-tune {
  box-shadow: none;
  padding: 15px;
}

.result-header {
  margin-bottom: 10px;
}

.icon-button {
  width: 42px;
  min-width: 42px;
  padding: 0;
}

pre,
.guide-output {
  min-height: 260px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #19211f;
  background: #fbfdfc;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.55;
}

pre {
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
}

.guide-output {
  color: var(--muted);
}

.guide-output strong {
  color: var(--ink);
}

.guide-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-list li {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.fine-tune {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.chip {
  min-height: 38px;
  padding: 0 12px;
  color: var(--teal-strong);
}

.is-admin #planStatus {
  color: var(--green);
}

.is-paid #planStatus {
  color: var(--green);
}

.is-blocked #planStatus {
  color: var(--red);
}

@media (max-width: 1050px) {
  .studio {
    grid-template-columns: 1fr;
  }

  .access-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
  }

  .top-actions {
    justify-content: flex-end;
  }

  .link-button {
    display: none;
  }

  .studio {
    padding: 14px;
  }

  .form-grid,
  .results-layout,
  .status-grid {
    grid-template-columns: 1fr;
  }

  .panel-header,
  .result-header {
    align-items: stretch;
    flex-direction: column;
  }

  .mode-tabs {
    width: 100%;
  }

  .inline-field {
    flex-direction: column;
  }

  h1 {
    font-size: 34px;
  }
}
