:root {
  --bg-base:         #0d2b0d;
  --bg-panel:        #1a4d1a;
  --bg-deep:         #070f07;
  --border-color:    #2e8b2e;
  --border-muted:    #1a4d1a;
  --text-primary:    #f0f0f0;
  --text-muted:      #9fcf9f;
  --accent-gold:     #f1c40f;
  --accent-red:      #c0392b;
  --radius-btn:      8px;
  --radius-panel:    12px;
  --shadow-card:     0 2px 8px rgba(0,0,0,0.4);
  --shadow-selected: 0 8px 20px rgba(241,196,15,0.65);
  --table-felt:      radial-gradient(ellipse at 50% 40%, #225c22 0%, #1a5c1a 55%, #133c13 100%);
  --transition-card: 0.15s cubic-bezier(0.25,0.8,0.25,1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', sans-serif;
  background: #0d2b0d;
  color: #f0f0f0;
  min-height: 100vh;
}

.hidden { display: none !important; }

button,
.mode-card,
.code-value,
.rule-btn,
.card {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ═══════════════════════════════════════════
   サイト情報 / 静的コンテンツ
═══════════════════════════════════════════ */
a {
  color: inherit;
}

.home-screen {
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  flex-direction: column;
  padding: 0;
}

.site-nav {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  color: #d8efd8;
}

.site-brand {
  font-size: 1.02rem;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 1px;
  white-space: nowrap;
}

.site-nav nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 0.86rem;
  margin-left: auto;
}

.site-nav nav a {
  color: #a9cfa9;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.site-nav nav a:hover,
.site-nav nav a:focus-visible {
  color: #fff;
  border-bottom-color: #f1c40f;
}

.home-stage {
  width: 100%;
  min-height: min(680px, calc(100vh - 96px));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 20px 28px;
}

.home-content {
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 42px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.content-section {
  background: #f6f2e8;
  color: #1f2d24;
  border: 1px solid #dfd5c0;
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.18);
}

.intro-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: center;
}

.section-kicker {
  color: #8a6a10;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.content-section h2 {
  font-size: 1.45rem;
  color: #193f2b;
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.content-section h3 {
  font-size: 1rem;
  color: #24563a;
  margin-bottom: 8px;
}

.content-section p,
.content-section li {
  font-size: 0.95rem;
  line-height: 1.85;
  color: #33483a;
}

.card-preview {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.card-preview span {
  width: 54px;
  height: 78px;
  display: grid;
  place-items: center;
  background: #fff;
  color: #111;
  border: 1px solid #d0c7b5;
  border-radius: 7px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
  font-weight: 800;
}

.card-preview span:nth-child(even) {
  color: #b8322a;
  transform: translateY(8px);
}

.guide-grid,
.rule-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.rule-summary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.guide-grid article,
.rule-summary > div {
  background: #fffdf7;
  border: 1px solid #e8dec9;
  border-radius: 8px;
  padding: 18px;
}

.plain-list {
  padding-left: 1.1rem;
}

.plain-list li + li {
  margin-top: 8px;
}

.text-link {
  display: inline-block;
  color: #17613f;
  font-weight: 800;
  text-decoration: none;
  border-bottom: 1px solid #17613f;
}

.text-link:hover,
.text-link:focus-visible {
  color: #8a6a10;
  border-bottom-color: #8a6a10;
}

.guide-link-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.guide-link-card {
  display: flex;
  min-height: 104px;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  background: #fffdf7;
  border: 1px solid #e8dec9;
  border-radius: 8px;
  color: #24563a;
  padding: 16px;
  text-decoration: none;
}

.guide-link-card:hover,
.guide-link-card:focus-visible {
  border-color: #8a6a10;
  box-shadow: 0 8px 18px rgba(138,106,16,0.16);
  color: #8a6a10;
}

.guide-link-card span {
  font-weight: 800;
}

.guide-link-card small {
  color: #526859;
  font-size: 0.82rem;
  line-height: 1.55;
}

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

.faq-list details {
  background: #fffdf7;
  border: 1px solid #e8dec9;
  border-radius: 8px;
  padding: 14px 16px;
}

.faq-list summary {
  color: #24563a;
  cursor: pointer;
  font-weight: 800;
}

.faq-list p {
  margin-top: 10px;
}

.site-footer {
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
  padding: 22px 0 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 18px;
  color: #9fcf9f;
  font-size: 0.82rem;
}

.site-footer a {
  color: #c9e3c9;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: #fff;
  border-bottom-color: #f1c40f;
}

.content-page .site-footer {
  color: #65756a;
}

.content-page .site-footer a {
  color: #315945;
}

.content-page .site-footer a:hover,
.content-page .site-footer a:focus-visible {
  color: #8a6a10;
  border-bottom-color: #8a6a10;
}

.content-page {
  background: #f6f2e8;
  color: #1f2d24;
}

.content-page .site-nav {
  color: #193f2b;
  border-bottom: 1px solid #dfd5c0;
}

.content-page .site-brand {
  color: #193f2b;
}

.content-page .site-nav nav a {
  color: #315945;
}

.content-page .site-nav nav a:hover,
.content-page .site-nav nav a:focus-visible {
  color: #8a6a10;
}

.static-main {
  width: min(920px, calc(100% - 40px));
  margin: 0 auto;
  padding: 42px 0 70px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: #65756a;
  font-size: 0.84rem;
  margin-bottom: 18px;
}

.breadcrumb a {
  color: #315945;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.breadcrumb a:hover,
.breadcrumb a:focus-visible {
  color: #8a6a10;
  border-bottom-color: #8a6a10;
}

.static-hero {
  margin-bottom: 24px;
}

.static-hero h1 {
  color: #193f2b;
  font-size: 2rem;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.static-hero p {
  color: #415846;
  font-size: 1rem;
  line-height: 1.85;
}

.static-section {
  background: #fffdf7;
  border: 1px solid #e4dac7;
  border-radius: 8px;
  padding: 24px 26px;
  margin-top: 16px;
}

.static-section h2 {
  color: #24563a;
  font-size: 1.18rem;
  margin-bottom: 10px;
}

.static-section h3 {
  color: #315945;
  font-size: 1rem;
  margin: 18px 0 8px;
}

.static-section p,
.static-section li {
  color: #33483a;
  font-size: 0.95rem;
  line-height: 1.85;
}

.static-section ul,
.static-section ol {
  padding-left: 1.2rem;
}

.static-section li + li {
  margin-top: 6px;
}

.static-section a {
  color: #17613f;
  font-weight: 700;
}

.rules-hub .guide-link-grid {
  margin-top: 16px;
}

.effect-figure {
  margin: 0 0 18px;
}

.effect-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #e4dac7;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.12);
}

.effect-figure figcaption {
  color: #526859;
  font-size: 0.86rem;
  line-height: 1.7;
  margin-top: 8px;
}

.related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.related-links a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid #d8ccb6;
  border-radius: 999px;
  background: #f6f2e8;
  text-decoration: none;
}

.related-links a:hover,
.related-links a:focus-visible {
  border-color: #8a6a10;
  color: #8a6a10;
}

.static-note {
  background: #eef4e9;
  border-left: 4px solid #2e8b2e;
  padding: 12px 14px;
  margin-top: 12px;
  color: #315945;
  line-height: 1.75;
}

.rules-table-wrap {
  overflow-x: auto;
  margin-top: 12px;
}

.rules-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
  background: #fff;
}

.rules-table th,
.rules-table td {
  border: 1px solid #e4dac7;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  font-size: 0.9rem;
  line-height: 1.65;
}

.rules-table th {
  background: #eef4e9;
  color: #24563a;
  font-weight: 800;
}

.rules-table td:first-child,
.rules-table td:nth-child(2) {
  font-weight: 800;
  color: #24563a;
  white-space: nowrap;
}

.updated-date {
  color: #65756a;
  font-size: 0.85rem;
  margin-top: 16px;
}

/* ═══════════════════════════════════════════
   フォームスクリーン共通（スタート / 作成 / 参加 / ロビー）
═══════════════════════════════════════════ */
.screen-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.form-box {
  background: #1a4d1a;
  border: 2px solid #2e8b2e;
  border-radius: 16px;
  padding: 44px 52px;
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

.form-box h1 {
  font-size: 2.8rem;
  letter-spacing: 4px;
  text-align: center;
}

.form-box h2 {
  font-size: 1.6rem;
  letter-spacing: 2px;
  text-align: center;
  margin-bottom: 4px;
}

.subtitle {
  text-align: center;
  color: #9fcf9f;
  font-size: 0.95rem;
}

.form-box label {
  font-size: 0.85rem;
  color: #9fcf9f;
  margin-bottom: -8px;
}

.form-box input {
  padding: 11px 14px;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid #4a8a4a;
  background: #0d2b0d;
  color: #f0f0f0;
  outline: none;
  width: 100%;
}

.form-box input:focus { border-color: #7dca7d; }

.hint-text {
  font-size: 0.78rem;
  color: #7da07d;
  text-align: center;
  line-height: 1.5;
  margin-top: -4px;
}

/* プレイヤー数セレクター */
#count-selector {
  display: flex;
  gap: 8px;
}

.count-btn {
  flex: 1;
  padding: 10px 0;
  background: #0d3a0d;
  color: #9fcf9f;
  border: 1px solid #3a6a3a;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: bold;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.count-btn:hover { background: #1a5a1a; border-color: #5a9a5a; }

.count-btn.active {
  background: #2e8b2e;
  border-color: #4ab84a;
  color: #fff;
}

#difficulty-selector {
  display: flex;
  gap: 8px;
}

.diff-btn {
  flex: 1;
  padding: 10px 0;
  background: #0d3a0d;
  color: #9fcf9f;
  border: 1px solid #3a6a3a;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: bold;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.diff-btn:hover:not(.active) { background: #1a5a1a; border-color: #5a9a5a; }

.diff-btn.active {
  background: #2e8b2e;
  border-color: #4ab84a;
  color: #fff;
}

/* スタートメニュー拡張 */
.start-box { max-width: 520px; }

.mode-select-label {
  font-size: 0.8rem;
  color: #7da07d;
  text-align: center;
  margin-bottom: -6px;
}

.mode-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mode-card {
  background: #0d3a0d;
  border: 2px solid #2e5a2e;
  border-radius: 12px;
  padding: 16px 10px;
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: background 0.15s, border-color 0.15s;
}

.mode-card:hover { background: #1a4d1a; border-color: #4a8a4a; }

.mode-card.active {
  background: #1a5a1a;
  border-color: #4ab84a;
  box-shadow: 0 0 10px rgba(74,184,74,0.3);
}

.mode-card-icon { font-size: 1.4rem; }
.mode-card-title { font-size: 0.88rem; font-weight: bold; color: #c8f0c8; }
.mode-card-desc  { font-size: 0.72rem; color: #7da07d; line-height: 1.45; }

.mode-card.active .mode-card-title { color: #fff; }

.mode-card-zen { border-color: #4a3a00; }
.mode-card-zen:hover { background: #2a1e00; border-color: #8a6a00; }
.mode-card-zen.active {
  background: #2a1e00;
  border-color: #c8a020;
  box-shadow: 0 0 10px rgba(200,160,32,0.35);
}
.mode-card-zen.active .mode-card-title { color: #f1c40f; }
.mode-card-zen.active .mode-card-desc  { color: #c8a020; }

.ranked-start-btn {
  border-color: #c8a020;
  color: #f1c40f;
  background: #2a1e00;
}

.ranked-start-btn:hover {
  background: #3a2c05;
}

.ranked-box {
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
}

.ranked-summary {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 10px;
  margin: 14px 0;
}

.ranked-stat {
  background: #0d2b0d;
  border: 1px solid #2e5a2e;
  border-radius: 8px;
  padding: 12px;
}

.ranked-stat-main {
  font-size: 1.5rem;
  font-weight: bold;
  color: #f1c40f;
}

.ranked-stat-label {
  color: #8fb88f;
  font-size: 0.78rem;
  margin-top: 3px;
}

.ranked-record {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 8px;
}

.ranked-record span {
  background: rgba(10, 40, 10, 0.7);
  border: 1px solid rgba(143, 210, 143, 0.18);
  border-radius: 8px;
  color: #cfe8cf;
  font-size: 0.78rem;
  padding: 7px 5px;
  text-align: center;
}

.ranked-queue-status {
  min-height: 22px;
  color: #c8f0c8;
  font-size: 0.86rem;
  margin: 10px 0;
  text-align: center;
}

.ranked-actions {
  display: grid;
  gap: 8px;
}

.ranked-leaderboard-section {
  margin-top: 18px;
  text-align: left;
}

.ranked-leaderboard {
  display: grid;
  gap: 6px;
}

.ranked-leader-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #2e5a2e;
  color: #d8f0d8;
  font-size: 0.84rem;
  padding: 7px 0;
}

.ranked-leader-place {
  color: #f1c40f;
  font-weight: bold;
  text-align: right;
}

.ranked-leader-rating {
  color: #c8f0c8;
  font-weight: bold;
}

.ranked-result-panel {
  background: rgba(10, 40, 10, 0.6);
  border: 1px solid rgba(241, 196, 15, 0.5);
  border-radius: 8px;
  margin: 6px 0 18px;
  padding: 12px;
  text-align: left;
}

.ranked-result-title {
  color: #f1c40f;
  font-weight: bold;
  margin-bottom: 8px;
  text-align: center;
}

.ranked-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #e8f4e8;
  font-size: 0.86rem;
  padding: 5px 0;
}

.ranked-delta-pos { color: #58d68d; font-weight: bold; }
.ranked-delta-neg { color: #ec7063; font-weight: bold; }

/* ゲーム作成スクリーン */
.create-box { max-height: 92vh; overflow-y: auto; }

.zen-all-on-note {
  background: #1a1000;
  border: 1px solid #c8a020;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.82rem;
  color: #f1c40f;
  line-height: 1.65;
  text-align: center;
}

/* ルールトグル */
#screen-create .form-box {
  max-width: 480px;
}

#rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.rule-btn {
  padding: 8px 6px;
  background: #0d2b0d;
  color: #5a7a5a;
  border: 1px solid #2a4a2a;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: bold;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.rule-btn:hover { background: #1a4a1a; border-color: #4a7a4a; color: #9fcf9f; }

.rule-btn.active {
  background: #1a4d1a;
  border-color: #4ab84a;
  color: #9fcf9f;
}

/* ルールボタン ツールチップ */
.rule-btn {
  position: relative;
  overflow: visible;
}

.rule-btn[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #071407;
  color: #b8d8b8;
  border: 1px solid #2e8b2e;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.72rem;
  font-weight: normal;
  line-height: 1.55;
  width: 200px;
  text-align: left;
  z-index: 2000;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s, visibility 0.18s;
  white-space: normal;
  box-shadow: 0 4px 16px rgba(0,0,0,0.6);
}

.rule-btn[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
}

/* ボタン */
.btn-primary {
  padding: 13px;
  font-size: 1rem;
  font-weight: bold;
  letter-spacing: 1px;
  background: #2e8b2e;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover { background: #3aaa3a; }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-secondary {
  padding: 13px;
  font-size: 1rem;
  font-weight: bold;
  background: #1a4d1a;
  color: #9fcf9f;
  border: 1px solid #4a8a4a;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-secondary:hover { background: #224d22; }

.tutorial-start-btn {
  border-color: rgba(241,196,15,0.68);
  color: #f7dc6f;
  background: #2a2508;
}

.tutorial-start-btn:hover {
  background: #3a320b;
}

.btn-ghost {
  padding: 10px;
  font-size: 0.9rem;
  background: transparent;
  color: #7da07d;
  border: 1px solid #3a6a3a;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.btn-ghost:hover { border-color: #6aaa6a; color: #9fcf9f; }

/* ロビー */
.lobby-box { max-width: 500px; }

.code-row {
  text-align: center;
  font-size: 1rem;
  color: #9fcf9f;
}

.code-value {
  font-family: monospace;
  font-size: 1.8rem;
  font-weight: bold;
  color: #f1c40f;
  letter-spacing: 6px;
  background: #0d2b0d;
  padding: 4px 14px;
  border-radius: 6px;
  border: 1px solid #4a8a4a;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.code-value:hover {
  background: #1a3a0d;
  border-color: #7dca7d;
}

.code-value:active { transform: scale(0.97); }

.code-value.copied {
  border-color: #4ab84a;
  color: #4ab84a;
}

#lobby-slots {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0;
}

.lobby-slot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #0d2b0d;
  border-radius: 8px;
  border: 1px solid #2e5a2e;
  font-size: 0.95rem;
}

.lobby-slot.filled { border-color: #2e8b2e; }

.slot-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #2e5a2e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  flex-shrink: 0;
}

.lobby-slot.filled .slot-num { background: #2e8b2e; }

.slot-name { flex: 1; }
.slot-status { font-size: 0.8rem; color: #7da07d; }
.lobby-slot.filled .slot-status { color: #4ab84a; }

#lobby-actions { display: flex; flex-direction: column; gap: 8px; }

/* ═══════════════════════════════════════════
   ゲームボード
═══════════════════════════════════════════ */
#game-board {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: #0d2b0d;
}

/* ── ヘッダー ── */
#header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: #1a4d1a;
  border-bottom: 2px solid #2e8b2e;
  flex-shrink: 0;
  z-index: 10;
}

#game-title {
  font-size: 1.2rem;
  font-weight: bold;
  flex: 1;
  letter-spacing: 2px;
}

#zen-mode-badge {
  background: #2a1e00;
  border: 1px solid #c8a020;
  color: #f1c40f;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: bold;
}

#revolution-badge {
  background: #c0392b;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: bold;
  animation: pulse 1s infinite;
}

#j-back-badge {
  background: #7d3c98;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: bold;
}

#suit-lock-badge {
  background: #1a5276;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: bold;
}

#six-strongest-badge {
  background: #2a1500;
  border: 1px solid #e67e22;
  color: #f39c12;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: bold;
  animation: pulse 1s infinite;
}

#effect-nullified-badge {
  background: #2a0a2a;
  border: 1px solid #9b59b6;
  color: #bb8fce;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: bold;
}

#ten-nullified-badge {
  background: #0a0a2a;
  border: 1px solid #3498db;
  color: #7fb3e8;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: bold;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.header-btn {
  padding: 5px 12px;
  background: #1a4d1a;
  border: 1px solid #4a8a4a;
  border-radius: 6px;
  color: #9fcf9f;
  cursor: pointer;
  font-size: 0.82rem;
  transition: background 0.12s;
}
.header-btn:hover { background: #2e5a2e; }

#new-game-btn {
  padding: 5px 12px;
  background: #2a2a2a;
  border: 1px solid #666;
  border-radius: 6px;
  color: #bbb;
  cursor: pointer;
  font-size: 0.82rem;
}
#new-game-btn:hover { background: #3a3a3a; }

/* ── コンテンツ（メイン ＋ ログ） ── */
#game-content {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
}

/* ── テーブルラッパー（囲み型グリッド） ── */
#table-wrapper {
  flex: 1 0 420px;
  min-height: 420px;
  display: grid;
  grid-template-columns: 164px 1fr 164px;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "tl  top  tr"
    "lft tbl  rgt";
  gap: 6px;
}

/* opp-row はデスクトップで透明（display:contents により子が直接 Grid に参加） */
#opp-row { display: contents; }

/* ── 各席スロット ── */
.opp-slot {
  display: flex;
  align-items: flex-end;   /* 下寄せ＝テーブル寄り */
  justify-content: center;
}

#opp-top-left  { grid-area: tl;  justify-content: flex-start; }
#opp-top       { grid-area: top; }
#opp-top-right { grid-area: tr;  justify-content: flex-end; }
#opp-left      { grid-area: lft; align-items: center; justify-content: flex-end; }
#opp-right     { grid-area: rgt; align-items: center; justify-content: flex-start; }
#table-area    { grid-area: tbl; }

/* ── プレイヤーボックス ── */
.cpu-player {
  background: #1a4d1a;
  border: 1px solid #2e8b2e;
  border-radius: 10px;
  padding: 10px 12px;
  flex: none;
  width: 150px;
}

/* 左右スロットは列幅いっぱいに広げる */
#opp-left .cpu-player,
#opp-right .cpu-player {
  width: 158px;
}

.cpu-player.is-current {
  border-color: var(--accent-gold);
  box-shadow: 0 0 14px rgba(241,196,15,0.5), inset 0 0 8px rgba(241,196,15,0.08);
  position: relative;
}
.cpu-player.is-current::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
  border-radius: var(--radius-panel) var(--radius-panel) 0 0;
  animation: active-bar-pulse 1.6s ease-in-out infinite;
}
@keyframes active-bar-pulse {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1; }
}
.turn-arrow {
  color: var(--accent-gold);
  animation: turn-blink 1s step-start infinite;
}
@keyframes turn-blink { 50% { opacity: 0; } }

