/* せーの！: テーマ上書き（インディゴ系）＋ゲーム画面スタイル
 *
 * 静かな緊張感を出したいので、背景は動かさない・色数を絞る。
 * 動くのは「ミスの赤フラッシュ」「❤️が割れる」「レベルクリアの星」だけ。
 */

:root {
  --party-accent: #4b57c9;
  --party-accent-dark: #333d9e;
  --party-accent-soft: #e2e5ff;
  --party-bg: #eef0ff;
  --party-card: #ffffff;
  --sn-ink: #232a5c;
  --sn-line: #ccd2f5;
}

#sn-root {
  min-height: 100dvh;
}

.sn-screen {
  min-height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) calc(env(safe-area-inset-right) + 14px)
    calc(env(safe-area-inset-bottom) + 14px) calc(env(safe-area-inset-left) + 14px);
}

/* ===== 上部バー（レベル・ライフ） ===== */

.sn-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sn-level {
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: var(--sn-ink);
  font-weight: 800;
}

.sn-level-label {
  font-size: 15px;
  color: var(--party-muted);
}

.sn-level-now {
  font-size: 26px;
  line-height: 1;
  color: var(--party-accent-dark);
}

.sn-level-max {
  font-size: 14px;
  color: var(--party-muted);
}

.sn-lives {
  display: flex;
  gap: 2px;
  font-size: 22px;
  line-height: 1;
}

.sn-lives--end {
  justify-content: center;
  font-size: 26px;
  margin-top: 6px;
}

/* 割れた❤️は一度だけ大きく震えて消える（責める演出にはしない） */
.sn-heart--break {
  animation: sn-break 1.6s ease-out forwards;
}

@keyframes sn-break {
  0% { transform: scale(1.4) rotate(0deg); opacity: 1; }
  30% { transform: scale(1.4) rotate(-12deg); }
  60% { transform: scale(1.2) rotate(10deg); opacity: 1; }
  100% { transform: scale(0.6) rotate(0deg); opacity: 0; }
}

/* ===== メンバーの残り枚数 ===== */

.sn-peers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.sn-peer {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--party-card);
  box-shadow: 0 2px 0 var(--sn-line);
}

.sn-peer-icon {
  font-size: 20px;
  line-height: 1;
}

.sn-peer-count {
  font-size: 16px;
  font-weight: 800;
  color: var(--party-accent-dark);
  min-width: 0.8em;
  text-align: center;
}

/* 出しきった人は薄く（もう待たなくていい人が一目で分かる） */
.sn-peer--done {
  opacity: 0.45;
}

/* ===== 場（最後に出たカード＋履歴） ===== */

.sn-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 150px;
}

.sn-last {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.sn-last-icon {
  font-size: 26px;
  line-height: 1;
}

.sn-last-card {
  font-size: 72px;
  font-weight: 800;
  line-height: 1;
  color: var(--party-accent-dark);
  font-variant-numeric: tabular-nums;
}

.sn-field-empty {
  margin: 0;
  color: var(--party-muted);
  font-weight: 700;
}

.sn-history {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
  max-width: 100%;
}

.sn-history-card {
  min-width: 30px;
  padding: 2px 6px;
  border-radius: 8px;
  background: var(--party-accent-soft);
  color: var(--party-accent-dark);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ===== 自分の手札 ===== */

.sn-hand {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.sn-card {
  min-width: 44px;
  padding: 8px 6px;
  border-radius: 12px;
  background: var(--party-card);
  color: var(--sn-ink);
  font-size: 22px;
  font-weight: 800;
  text-align: center;
  line-height: 1.1;
  box-shadow: 0 3px 0 var(--sn-line);
  font-variant-numeric: tabular-nums;
}

/* つぎに出せる1枚（＝自分の最小カード）だけ強調する。選ばせないので迷わない */
.sn-card--next {
  background: var(--party-accent);
  color: #fff;
  box-shadow: 0 3px 0 var(--party-accent-dark);
}

.sn-card--burn {
  background: #ffe3e3;
  color: #b3262a;
  box-shadow: 0 2px 0 #f2b8b8;
  font-size: 18px;
  min-width: 38px;
  padding: 5px 5px;
}

/* ===== 下部の大ボタン ===== */

.sn-foot {
  padding-top: 4px;
}

.sn-play-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 84px;
  border: none;
  border-radius: 20px;
  background: var(--party-accent);
  color: #fff;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--party-accent-dark);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}

.sn-play-btn:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--party-accent-dark);
}

.sn-play-btn:disabled {
  background: #c3c7e4;
  box-shadow: 0 5px 0 #a9aecf;
}

.sn-play-label {
  font-size: 26px;
  font-weight: 800;
}

.sn-play-card {
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.sn-done {
  margin: 0;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 800;
  color: var(--party-accent-dark);
  background: var(--party-accent-soft);
  border-radius: 20px;
  padding: 10px 14px;
}

/* ===== ミス演出 ===== */

/* 画面を一瞬だけ赤くする（一度きり・音なし） */
.sn-flash {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #e5484d;
  pointer-events: none;
  animation: sn-flash 0.5s ease-out forwards;
}

@keyframes sn-flash {
  0% { opacity: 0.55; }
  100% { opacity: 0; }
}

.sn-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(24, 28, 70, 0.5);
}

.sn-miss {
  background: var(--party-card);
  border-radius: var(--party-radius);
  padding: 18px 16px;
  width: 100%;
  max-width: 420px;
  max-height: 80dvh;
  overflow-y: auto;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.sn-miss-title {
  margin: 0 0 10px;
  font-size: 26px;
  font-weight: 800;
  color: var(--party-accent-dark);
}

.sn-miss-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sn-miss-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--party-accent-soft);
  border-radius: 14px;
  padding: 8px 10px;
  text-align: left;
}

