:root {
  color-scheme: light;
  --ink: #23211f;
  --muted: #6d6760;
  --paper: #f7f3ea;
  --wall: #ebe4d6;
  --line: #d8cec0;
  --accent: #8f3f34;
  --accent-dark: #6f2d25;
  --focus: #166c78;
  --shadow: 0 18px 50px rgba(45, 34, 23, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(180deg, #fcfaf5 0%, var(--paper) 100%);
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.screen {
  display: none;
}

.screen-active {
  display: block;
}

.screen-header {
  margin-bottom: 24px;
}

.screen-header.compact {
  margin-bottom: 18px;
}

.kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.lead {
  max-width: 42rem;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.8;
}

.action-bar,
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.selection-summary,
.selection-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.selection-summary {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px 0;
  color: var(--muted);
}

.selection-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.title-idea {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 253, 248, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.title-idea span {
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 700;
}

.title-idea strong {
  min-width: 0;
  color: var(--ink);
  font-size: 0.98rem;
  overflow-wrap: anywhere;
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.work-card {
  display: grid;
  grid-template-rows: auto minmax(46px, auto);
  gap: 12px;
  min-width: 0;
  padding: 12px;
  color: inherit;
  text-align: left;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(58, 45, 31, 0.08);
}

.work-card[aria-pressed="true"] {
  border-color: var(--focus);
  outline: 3px solid rgba(22, 108, 120, 0.22);
}

.art-thumb {
  display: grid;
  place-items: center;
  position: relative;
  aspect-ratio: 1 / 1;
  padding: 10px;
  background: #ede8dc;
  overflow: hidden;
}

.art-thumb img {
  display: block;
  position: absolute;
  inset: 10px;
  width: calc(100% - 20px);
  height: calc(100% - 20px);
  object-fit: contain;
}

.preview-item img,
.frame-image img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.work-meta {
  display: grid;
  gap: 4px;
  align-content: start;
  min-height: 46px;
  text-align: center;
}

.work-meta strong,
.preview-item figcaption,
.exhibition-frame strong {
  overflow-wrap: anywhere;
}

.work-meta span,
.exhibition-frame span {
  color: var(--muted);
  font-size: 0.9rem;
}

.primary-button,
.secondary-button,
.text-button,
.suggestion-chip {
  min-height: 44px;
  border-radius: 8px;
}

.primary-button {
  padding: 0 20px;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  font-weight: 700;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.primary-button:disabled {
  cursor: not-allowed;
  background: #c8beb1;
  border-color: #c8beb1;
}

.secondary-button,
.text-button,
.suggestion-chip {
  color: var(--ink);
  background: #fffdf8;
  border: 1px solid var(--line);
}

.secondary-button {
  padding: 0 18px;
}

.text-button {
  padding: 0 14px;
}

.action-bar {
  margin-top: 22px;
  justify-content: flex-end;
}

.selected-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.preview-item {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 10px;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.preview-item img {
  justify-self: center;
  height: 120px;
  object-fit: contain;
}

.preview-item figcaption {
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
}

.title-form {
  display: grid;
  gap: 14px;
  max-width: 720px;
}

.title-form label {
  font-weight: 700;
}

.title-form input {
  width: 100%;
  min-height: 58px;
  padding: 0 16px;
  color: var(--ink);
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1.1rem;
}

.suggestion-panel {
  display: grid;
  gap: 10px;
}

.suggestion-panel p {
  margin: 0;
  color: var(--muted);
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.suggestion-chip {
  padding: 0 12px;
}

.museum-wall {
  min-height: calc(100vh - 128px);
  padding: clamp(24px, 5vw, 48px);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0)),
    var(--wall);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.exhibition-header {
  text-align: center;
  margin-bottom: clamp(24px, 4vw, 42px);
}

.exhibition-header h1 {
  font-size: clamp(2rem, 5vw, 4.5rem);
}

.exhibition-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(14px, 2.4vw, 28px);
  align-items: start;
}

.exhibition-frame {
  display: grid;
  gap: 12px;
  margin: 0;
  text-align: center;
}

.frame-image {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 16px;
  background: #fffdf8;
  border: 10px solid #6b4b35;
  outline: 1px solid rgba(53, 39, 27, 0.3);
  box-shadow: 0 14px 30px rgba(58, 45, 31, 0.18);
}

.exhibition-frame figcaption {
  display: grid;
  gap: 3px;
  justify-self: center;
  min-width: min(100%, 180px);
  min-height: 10px;
  padding: 8px 12px;
  background: #fffdf8;
  border: 1px solid rgba(35, 33, 31, 0.14);
  box-shadow: 0 6px 14px rgba(58, 45, 31, 0.08);
  font-size: 0.92rem;
}

@media (max-width: 860px) {
  .work-grid,
  .exhibition-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .selected-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .frame-image {
    min-height: 190px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1120px);
    padding: 18px 0;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .selection-summary,
  .selection-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .selection-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
  }

  .title-idea {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .work-grid {
    gap: 10px;
  }

  .work-card {
    padding: 8px;
  }

  .museum-wall {
    min-height: auto;
    padding: 20px 12px;
  }

  .frame-image {
    min-height: 150px;
    border-width: 7px;
  }

  .primary-button,
  .secondary-button,
  .text-button {
    width: 100%;
  }
}