.cpu-player.is-finished { opacity: 0.5; }
.cpu-player.is-substitute {
  border-color: #d8a344;
}
.cpu-player.is-left {
  border-style: dashed;
}

.cpu-name {
  font-size: 0.88rem;
  font-weight: bold;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-presence-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin: -1px 0 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(241, 196, 15, 0.16);
  border: 1px solid rgba(241, 196, 15, 0.45);
  color: #f4d35e;
  font-size: 0.68rem;
  font-weight: bold;
}
.cpu-player.is-left .player-presence-badge {
  background: rgba(192, 57, 43, 0.16);
  border-color: rgba(231, 76, 60, 0.45);
  color: #f1948a;
}

.cpu-rank-badge {
  display: inline-block;
  font-size: 0.72rem;
  background: #8b2222;
  padding: 1px 8px;
  border-radius: 10px;
  margin-bottom: 5px;
}

.cpu-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-bottom: 4px;
  max-height: 72px;
  overflow: hidden;
}

.card-back {
  width: 22px;
  height: 32px;
  background: linear-gradient(135deg, #1a3a8c 30%, #2a50c0 70%);
  border: 1px solid #4a6fdf;
  border-radius: 3px;
}

/* ── 場 ── */
#table-area {
  background: var(--table-felt);
  border: 2px dashed #3a9a3a;
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  min-height: 250px;
  display: grid;
  grid-template-rows: auto auto minmax(84px, 1fr) auto auto;
  align-items: center;
  justify-items: center;
  align-content: center;
  gap: 8px;
  overflow: hidden;
  transition: border-color 0.24s, box-shadow 0.24s, background 0.24s;
}

