/* =========================================================
   ぬりおた — 404塗装ブース（ミニゲーム）専用スタイル
   ========================================================= */

.booth {
  padding: 16px 0 60px;
  display: grid;
  gap: 22px;
}

.booth__notice {
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius-m);
  font-size: 0.9rem;
}

.booth__404 {
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.3em;
  color: var(--accent);
  margin-bottom: 6px;
}

.booth__notice a {
  color: var(--tape);
  font-weight: 700;
}

.booth__bonus {
  font-size: 0.82rem;
  color: var(--paper-text-dim);
  text-align: center;
}

.booth__bonus a {
  color: var(--tape);
  font-weight: 700;
}

/* ---- ゲーム枠 ---- */
.game {
  position: relative;
  display: grid;
  gap: 18px;
}

.game__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
}

.game__title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  letter-spacing: 0.05em;
}

.game__stage-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--tape);
}

.game__layout {
  display: grid;
  gap: 18px;
}

/* ---- 指定書 ---- */
.specsheet {
  padding: 16px;
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-chip);
}

.specsheet__title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 2px solid var(--ink);
}

.specsheet__desc {
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin-bottom: 10px;
}

.specsheet__list {
  list-style: none;
  display: grid;
  gap: 6px;
}

.specsheet__item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.83rem;
  font-weight: 600;
}

.specsheet__swatch {
  width: 34px;
  height: 24px;
  border-radius: 5px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
  background-image: linear-gradient(160deg, rgba(255, 255, 255, 0.25), transparent 50%);
}

.specsheet__done {
  margin-left: auto;
  font-size: 0.9rem;
}

.specsheet__hint {
  margin-top: 12px;
  font-size: 0.72rem;
  color: var(--ink-soft);
  border-top: 1px dashed rgba(0, 0, 0, 0.15);
  padding-top: 10px;
}

/* ---- 格納庫（機体表示） ---- */
.hangar {
  display: grid;
  gap: 12px;
  justify-items: center;
}

.hangar__frame {
  width: 100%;
  max-width: 380px;
  padding: 12px;
  background:
    repeating-linear-gradient(45deg, rgba(242, 209, 107, 0.12) 0 12px, transparent 12px 24px),
    var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius-l);
}

.mecha {
  display: block;
  width: 100%;
  height: auto;
}

/* パーツ共通：分解状態で待機 */
.mecha__part {
  cursor: pointer;
  transition: transform 0.55s cubic-bezier(0.34, 1.4, 0.5, 1), filter 0.2s ease;
}

.mecha__part:hover { filter: brightness(1.12); }

.mecha__part .paintable {
  fill: #a9adaf; /* 成形色（未塗装） */
  stroke: rgba(0, 0, 0, 0.35);
  stroke-width: 1.5;
  transition: fill 0.25s ease;
}

.mecha__joint { fill: #3a4046; }
.mecha__vent  { fill: #4d565c; }
.mecha__visor { fill: #7fe3c8; }

/* 分解（塗装フェーズ）の配置 */
.mecha--exploded [data-part="head"]  { transform: translateY(-16px); }
.mecha--exploded [data-part="armL"]  { transform: translate(-16px, 6px) rotate(-4deg); }
.mecha--exploded [data-part="armR"]  { transform: translate(16px, 6px) rotate(4deg); }
.mecha--exploded [data-part="waist"] { transform: translateY(10px); }
.mecha--exploded [data-part="legL"]  { transform: translate(-8px, 24px); }
.mecha--exploded [data-part="legR"]  { transform: translate(8px, 24px); }

/* 組み立て完了の躍動 */
.mecha--assembled { animation: mecha-bounce 0.7s ease 0.6s; }

@keyframes mecha-bounce {
  0%, 100% { transform: translateY(0); }
  35% { transform: translateY(-10px); }
  60% { transform: translateY(2px); }
}

/* 間違いパーツの震え */
.mecha__part.is-wrong { animation: part-shake 0.4s ease; }

@keyframes part-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

/* 選択中パーツの強調（塗った直後） */
.mecha__part.is-just-painted .paintable {
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.5));
}

.hangar__actions {
  display: flex;
  gap: 10px;
}

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

.hangar__mistakes {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--paper-text-dim);
}

/* ---- パレット ---- */
.palette {
  padding: 16px;
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-chip);
}

.palette__bottles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 10px;
}

/* 塗料ボトル */
.bottle {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 8px 6px;
  background: var(--surface-dim);
  border: 2px solid transparent;
  border-radius: var(--radius-s);
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.bottle:hover { transform: translateY(-2px); }

.bottle.is-selected {
  border-color: var(--accent);
  background: #fff;
}

.bottle__cap {
  width: 34px;
  height: 12px;
  border-radius: 4px 4px 0 0;
  background: #23282c;
}

.bottle__glass {
  width: 44px;
  height: 40px;
  border-radius: 6px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35), inset 0 -4px 6px rgba(0, 0, 0, 0.18);
}

.bottle__code {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--ink-soft);
}

.bottle__name {
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
}

/* ---- クリアオーバーレイ ---- */
.clear[hidden] { display: none; }

.clear {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 25, 20, 0.78);
  backdrop-filter: blur(3px);
}

.clear__card {
  width: min(460px, 100%);
  padding: 30px 26px;
  text-align: center;
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-lift);
  animation: clear-pop 0.4s cubic-bezier(0.34, 1.5, 0.6, 1);
}

@keyframes clear-pop {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

.clear__rank {
  font-family: var(--font-display);
  font-size: 2.4rem;
  color: var(--accent);
  line-height: 1;
}

.clear__title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.2rem;
  margin: 10px 0 8px;
}

.clear__text {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-bottom: 18px;
}

.clear__paints {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 18px;
}

.clear__paints-label {
  width: 100%;
  font-size: 0.7rem;
  color: var(--ink-soft);
  margin-bottom: 2px;
}

.clear__paint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink);
  background: var(--surface-dim);
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.15s ease;
}

.clear__paint:hover { background: var(--accent-soft); }

.clear__paint-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.clear__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.clear__actions a,
.clear__actions button {
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-s);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  transition: background 0.15s ease;
}

.clear__actions a:hover,
.clear__actions button:hover { background: var(--accent-deep); }

.clear__actions .is-sub {
  background: var(--ink);
}

.clear__actions .is-sub:hover { background: #000; }

/* ---- デバッグパネル ---- */
.debug {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 99;
  width: 250px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: #9fe8c5;
  font-family: var(--font-mono);
  font-size: 0.66rem;
}

.debug__title {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.2em;
  margin-bottom: 6px;
}

.debug__row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.debug button {
  padding: 3px 8px;
  font-family: inherit;
  font-size: 0.64rem;
  background: #1d423a;
  color: #9fe8c5;
  border: 1px solid #3a6a5c;
  border-radius: 4px;
}

.debug button:hover { background: #2a5a4d; }

.debug__state {
  max-height: 120px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ---- タブレット以上 ---- */
@media (min-width: 768px) {
  .game__layout {
    grid-template-columns: 230px 1fr 230px;
    align-items: start;
  }

  .specsheet,
  .palette {
    position: sticky;
    top: 16px;
  }

  .palette__bottles {
    grid-template-columns: repeat(2, 1fr);
  }
}
