/* 「コインはどこに？」固有の盤面。共通UIは ../css/game-common.css。 */

.game-area { width: 100%; }

.game-area .coin-skeleton {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.coin-prompt {
  margin: 0;
  min-height: 1.5em;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.5;
  text-align: center;
  color: var(--ink);
}

/* 盤面: 幅に対する比率でカップを置く。位置は left/top(%)、移動中だけ transform。 */
.coin-board {
  --cup-w: 0.25;
  --board-max: 440px;
  position: relative;
  width: 100%;
  max-width: var(--board-max);
  margin: 0 auto;
  border: 2px solid #c2d3b8;
  border-radius: 20px;
  background:
    radial-gradient(ellipse at 50% 32%, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 62%),
    linear-gradient(180deg, #e4eedb, #d3e2c9);
  box-shadow: inset 0 2px 10px rgba(50, 102, 77, 0.12);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.coin-board[data-level="3"] { --board-max: 400px; --lift: -46%; }

.coin-cup {
  position: absolute;
  width: calc(var(--cup-w) * 100%);
  aspect-ratio: 1 / 1.12;
  margin-left: calc(var(--cup-w) * -50%);
  margin-top: calc(var(--cup-w) * -56%);
  padding: 0;
  border: 0;
  background: none;
  cursor: default;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  -webkit-touch-callout: none;
  outline: none;
  font: inherit;
  color: inherit;
  will-change: transform;
}
.coin-board.is-answering .coin-cup { cursor: pointer; }
.coin-board:not(.is-answering) .coin-cup { pointer-events: none; }

.coin-cup > span { position: absolute; display: block; pointer-events: none; }

.cc-shadow {
  left: -4%;
  right: -4%;
  bottom: -7%;
  height: 16%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(52, 75, 64, 0.34), rgba(52, 75, 64, 0) 70%);
}

.cc-ring {
  left: -9%;
  right: -9%;
  bottom: -8%;
  height: 26%;
  border: 3px solid transparent;
  border-radius: 50%;
  box-sizing: border-box;
}

.cc-coin {
  left: 22%;
  right: 22%;
  bottom: 8%;
  height: 22%;
  border-radius: 50%;
  border: 2px solid #b98313;
  background: radial-gradient(ellipse at 40% 35%, #fbe58b, #e2b238 70%, #c9961f);
  box-shadow: 0 3px 0 #b98313, 0 5px 6px rgba(52, 75, 64, 0.28);
  box-sizing: border-box;
}
.cc-coin::after {
  content: "";
  position: absolute;
  inset: 22% 24%;
  border-radius: 50%;
  border: 2px solid rgba(185, 131, 19, 0.7);
}

.cc-body {
  inset: 0;
  transition: transform 0.45s cubic-bezier(0.3, 0.7, 0.25, 1), filter 0.15s;
  filter: drop-shadow(0 3px 3px rgba(52, 75, 64, 0.25));
}
.cc-body svg { display: block; width: 100%; height: 100%; overflow: visible; }
.coin-cup.is-lifted .cc-body { transform: translateY(var(--lift, -52%)); }

.coin-cup > .cc-badge {
  bottom: -16%;
  right: -8%;
  width: 30%;
  aspect-ratio: 1;
  min-width: 22px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--green);
  color: #fff;
  font-size: clamp(12px, 3.6vw, 17px);
  font-weight: 800;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(52, 75, 64, 0.3);
  z-index: 4;
}

/* 選択中: 輪郭＋チェック。持ち上げない（コインが見えてしまうため）。 */
.coin-cup.is-selected .cc-ring { border-color: var(--green); background: rgba(50, 102, 77, 0.12); }
.coin-cup.is-selected .cc-body { filter: drop-shadow(0 0 0 transparent) brightness(1.06) saturate(1.1) drop-shadow(0 3px 3px rgba(52, 75, 64, 0.25)); }
.coin-cup.is-selected > .cc-badge { display: flex; }
.coin-cup.is-selected .cc-badge::before { content: "✓"; }

html.is-keyboard-nav .coin-cup:focus-visible .cc-ring { border-color: #d88635; }
@media (hover: hover) {
  .coin-board.is-answering .coin-cup:not(.is-selected):hover .cc-ring { border-color: rgba(50, 102, 77, 0.45); }
}

/* 答え合わせ */
.coin-cup.is-reveal .cc-body { transition-duration: 0.5s; }
.coin-cup.is-hit .cc-ring { border-color: var(--green); background: rgba(50, 102, 77, 0.16); }
.coin-cup.is-hit > .cc-badge { display: flex; background: var(--green); }
.coin-cup.is-hit .cc-badge::before { content: "○"; }
.coin-cup.is-wrong .cc-ring { border: 3px dashed #b42318; background: rgba(180, 35, 24, 0.1); }
.coin-cup.is-wrong > .cc-badge { display: flex; background: #b42318; }
.coin-cup.is-wrong .cc-badge::before { content: "×"; }
.coin-cup.is-missed .cc-ring { border: 3px dashed #b7791f; background: rgba(183, 121, 31, 0.14); }
.coin-cup.is-missed > .cc-badge { display: flex; background: #b7791f; }
.coin-cup.is-missed .cc-badge::before { content: "！"; }

.coin-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  max-width: 440px;
}
.coin-count {
  min-width: 5.5em;
  font-size: 14px;
  font-weight: 800;
  color: var(--green);
  text-align: center;
}
.coin-confirm.play {
  flex: 0 1 200px;
  min-height: 48px;
  padding: 10px 24px;
  font-size: 16px;
  text-align: center;
}
.coin-confirm.play:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.coin-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 12px;
  margin: 0;
  min-height: 1.4em;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  visibility: hidden;
}
.coin-legend.is-visible { visibility: visible; }
.coin-legend b { font-weight: 800; }
.coin-legend .lg-hit b { color: var(--green); }
.coin-legend .lg-wrong b { color: #b42318; }
.coin-legend .lg-missed b { color: #b7791f; }

.game-feedback.coin-perfect { color: var(--green); }
.game-feedback.coin-partial { color: #8a5a12; }
.game-feedback.coin-zero { color: #b42318; }

@media (max-width: 430px) {
  .coin-skeleton { gap: 8px; }
  .coin-prompt { font-size: 14px; }
  .coin-controls { gap: 10px; }
  .coin-confirm.play { flex-basis: 170px; }
  .cc-ring { border-width: 2px; }
  .coin-cup.is-wrong .cc-ring,
  .coin-cup.is-missed .cc-ring { border-width: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .cc-body { transition-duration: 0.01s; }
}
