:root {
  color-scheme: light;
  --ink: #263238;
  --muted: #5c6f74;
  --paper: #fffdf7;
  --mint: #7be0c3;
  --aqua: #5eb9e6;
  --coral: #ff8f7a;
  --sun: #ffd66b;
  --leaf: #9bd86f;
  --line: #253238;
  --shadow: 0 10px 0 rgba(38, 50, 56, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(90deg, rgba(94, 185, 230, 0.13) 1px, transparent 1px),
    linear-gradient(rgba(255, 143, 122, 0.12) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
}

body {
  min-height: 100%;
  margin: 0;
  font-family:
    ui-rounded,
    "SF Pro Rounded",
    "Avenir Next",
    system-ui,
    sans-serif;
  color: var(--ink);
}

button,
textarea {
  font: inherit;
}

button {
  touch-action: manipulation;
}

.app-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 18px 14px 34px;
}

.hero {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 14px;
  align-items: center;
  padding: 18px 0 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: var(--sun);
  box-shadow: 6px 6px 0 var(--mint);
}

.brand-mark img {
  width: 54px;
  height: 54px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 2px;
  font-size: clamp(2.1rem, 10vw, 4.4rem);
  line-height: 0.94;
}

h2 {
  margin-bottom: 12px;
  font-size: 1.22rem;
  line-height: 1.15;
}

.hero-copy {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
}

.panel {
  margin-top: 14px;
  padding: 16px;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.94);
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.limit-pill,
.ready-pill {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--leaf);
  font-size: 0.78rem;
  font-weight: 800;
}

.ready-pill {
  background: var(--mint);
}

.prompt-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

textarea {
  width: 100%;
  min-height: 128px;
  resize: vertical;
  padding: 14px;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.4;
}

textarea:focus,
button:focus-visible {
  outline: 4px solid var(--aqua);
  outline-offset: 3px;
}

.chip-grid,
.mode-grid,
.action-grid {
  display: grid;
  gap: 10px;
}

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

.chip,
.mode-button,
.action-button,
.generate-button {
  min-height: 48px;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
  box-shadow: 4px 4px 0 rgba(38, 50, 56, 0.16);
}

.chip {
  padding: 10px;
  background: #fff7cf;
}

.chip:nth-child(odd) {
  background: #dcf7ff;
}

.chip:nth-child(even) {
  background: #fff7cf;
}

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

.mode-button {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
  padding: 12px;
  background: #ffffff;
  text-align: left;
}

.mode-button.active {
  background: var(--mint);
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 rgba(38, 50, 56, 0.16);
}

.mode-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--sun);
}

.generate-button {
  width: 100%;
  min-height: 62px;
  margin-top: 16px;
  background: var(--coral);
  font-size: 1.08rem;
}

.generate-button:disabled,
.action-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.status-message {
  min-height: 28px;
  margin: 12px 4px 0;
  color: var(--muted);
  font-weight: 800;
}

.hidden {
  display: none;
}

.image-frame {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border: 3px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(45deg, #f7f7f7 25%, transparent 25%),
    linear-gradient(-45deg, #f7f7f7 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f7f7f7 75%),
    linear-gradient(-45deg, transparent 75%, #f7f7f7 75%),
    #ffffff;
  background-position:
    0 0,
    0 10px,
    10px -10px,
    -10px 0;
  background-size: 20px 20px;
}

.image-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.action-grid {
  grid-template-columns: 1fr;
  margin-top: 14px;
}

.action-button {
  padding: 10px 12px;
  background: #e5f8ed;
}

.action-button.primary {
  width: 100%;
  margin-top: 12px;
  background: var(--mint);
}

.prompt-details {
  margin-top: 14px;
  color: var(--muted);
}

.prompt-details summary {
  min-height: 44px;
  cursor: pointer;
  font-weight: 900;
}

.prompt-details p {
  margin-bottom: 0;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow-wrap: anywhere;
}

.instructions-dialog {
  width: min(calc(100% - 28px), 520px);
  border: 3px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 10px 10px 0 rgba(38, 50, 56, 0.18);
}

.instructions-dialog::backdrop {
  background: rgba(38, 50, 56, 0.36);
}

.instructions-dialog ol {
  padding-left: 24px;
  line-height: 1.5;
}

@media (min-width: 680px) {
  .app-shell {
    padding-top: 28px;
  }

  .hero {
    grid-template-columns: 104px 1fr;
  }

  .brand-mark {
    width: 96px;
    height: 96px;
  }

  .brand-mark img {
    width: 66px;
    height: 66px;
  }

  .chip-grid,
  .action-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mode-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mode-button {
    min-height: 86px;
    align-items: flex-start;
    flex-direction: column;
  }
}
