:root {
  color-scheme: light;
  --ink: #1f1712;
  --muted: #756252;
  --panel: rgba(255, 249, 241, 0.9);
  --line: rgba(74, 47, 25, 0.14);
  --accent: #cb5b2f;
  --accent-dark: #8f3219;
  --green: #2d5b43;
  --green-soft: rgba(45, 91, 67, 0.12);
  --warn: #9f5a1d;
  --shadow: 0 24px 70px rgba(81, 43, 15, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Avenir Next", "Helvetica Neue", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(203, 91, 47, 0.24), transparent 34rem),
    radial-gradient(circle at bottom right, rgba(45, 91, 67, 0.22), transparent 28rem),
    linear-gradient(140deg, #fff3e0 0%, #f4dcc2 42%, #ead5bc 100%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: pan-y;
}

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

button {
  border: 0;
}

.shell {
  width: min(1360px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.hero {
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: "Georgia", "Times New Roman", serif;
  font-size: clamp(36px, 6vw, 76px);
  line-height: 0.96;
  letter-spacing: -0.05em;
}

.sub {
  max-width: 760px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.workspace-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.view-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--green);
  font-size: 14px;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: var(--shadow);
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.view-switch-link {
  text-decoration: none;
}

.view-switch.is-active {
  color: #fff;
  background: var(--green);
}

.history-panel,
.control-panel,
.stage {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.history-panel {
  padding: 14px;
}

.app-view.hidden {
  display: none;
}

.workspace {
  display: grid;
  gap: 14px;
}

.panel-head,
.stage-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel-head p,
.stage-head p {
  margin: 0;
  color: var(--green);
  font-size: 16px;
  font-weight: 900;
}

.panel-head small,
.stage-head small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.history-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  overflow: auto;
  align-content: start;
}

.history-empty,
.empty-block {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.48);
  font-size: 13px;
}

.history-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.64);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  -webkit-tap-highlight-color: transparent;
}

.history-card:active {
  transform: scale(0.98);
}

.history-card:hover,
.history-card.is-active {
  transform: translateY(-1px);
  border-color: rgba(203, 91, 47, 0.42);
  box-shadow: 0 12px 32px rgba(62, 33, 12, 0.12);
}

.history-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 12px;
}

.history-thumb-text {
  display: grid;
  place-items: center;
  color: var(--green);
  font-weight: 900;
  background: var(--green-soft);
}

.history-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.history-flags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.history-badge,
.history-progress {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  background: var(--green-soft);
}

.history-badge-warn {
  color: var(--warn);
  background: rgba(159, 90, 29, 0.12);
}

.history-prompt,
.history-meta,
.history-time {
  margin: 0;
}