.sn-miss-icon {
  font-size: 22px;
  line-height: 1;
}

.sn-miss-name {
  font-weight: 800;
  color: var(--sn-ink);
  max-width: 5em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sn-miss-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-left: auto;
}

.sn-miss-sub {
  margin: 12px 0 0;
  font-weight: 700;
  color: var(--party-muted);
}

/* ===== レベルクリア演出 ===== */

.sn-clear {
  position: relative;
  text-align: center;
  padding: 20px;
}

.sn-clear-title {
  margin: 0;
  font-size: 34px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 3px 0 var(--party-accent-dark);
  animation: sn-pop 0.4s ease-out;
}

.sn-clear-bonus {
  margin: 10px 0 0;
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  animation: sn-pop 0.4s ease-out 0.2s backwards;
}

@keyframes sn-pop {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); }
}

/* 星がぱっと散るだけ（画像なし・CSSのみ） */
.sn-stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.sn-star {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: 22px;
  opacity: 0;
  animation: sn-star 0.9s ease-out forwards;
}

.sn-star--0 { --sn-x: -120px; --sn-y: -90px; animation-delay: 0s; }
.sn-star--1 { --sn-x: 120px; --sn-y: -80px; animation-delay: 0.05s; }
.sn-star--2 { --sn-x: -90px; --sn-y: 80px; animation-delay: 0.1s; }
.sn-star--3 { --sn-x: 100px; --sn-y: 90px; animation-delay: 0.15s; }
.sn-star--4 { --sn-x: 0px; --sn-y: -130px; animation-delay: 0.08s; }
.sn-star--5 { --sn-x: 10px; --sn-y: 120px; animation-delay: 0.18s; }

@keyframes sn-star {
  0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
  40% { opacity: 1; }
  100% {
    transform: translate(calc(-50% + var(--sn-x)), calc(-50% + var(--sn-y))) scale(1.1);
    opacity: 0;
  }
}

/* ===== おわりの画面 ===== */

.sn-screen--end {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
}

.sn-end-emoji {
  margin: 0;
  font-size: 64px;
  line-height: 1;
  animation: sn-pop 0.5s ease-out;
}

.sn-end-title {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  color: var(--party-accent-dark);
}

.sn-end-sub {
  margin: 0;
  color: var(--party-muted);
  font-weight: 700;
}

.sn-end-actions {
  width: 100%;
  max-width: 340px;
  margin-top: 18px;
}

.sn-end-wait {
  margin-top: 18px;
  font-weight: 800;
  color: var(--party-muted);
}

.sn-btn {
  display: block;
  width: 100%;
  min-height: 56px;
  margin: 0 0 12px;
  padding: 12px 18px;
  border: none;
  border-radius: 16px;
  background: var(--party-accent-soft);
  color: var(--party-accent-dark);
  font-family: inherit;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--sn-line);
}

.sn-btn--primary {
  background: var(--party-accent);
  color: #fff;
  box-shadow: 0 4px 0 var(--party-accent-dark);
}

.sn-btn:active {
  transform: translateY(3px);
  box-shadow: none;
}

/* あそびかたモーダルの1行目（ここがこのゲームの全部） */
.sn-rule-lead {
  margin: 0 0 10px;
  font-size: 19px;
  font-weight: 800;
  text-align: center;
  color: var(--party-accent-dark);
}
