:root {
  --c-base: #ffffff;
  --c-surface: #fafafa;
  --c-main: #333333;
  --c-accent: #0f766e;
  --c-accent-soft: #d9f2ed;
  --c-text: #333333;
  --c-text-muted: #686f78;
  --c-border: #ececec;
  --c-shadow: rgba(51, 51, 51, 0.05);
  --font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-size-body: clamp(0.9375rem, 0.875rem + 0.25vw, 1.0625rem);
  --font-size-sm: 0.875rem;
  --font-size-h1: clamp(2rem, 1.58rem + 1.8vw, 3.1rem);
  --font-size-h2: clamp(1.4rem, 1.1rem + 1vw, 2rem);
  --line-height: 1.6;
  --container-max: 1180px;
  --container-padding: clamp(1rem, 4vw, 2rem);
  --radius: 0;
  --site-header-height: 68px;
  --site-footer-height: 57px;
  --category-sticky-top: var(--site-header-height);
  --transition: 160ms ease;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--c-base);
  color: var(--c-text);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  line-height: var(--line-height);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 32px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(20px);
  transition: transform var(--transition);
  will-change: transform;
}

body.is-header-hidden {
  --category-sticky-top: 0px;
}

body.is-header-hidden .site-header {
  transform: translateY(-100%);
}

body.is-header-hidden .category-strip {
  pointer-events: none;
  transform: translateY(calc(-100% - 28px));
}

.category-strip,
.gallery-section {
  max-width: var(--container-max);
}

.header-inner {
  position: relative;
  display: flex;
  align-items: center;
  height: 68px;
  max-width: 1440px;
  margin: 0 auto;
  gap: 20px;
}

.header-logo img {
  display: block;
  height: 28px;
}

.header-tools {
  position: absolute;
  left: 50%;
  width: min(589px, calc(100% - 420px));
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 1 auto;
  gap: 12px;
  min-width: 240px;
  max-width: 589px;
  transform: translateX(-50%);
}

.header-tools .search-box {
  flex: 1 1 266px;
  min-width: 180px;
}

.header-tools .result-count {
  flex: 0 0 auto;
  white-space: nowrap;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-left: auto;
  flex-shrink: 0;
}

.header-nav a {
  color: var(--c-text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color var(--transition);
}

.header-nav a:hover {
  color: var(--c-text);
}

main {
  padding-bottom: calc(var(--site-footer-height) + 72px);
}

.site-footer {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 80;
  border-top: 1px solid var(--c-border);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: var(--container-max);
  margin: 0 auto;
  min-height: var(--site-footer-height);
  padding: 10px var(--container-padding);
  color: var(--c-text-muted);
  font-size: 0.78rem;
}

.footer-inner p {
  margin: 0;
}

.footer-inner nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-inner a {
  color: var(--c-text-muted);
}

.footer-inner a:hover {
  color: var(--c-text);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--c-accent);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 13em;
  margin-bottom: 18px;
  font-size: var(--font-size-h1);
  line-height: 1.18;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: var(--font-size-h2);
  line-height: 1.28;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.search-box {
  position: relative;
  display: block;
}

.search-box input {
  min-height: 44px;
  width: 100%;
  padding: 0 14px 0 42px;
  border: 1px solid #e2e5e9;
  border-radius: 0;
  background: transparent;
  color: var(--c-text);
  outline: none;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: #b8bec6;
  pointer-events: none;
  transform: translateY(-50%);
}

.search-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.search-box input:focus {
  box-shadow: 0 0 0 3px var(--c-accent-soft);
}

.search-box input::placeholder {
  color: #cdd2d8;
  opacity: 1;
}

.result-count {
  color: #9aa3ad;
  font-size: 0.78rem;
}

.category-strip {
  position: sticky;
  top: var(--category-sticky-top);
  z-index: 90;
  display: flex;
  gap: 8px;
  width: calc(100% - (var(--container-padding) * 2));
  margin: 28px auto 34px;
  padding: 10px 0;
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
  transition:
    top var(--transition),
    transform var(--transition);
  will-change: transform;
}

.category-chip {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 0;
  background: var(--c-surface);
  color: var(--c-text-muted);
  font-size: var(--font-size-sm);
}

.category-chip.is-active {
  border-color: var(--c-main);
  background: var(--c-main);
  color: white;
}

.gallery-section {
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 28px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: var(--c-surface);
  color: var(--c-text-muted);
}

.prompt-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 0;
  border-radius: var(--radius);
  background: white;
  text-align: left;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.prompt-card:hover,
.prompt-card:focus-within {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px var(--c-shadow);
}

.prompt-open {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.prompt-open:focus-visible,
.card-copy-button:focus-visible {
  outline: 3px solid var(--c-accent-soft);
  outline-offset: 2px;
}

.prompt-thumb {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  background: #ffffff;
}

.prompt-thumb img,
.modal-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #ffffff;
}

.prompt-card.has-no-image .prompt-thumb,
.modal-visual.has-no-image {
  background: #d8dde3;
}

.no-image-label {
  display: grid;
  place-items: center;
  padding: 0;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
}

.prompt-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: 1 1 auto;
  padding: 14px;
}

