:root {
  color-scheme: light;
  --bg: #f4efe4;
  --panel: rgba(255, 252, 245, 0.95);
  --panel-strong: #ece3d1;
  --text: #3f3527;
  --text-soft: rgb(119, 100, 74);
  --muted: #7d715f;
  --accent: #b8860b;
  --accent-strong: #8b6914;
  --border: rgba(80, 60, 30, 0.15);
  --shadow: 0 12px 32px rgba(0,0,0,0.08);
  --menu-bg: #ece3d1;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Hiragino Sans", "Yu Gothic UI", sans-serif;
  background: radial-gradient(circle at top, #fff9ef 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
}


.page-shell {
  min-height: 100vh;
  padding: 1rem 1rem 3rem;
}

.title-image {
  text-align: center;
}

.title-image img {
  display: inline-block;
  width: min(220px, 40vw);
  height: auto;
}

.top-bar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 0.6rem 0.2rem 1rem;
}

.menu-toggle {
  width: 44px;
  height: 44px;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  gap: 5px;

  background: transparent;
  border: none;

  box-shadow: none;
  cursor: pointer;

  transition: background-color 0.2s ease;
}

.menu-toggle span {
  width: 20px;
  height: 2px;

  border-radius: 999px;

  background: var(--text);

  transition: transform 0.2s ease;
}

.menu-toggle:hover,
.menu-toggle:focus-visible {
  background: rgba(0,0,0,0.05);
  border-radius: 50%;
}

.hero {
  display: grid;
  gap: 1rem;
  padding-top: 0.4rem;
}

.hero-copy,
.hero-card,
.info-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 1.3rem;
}

.eyebrow {
  margin: 0 0 0.4rem;
  color: var(--accent);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0 0 0.7rem;
  line-height: 1.2;
}

h1 {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
}

h2 {
  font-size: 1.2rem;
}

.hero-copy p,
.hero-card p,
.info-card p {
  color: var(--text);
  line-height: 1.7;
  margin: 0 0 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 999px;
  padding: 0.8rem 1.1rem;
  font-weight: 700;
  transition: transform 0.2s ease, background 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
}

.btn-secondary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.6rem;
}

.feature-list li {
  color: var(--text);
  padding-left: 1.2rem;
  position: relative;
}

.feature-list li::before {
  content: "•";
  color: var(--accent);
  position: absolute;
  left: 0;
}

.hero-card {
  padding: 1.2rem;
}

.card-stack {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.8rem;
}

.card {
  padding: 0.9rem 1rem;
  border-radius: 16px;
  background: var(--panel-strong);
  border: 1px solid rgba(77, 163, 255, 0.2);
  color: var(--text);
}

.info-section {
  margin-top: 1rem;
  display: grid;
  gap: 0.85rem;
}

.info-card {
  padding: 1.1rem 1.2rem;
}

.info-card p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.rule-example-image {
  margin-top: 0.8rem;
}

.rule-example-image img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
}

.page-footer {
  margin-top: 1.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  padding-bottom: 0.4rem;
}

.page-start {
  width: 100%;
  max-width: 280px;
  padding: 0.95rem 1.2rem;
}

.credit-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.slide-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: min(53vw, 170px);
  height: 100vh;
  background: rgba(236, 227, 209, 0.94);
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  z-index: 40;
  padding: 1rem;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.12);
}

.slide-menu.is-open {
  transform: translateX(0);
}

.menu-panel {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-top: 2.2rem;
  align-items: stretch;
}

.menu-panel a {
  width: 100%;
  text-align: left;
  display: block;
}

.menu-panel a,
.menu-close {
  color: var(--text-soft);
  text-decoration: none;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
}

.menu-close {
  align-self: flex-end;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
}

.menu-panel a:hover,
.menu-close:hover {
  border-color: rgba(77, 163, 255, 0.35);
  background: rgba(77, 163, 255, 0.12);
}

.credit-text a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}

.credit-text a:hover {
  opacity: 0.8;
}

.credit-link {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: left;
}

.credit-link a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}

.credit-link a:hover {
  opacity: 0.8;
}

/* 表示方法 */
@media (min-width: 500px) {
  .page-shell {
    max-width: 500px;
    margin: 0 auto;
  }
}

/* 謎解き画面 */
.puzzle-page {
  display: flex;
  flex-direction: column;
  padding-bottom: 12rem;
}

.puzzle-container {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: 1rem;
}

.puzzle-image {
  position: relative;
  flex-grow: 1;
  min-height: 400px;
  background: transparent;
  border-radius: 0;
  overflow: none;
  box-shadow: none;
}

.puzzle-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.puzzle-image img.overlay {
  z-index: 10;
  pointer-events: auto;
}

.puzzle-image img.fade-out {
  opacity: 0;
  transition: opacity 1s ease;
}

.puzzle-select {
  margin: 1rem 0 0;
  max-width: 360px;
}

.puzzle-select label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.puzzle-select-input {
  width: 100%;
  min-width: 180px;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}

.puzzle-controls {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.6rem;
  z-index: 20;
  max-width: 360px;
}

.puzzle-input {
  width: 220px;
  min-width: 180px;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}

.puzzle-input::placeholder {
  color: var(--muted);
}

.puzzle-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.1);
}

.puzzle-submit {
  padding: 0.75rem 1.2rem;
  flex-shrink: 0;
  transition: color 1s ease-out;
}

.puzzle-submit.is-white-hidden {
  color: transparent;
}

.puzzle-submit.is-white-reset {
  transition: none !important;
  color: var(--text);
}

.puzzle-result {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 1.15rem 1.5rem;
  border-radius: 20px;
  min-width: 220px;
  text-align: center;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  background: transparent;
  border: none;
}

.puzzle-result.visible {
  opacity: 1;
}

.puzzle-result-icon {
  width: min(90vw, 400px);
  height: auto;
  display: block;
  margin: 0 auto;
  animation: puzzle-result-pop 0.25s ease-out;
}

.puzzle-result.hidden {
  opacity: 0;
  pointer-events: none;
}

@keyframes puzzle-scanline {
  0% {
    transform: translateX(-140%) rotate(16deg) skewX(-20deg);
  }
  100% {
    transform: translateX(180vw) rotate(16deg) skewX(-20deg);
  }
}

@keyframes puzzle-result-pop {
  0% {
    transform: translateY(12px) scale(0.9);
    opacity: 0;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.credit-red-highlight {
  font-weight: bold;
  color: inherit;
}

.color-detection-message {
  position: fixed;
  z-index: 10000;

  padding: 0.6rem 0.8rem;
  background: rgba(238, 200, 165, 0.94);
  border: 1px solid #491700;
  border-radius: 8px;

  font-size: 0.9rem;
  color: #491700;
  white-space: nowrap;

  pointer-events: none;

  opacity: 0;
  transform: translateY(8px);

  transition:
    opacity .25s ease,
    transform .25s ease;
}

.color-detection-message.visible {
  opacity: 1;
  transform: translateY(0);
}