#table-label {
  font-size: 0.8rem;
  color: #7dca7d;
  font-weight: bold;
  letter-spacing: 2px;
}

#table-state-chips {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 24px;
}

.table-state-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.28);
  color: #d8f0d8;
  font-size: 0.7rem;
  font-weight: bold;
  letter-spacing: 0;
  white-space: nowrap;
}

.table-state-chip.revolution {
  border-color: rgba(231,76,60,0.7);
  color: #ffb0a7;
  background: rgba(130,20,18,0.46);
}

.table-state-chip.six {
  border-color: rgba(245,176,65,0.72);
  color: #ffd889;
  background: rgba(90,44,0,0.46);
}

.table-state-chip.reverse {
  border-color: rgba(178,109,224,0.72);
  color: #d7b2ef;
  background: rgba(74,30,110,0.46);
}

.table-state-chip.lock {
  border-color: rgba(93,173,226,0.72);
  color: #b9ddf5;
  background: rgba(20,72,112,0.46);
}

.table-state-chip.nullify {
  border-color: rgba(155,89,182,0.72);
  color: #d7b2ef;
  background: rgba(55,20,70,0.46);
}

#table-cards {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
  min-height: 84px;
  max-width: 100%;
  box-sizing: border-box;
}

#table-hint {
  font-size: 0.78rem;
  color: #9fcf9f;
  min-height: 18px;
  line-height: 1.35;
}