.history-prompt {
  display: -webkit-box;
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.history-meta,
.history-time {
  color: var(--muted);
  font-size: 12px;
}

.control-panel,
.stage {
  padding: 16px;
}

.control-panel {
  display: grid;
  gap: 12px;
}

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

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

.field span {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

textarea,
select,
input[type="number"],
input[type="text"],
input[type="file"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  outline: none;
  font-size: 16px;
  -webkit-appearance: none;
}

textarea {
  min-height: 140px;
  resize: vertical;
  padding: 14px;
  line-height: 1.5;
}

select,
input[type="number"],
input[type="text"],
input[type="file"] {
  height: 48px;
  padding: 0 14px;
}

textarea:focus,
select:focus,
input[type="number"]:focus,
input[type="text"]:focus,
input[type="file"]:focus {
  border-color: rgba(203, 91, 47, 0.56);
  box-shadow: 0 0 0 4px rgba(203, 91, 47, 0.1);
}

input[type="file"] {
  padding: 12px;
  cursor: pointer;
}

input[type="file"]::file-selector-button {
  padding: 8px 16px;
  margin-right: 12px;
  border: none;
  border-radius: 999px;
  color: #fff;
  background: var(--green);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

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

.submit,
.ghost-button,
.shot-button {
  min-height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.submit:active,
.ghost-button:active,
.shot-button:active {
  transform: scale(0.98);
}

.submit {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
}

.ghost-button,
.shot-button {
  color: #fff;
  background: var(--green);
}

.shot-button-secondary {
  background: rgba(45, 91, 67, 0.78);
}

.ghost-button:disabled,
.shot-button:disabled,
.submit:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.status {
  margin: 0;
  color: var(--accent-dark);
  font-size: 13px;
  line-height: 1.45;
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.info-card,
.media-card,
.shot-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.64);
  padding: 12px;
}

.info-card-wide {
  grid-column: 1 / -1;
}

.collapsible {
  padding: 0;
  overflow: hidden;
}

.collapse-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
  font-size: 14px;
}

.collapse-head::-webkit-details-marker {
  display: none;
}

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

.collapsible .info-body {
  margin: 0 12px 12px;
}

.info-head,
.media-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.info-head span,
.media-label,
.media-title {
  font-weight: 800;
}

.info-body,
.media-prompt {
  margin: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(31, 23, 18, 0.05);
  white-space: pre-wrap;
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
}

.prompt-toggle {
  display: grid;
  gap: 10px;
}

.prompt-toggle summary {
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.prompt-toggle summary::-webkit-details-marker {
  display: none;
}

.gallery,
.shot-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.gallery {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.shot-list {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  align-items: start;
}

.empty-gallery,
.shot-list:empty {
  display: block;
}

.media-image,
.shot-image {
  width: 100%;
  border-radius: 14px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.shot-image {
  max-height: 240px;
}

.media-image:active,
.shot-image:active {
  opacity: 0.9;
}

.shot-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.shot-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.shot-kicker,
.shot-time {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.shot-inline-status {
  margin: 0;
  padding: 8px 10px;
  border-radius: 12px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  background: rgba(203, 91, 47, 0.1);
}

.shot-title {
  margin: 4px 0 0;
  font-size: 18px;
  line-height: 1.2;
}

.shot-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.shot-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  background: var(--green-soft);
}

.shot-grid-block {
  display: grid;
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(31, 23, 18, 0.04);
}

.shot-grid-image {
  width: 100%;
  max-height: 320px;
  border-radius: 14px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.8);
}

.stage-collapsible {
  padding: 0;
  overflow: hidden;
}

.stage-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}

.stage-summary::-webkit-details-marker {
  display: none;
}

.compact-stage-head {
  padding: 0 16px 4px;
}

.compact-grid {
  padding: 0 16px 16px;
  margin-top: 0;
}

.slim-shell {
  width: min(1180px, calc(100% - 32px));
}

.slim-grid {
  display: grid;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.slim-stage {
  min-height: 100%;
}

.slim-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.hairstyle-preview-grid .slim-preview-frame {
  min-height: 440px;
}

.hairstyle-result-card .slim-preview-image {
  object-fit: cover;
}

.hairstyle-prompt-card {
  margin-top: 12px;
}

.hairstyle-grid .field textarea {
  min-height: 116px;
}

.work-menu-grid textarea {
  min-height: 220px;
}

.work-menu-preview-grid {
  grid-template-columns: minmax(280px, 440px) minmax(0, 1fr);
}

.work-menu-preview-frame {
  width: min(100%, 360px);
  min-height: 380px;
  justify-self: center;
}

.video-layout {
  margin-bottom: 14px;
}

.video-preview-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.video-info-card,
.video-history-panel {
  margin-top: 12px;
}

.video-frame {
  padding: 12px;
}

.video-player {
  width: 100%;
  max-height: 420px;
  border-radius: 14px;
  background: rgba(19, 17, 16, 0.9);
}

.history-link {
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.history-link:hover {
  text-decoration: underline;
}

.slim-preview-card {
  align-content: start;
}

.slim-preview-frame {
  display: grid;
  place-items: center;
  min-height: 380px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.7);
}

.slim-preview-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.86);
}

.reference-mosaic {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  width: 100%;
  padding: 12px;
}

.reference-tile {
  min-height: 120px;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(74, 47, 25, 0.08);
}

.reference-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.field-note {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.slim-download {
  text-decoration: none;
}

.is-hidden {
  display: none;
}

@media (max-width: 900px) {
  .slim-preview-grid,
  .control-grid,
  .analysis-grid {
    grid-template-columns: 1fr;
  }

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

  .shot-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .shell {
    width: calc(100% - 24px);
    padding: 16px 0 32px;
  }

  h1 {
    font-size: 32px;
  }

  .sub {
    font-size: 14px;
  }

  .workspace-nav {
    gap: 6px;
  }

  .view-switch {
    min-height: 40px;
    padding: 0 14px;
    font-size: 13px;
  }

  .control-grid,
  .analysis-grid,
  .gallery,
  .slim-preview-grid {
    grid-template-columns: 1fr;
  }

  .shot-list {
    grid-template-columns: 1fr;
  }

  .control-panel,
  .stage,
  .history-panel {
    padding: 16px;
    border-radius: 18px;
  }

  .shot-top,
  .stage-head,
  .panel-head,
  .stage-summary {
    flex-direction: column;
    align-items: flex-start;
  }

  .shot-actions {
    width: 100%;
    justify-content: stretch;
  }

  .ghost-button,
  .shot-button,
  .submit {
    width: 100%;
  }

  textarea {
    min-height: 120px;
    font-size: 16px;
  }

  select,
  input[type="number"],
  input[type="file"] {
    font-size: 16px;
  }

  .media-image,
  .shot-image {
    max-height: 400px;
  }

  .slim-preview-frame {
    min-height: 320px;
  }

  .hairstyle-preview-grid .slim-preview-frame {
    min-height: 300px;
  }

  .history-card {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .history-thumb {
    width: 64px;
    height: 64px;
  }
}