.prompt-meta {
  min-width: 0;
  color: #9aa3ad;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.3;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 4px 8px;
  border-radius: 0;
  background: var(--c-surface);
  color: var(--c-text-muted);
  font-size: 0.76rem;
}

.card-copy-button {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #c3c8cf;
}

.card-copy-button:hover {
  background: transparent;
  color: #9aa3ad;
}

.card-copy-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.card-copy-button.is-copied {
  background: transparent;
  color: var(--c-main);
}

.modal[hidden] {
  display: none;
}

.terms-consent-modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: end center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(51, 51, 51, 0.46);
}

.terms-consent-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 16px;
}

.terms-consent-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(51, 51, 51, 0.58);
}

.terms-consent-panel {
  position: relative;
  width: min(640px, 100%);
  max-height: min(760px, 92vh);
  overflow: auto;
  padding: 28px;
  border: 1px solid var(--c-border);
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(51, 51, 51, 0.25);
}

.terms-consent-eyebrow {
  margin: 0 0 8px;
  color: var(--c-accent);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.terms-consent-panel h2 {
  margin-bottom: 12px;
}

.terms-consent-panel p,
.terms-consent-list {
  color: var(--c-text);
  font-size: 0.94rem;
}

.terms-consent-list {
  margin: 0 0 18px;
  padding-left: 1.2em;
}

.terms-consent-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-bottom: 14px;
  color: var(--c-accent);
  font-weight: 700;
}

.terms-consent-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 18px;
  color: var(--c-text);
  font-size: 0.92rem;
}

.terms-consent-check input {
  width: 20px;
  height: 20px;
  margin-top: 3px;
  accent-color: var(--c-main);
}

.terms-consent-button {
  width: 100%;
  min-height: 48px;
  border: 0;
  background: #333333;
  color: #ffffff;
  font-weight: 700;
}

.terms-consent-button:disabled {
  cursor: not-allowed;
  background: #c8cdd3;
}

body.is-terms-consent-open {
  overflow: hidden;
}

.modal-panel {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(940px, 100%);
  height: min(820px, 92vh);
  border-radius: 0;
  background: white;
  box-shadow: 0 24px 80px rgba(51, 51, 51, 0.25);
}

.terms-page {
  padding: 60px var(--container-padding) calc(var(--site-footer-height) + 88px);
  background:
    linear-gradient(180deg, #fafafa 0, #ffffff 180px),
    #ffffff;
}

.terms-document {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 clamp(0px, 2vw, 28px);
}

.terms-document h1 {
  max-width: none;
  margin-bottom: 20px;
}

.terms-lead {
  max-width: 760px;
  margin-bottom: 42px;
  color: var(--c-text-muted);
  font-size: 1.02rem;
  line-height: 1.9;
}

.terms-document section {
  display: grid;
  grid-template-columns: minmax(180px, 0.34fr) minmax(0, 1fr);
  gap: clamp(18px, 4vw, 44px);
  padding: 30px 0;
  border-top: 1px solid var(--c-border);
}

.terms-document section h2 {
  margin-bottom: 0;
  font-size: 1.2rem;
  line-height: 1.45;
}

.terms-document p,
.terms-document li {
  color: var(--c-text);
  line-height: 1.9;
}

.terms-document section p:first-of-type {
  margin-top: -0.2em;
}

.terms-document section p:last-child {
  margin-bottom: 0;
}

.terms-document ul {
  margin: 0;
  padding-left: 1.3em;
}

.terms-updated {
  margin-top: 28px;
  color: var(--c-text-muted);
  font-size: 0.9rem;
}

.close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
}