/* ── 全役職モード: 捨て札/除外パイル ── */
#zen-piles {
  display: flex;
  gap: 10px;
  margin-top: 0;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.zen-pile {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 7px;
  min-width: 92px;
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.08);
  cursor: default;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.zen-pile.pile-active {
  border-color: #f1c40f;
  box-shadow: 0 0 10px rgba(241,196,15,0.5);
  cursor: pointer;
}

.zen-pile-stack {
  position: relative;
  width: 30px;
  height: 42px;
  flex: none;
}

.zen-pile-card {
  width: 30px !important;
  height: 42px !important;
  border-radius: 4px !important;
  position: absolute;
  top: 0;
  left: 0;
}

.zen-pile-card-removed {
  background: linear-gradient(135deg, #4a1a4a 0%, #2a0a2a 100%) !important;
  border-color: #8e44ad !important;
}

.zen-pile-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}

.zen-pile-label {
  font-size: 0.62rem;
  color: #8fa88f;
}

.zen-pile-count {
  font-size: 0.8rem;
  font-weight: bold;
  color: #d5e8d5;
}

#game-board.state-revolution #table-area {
  border-color: #e74c3c;
  background:
    radial-gradient(circle at 50% 38%, rgba(231,76,60,0.18), transparent 55%),
    var(--table-felt);
  box-shadow: inset 0 0 28px rgba(231,76,60,0.22), 0 0 20px rgba(231,76,60,0.18);
}

#game-board.state-j-back #table-area {
  border-color: #9b59b6;
  box-shadow: inset 0 0 24px rgba(155,89,182,0.18);
}

#game-board.state-suit-lock #table-area {
  border-color: #5dade2;
  box-shadow: inset 0 0 24px rgba(93,173,226,0.18);
}

#game-board.state-six-strongest #table-area {
  border-color: #f5b041;
  background:
    radial-gradient(circle at 50% 38%, rgba(245,176,65,0.16), transparent 55%),
    var(--table-felt);
}

#game-board.state-effect-nullified #table-area,
#game-board.state-ten-nullified #table-area {
  border-style: solid;
}

#game-board.board-flash-revolution::after,
#game-board.board-flash-lock::after,
#game-board.board-flash-reverse::after,
#game-board.board-flash-cut::after,
#game-board.board-flash-nullify::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 320;
  opacity: 0;
}

#game-board.board-flash-revolution::after {
  background:
    radial-gradient(circle at 50% 44%, rgba(255,240,210,0.30), transparent 22%),
    linear-gradient(135deg, rgba(231,76,60,0.34), rgba(70,0,0,0.08) 52%, rgba(231,76,60,0.28));
  animation: revolution-screen-flash 0.86s ease-out;
}

#game-board.board-flash-lock::after {
  background: radial-gradient(circle at 50% 42%, rgba(93,173,226,0.30), transparent 34%);
  animation: table-soft-flash 0.72s ease-out;
}

#game-board.board-flash-reverse::after {
  background: linear-gradient(180deg, rgba(155,89,182,0.28), rgba(0,0,0,0) 52%, rgba(155,89,182,0.20));
  animation: table-soft-flash 0.72s ease-out;
}

#game-board.board-flash-cut::after {
  background: radial-gradient(circle at 50% 42%, rgba(243,156,18,0.30), transparent 34%);
  animation: table-soft-flash 0.64s ease-out;
}

#game-board.board-flash-nullify::after {
  background: radial-gradient(circle at 50% 42%, rgba(155,89,182,0.30), transparent 34%);
  animation: nullify-screen-flash 0.68s ease-out;
}

#game-board.board-flash-revolution #table-cards .table-card {
  animation: table-card-revolt 0.72s ease-out;
}

@keyframes revolution-screen-flash {
  0%   { opacity: 0; transform: scale(1); }
  14%  { opacity: 1; transform: scale(1.01); }
  42%  { opacity: 0.72; }
  100% { opacity: 0; transform: scale(1.02); }
}

@keyframes table-soft-flash {
  0%   { opacity: 0; }
  18%  { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes nullify-screen-flash {
  0%   { opacity: 0; filter: saturate(1); }
  20%  { opacity: 1; filter: saturate(0.4); }
  100% { opacity: 0; filter: saturate(0.8); }
}

@keyframes table-card-revolt {
  0%   { transform: translateY(0) rotateY(0deg); }
  42%  { transform: translateY(-10px) rotateY(180deg); }
  100% { transform: translateY(0) rotateY(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  #game-board.board-flash-revolution::after,
  #game-board.board-flash-lock::after,
  #game-board.board-flash-reverse::after,
  #game-board.board-flash-cut::after,
  #game-board.board-flash-nullify::after,
  #game-board.board-flash-revolution #table-cards .table-card {
    animation: none;
  }
}

/* ── カード共通 ── */
.card {
  width: 52px;
  height: 76px;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #ccc;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
  flex-shrink: 0;
}

.card.red { color: #c0392b; }
.card.black { color: #1a1a1a; }

.card.selected {
  transform: translateY(-14px);
  box-shadow: 0 8px 20px rgba(241,196,15,0.65);
  border-color: #f1c40f;
  border-width: 2px;
}

.card.table-card {
  cursor: default;
  width: 58px;
  height: 84px;
}

.card-rank { font-size: 0.95rem; line-height: 1; }
.card-suit { font-size: 1.05rem; line-height: 1; }

/* ── ターン状態バー ── */
#turn-status-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 14px;
  background: rgba(26, 77, 26, 0.6);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-panel);
  font-size: 0.82rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}
#tsb-player     { font-weight: bold; color: var(--accent-gold); }
#tsb-card-count { color: var(--text-muted); }
#tsb-constraints { color: #7fb3e8; font-size: 0.78rem; }

/* ── ミニログ ── */
#mini-log {
  padding: 2px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}
.mini-log-item {
  font-size: 0.75rem;
  color: #9fb89f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-log-item:first-child { color: #d8f0d8; }

/* ── 手札 inactive（自分のターン以外はグレーアウト） ── */
#player-hand.hand-inactive .card {
  opacity: 0.6;
  filter: saturate(0.45) brightness(0.82);
  cursor: default;
  pointer-events: none;
  transition: opacity 0.3s, filter 0.3s;
}

/* ── ログトグルボタン（デスクトップでは非表示） ── */
#log-toggle-btn { display: none; }

/* ── プレイヤーエリア ── */
#player-area {
  background: #1a4d1a;
  border: 2px solid #2e8b2e;
  border-radius: 12px;
  padding: 12px 14px;
}

#player-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

#my-name { font-weight: bold; font-size: 0.95rem; }

#my-turn-badge {
  background: #f1c40f;
  color: #1a1a1a;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: bold;
}

#player-hand {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  min-height: 78px;
  align-items: flex-end;
}

#discard-area {
  background: #1a0d00;
  border: 2px solid #e67e22;
  border-radius: 10px;
  padding: 9px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.discard-hint {
  font-size: 0.82rem;
  color: #e67e22;
  flex: 1;
  min-width: 180px;
}

#discard-btn {
  padding: 7px 18px;
  background: #e67e22;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.12s;
}
#discard-btn:hover:not(:disabled) { background: #f39c12; }
#discard-btn:disabled { opacity: 0.35; cursor: not-allowed; }

#discard-skip-btn {
  padding: 7px 14px;
  background: transparent;
  color: #9fcf9f;
  border: 1px solid #4a8a4a;
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
}
#discard-skip-btn:hover { background: #1a4d1a; }

/* ── 全役職: カード取得エリア（4/K効果）── */
#pickup-area {
  background: #1a0a2a;
  border: 2px solid #9b59b6;
  border-radius: 10px;
  padding: 9px 14px;
  margin-bottom: 8px;
}

