:root {
  color-scheme: light;
  font-family:
    Inter,
    "Noto Sans JP",
    "Yu Gothic UI",
    system-ui,
    -apple-system,
    sans-serif;
  color: #15231f;
  background: #e7ebe7;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #15231f;
  --muted: #66736e;
  --line: rgb(21 35 31 / 12%);
  --paper: #fbfaf6;
  --mint: #bfffe1;
  --green: #155c45;
  --coral: #ff765e;
  --yellow: #f7c955;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 90% 2%, rgb(191 255 225 / 72%), transparent 28rem),
    linear-gradient(180deg, #f5f6f2, #e8ebe7);
}

a {
  color: inherit;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

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

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

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

.site-header,
.site-header nav,
footer,
.studio-heading,
.section-heading,
.result-toolbar,
.browser-chrome,
.primary-actions,
.share-actions,
.saved-heading {
  display: flex;
  align-items: center;
}

.site-header {
  min-height: 4rem;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.site-header nav {
  gap: 1rem;
  font-size: 0.78rem;
}

.brand {
  font-weight: 900;
  letter-spacing: -0.04em;
  text-decoration: none;
}

.brand::before {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  margin-right: 0.55rem;
  background: var(--coral);
  border: 3px solid var(--ink);
  border-radius: 0.15rem;
  content: "";
  transform: rotate(12deg);
}

.nav-cta {
  min-height: 2.35rem;
  padding: 0.55rem 0.8rem;
  color: white;
  background: var(--ink);
  border-radius: 0.55rem;
  font-weight: 850;
  text-decoration: none;
}

.search-studio {
  padding-block: 1.7rem 4rem;
}

.studio-heading {
  min-height: 5.5rem;
  padding: 0 0.25rem 1.2rem;
  justify-content: space-between;
  gap: 2rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--green);
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1,
h2,
p {
  max-width: 48rem;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.035em;
}

h1 {
  font-size: clamp(1.55rem, 2.3vw, 2.15rem);
  line-height: 1.15;
}

h2 {
  font-size: 0.92rem;
}

.local-note {
  display: inline-flex;
  margin: 0;
  gap: 0.45rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.local-note span {
  color: var(--green);
  font-size: 0.62rem;
}

.studio-grid {
  display: grid;
  overflow: hidden;
  min-height: 43rem;
  background: rgb(255 255 255 / 84%);
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  box-shadow: 0 1.8rem 5rem rgb(43 59 53 / 12%);
  grid-template-columns: minmax(22rem, 0.9fr) minmax(0, 1.1fr);
}

.query-panel {
  min-width: 0;
  padding: clamp(1rem, 2.5vw, 1.8rem);
  background: var(--paper);
  border-right: 1px solid var(--line);
}

.panel-section {
  padding-block: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.panel-section:first-child {
  padding-top: 0;
}

.compact-section {
  border-bottom: 0;
}

.section-heading {
  margin-bottom: 1rem;
  gap: 0.65rem;
}

.section-heading > span {
  display: grid;
  width: 1.65rem;
  height: 1.65rem;
  place-items: center;
  color: white;
  background: var(--green);
  border-radius: 50%;
  font-size: 0.62rem;
  font-weight: 900;
}

.preset-row,
.mode-picker,
.condition-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.preset-row button {
  display: inline-flex;
  min-height: 2.75rem;
  padding: 0.55rem 0.8rem;
  gap: 0.5rem;
  align-items: center;
  background: white;
  border: 1px solid #cbd4cf;
  border-radius: 0.65rem;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 800;
}

.preset-row button:hover {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgb(21 92 69 / 8%);
}

.preset-row button span {
  display: grid;
  width: 1.55rem;
  height: 1.55rem;
  place-items: center;
  background: #e8f6ef;
  border-radius: 0.4rem;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.field {
  display: grid;
  gap: 0.42rem;
  color: #48544f;
  font-size: 0.72rem;
  font-weight: 850;
}

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

.field small {
  color: #818a86;
  font-size: 0.64rem;
  font-weight: 650;
}

textarea {
  width: 100%;
  min-height: 4.25rem;
  padding: 0.7rem 0.75rem;
  resize: vertical;
  color: var(--ink);
  background: white;
  border: 1px solid #cbd4cf;
  border-radius: 0.6rem;
  line-height: 1.55;
}

textarea::placeholder {
  color: #9ca5a1;
}

fieldset {
  padding: 0;
  border: 0;
}

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

.mode-picker label {
  position: relative;
}

.mode-picker input {
  position: absolute;
  opacity: 0;
}

.mode-picker span {
  display: inline-flex;
  min-height: 2.4rem;
  padding-inline: 0.9rem;
  align-items: center;
  background: white;
  border: 1px solid #cbd4cf;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
}

.mode-picker input:checked + span {
  color: white;
  background: var(--ink);
  border-color: var(--ink);
}

.primary-actions {
  margin-top: 1.2rem;
  gap: 0.65rem;
}

.button {
  display: inline-flex;
  min-height: 2.9rem;
  padding-inline: 1rem;
  gap: 0.45rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ink);
  border-radius: 0.65rem;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 900;
}

.button.primary {
  flex: 1;
  color: white;
  background: var(--ink);
}

.button.primary:hover {
  background: var(--green);
  border-color: var(--green);
}

.button.secondary {
  background: white;
}

.button.tertiary {
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}

.button.tertiary:hover {
  color: var(--ink);
  background: rgb(21 35 31 / 5%);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.action-status {
  min-height: 1.3rem;
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.5;
}

.action-status[data-kind="error"] {
  color: #a43a2b;
}

.action-status[data-kind="success"] {
  color: var(--green);
}

.result-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  background:
    linear-gradient(rgb(255 255 255 / 28%), rgb(255 255 255 / 28%)),
    repeating-linear-gradient(0deg, transparent, transparent 31px, rgb(21 35 31 / 3%) 32px), #e9efea;
}

.result-toolbar {
  min-height: 3.25rem;
  padding-inline: clamp(1rem, 2.5vw, 1.7rem);
  justify-content: space-between;
  background: rgb(255 255 255 / 55%);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.result-toolbar > span:first-child {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
}

.result-toolbar i {
  width: 0.48rem;
  height: 0.48rem;
  background: var(--coral);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgb(255 118 94 / 15%);
}

.query-preview {
  padding: clamp(1rem, 3vw, 2rem);
}

.browser-chrome {
  min-height: 2.35rem;
  padding-inline: 0.8rem;
  gap: 0.35rem;
  background: #eef1ee;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 0.85rem 0.85rem 0 0;
}

.browser-chrome > span {
  width: 0.48rem;
  height: 0.48rem;
  background: #c5cdc8;
  border-radius: 50%;
}

.browser-chrome > span:first-child {
  background: var(--coral);
}

.browser-chrome p {
  overflow: hidden;
  min-width: 0;
  margin: 0 0 0 0.4rem;
  padding: 0.28rem 0.65rem;
  flex: 1;
  color: #78817d;
  background: white;
  border-radius: 0.35rem;
  font-size: 0.62rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.query-card {
  min-height: 14rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  background: white;
  border: 1px solid var(--line);
  border-radius: 0 0 0.85rem 0.85rem;
}

.query-label {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0.08em;
}

#query-preview {
  display: block;
  overflow-wrap: anywhere;
  min-height: 4rem;
  color: var(--ink);
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: clamp(0.78rem, 1.7vw, 1rem);
  font-weight: 720;
  line-height: 1.7;
}

.condition-chips {
  margin-top: 1rem;
}

.condition-chip {
  display: inline-flex;
  min-height: 1.8rem;
  padding-inline: 0.65rem;
  align-items: center;
  color: #275646;
  background: #e9f8f0;
  border: 1px solid #c4e6d6;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 800;
}

.condition-chip[data-kind="exclude"] {
  color: #8f3b2e;
  background: #fff0ed;
  border-color: #f4c9c1;
}

.condition-chip[data-kind="any"] {
  color: #725716;
  background: #fff6d9;
  border-color: #eedb9d;
}

.result-note {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.6;
}

.share-actions {
  padding: 0 clamp(1rem, 3vw, 2rem) 1.6rem;
  gap: 0.55rem;
}

.icon-button {
  display: inline-flex;
  min-height: 2.5rem;
  padding-inline: 0.72rem;
  gap: 0.4rem;
  align-items: center;
  background: rgb(255 255 255 / 72%);
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 800;
}

.icon-button:hover {
  background: white;
  border-color: #90a198;
}

.saved-section {
  margin-top: auto;
  padding: clamp(1rem, 3vw, 1.7rem);
  background: rgb(21 35 31 / 94%);
  color: white;
}

.saved-heading {
  margin-bottom: 0.9rem;
  justify-content: space-between;
}

.saved-heading .eyebrow {
  color: var(--mint);
}

.saved-heading > span {
  color: rgb(255 255 255 / 52%);
  font-size: 0.64rem;
  font-weight: 800;
}

.saved-list {
  display: grid;
  max-height: 12rem;
  gap: 0.5rem;
  overflow-y: auto;
}

.empty-state {
  margin: 0;
  color: rgb(255 255 255 / 58%);
  font-size: 0.7rem;
  line-height: 1.6;
}

.saved-item {
  display: grid;
  padding: 0.65rem 0.75rem;
  background: rgb(255 255 255 / 7%);
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 0.55rem;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
}

.saved-item button {
  color: white;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.saved-item .saved-load {
  min-width: 0;
  padding: 0;
  text-align: left;
}

.saved-item strong,
.saved-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-item strong {
  font-size: 0.72rem;
}

.saved-item small {
  margin-top: 0.22rem;
  color: rgb(255 255 255 / 50%);
  font-size: 0.61rem;
}

.saved-delete {
  width: 1.8rem;
  height: 1.8rem;
  color: rgb(255 255 255 / 58%) !important;
  border-radius: 50%;
}

.saved-delete:hover {
  color: white !important;
  background: rgb(255 255 255 / 10%);
}

.affiliation-note {
  margin: 0.85rem 0 0;
  color: #7a8580;
  font-size: 0.62rem;
  line-height: 1.6;
}

.prose {
  margin-block: 3rem 6rem;
  padding: clamp(1.5rem, 5vw, 3rem);
  background: rgb(255 255 255 / 78%);
  border: 1px solid var(--line);
  border-radius: 1rem;
  box-shadow: 0 1.5rem 4rem rgb(43 59 53 / 8%);
}

.prose > section {
  max-width: 48rem;
  margin-top: 2rem;
}

.prose h2 {
  font-size: 1rem;
}

.prose p {
  margin-bottom: 0;
  color: #53615b;
  font-size: 0.92rem;
  line-height: 1.85;
}

footer {
  min-height: 5rem;
  justify-content: space-between;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 0.72rem;
}

footer nav {
  display: flex;
  gap: 1rem;
}

button:focus-visible,
a:focus-visible,
textarea:focus-visible,
.mode-picker input:focus-visible + span {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

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

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

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

  .site-header nav > a:not(.nav-cta) {
    display: none;
  }

  .search-studio {
    padding-top: 1rem;
  }

  .studio-heading {
    min-height: auto;
    padding: 0.75rem 0.4rem 1rem;
    align-items: flex-start;
    flex-direction: column;
    gap: 0.75rem;
  }

  .studio-grid {
    border-radius: 0.9rem;
  }

  .query-panel,
  .query-preview,
  .saved-section {
    padding: 1rem;
  }

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

  .field.wide {
    grid-column: auto;
  }

  .primary-actions,
  .share-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .share-actions {
    padding: 0 1rem 1rem;
  }

  .button,
  .icon-button {
    width: 100%;
  }

  .query-card {
    min-height: 12rem;
  }

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

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