:root {
  color-scheme: light;
  font-family:
    Inter,
    "Noto Sans JP",
    "Yu Gothic UI",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  color: #20242d;
  background: #ecebe7;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #20242d;
  --muted: #70747c;
  --line: #d9d8d2;
  --paper: #fffefa;
  --soft: #f4f3ef;
  --accent: #5361d9;
  --accent-soft: #eef0ff;
  --coral: #f1705b;
  --shadow: 0 1.2rem 3rem rgb(41 38 29 / 8%);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(rgb(255 255 255 / 42%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 42%) 1px, transparent 1px), #ecebe7;
  background-size: 2.5rem 2.5rem;
}

button,
input,
textarea {
  font: inherit;
}

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

button {
  color: inherit;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 20;
  inset: 0 auto auto 0;
  padding: 0.65rem 0.9rem;
  color: white;
  background: var(--ink);
  transform: translateY(-110%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header,
main,
footer {
  width: min(92rem, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  display: flex;
  min-height: 3.65rem;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.88rem;
  font-weight: 850;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 1.85rem;
  height: 1.85rem;
  place-items: center;
  color: white;
  background:
    linear-gradient(135deg, transparent 42%, rgb(255 255 255 / 28%) 43% 57%, transparent 58%),
    var(--accent);
  border-radius: 0.42rem;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 9%);
}

.brand-mark i {
  font-size: 0.72rem;
  font-style: normal;
}

.site-header nav,
footer nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.site-header nav a,
footer a {
  color: #686c75;
  font-size: 0.72rem;
  text-decoration: none;
}

.site-header nav a:hover,
footer a:hover {
  color: var(--ink);
}

main {
  min-height: calc(100vh - 7rem);
}

.workbench-intro {
  display: grid;
  min-height: 4.8rem;
  align-items: center;
  gap: 0.8rem;
  grid-template-columns: auto 1fr auto;
}

.workbench-intro h1 {
  margin: 0 0 0.18rem;
  font-size: clamp(1.02rem, 1.8vw, 1.25rem);
  letter-spacing: -0.035em;
}

.workbench-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.app-icon {
  display: grid;
  width: 2.55rem;
  height: 2.55rem;
  padding: 0.55rem;
  gap: 0.25rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  box-shadow: 0 0.35rem 1rem rgb(41 38 29 / 6%);
}

.app-icon i {
  display: block;
  background: #d9dce5;
  border-radius: 99px;
}

.app-icon i:first-child {
  width: 66%;
  background: var(--coral);
}

.app-icon i:nth-child(2) {
  width: 100%;
  background: var(--accent);
}

.app-icon i:last-child {
  width: 82%;
}

.local-badge {
  padding: 0.4rem 0.65rem;
  color: #3e6e59;
  background: #e9f4ed;
  border: 1px solid #cce3d4;
  border-radius: 999px;
  font-size: 0.67rem;
  font-weight: 750;
}

.prompt-workbench {
  display: grid;
  overflow: hidden;
  min-height: 42rem;
  background: var(--paper);
  border: 1px solid #d3d2cc;
  border-radius: 0.9rem;
  box-shadow: var(--shadow);
  grid-template-columns: minmax(15rem, 0.78fr) minmax(18rem, 0.94fr) minmax(21rem, 1.28fr);
}

.recipe-panel,
.editor-panel,
.output-panel {
  min-width: 0;
  padding: 1rem;
}

.recipe-panel {
  display: flex;
  gap: 0.75rem;
  flex-direction: column;
  background: #f5f4f0;
  border-right: 1px solid var(--line);
}

.editor-panel {
  overflow-y: auto;
  background: #fbfaf6;
  border-right: 1px solid var(--line);
}

.output-panel {
  display: flex;
  gap: 0.75rem;
  flex-direction: column;
  background: var(--paper);
}

.panel-header,
.saved-panel > header,
.quality-checks > header,
.editor-actions,
.output-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.panel-header {
  min-height: 2.35rem;
}

.panel-header > div > span,
.saved-panel > header span {
  display: block;
  margin-bottom: 0.12rem;
  color: #8b8e96;
  font-size: 0.55rem;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.panel-header h2,
.saved-panel h3 {
  margin: 0;
  font-size: 0.86rem;
  letter-spacing: -0.025em;
}

.panel-header output {
  color: var(--muted);
  font-size: 0.65rem;
}

.search-field {
  display: flex;
  height: 2.25rem;
  align-items: center;
  gap: 0.35rem;
  padding-inline: 0.65rem;
  color: #858992;
  background: white;
  border: 1px solid var(--line);
  border-radius: 0.52rem;
}

.search-field input {
  width: 100%;
  min-width: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 0.74rem;
}

.category-row {
  display: flex;
  gap: 0.3rem;
  overflow-x: auto;
  padding-bottom: 0.1rem;
  scrollbar-width: thin;
}

.category-row button {
  flex: 0 0 auto;
  padding: 0.3rem 0.5rem;
  color: #737780;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.64rem;
}

.category-row button[aria-pressed="true"] {
  color: #3843a7;
  background: var(--accent-soft);
  border-color: #d7dafd;
  font-weight: 800;
}

.recipe-list {
  display: flex;
  overflow-y: auto;
  max-height: 34rem;
  padding-right: 0.2rem;
  gap: 0.35rem;
  flex-direction: column;
  scrollbar-color: #cbc9c1 transparent;
  scrollbar-width: thin;
}

.recipe-card {
  display: grid;
  width: 100%;
  padding: 0.65rem;
  align-items: start;
  gap: 0.55rem;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.58rem;
  cursor: pointer;
  grid-template-columns: 0.3rem minmax(0, 1fr) auto;
}

.recipe-card:hover {
  background: rgb(255 255 255 / 72%);
}

.recipe-card[aria-pressed="true"] {
  background: white;
  border-color: #d6d5cf;
  box-shadow: 0 0.25rem 0.9rem rgb(41 38 29 / 5%);
}

.recipe-card > span:nth-child(2) {
  min-width: 0;
}

.recipe-card > span:last-child {
  padding-top: 0.05rem;
  color: #a4a6ac;
}

.recipe-kind {
  width: 0.28rem;
  height: 1.65rem;
  background: var(--accent);
  border-radius: 99px;
}

.kind-think {
  background: #a46dc1;
}

.kind-research {
  background: #4c9a8e;
}

.kind-learn {
  background: #e09a3e;
}

.kind-build {
  background: var(--coral);
}

.recipe-card strong,
.recipe-card small {
  display: block;
}

.recipe-card strong {
  margin-bottom: 0.18rem;
  font-size: 0.72rem;
}

.recipe-card small {
  overflow: hidden;
  color: #737780;
  font-size: 0.62rem;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-row {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.35rem;
}

.tag-row i {
  padding: 0.12rem 0.3rem;
  color: #7d8087;
  background: #f0efeb;
  border-radius: 0.2rem;
  font-size: 0.52rem;
  font-style: normal;
}

.empty-recipes {
  padding: 1rem;
  color: var(--muted);
  font-size: 0.7rem;
  text-align: center;
}

.editor-heading {
  padding-bottom: 0.65rem;
  border-bottom: 1px solid #e1e0db;
}

#favorite-recipe {
  width: 2rem;
  height: 2rem;
  padding: 0;
  color: #9b792c;
  background: white;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  cursor: pointer;
}

.recipe-description {
  min-height: 2.4rem;
  margin: 0.8rem 0 0.9rem;
  color: #666a73;
  font-size: 0.7rem;
  line-height: 1.65;
}

.variable-fields {
  display: grid;
  gap: 0.7rem;
}

.field {
  display: grid;
  gap: 0.28rem;
  color: #585c65;
  font-size: 0.64rem;
  font-weight: 800;
}

.field input,
.field textarea {
  width: 100%;
  min-width: 0;
  padding: 0.58rem 0.65rem;
  color: var(--ink);
  background: white;
  border: 1px solid #d5d4ce;
  border-radius: 0.46rem;
  outline: none;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.55;
}

.field textarea {
  min-height: 4.7rem;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
#prompt-output:focus,
.search-field:focus-within {
  border-color: #8c95e9;
  box-shadow: 0 0 0 3px rgb(83 97 217 / 10%);
}

.quality-checks {
  margin-top: 0.9rem;
  padding: 0.65rem;
  background: #f0f1fa;
  border: 1px solid #dfe1f2;
  border-radius: 0.55rem;
}

.quality-checks header {
  color: #666b83;
  font-size: 0.57rem;
  font-weight: 750;
}

.quality-checks header span:last-child {
  color: #858aa0;
  font-weight: 500;
}

#quality-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

#quality-checks > span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.26rem 0.38rem;
  color: #555b73;
  background: white;
  border: 1px solid #e0e1eb;
  border-radius: 0.35rem;
  font-size: 0.57rem;
}

#quality-checks i {
  color: #4d9a78;
  font-style: normal;
  font-weight: 900;
}

.editor-actions {
  margin-top: 0.8rem;
}

.secondary-button,
.output-button,
#export-library {
  padding: 0.43rem 0.62rem;
  color: #656971;
  background: white;
  border: 1px solid var(--line);
  border-radius: 0.42rem;
  cursor: pointer;
  font-size: 0.61rem;
}

.editor-actions > span {
  color: #96989e;
  font-size: 0.55rem;
}

kbd {
  padding: 0.1rem 0.25rem;
  background: white;
  border: 1px solid #d4d3cd;
  border-bottom-width: 2px;
  border-radius: 0.22rem;
  font: inherit;
}

.output-heading {
  padding-bottom: 0.05rem;
}

#prompt-output {
  width: 100%;
  min-height: 20.5rem;
  padding: 0.9rem;
  resize: vertical;
  color: #292d36;
  background:
    linear-gradient(90deg, #f2f1eb 1px, transparent 1px) 2.2rem 0 / 1px 100% no-repeat,
    repeating-linear-gradient(white 0 1.72rem, #eeede8 1.72rem calc(1.72rem + 1px));
  border: 1px solid #d6d4cc;
  border-radius: 0.55rem;
  outline: none;
  font-family: "BIZ UDPGothic", "Yu Gothic UI", sans-serif;
  font-size: 0.72rem;
  line-height: 1.72rem;
}

.output-actions {
  justify-content: flex-start;
}

.copy-button {
  display: inline-flex;
  min-width: 8.5rem;
  min-height: 2.45rem;
  padding: 0.55rem 0.9rem;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: white;
  background: var(--accent);
  border: 1px solid #4652c7;
  border-radius: 0.48rem;
  box-shadow: 0 0.35rem 0.8rem rgb(83 97 217 / 18%);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 850;
}

.output-button {
  min-height: 2.45rem;
  padding-inline: 0.85rem;
}

button:hover {
  filter: brightness(0.98);
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgb(83 97 217 / 25%);
  outline-offset: 2px;
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.saved-panel {
  min-height: 8rem;
  margin-top: 0.2rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e3e1db;
}

.saved-panel > header {
  margin-bottom: 0.5rem;
}

.saved-list {
  display: grid;
  max-height: 13rem;
  gap: 0.4rem;
  overflow-y: auto;
  scrollbar-width: thin;
}

.empty-saved {
  display: flex;
  min-height: 5rem;
  padding: 0.75rem;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #8a8d94;
  background: #f8f7f3;
  border: 1px dashed #d4d2ca;
  border-radius: 0.5rem;
}

.empty-saved p {
  max-width: 15rem;
  margin: 0;
  font-size: 0.62rem;
  line-height: 1.5;
}

.saved-item {
  display: grid;
  overflow: hidden;
  background: #f8f7f3;
  border: 1px solid #deddd7;
  border-radius: 0.46rem;
  grid-template-columns: minmax(0, 1fr) auto;
}

.saved-restore,
.saved-delete {
  background: transparent;
  border: 0;
  cursor: pointer;
}

.saved-restore {
  display: grid;
  min-width: 0;
  padding: 0.55rem 0.65rem;
  gap: 0.13rem;
  text-align: left;
}

.saved-restore strong,
.saved-restore span,
.saved-restore small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-restore strong {
  font-size: 0.64rem;
}

.saved-restore span,
.saved-restore small {
  color: #777a82;
  font-size: 0.55rem;
}

.saved-delete {
  width: 2.2rem;
  color: #989aa0;
  border-left: 1px solid #deddd7;
}

.output-note {
  margin: auto 0 0;
  color: #898c93;
  font-size: 0.56rem;
  line-height: 1.5;
}

footer {
  display: flex;
  min-height: 4rem;
  align-items: center;
  justify-content: space-between;
  color: #85878d;
  font-size: 0.65rem;
}

.prose {
  width: min(42rem, 100%);
  padding: clamp(1.2rem, 4vw, 2.5rem);
  margin: 2rem auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  box-shadow: var(--shadow);
}

.prose-kicker {
  margin: 0 0 0.4rem;
  color: var(--accent);
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.15em;
}

.prose h1,
.not-found h1 {
  margin: 0 0 1.5rem;
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  letter-spacing: -0.03em;
}

.prose h2 {
  margin: 1.5rem 0 0.4rem;
  font-size: 0.82rem;
}

.prose p {
  margin: 0;
  color: #60646c;
  font-size: 0.75rem;
  line-height: 1.85;
}

.not-found {
  display: grid;
  min-height: 24rem;
  place-content: center;
  text-align: center;
}

.not-found > span {
  margin-bottom: 0.8rem;
  color: var(--coral);
  font-size: 1.5rem;
}

.not-found p {
  margin: -0.8rem 0 1.2rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.not-found a {
  justify-self: center;
  padding: 0.55rem 0.75rem;
  color: white;
  background: var(--ink);
  border-radius: 0.45rem;
  font-size: 0.7rem;
  text-decoration: none;
}

@media (max-width: 68rem) {
  .prompt-workbench {
    grid-template-columns: minmax(13rem, 0.75fr) minmax(17rem, 1fr) minmax(19rem, 1.2fr);
  }

  .recipe-panel,
  .editor-panel,
  .output-panel {
    padding: 0.8rem;
  }

  .recipe-card small,
  .tag-row {
    display: none;
  }
}

@media (max-width: 52rem) {
  .prompt-workbench {
    overflow: visible;
    grid-template-columns: 1fr 1fr;
  }

  .recipe-panel {
    grid-column: 1 / -1;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .recipe-list {
    display: grid;
    max-height: 13rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .editor-panel {
    border-right: 1px solid var(--line);
  }

  .recipe-card small,
  .tag-row {
    display: block;
  }

  .tag-row {
    display: flex;
  }
}

@media (max-width: 38rem) {
  .site-header,
  main,
  footer {
    width: min(100% - 1rem, 92rem);
  }

  .site-header {
    min-height: 3.25rem;
  }

  .site-header nav a:first-child {
    display: none;
  }

  .workbench-intro {
    min-height: 4.2rem;
    grid-template-columns: auto 1fr;
  }

  .workbench-intro p {
    display: none;
  }

  .local-badge {
    display: none;
  }

  .prompt-workbench {
    border-radius: 0.65rem;
    grid-template-columns: 1fr;
  }

  .recipe-panel,
  .editor-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .recipe-list {
    display: flex;
    max-height: 15rem;
  }

  .recipe-card small,
  .tag-row {
    display: block;
  }

  .tag-row {
    display: flex;
  }

  #prompt-output {
    min-height: 18rem;
  }

  .editor-actions > span {
    display: none;
  }

  .copy-button {
    flex: 1;
  }

  footer {
    align-items: flex-start;
    padding-block: 1.2rem;
    gap: 0.8rem;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