.pickup-hint {
  font-size: 0.82rem;
  color: #bb8fce;
  margin-bottom: 8px;
}

#pickup-pile {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 120px;
  overflow-y: auto;
}

#pickup-pile .card {
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}

#pickup-pile .card.selected {
  transform: translateY(-12px);
  box-shadow: 0 8px 20px rgba(155,89,182,0.65);
  border-color: #9b59b6;
  border-width: 2px;
}

#pickup-pile .card:hover {
  transform: translateY(-10px);
  box-shadow: 0 8px 20px rgba(155,89,182,0.65);
  border-color: #9b59b6;
  border-width: 2px;
}

#pickup-confirm-btn {
  padding: 7px 18px;
  background: #9b59b6;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.12s;
}
#pickup-confirm-btn:hover:not(:disabled) { background: #af7ac5; }
#pickup-confirm-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── 全役職: カードを渡すエリア（7効果）── */
#give-area {
  background: #001a14;
  border: 2px solid #1abc9c;
  border-radius: 10px;
  padding: 9px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.give-hint {
  font-size: 0.82rem;
  color: #1abc9c;
  flex: 1;
  min-width: 180px;
}

#give-btn {
  padding: 7px 18px;
  background: #1abc9c;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.12s;
}
#give-btn:hover:not(:disabled) { background: #16a085; }
#give-btn:disabled { opacity: 0.35; cursor: not-allowed; }

#action-area {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#play-btn, #pass-btn {
  padding: 9px 26px;
  font-size: 0.95rem;
  font-weight: bold;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background 0.12s, opacity 0.12s;
}

#play-btn { background: #2e8b2e; color: #fff; }
#play-btn:hover:not(:disabled) { background: #3aaa3a; }

#pass-btn { background: #3a3a3a; color: #ccc; border: 1px solid #666; }
#pass-btn:hover:not(:disabled) { background: #4a4a4a; }

#play-btn:disabled, #pass-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── 全役職: ワンチャンスボタン ── */
#one-chance-btn, #one-chance-skip-btn {
  padding: 9px 18px;
  font-size: 0.88rem;
  font-weight: bold;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

#one-chance-btn {
  border: 2px solid #e74c3c;
  background: #3a0808;
  color: #f0a0a0;
}
#one-chance-btn:hover { background: #5a1010; color: #fff; border-color: #c0392b; }

#one-chance-skip-btn {
  border: 1px solid #666;
  background: #2a2a2a;
  color: #ccc;
}
#one-chance-skip-btn:hover { background: #3a3a3a; color: #fff; }

#selected-info { font-size: 0.82rem; color: #9fcf9f; }

#selected-effect-preview {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid rgba(241,196,15,0.55);
  background: rgba(241,196,15,0.12);
  color: #f7dc6f;
  font-size: 0.78rem;
  font-weight: bold;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════
   サイドログ
═══════════════════════════════════════════ */
#log-area {
  width: 240px;
  flex-shrink: 0;
  background: #070f07;
  border-left: 2px solid #1a4d1a;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#log-title {
  font-size: 0.78rem;
  font-weight: bold;
  color: #7dca7d;
  letter-spacing: 1px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid #1a4d1a;
  flex-shrink: 0;
}

#log-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px;
}

#log-scroll::-webkit-scrollbar { width: 4px; }
#log-scroll::-webkit-scrollbar-thumb { background: #2e5a2e; border-radius: 2px; }

.log-item {
  font-size: 0.8rem;
  color: #9fb89f;
  padding: 4px 0;
  border-bottom: 1px solid #0f200f;
  line-height: 1.4;
  word-break: break-all;
}

.log-item:first-child { color: #e0f0e0; }

/* ═══════════════════════════════════════════
   ゲーム終了モーダル
═══════════════════════════════════════════ */
#end-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

#end-modal {
  background: #1a4d1a;
  border: 2px solid #2e8b2e;
  border-radius: 16px;
  padding: 40px 52px;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.8);
  min-width: 320px;
}

#end-modal h2 { font-size: 1.7rem; margin-bottom: 22px; }

#end-results { margin-bottom: 18px; }

.result-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid #2e5a2e;
}

.result-rank { font-weight: bold; min-width: 80px; text-align: right; }
.result-name { flex: 1; text-align: left; font-size: 0.95rem; }

.rematch-ready-list {
  background: rgba(0, 20, 0, 0.24);
  border: 1px solid rgba(143, 210, 143, 0.26);
  border-radius: 12px;
  margin: 0 0 18px;
  padding: 10px 12px;
}

.rematch-ready-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  color: #e5f4e5;
  font-size: 0.88rem;
}

.rematch-ready-row + .rematch-ready-row {
  border-top: 1px solid rgba(143, 210, 143, 0.16);
}

.rematch-ready-name {
  text-align: left;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rematch-ready-status {
  flex-shrink: 0;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.76rem;
  border: 1px solid rgba(184, 216, 184, 0.3);
  color: #b8d8b8;
}

.rematch-ready-status.is-ready {
  color: #062706;
  background: #8fe08f;
  border-color: #8fe08f;
  font-weight: bold;
}

.rematch-ready-status.is-waiting {
  color: #f4d78b;
  border-color: rgba(244, 215, 139, 0.45);
}

.end-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.end-note {
  min-height: 1.2em;
  margin: -2px 0 2px;
  color: #b8d8b8;
  font-size: 0.82rem;
  line-height: 1.45;
}

#end-modal .btn-primary {
  padding: 12px 32px;
  background: #2e8b2e;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  font-weight: bold;
}
#end-modal .btn-primary:hover { background: #3aaa3a; }

#end-modal .btn-secondary {
  padding: 11px 32px;
  background: #f1c40f;
  color: #173417;
  border: none;
  border-radius: 8px;
  font-size: 0.96rem;
  cursor: pointer;
  font-weight: bold;
}
#end-modal .btn-secondary:hover { background: #f4d03f; }

#end-modal .btn-ghost {
  padding: 10px 32px;
  background: transparent;
  color: #9fcf9f;
  border: 1px solid #4a8a4a;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
}
#end-modal .btn-ghost:hover { background: #1a4d1a; color: #c8f0c8; }

#end-modal button:disabled,
#end-modal button:disabled:hover {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.25);
}

/* ═══════════════════════════════════════════
   退出確認モーダル
═══════════════════════════════════════════ */
#confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 250;
}

#confirm-modal {
  background: #1a3a1a;
  border: 2px solid #c0392b;
  border-radius: 14px;
  padding: 32px 40px;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.8);
  max-width: 380px;
  width: 90%;
}

.confirm-title {
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 14px;
  color: #f5a5a0;
}

.confirm-body {
  font-size: 0.88rem;
  color: #c8d8c8;
  line-height: 1.7;
  margin-bottom: 24px;
}

.confirm-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-danger {
  padding: 11px 28px;
  background: #c0392b;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
}
.btn-danger:hover { background: #e74c3c; }

/* ═══════════════════════════════════════════
   ルール確認モーダル
═══════════════════════════════════════════ */
#rules-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 180;
}

#rules-modal {
  background: #1a4d1a;
  border: 2px solid #2e8b2e;
  border-radius: 14px;
  padding: 28px 32px;
  min-width: 300px;
  max-width: 460px;
  width: 90%;
  max-height: 82vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,0.8);
}

#rules-modal::-webkit-scrollbar { width: 4px; }
#rules-modal::-webkit-scrollbar-thumb { background: #2e5a2e; border-radius: 2px; }

#rules-modal h3 {
  font-size: 1.15rem;
  font-weight: bold;
  text-align: center;
  margin-bottom: 18px;
  letter-spacing: 1px;
}

#rules-list { display: flex; flex-direction: column; gap: 0; }

.rules-item {
  padding: 10px 0;
  border-bottom: 1px solid #2e5a2e;
}

.rules-item:last-child { border-bottom: none; }

.rules-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.rules-item-name {
  font-weight: bold;
  font-size: 0.92rem;
  color: #c8f0c8;
}

