:root {
  color-scheme: light;
  --bg: #f2f1ee;
  --surface: #f9f8f5;
  --surface-soft: #eeece7;
  --ink: #2b2b29;
  --muted: #77736d;
  --faint: #aaa59d;
  --line: #dedbd4;
  --line-strong: #c8c4bb;
  --accent: #ff5a1f;
  --accent-soft: #fff1eb;
  --shadow: 0 28px 70px rgba(54, 52, 48, 0.12);
  --control-shadow: inset 0 1px 0 rgba(255,255,255,.82), 0 1px 2px rgba(54,52,48,.08);
  --radius: 10px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter-italic.woff2") format("woff2");
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); font-size: 15px; }
body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-size: 13px;
}

button, select, textarea { font: inherit; }
button, select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--control-shadow);
}
button { padding: 0 16px; cursor: pointer; font-weight: 560; }
button:hover, select:hover { border-color: var(--line-strong); background: #fffdfa; }
button:active { transform: translateY(1px); box-shadow: inset 0 2px 6px rgba(54,52,48,.12); }
button:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: rgba(255,90,31,.48);
  box-shadow: 0 0 0 4px rgba(255,90,31,.12), var(--control-shadow);
}

.app-shell { width: min(1440px, 100%); margin: 0 auto; padding: 28px; }
.topbar {
  min-height: 96px;
  margin-bottom: 24px;
  padding: 6px 6px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand { display: flex; align-items: center; gap: 18px; min-width: 0; color: inherit; text-decoration: none; }
.brand-mark { display: block; width: 68px; height: 68px; border-radius: 16px; box-shadow: 0 8px 22px rgba(80,56,42,.12); }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.38rem,2.25vw,1.9rem); font-weight: 700; line-height: 1.02; }
.brand p { margin-top: 8px; color: var(--muted); font-size: .95rem; font-weight: 430; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.top-actions button { min-height: 36px; }

.app-switcher { position: relative; flex: 0 0 auto; }
.app-switcher-button { width: 36px; height: 36px; min-height: 36px; flex: 0 0 36px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 999px; background: var(--ink); color: white; box-shadow: none; }
.app-switcher-button svg { width: 16px; height: 16px; display: block; fill: currentColor; transform: translateY(0.5px); }
.app-switcher-button:hover, .app-switcher-button[aria-expanded="true"] { border-color: transparent; background: #1f1e1b; color: white; }
.app-switcher-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 100;
  width: 316px;
  max-height: calc(100vh - 110px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 18px;
  background: rgba(249,247,242,.97);
  box-shadow: 0 18px 44px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.7);
  backdrop-filter: blur(36px) saturate(1.25);
  -webkit-backdrop-filter: blur(36px) saturate(1.25);
}
.app-switcher-menu[hidden] { display: none; }
.app-switcher-heading { display: grid; gap: 3px; padding: 10px 12px 13px; }
.app-switcher-heading strong { font-size: .82rem; font-weight: 650; }
.app-switcher-heading span { color: var(--muted); font-size: .72rem; }
.app-switcher-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 4px; }
.app-switcher-item {
  position: relative;
  min-width: 0;
  min-height: 112px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 5px 8px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--ink);
  text-decoration: none;
}
.app-switcher-item:hover, .app-switcher-item:focus-visible { outline: none; border-color: rgba(0,0,0,.08); background: #f1eee8; }
.app-switcher-item.is-current { background: #f1eee8; }
.app-switcher-item strong { max-width: 100%; overflow: hidden; font-size: .76rem; font-weight: 580; text-overflow: ellipsis; white-space: nowrap; }
.mini-app-icon { position: relative; width: 56px; height: 56px; display: grid; place-items: center; overflow: hidden; border: 1px solid rgba(200,196,187,.72); border-radius: 15px; background: linear-gradient(145deg,#f4ede3,#ddd1c1); color: var(--ink); font-size: 1.25rem; font-weight: 650; box-shadow: inset 0 1px 0 rgba(255,255,255,.8),0 3px 8px rgba(0,0,0,.12); }
.mini-app-icon i { position: absolute; display: block; border-radius: 50%; background: var(--accent); }
.real-app-icon { border: 0; background: transparent; box-shadow: none; }
.real-app-icon img { display: block; width: 100%; height: 100%; object-fit: cover; }
.time-icon i { top: 9px; right: 8px; width: 12px; height: 12px; box-shadow: 0 0 0 1px #bd3e12; }
.lorem-icon { justify-items: start; padding-left: 12px; }
.lorem-icon i { top: 8px; right: 7px; width: 8px; height: 8px; box-shadow: 0 0 0 1px #bd3e12; }
.frido-icon { border-color: rgba(130,58,229,.14); background: #f2eafe; }
.frido-icon img { width: 32px; height: 32px; }

.workbench {
  display: grid;
  grid-template-columns: 236px minmax(0,1fr);
  min-height: 620px;
  overflow: hidden;
  border: 1px solid rgba(222,219,212,.88);
  border-radius: 18px;
  background: rgba(249,248,245,.9);
  box-shadow: var(--shadow);
}

.content-nav {
  display: flex;
  flex-direction: column;
  padding: 18px 12px 14px;
  border-right: 1px solid var(--line);
  background: rgba(246,245,241,.76);
}
.nav-heading { display: flex; justify-content: space-between; align-items: center; padding: 0 10px 12px; color: var(--muted); font-size: .75rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.category-list { display: grid; gap: 3px; }
.category-button {
  width: 100%;
  min-height: 44px;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
  border-color: transparent;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
  text-align: left;
}
.category-button:hover { border-color: transparent; background: rgba(255,255,255,.6); color: var(--ink); }
.category-button[aria-current="true"] { color: var(--ink); background: #fffdfa; box-shadow: var(--control-shadow); border-color: var(--line); }
.category-icon { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; color: var(--muted); background: var(--surface-soft); font-size: .76rem; font-weight: 700; }
.category-button[aria-current="true"] .category-icon { color: var(--ink); background: var(--surface-soft); }
.category-count { color: var(--faint); font-size: .72rem; font-weight: 500; }
.nav-note { margin-top: auto; padding: 18px 10px 2px; color: var(--muted); }
.nav-note-icon { display: inline-flex; min-height: 24px; align-items: center; margin-bottom: 9px; padding: 0 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); box-shadow: var(--control-shadow); color: var(--ink); font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace; font-size: .68rem; }
.nav-note p { max-width: 150px; font-size: .75rem; line-height: 1.45; }

.generator { min-width: 0; display: grid; grid-template-rows: auto 1fr; }
.generator-toolbar {
  display: grid;
  grid-template-columns: minmax(170px,1.1fr) minmax(140px,.8fr) auto minmax(170px,.8fr);
  align-items: stretch;
  border-bottom: 1px solid rgba(222,219,212,.82);
  background: rgba(246,245,241,.48);
}
.toolbar-field { min-width: 0; padding: 12px; border-right: 1px solid var(--line); }
.toolbar-field label, .eyebrow { display: block; margin-bottom: 7px; color: var(--muted); font-size: .7rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
select { width: 100%; min-height: 42px; padding: 0 38px 0 13px; appearance: none; background-image: linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%); background-position: calc(100% - 17px) 18px,calc(100% - 12px) 18px; background-size: 5px 5px,5px 5px; background-repeat: no-repeat; font-weight: 550; }
.stepper { display: grid; grid-template-columns: 40px minmax(54px,auto) 40px; }
.stepper button { min-height: 42px; padding: 0; border-radius: 0; position: relative; z-index: 1; }
.stepper button:first-child { border-radius: 12px 0 0 12px; }
.stepper button:last-child { border-radius: 0 12px 12px 0; }
.stepper input { width: 100%; min-width: 0; min-height: 42px; border: 0; border-block: 1px solid var(--line); border-radius: 0; padding: 0 4px; background: #fffdfa; box-shadow: none; color: var(--ink); text-align: center; font-weight: 600; appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { margin: 0; appearance: none; }
.stepper input:focus { position: relative; z-index: 2; outline: none; box-shadow: inset 0 0 0 2px rgba(255,90,31,.3); }
.figma-toggle { min-width: 0; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.switch-copy { min-width: 0; display: grid; gap: 3px; }
.switch-copy strong { font-size: .82rem; font-weight: 600; }
.switch-copy small { color: var(--muted); font-size: .7rem; white-space: nowrap; }
.figma-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; width: 42px; height: 24px; flex: 0 0 auto; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface-soft); box-shadow: inset 0 1px 2px rgba(54,52,48,.1); transition: .18s ease; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: white; box-shadow: 0 1px 4px rgba(54,52,48,.25); transition: .18s ease; }
.figma-toggle input:checked + .switch { border-color: var(--ink); background: var(--ink); }
.figma-toggle input:checked + .switch::after { transform: translateX(18px); }
.figma-toggle input:focus-visible + .switch { box-shadow: 0 0 0 4px rgba(255,90,31,.12); }

.output-panel { min-height: 0; display: grid; grid-template-rows: auto 1fr auto; padding: 26px 28px 24px; background: rgba(255,253,250,.54); }
.output-meta, .output-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.output-meta { padding-bottom: 14px; }
.output-meta > div { display: flex; align-items: center; gap: 10px; }
.output-meta .eyebrow { margin: 0; }
.output-count { min-height: 25px; display: inline-flex; align-items: center; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); color: var(--ink); font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace; font-size: .72rem; font-weight: 600; box-shadow: inset 0 1px 0 rgba(255,255,255,.72); }
.quiet-button { min-height: 34px; display: inline-flex; align-items: center; gap: 7px; padding: 0 11px; border-color: transparent; background: transparent; box-shadow: none; color: var(--muted); font-size: .78rem; }
.quiet-button svg, .primary-action svg { width: 15px; height: 15px; }
.quiet-button svg { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.primary-action svg { fill: currentColor; }
textarea {
  width: 100%;
  min-height: 390px;
  resize: none;
  border: 0;
  border-radius: 0;
  outline: none;
  padding: 16px 0 24px;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  font-size: clamp(1.05rem,1.5vw,1.24rem);
  font-weight: 430;
  line-height: 1.66;
}
textarea:focus-visible { border: 0; box-shadow: none; }
.output-actions { padding-top: 18px; border-top: 1px solid var(--line); }
.copy-status { color: var(--muted); font-size: .78rem; }
.copy-status.is-success { color: #377b48; }
.primary-action { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-color: rgba(43,43,41,.9); background: #2b2b29; color: white; }
.primary-action:hover, .primary-action:focus-visible { border-color: #1f1e1b; background: #1f1e1b; color: white; }

.recent-section { margin-top: 34px; }
.section-heading { min-height: 64px; display: flex; align-items: end; justify-content: space-between; gap: 18px; padding: 0 4px 14px; }
.section-heading .eyebrow { margin-bottom: 5px; }
h2 { font-size: 1.15rem; font-weight: 620; }
.text-button { min-height: 32px; padding: 0 8px; border-color: transparent; background: transparent; box-shadow: none; color: var(--muted); font-size: .76rem; }
.recent-list { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.recent-card { min-width: 0; min-height: 148px; display: grid; grid-template-rows: auto 1fr auto; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(249,248,245,.72); box-shadow: var(--control-shadow); }
.recent-card header, .recent-card footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.recent-card footer { justify-content: flex-end; }
.recent-card header { color: var(--muted); font-size: .69rem; font-weight: 650; }
.recent-card p { display: -webkit-box; overflow: hidden; margin: 13px 0; color: var(--ink); font-size: .82rem; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 3; white-space: pre-line; }
.recent-card button { min-height: 30px; padding: 0 9px; font-size: .7rem; }
.empty-history { grid-column: 1/-1; min-height: 120px; display: grid; place-items: center; border: 1px dashed var(--line-strong); border-radius: 14px; color: var(--muted); font-size: .82rem; }

.seo-summary { margin-top: 34px; padding: 24px 26px; border: 1px solid var(--line); border-radius: 16px; background: rgba(249,248,245,.58); }
.seo-summary-intro { display: grid; grid-template-columns: minmax(220px,.7fr) minmax(0,1.3fr); gap: 36px; align-items: start; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.seo-summary-intro h2 { font-size: 1.08rem; }
.seo-summary-intro p { max-width: 720px; color: var(--muted); font-size: .84rem; line-height: 1.58; }
.seo-summary-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 28px; padding-top: 21px; }
.seo-summary-grid h3 { margin: 0 0 7px; font-size: .82rem; font-weight: 620; }
.seo-summary-grid p { margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.52; }

.site-footer {
  width: 100vw;
  margin: 104px calc(50% - 50vw) -28px;
  padding: 80px 30px 40px;
  padding-top: 160px;
  position: relative;
  z-index: 1;
  overflow: hidden;
  background: #0E0D12;
  color: #F8E8D4;
  line-height: 1.6;
}
.site-footer::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 100%;
  height: 78px;
  border-radius: 0 0 48px 48px;
  background: var(--bg);
}
.footer-content {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.footer-left { display: flex; align-items: center; gap: 14px; }
.footer-logo-link { display: block; width: 40px; height: 40px; }
.footer-logo { display: block; width: 40px; height: 40px; }
.footer-left p { font-size: 14.4px; line-height: 1.4; }
.footer-links { display: flex; gap: 100px; }
.footer-link-group { display: flex; flex-direction: column; gap: 10px; }
.footer-link-heading { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; color: #B8AB98; }
.footer-links a { color: #F8E8D4; text-decoration: none; font-size: 14.4px; }
.footer-links a:hover { text-decoration: underline; }
.footer-bottom {
  position: relative;
  z-index: 1;
  border-top: 1px solid rgba(255,255,255,.15);
  margin-top: 60px;
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12.8px;
  color: #B8AB98;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}
.footer-bottom a { color: #B8AB98; text-decoration: none; }
.footer-bottom a:hover { text-decoration: underline; }
.footer-logo-madsen { height: 24px; width: auto; animation: heart-flip 3s ease-in-out infinite; }
@keyframes heart-flip {
  0%, 100% { transform: rotateY(0deg); }
  50% { transform: rotateY(180deg); }
}

@media (max-width: 960px) {
  .workbench { grid-template-columns: 190px minmax(0,1fr); }
  .generator-toolbar { grid-template-columns: 1fr 1fr auto; }
  .figma-toggle { grid-column: 1/-1; border-top: 1px solid var(--line); justify-content: flex-start; }
  .figma-toggle .switch { order: -1; }
  .recent-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 900px) {
  .app-shell { padding: 14px; }
  .topbar {
    min-height: auto;
    margin-bottom: 18px;
    padding: 4px 2px 0;
  }
  .brand { gap: 14px; }
  .brand-mark { width: 58px; height: 58px; }
  h1 { font-size: clamp(1.36rem, 5.4vw, 1.78rem); }
  .top-actions button {
    min-height: 34px;
    padding: 0 13px;
  }
  .brand p { display: none; }
}

@media (max-width: 680px) {
  .workbench { display: block; min-height: 0; overflow: visible; }
  .content-nav { padding: 10px; border-right: 0; border-bottom: 1px solid var(--line); border-radius: 17px 17px 0 0; }
  .nav-heading { display: none; }
  .category-list { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
  .category-list::-webkit-scrollbar { display: none; }
  .category-button { width: auto; min-width: max-content; min-height: 38px; grid-template-columns: 24px auto; padding: 0 9px; }
  .category-count { display: none; }
  .nav-note { display: none; }
  .generator-toolbar { grid-template-columns: minmax(0,1fr) 116px; }
  .type-field { grid-column: 1/-1; border-right: 0; border-bottom: 1px solid var(--line); }
  .tone-field { border-right: 1px solid var(--line); }
  .amount-field { border-right: 0; }
  .stepper { grid-template-columns: 34px minmax(46px,auto) 34px; }
  .toolbar-field { padding: 10px; }
  .figma-toggle { padding: 11px 12px; }
  .output-panel { padding: 20px 16px 16px; }
  textarea { min-height: 330px; font-size: 1rem; line-height: 1.58; }
  .output-actions { align-items: stretch; flex-direction: column; }
  .copy-status { text-align: center; }
  .primary-action { width: 100%; }
  .recent-section { margin-top: 24px; }
  .recent-list { grid-template-columns: 1fr; }
  .seo-summary { margin-top: 24px; padding: 20px 18px; }
  .seo-summary-intro { grid-template-columns: 1fr; gap: 10px; }
  .seo-summary-grid { grid-template-columns: 1fr; gap: 18px; }
  .site-footer { margin-top: 78px; padding: 112px 24px 34px; }
  .site-footer::before { height: 68px; border-radius: 0 0 34px 34px; }
  .footer-content { flex-direction: column; align-items: flex-start; gap: 32px; }
  .footer-left { justify-content: flex-start; }
  .footer-links { gap: 80px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; justify-content: flex-start; margin-top: 42px; gap: 8px; }
}

@media (max-width: 520px) {
  .app-shell { padding: 8px; }
  .topbar {
    gap: 10px;
    margin-bottom: 14px;
    padding: 10px 8px 8px;
  }
  .brand { gap: 10px; }
  .brand-mark { width: 42px; height: 42px; border-radius: 11px; }
  .brand p { display: none; }
  h1 { font-size: 1.3rem; }
  .top-actions button {
    min-height: 34px;
    padding: 0 12px;
  }
  .top-actions .app-switcher-button {
    width: 36px;
    height: 36px;
    min-height: 36px;
    flex-basis: 36px;
    padding: 0;
    border-radius: 999px;
  }
  .app-switcher-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    left: auto;
    bottom: auto;
    width: min(316px, calc(100vw - 24px));
    max-height: min(640px, calc(100dvh - 140px));
    padding: 10px;
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(54,52,48,.28);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