.modal-nav-button {
  position: absolute;
  top: 50%;
  z-index: 2;
  background: rgba(255, 255, 255, 0.95);
  font-size: 2rem;
  line-height: 1;
  transform: translateY(-50%);
}

.modal-nav-button span {
  display: block;
  transform: translateY(-2px);
}

.modal-nav-prev {
  left: max(16px, calc(50% - 604px));
}

.modal-nav-next {
  right: max(16px, calc(50% - 604px));
}

.modal-nav-button:disabled {
  cursor: default;
  opacity: 0.35;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--c-border);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.92);
  color: var(--c-text);
  font-size: 1.35rem;
}

.modal-visual {
  overflow: hidden;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  max-height: 38vh;
  min-height: 0;
  background: #ffffff;
}

.modal-content {
  display: flex;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  padding: 22px;
}

.modal-category {
  margin-bottom: 6px;
  color: #333333;
  font-size: var(--font-size-sm);
  font-weight: 700;
}

#modalTitle {
  font-size: clamp(1.12rem, 0.88rem + 0.8vw, 1.6rem);
}

pre {
  flex: 1 1 auto;
  overflow: auto;
  min-height: 0;
  white-space: pre-wrap;
  margin: 18px 0;
  padding: 16px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: #fbfbfa;
  color: #333333;
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 300;
  font-variation-settings: "wght" 300;
  line-height: 1.65;
}

.copy-button {
  flex: 0 0 auto;
  min-height: 44px;
  width: 100%;
  padding: 0 18px;
  border: 0;
  border-radius: 0;
  background: #333333;
  color: white;
  font-weight: 700;
}

.copy-button.is-copied {
  background: var(--c-main);
}

@media (min-width: 768px) {
  .modal {
    place-items: center;
  }

  .modal-panel {
    grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
    grid-template-rows: minmax(0, 1fr);
    width: min(1080px, calc(100vw - 32px));
  }

  .modal-visual {
    width: 100%;
    height: 100%;
    max-height: none;
    aspect-ratio: auto;
    padding: 18px;
    border-right: 1px solid var(--c-border);
  }

  .modal-content .tag-row {
    flex: 0 0 auto;
  }

  #modalTitle {
    flex: 0 0 auto;
  }

  #modalPrompt {
    flex: 1 1 auto;
  }
}

@media (max-width: 900px) {
  .site-header {
    padding: 10px 20px;
  }

  .header-inner {
    flex-wrap: wrap;
    height: auto;
    min-height: 62px;
    gap: 10px 16px;
  }

  .header-tools {
    position: static;
    left: auto;
    order: 3;
    flex: 0 0 95%;
    width: 95%;
    max-width: none;
    min-width: 0;
    margin: 0 auto;
    transform: none;
  }

  .header-nav {
    margin-left: auto;
  }

  .category-strip {
    margin-top: 22px;
  }

  body.is-header-hidden .category-strip {
    transform: translateY(calc(-100% - 22px));
  }
}

@media (max-width: 520px) {
  .site-header {
    padding: 10px 16px;
  }

  .header-inner {
    gap: 10px 12px;
  }

  .header-nav {
    gap: 12px;
  }

  .header-nav a {
    font-size: 0.76rem;
  }

  .header-logo img {
    height: 24px;
  }

  .header-tools {
    gap: 8px;
    min-width: 0;
  }

  .search-box input {
    min-height: 38px;
    padding-left: 38px;
    font-size: 0.86rem;
  }

  .search-icon {
    left: 12px;
  }

  .header-tools .result-count {
    font-size: 0.72rem;
  }

  .modal {
    padding: 10px;
  }

  .modal-panel {
    height: min(720px, 94vh);
  }

  .modal-visual {
    aspect-ratio: 16 / 9;
    max-height: 34vh;
  }

  .modal-content {
    padding: 16px;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .terms-page {
    padding-top: 36px;
  }

  .terms-document section {
    display: block;
    padding: 26px 0;
  }

  .terms-document section h2 {
    margin-bottom: 12px;
  }

  .terms-consent-panel {
    padding: 22px;
  }

  .modal-nav-button {
    top: auto;
    bottom: 10px;
    font-size: 1.7rem;
    transform: none;
  }

  .modal-nav-prev {
    left: 10px;
  }

  .modal-nav-next {
    right: 10px;
  }
}