.rules-item-status {
  font-size: 0.72rem;
  font-weight: bold;
  padding: 1px 7px;
  border-radius: 10px;
}

.status-on  { background: #1e5c1e; color: #4ab84a; }
.status-off { background: #1a1a1a; color: #555; }

.rules-item-desc {
  font-size: 0.8rem;
  color: #9fb89f;
  line-height: 1.55;
}

.rules-item-off .rules-item-name { color: #5a7a5a; }
.rules-item-off .rules-item-desc { color: #4a5a4a; }

/* ═══════════════════════════════════════════
   カード効果モーダル（全役職大富豪モード）
═══════════════════════════════════════════ */
#card-rules-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 180;
}

#card-rules-modal {
  background: #1a1000;
  border: 2px solid #c8a020;
  border-radius: 14px;
  padding: 28px 32px;
  min-width: 300px;
  max-width: 460px;
  width: 90%;
  max-height: 82vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,0.85);
}

#card-rules-modal::-webkit-scrollbar { width: 4px; }
#card-rules-modal::-webkit-scrollbar-thumb { background: #5a4000; border-radius: 2px; }

#card-rules-modal h3 {
  font-size: 1.15rem;
  font-weight: bold;
  text-align: center;
  margin-bottom: 18px;
  letter-spacing: 1px;
  color: #f1c40f;
}

#card-rules-list { display: flex; flex-direction: column; gap: 0; }

.card-rule-item {
  padding: 10px 0;
  border-bottom: 1px solid #2a1e00;
}

.card-rule-item:last-child { border-bottom: none; }

.card-rule-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.card-rule-rank {
  font-weight: bold;
  font-size: 0.9rem;
  color: #f1c40f;
  min-width: 38px;
}

.card-rule-name {
  font-weight: bold;
  font-size: 0.9rem;
  color: #c8f0c8;
  flex: 1;
}

.card-rule-pending {
  font-size: 0.7rem;
  color: #7da07d;
  background: #0d2b0d;
  padding: 1px 7px;
  border-radius: 10px;
  white-space: nowrap;
}

.card-rule-desc {
  font-size: 0.8rem;
  color: #9fb89f;
  line-height: 1.55;
}

/* ═══════════════════════════════════════════
   初回プレイ向けチュートリアル
═══════════════════════════════════════════ */
.tutorial-coach {
  position: fixed;
  right: 18px;
  bottom: 18px;
  transform: none;
  z-index: 170;
  width: min(460px, calc(100vw - 28px));
  padding: 16px;
  background: rgba(8, 27, 8, 0.96);
  border: 1px solid rgba(241,196,15,0.55);
  border-radius: 12px;
  box-shadow: 0 10px 34px rgba(0,0,0,0.62), 0 0 22px rgba(241,196,15,0.12);
  color: var(--text-primary);
}

.tutorial-coach-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--accent-gold);
  font-size: 0.78rem;
  font-weight: bold;
  letter-spacing: 1px;
}

.tutorial-close-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid rgba(241,196,15,0.35);
  border-radius: 8px;
  color: #d8efd8;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.tutorial-close-btn:hover {
  background: rgba(241,196,15,0.12);
}

.tutorial-coach h3 {
  margin: 0 0 8px;
  color: #f7dc6f;
  font-size: 1.02rem;
  line-height: 1.35;
}

.tutorial-coach p {
  margin: 0;
  color: #c8e6c8;
  font-size: 0.86rem;
  line-height: 1.65;
}

.tutorial-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 12px;
}

.tutorial-progress-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border: 1px solid rgba(159,207,159,0.24);
  border-radius: 999px;
  color: #7da07d;
  background: rgba(0,0,0,0.22);
  font-size: 0.68rem;
  font-weight: bold;
}

.tutorial-progress-pill.done {
  border-color: rgba(241,196,15,0.58);
  color: #f7dc6f;
  background: rgba(241,196,15,0.13);
}

.tutorial-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.tutorial-actions .btn-primary,
.tutorial-actions .btn-ghost {
  padding: 8px 14px;
  font-size: 0.82rem;
}

.tutorial-highlight {
  position: relative;
  z-index: 160;
  outline: 2px solid var(--accent-gold);
  outline-offset: 4px;
  box-shadow: 0 0 0 4px rgba(241,196,15,0.14), 0 0 18px rgba(241,196,15,0.45) !important;
}

/* ═══════════════════════════════════════════
   エフェクトバナー（8切り・革命など）
═══════════════════════════════════════════ */
#effect-banner {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 350;
}

#effect-text {
  display: inline-block;
  font-size: 3.2rem;
  font-weight: bold;
  letter-spacing: 6px;
  padding: 14px 36px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.65);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.9);
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.5);
  animation: banner-pop 1.2s ease-out forwards;
}

#effect-text.effect-banner-revolution {
  background: rgba(70, 0, 0, 0.78);
  box-shadow: 0 0 42px rgba(231,76,60,0.62), 0 4px 32px rgba(0,0,0,0.5);
  animation: revolution-banner-pop 1.2s ease-out forwards;
}

#effect-text.effect-banner-lock {
  background: rgba(4, 34, 58, 0.78);
  box-shadow: 0 0 36px rgba(93,173,226,0.48), 0 4px 32px rgba(0,0,0,0.5);
}

#effect-text.effect-banner-reverse {
  background: rgba(42, 12, 72, 0.78);
  box-shadow: 0 0 36px rgba(155,89,182,0.50), 0 4px 32px rgba(0,0,0,0.5);
}

#effect-text.effect-banner-nullify {
  background: rgba(36, 12, 46, 0.80);
  box-shadow: 0 0 36px rgba(155,89,182,0.48), 0 4px 32px rgba(0,0,0,0.5);
}

#effect-text.effect-banner-cut {
  background: rgba(58, 32, 0, 0.78);
  box-shadow: 0 0 36px rgba(243,156,18,0.50), 0 4px 32px rgba(0,0,0,0.5);
}

@keyframes banner-pop {
  0%   { opacity: 0; transform: scale(0.4); }
  12%  { opacity: 1; transform: scale(1.18); }
  22%  { transform: scale(1.0); }
  72%  { opacity: 1; transform: scale(1.0); }
  100% { opacity: 0; transform: scale(1.0) translateY(-24px); }
}

@keyframes revolution-banner-pop {
  0%   { opacity: 0; transform: scale(0.35) rotate(-2deg); }
  14%  { opacity: 1; transform: scale(1.22) rotate(1deg); }
  28%  { transform: scale(1.0) rotate(0); }
  72%  { opacity: 1; transform: scale(1.0); }
  100% { opacity: 0; transform: scale(1.04) translateY(-26px); }
}

/* ═══════════════════════════════════════════
   アニメーションオーバーレイ
═══════════════════════════════════════════ */
#anim-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 300;
  overflow: hidden;
}

/* アニメーション中のカードクローン */
.anim-card {
  position: fixed;
  margin: 0;
  pointer-events: none;
  will-change: left, top, transform;
}

/* ═══════════════════════════════════════════
   スマホ対応レイアウト (max-width: 640px)
═══════════════════════════════════════════ */
@media (max-width: 640px) {

  /* ── フォームスクリーン ── */
  .screen-overlay {
    align-items: flex-start;
    min-height: 100dvh;
    padding: 12px;
    overflow-y: auto;
  }

  .form-box {
    padding: 24px 16px;
    gap: 12px;
    border-radius: 12px;
  }

  .create-box {
    max-height: none;
    overflow-y: visible;
  }

  .form-box h1 { font-size: 1.8rem; letter-spacing: 2px; }
  .form-box h2 { font-size: 1.2rem; }

  #rules-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
  }

  .rule-btn {
    min-height: 42px;
  }

  /* ── ゲームボード全体: スクロール可能に ── */
  #game-board {
    height: auto;
    min-height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
  }

  /* ── ヘッダー: コンパクト ── */
  #header {
    flex-wrap: wrap;
    gap: 4px;
    padding: 5px 8px;
  }

  #game-title { font-size: 0.95rem; letter-spacing: 1px; flex: none; }

  #zen-mode-badge, #revolution-badge, #j-back-badge,
  #suit-lock-badge, #six-strongest-badge,
  #effect-nullified-badge, #ten-nullified-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
  }

  .header-btn, #new-game-btn {
    font-size: 0.68rem;
    padding: 4px 8px;
  }

  /* ── ゲームコンテンツ: 縦積み ── */
  #game-content {
    flex-direction: column;
    overflow: visible;
    height: auto;
  }

  #main-content {
    overflow: visible;
    padding: 6px;
    gap: 6px;
    flex: none;
  }

  /* ── テーブルラッパー: カラム積み（opp-row → table-area） ── */
  #table-wrapper {
    display: flex !important;
    flex-direction: column;
    gap: 4px;
    flex: none;
    min-height: 0;
  }

  /* opp-row: 相手枠を横スクロール1列に */
  #opp-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  #opp-row::-webkit-scrollbar { display: none; }

  /* opp-slot: モバイルでは opp-row 内の flex アイテム */
  .opp-slot {
    flex: none;
    width: auto;
    align-items: center;
    justify-content: center;
  }

  /* 空のスロットは非表示 */
  .opp-slot:empty { display: none; }

  /* 対戦相手スロットを時計回り（左→左上→上→右上→右）に並べる */
  #opp-left      { order: 1; }
  #opp-top-left  { order: 2; }
  #opp-top       { order: 3; }
  #opp-top-right { order: 4; }
  #opp-right     { order: 5; }

  /* table-area は全幅 */
  #table-area {
    width: 100%;
    flex: none;
    padding: 10px;
    min-height: 218px;
    grid-template-rows: auto auto minmax(64px, auto) auto auto;
    gap: 6px;
  }

  #table-state-chips {
    min-height: 20px;
    gap: 4px;
  }

  .table-state-chip {
    min-height: 20px;
    padding: 1px 7px;
    font-size: 0.63rem;
  }

  #table-cards {
    min-height: 64px;
    gap: 4px;
  }

  .card.table-card {
    width: 46px;
    height: 66px;
  }

  #table-hint {
    font-size: 0.72rem;
    min-height: 16px;
  }

  /* 対戦相手ボックス: コンパクト */
  .cpu-player {
    width: auto;
    min-width: 90px;
    max-width: 140px;
    padding: 6px 8px;
    font-size: 0.82rem;
  }

  #opp-left .cpu-player,
  #opp-right .cpu-player {
    width: auto;
    min-width: 90px;
    max-width: 140px;
  }

  /* カード: やや小さく */
  .card {
    width: 42px;
    height: 60px;
    font-size: 0.78rem;
    padding: 2px 3px;
  }

  .card .rank-top, .card .rank-bottom { font-size: 0.72rem; }
  .card .suit-center { font-size: 1.2rem; }

  /* ── プレイヤーエリア ── */
  #player-area {
    padding: 8px 10px;
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  #player-hand {
    gap: 4px;
    min-height: 60px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  #player-hand .card { flex-shrink: 0; }

  /* ── アクションボタン（固定フッター） ── */
  #action-area {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 50;
    background: rgba(7, 15, 7, 0.97);
    border-top: 2px solid var(--border-color);
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    flex-wrap: wrap;
    gap: 8px;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }

  #play-btn, #pass-btn {
    padding: 12px 0;
    font-size: 1rem;
    flex: 1;
    min-width: 80px;
    border-radius: 10px;
  }

  #one-chance-btn, #one-chance-skip-btn {
    font-size: 0.82rem;
    padding: 8px 14px;
    width: 100%;
  }

  #selected-info {
    font-size: 0.74rem;
  }

  #selected-effect-preview {
    max-width: 100%;
    font-size: 0.72rem;
    min-height: 22px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* フッター分のスクロール余白（#log-toggle-btn/#log-area がフッターに隠れないよう） */
  #game-content {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }

  /* ── ログトグルボタン（モバイルのみ表示） ── */
  #log-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 7px 12px;
    background: var(--bg-deep);
    border: none;
    border-top: 2px solid var(--border-muted);
    color: var(--text-muted);
    font-size: 0.78rem;
    cursor: pointer;
  }

  /* ── ログエリア: トグル式 ── */
  #log-area {
    width: 100%;
    border-left: none;
    flex-shrink: 0;
    max-height: 0 !important;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  #log-area.log-expanded {
    max-height: 200px !important;
    border-top: 2px solid var(--border-muted);
  }

  #log-scroll { max-height: 180px; }

  .log-item { font-size: 0.75rem; }

  /* ── ミニログ / ターン状態バー: モバイルサイズ ── */
  #mini-log { padding: 2px 10px; }
  #turn-status-bar { padding: 5px 10px; font-size: 0.75rem; }

  /* ── 捨て札 / 受取 / 渡すエリア ── */
  #discard-area, #pickup-area, #give-area {
    flex-wrap: wrap;
    padding: 8px 10px;
    gap: 8px;
  }

  /* ── ゲーム終了モーダル ── */
  #end-modal {
    padding: 20px 16px;
    min-width: 0;
    width: 94vw;
    border-radius: 12px;
  }

  #end-modal h2 { font-size: 1.2rem; margin-bottom: 14px; }

  .result-rank { min-width: 60px; font-size: 0.88rem; }
  .result-name { font-size: 0.88rem; }

  /* ── エフェクトバナー ── */
  #effect-text {
    font-size: 1.8rem;
    letter-spacing: 2px;
    padding: 10px 18px;
  }

  /* ── チュートリアル ── */
  .tutorial-coach {
    left: 10px;
    right: 10px;
    bottom: calc(84px + env(safe-area-inset-bottom));
    transform: none;
    width: auto;
    max-height: 42vh;
    overflow-y: auto;
    padding: 12px;
    border-radius: 10px;
  }

  .tutorial-coach h3 {
    font-size: 0.95rem;
  }

  .tutorial-coach p {
    font-size: 0.8rem;
  }

  .tutorial-actions {
    flex-wrap: wrap;
  }

  .tutorial-actions .btn-primary,
  .tutorial-actions .btn-ghost {
    flex: 1;
    min-width: 120px;
  }

  /* ── ルール / カード効果モーダル ── */
  #card-rules-modal, #rules-modal {
    max-height: 88vh;
    padding: 16px 14px;
    width: 96vw;
  }

  /* ── 捨て札 / 除外カードパイル ── */
  #zen-piles {
    flex-direction: row;
    gap: 8px;
    justify-content: center;
    margin-top: 0;
  }

  /* ── カード確認モーダル ── */
  #confirm-modal {
    padding: 20px 16px;
    width: 94vw;
  }
}

/* ── 認証ウィジェット ───────────────────────────────── */
.auth-widget {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.auth-display-name {
  color: #c8e6c8;
  font-size: 0.85rem;
  font-weight: 600;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-nav-link {
  position: relative;
  color: #c8e6c8;
  font-size: 0.82rem;
  text-decoration: none;
  white-space: nowrap;
}

.friend-pending-badge {
  position: absolute;
  top: -10px;
  right: -14px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #e74c3c;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
}

.btn-ghost-sm {
  background: transparent;
  border: 1px solid #4a7c4a;
  border-radius: 6px;
  color: #a8d5a8;
  cursor: pointer;
  font-size: 0.78rem;
  padding: 4px 10px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn-ghost-sm:hover {
  background: #2e6b2e;
  color: #e0f0e0;
}

/* ── 認証モーダル ───────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 400;
  overflow-y: auto;
  padding: 24px 16px;
}

.auth-modal-box {
  max-width: 420px;
  width: 90%;
  padding: 32px 28px;
}

.form-title {
  font-size: 1.4rem;
  font-weight: bold;
  text-align: center;
  letter-spacing: 1px;
}

.auth-modal-desc {
  color: #a0c8a0;
  font-size: 0.85rem;
  margin: -8px 0 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-label {
  font-size: 0.85rem;
  color: #9fcf9f;
}

.form-input {
  padding: 11px 14px;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid #4a8a4a;
  background: #0d2b0d;
  color: #f0f0f0;
  outline: none;
  width: 100%;
}
.form-input:focus { border-color: #7dca7d; }

.auth-modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.form-hint {
  color: #7aaa7a;
  font-size: 0.78rem;
  margin: 4px 0 0;
}

.form-error {
  color: #ff8a8a;
  font-size: 0.85rem;
  min-height: 1.2em;
}

.required {
  color: #ff8a8a;
}

/* ── アバター選択グリッド ── */
.avatar-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.avatar-opt {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  border: 2px solid #2e5a2e;
  background: #0d2b0d;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s;
  padding: 0;
  color: #e8f8e8;
}

.avatar-opt:hover {
  border-color: #4ab84a;
  background: #1a4d1a;
}

.avatar-opt.selected {
  border-color: #f1c40f;
  background: #1a4d1a;
  box-shadow: 0 0 0 2px rgba(241, 196, 15, 0.35);
}

/* ── 認証ウィジェット（アバター小） ── */
.auth-avatar-sm {
  font-size: 1.1rem;
  line-height: 1;
}

/* ── フォーム補助 ── */
.form-textarea {
  resize: vertical;
  min-height: 72px;
  font-family: inherit;
  line-height: 1.6;
}

.form-input-gap {
  margin-top: 6px;
  display: block;
}

/* ── 危険操作ボタン ── */
.btn-danger {
  background: #8b1a1a;
  border: 1px solid #c0392b;
  color: #f0f0f0;
  padding: 8px 20px;
  border-radius: var(--radius-btn);
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.15s;
}

.btn-danger:hover {
  background: #c0392b;
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid #6b1a1a;
  color: #ff8a8a;
  padding: 8px 16px;
  border-radius: var(--radius-btn);
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s, border-color 0.15s;
  width: 100%;
}

.btn-danger-outline:hover {
  background: rgba(139, 26, 26, 0.2);
  border-color: #c0392b;
}

/* ── モーダル区切り・削除警告 ── */
.modal-divider {
  border: none;
  border-top: 1px solid #2e5a2e;
  margin: 16px 0 14px;
}

.delete-title {
  color: #ff8a8a;
}

.delete-warning {
  background: rgba(139, 26, 26, 0.15);
  border: 1px solid #6b1a1a;
  border-radius: 8px;
  padding: 12px 14px;
  color: #ff8a8a;
  font-size: 0.88rem;
  line-height: 1.6;
  margin-bottom: 16px;
}

/* ── フレンド機能 ─────────────────────────────────── */
.friend-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -10px 0 24px;
}

.friend-action-btn {
  width: auto;
}

.friend-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(74, 184, 74, 0.16);
  border: 1px solid #4ab84a;
  color: #c8f0c8;
  font-size: 0.84rem;
}

.friends-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.friends-main {
  flex: 1;
  width: min(900px, calc(100% - 40px));
  margin: 0 auto;
  padding: 36px 0 60px;
}

.friends-hero {
  margin-bottom: 22px;
}

.friends-hero h1 {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.friends-hero p {
  color: #a8c8a8;
}

.friends-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  gap: 18px;
}

.friends-panel {
  background: #1a4d1a;
  border: 2px solid #2e8b2e;
  border-radius: 14px;
  padding: 22px;
}

.friends-panel h2 {
  font-size: 1.08rem;
  margin-bottom: 14px;
}

.friend-request-form {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.friend-request-form .form-input {
  flex: 1;
}

.friend-list,
.pending-list,
.sent-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.friends-subsection-title {
  margin-top: 22px;
}

.friend-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #0d2b0d;
  border: 1px solid #2e5a2e;
  border-radius: 10px;
  padding: 12px;
}

.friend-card-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #1a4d1a;
  border: 1px solid #2e8b2e;
}

.friend-card-main {
  flex: 1;
  min-width: 0;
}

.friend-card-name {
  color: #e8f8e8;
  font-weight: 700;
  text-decoration: none;
}

.friend-card-meta {
  color: #8cb78c;
  font-size: 0.78rem;
  margin-top: 3px;
}

.online-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #556655;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.06);
}

.online-dot.is-online {
  background: #2ecc71;
  box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.18);
}

.friend-card-actions {
  display: flex;
  gap: 8px;
}

.friends-empty,
.friends-message {
  color: #9fcf9f;
  font-size: 0.88rem;
}

.friends-message.error {
  color: #ff8a8a;
}

.friend-invite-context {
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.friend-invite-context .section-kicker {
  margin-bottom: 4px;
}

.friend-return-link {
  width: auto;
  text-decoration: none;
  white-space: nowrap;
}

.invite-link-btn {
  margin: 0 auto 14px;
}

.notifications-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.notifications-main {
  flex: 1;
  width: min(900px, calc(100% - 40px));
  margin: 0 auto;
  padding: 36px 0 60px;
}

.notifications-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.notifications-header-row h2 {
  margin-bottom: 0;
}

.notification-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.pwa-notification-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pwa-notification-panel.hidden {
  display: none;
}

.pwa-notification-panel .btn-ghost.is-enabled {
  border-color: #4ab84a;
  color: #d9ffd9;
  opacity: 1;
}

.pwa-notification-status {
  color: #b8d8b8;
  font-size: 0.82rem;
  white-space: nowrap;
}

.notification-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notification-card {
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: 10px;
  border: 1px solid #2e5a2e;
  background: #0d2b0d;
  padding: 14px;
}

.notification-card.is-unread {
  border-color: #4ab84a;
  box-shadow: inset 3px 0 0 #4ab84a;
}

.notification-card.is-read {
  opacity: 0.78;
}

.notification-card-main {
  flex: 1;
  min-width: 0;
}

.notification-title {
  color: #e8f8e8;
  font-weight: 700;
}

.notification-body {
  color: #b8d8b8;
  font-size: 0.9rem;
  margin-top: 5px;
}

.notification-meta {
  color: #8cb78c;
  font-size: 0.78rem;
  margin-top: 5px;
}

.notification-card-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* モーダルが長くなったときにスクロール可能にする */
.auth-modal-box {
  max-height: 90vh;
  overflow-y: auto;
}

/* ─────────────────────────────────────────────────── */

@media (max-width: 760px) {
  .home-screen {
    align-items: stretch;
    padding: 0;
    overflow-y: visible;
  }

  .site-nav {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 16px;
  }

  .site-nav nav {
    justify-content: flex-start;
    font-size: 0.8rem;
    gap: 8px 12px;
    margin-left: 0;
  }

  .auth-widget {
    margin-left: 0;
    flex-wrap: wrap;
  }

  .home-stage {
    min-height: auto;
    padding: 14px 12px 26px;
  }

  .home-content,
  .site-footer,
  .static-main {
    width: calc(100% - 24px);
  }

  .home-content {
    padding: 20px 0 28px;
  }

  .content-section,
  .static-section {
    padding: 20px 16px;
  }

  .intro-section,
  .guide-grid,
  .rule-summary,
  .guide-link-grid {
    grid-template-columns: 1fr;
  }

  .card-preview {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 6px;
  }

  .content-section h2,
  .static-hero h1 {
    font-size: 1.35rem;
  }

  .static-main {
    padding: 28px 0 52px;
  }

  .friends-main {
    width: calc(100% - 24px);
    padding: 20px 0 42px;
  }

  .notifications-main {
    width: calc(100% - 24px);
    padding: 20px 0 42px;
  }

  .friends-grid {
    grid-template-columns: 1fr;
  }

  .friend-request-form,
  .friend-card,
  .friend-invite-context {
    flex-direction: column;
    align-items: stretch;
  }

  .friend-card-actions {
    width: 100%;
  }

  .friend-card-actions button {
    flex: 1;
  }

  .notifications-header-row,
  .notification-card {
    flex-direction: column;
    align-items: stretch;
  }

  .notification-toolbar,
  .pwa-notification-panel {
    justify-content: flex-start;
  }

  .notification-card-actions button {
    flex: 1;
  }
}
