/* ===================================================
   BOARD ARENA - Platform Styles
   =================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

input, textarea {
  user-select: text;
  -webkit-user-select: text;
}

@property --tone {
  syntax: '<color>';
  inherits: true;
  initial-value: #2a2c30;
}

:root {
  color-scheme: dark;

  /* 背景・面 */
  --bg: #0e0e0f;
  --bg-raised: #161618;
  --bg-sunken: #0a0a0b;
  --surface: #1c1c1f;
  --surface-hover: #252528;

  /* 境界線 */
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);

  /* 文字色 */
  --text: #ecebe6;
  --text-2: #a8a6a0;
  --text-3: #6f6d68;
  --text-inverse: #111111;

  /* 状態色 */
  --ok: #8fc79a;

  /* タイポグラフィ */
  --font-ui: 'Zen Kaku Gothic New', 'Hiragino Sans', 'Yu Gothic UI', 'Meiryo', sans-serif;
  --font-display: 'Marcellus', 'Times New Roman', serif;

  /* レイアウト */
  --radius: 4px;
  --wrap: 1280px;
  --gutter: clamp(16px, 4vw, 48px);
  --header-h: 64px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

html, body {
  width: 100%;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button {
  font-family: inherit;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.hidden { display: none !important; }

/* ===================================================
   1. HEADER
   =================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(14, 14, 15, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 17px;
  letter-spacing: 0.32em;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.wordmark-sm {
  font-size: 12px;
  cursor: default;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.net-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.net-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-3);
}
.net-status.online::before {
  background: var(--ok);
}

.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: none;
  border: 0;
  border-radius: var(--radius);
  color: var(--text-2);
  cursor: pointer;
  transition: color 0.2s;
}
.icon-btn:hover { color: var(--text); }
.icon-btn .sfx-mute { display: none; }
.icon-btn.muted .sfx-wave { display: none; }
.icon-btn.muted .sfx-mute { display: inline; }

.profile-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 0;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s;
}
.profile-btn:hover { color: var(--text); }
.profile-initial {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 12px;
}

/* ===================================================
   2. VIEW PANELS
   =================================================== */
.view-panel {
  display: none;
  flex: 1;
}
.view-panel.active {
  display: flex;
  flex-direction: column;
}
#game-view.view-panel {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 16px 24px 32px;
}

/* ===================================================
   3. COVER (一覧・注目・詳細で共通の表紙)
   =================================================== */
.cover {
  --tone: #2a2c30;
  position: relative;
  aspect-ratio: 3 / 4;
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 3px;
  color: #f1ece2;
  background:
    radial-gradient(120% 75% at 25% 0%, rgba(255, 255, 255, 0.14), transparent 55%),
    radial-gradient(90% 60% at 50% 120%, rgba(0, 0, 0, 0.45), transparent 70%),
    var(--tone);
}

.cover-frame {
  position: absolute;
  inset: 5cqw;
  border: 1px solid rgba(241, 236, 226, 0.22);
  pointer-events: none;
}

.cover-latin {
  font-family: var(--font-display);
  font-size: var(--latin-size, 12cqw);
  line-height: 1.12;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  padding: 0 12cqw;
  text-wrap: balance;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}
.cover-latin::after {
  content: '';
  display: block;
  width: 12cqw;
  height: 1px;
  margin: 6cqw auto 0;
  background: rgba(241, 236, 226, 0.5);
}

.cover-mark {
  position: absolute;
  bottom: 11cqw;
  padding-left: 0.32em;
  font-family: var(--font-display);
  font-size: 3.6cqw;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(241, 236, 226, 0.5);
}

/* ===================================================
   4. HERO (注目のタイトル)
   =================================================== */
.hero {
  --tone: #2a2c30;
  position: relative;
  isolation: isolate;
  margin-top: calc(var(--header-h) * -1);
  padding: calc(var(--header-h) + clamp(40px, 8vh, 96px)) 0 0;
  min-height: min(780px, 94vh);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  background:
    radial-gradient(60% 80% at 76% 42%, color-mix(in srgb, var(--tone) 80%, transparent), transparent 70%),
    linear-gradient(180deg, color-mix(in srgb, var(--tone) 28%, var(--bg)) 0%, var(--bg) 100%);
  transition: --tone 0.9s var(--ease);
}

.hero-inner {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr);
  align-items: center;
  gap: 48px;
}

.hero-copy {
  max-width: 640px;
}

.hero-eyebrow {
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--text-2);
  margin-bottom: 20px;
}

.hero-title {
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: 0.02em;
  margin-bottom: 20px;
  word-break: auto-phrase;
  text-wrap: balance;
}

.hero-desc {
  max-width: 30em;
  font-size: 16px;
  line-height: 1.85;
  color: var(--text-2);
  margin-bottom: 12px;
}

.hero-meta {
  font-size: 13px;
  color: var(--text-3);
  letter-spacing: 0.04em;
  margin-bottom: 36px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* 表紙を箱として立体的に置く */
.hero-art {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 1800px;
  padding: 24px 0 48px;
}
.hero-art::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 28px;
  width: clamp(220px, 26vw, 360px);
  height: 36px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.55), transparent);
  filter: blur(4px);
  z-index: -1;
}

.hero-box {
  position: relative;
  width: clamp(220px, 23vw, 320px);
  transform: rotateY(-22deg) rotateX(2deg);
  transform-style: preserve-3d;
}
.hero-box .cover {
  box-shadow: 0 50px 90px -30px rgba(0, 0, 0, 0.75);
}
.hero-box-side {
  position: absolute;
  top: 0;
  left: 100%;
  width: 34px;
  height: 100%;
  transform-origin: left center;
  transform: rotateY(90deg);
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--tone) 72%, #000),
    color-mix(in srgb, var(--tone) 48%, #000));
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.08);
}

/* 切り替え時のフェード */
.is-entering .hero-title,
.is-entering .hero-desc,
.is-entering .hero-meta {
  animation: heroRise 0.8s var(--ease) both;
}
.is-entering .hero-desc { animation-delay: 0.06s; }
.is-entering .hero-meta { animation-delay: 0.12s; }
.is-entering .hero-box {
  animation: heroBoxIn 1s var(--ease) both;
}

@keyframes heroRise {
  from { opacity: 0; transform: translateY(12px); }
}
@keyframes heroBoxIn {
  from { opacity: 0; transform: rotateY(-34deg) rotateX(2deg) translateX(24px); }
}

/* タイトル切り替えナビ */
.hero-nav {
  list-style: none;
  display: flex;
  gap: 36px;
  margin-top: 24px;
  border-top: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.hero-nav::-webkit-scrollbar { display: none; }

.hero-nav-item {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 16px 0 20px;
  background: none;
  border: 0;
  color: var(--text-3);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s;
}
.hero-nav-item:hover { color: var(--text-2); }
.hero-nav-item.active { color: var(--text); }

.hero-nav-index {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

.hero-nav-bar {
  position: absolute;
  top: -1px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--text);
  transform-origin: left;
  transform: scaleX(0);
}
.hero-nav-item.active .hero-nav-bar {
  animation: heroProgress 8s linear forwards;
}
.hero:hover .hero-nav-item.active .hero-nav-bar {
  animation-play-state: paused;
}

@keyframes heroProgress {
  to { transform: scaleX(1); }
}

/* ===================================================
   5. LIBRARY (ゲーム一覧)
   =================================================== */
.library {
  padding-top: 72px;
  padding-bottom: 112px;
}

.library-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 12px;
}

.library-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.library-count {
  margin-left: 8px;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  color: var(--text-3);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 220px;
  padding: 6px 0;
  color: var(--text-3);
  border-bottom: 1px solid var(--line-strong);
  transition: border-color 0.2s, color 0.2s;
}
.search-field:focus-within {
  color: var(--text-2);
  border-color: var(--text-2);
}
.search-field input {
  width: 100%;
  background: none;
  border: 0;
  outline: none;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
}
.search-field input::placeholder { color: var(--text-3); }

.library-tabs {
  display: flex;
  gap: 28px;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.library-tabs::-webkit-scrollbar { display: none; }

.library-tab {
  position: relative;
  padding: 12px 0;
  background: none;
  border: 0;
  color: var(--text-3);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s;
}
.library-tab:hover { color: var(--text-2); }
.library-tab.active { color: var(--text); }
.library-tab.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--text);
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 44px 24px;
}

.tile {
  cursor: pointer;
  outline: none;
}

.tile-art {
  position: relative;
  margin-bottom: 14px;
  transition: transform 0.35s var(--ease);
}
.tile .cover {
  box-shadow: 0 12px 24px -14px rgba(0, 0, 0, 0.7);
  transition: box-shadow 0.35s var(--ease);
}
.tile:hover .tile-art,
.tile:focus-visible .tile-art {
  transform: translateY(-6px);
}
.tile:hover .cover {
  box-shadow: 0 30px 44px -20px rgba(0, 0, 0, 0.85);
}
.tile:focus-visible .cover {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

.tile-play {
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 7%;
  padding: 9px 0;
  background: var(--text);
  color: var(--text-inverse);
  border: 0;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  cursor: pointer;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s, transform 0.25s var(--ease), background 0.2s;
}
.tile-play:hover { background: #ffffff; }
.tile:hover .tile-play {
  opacity: 1;
  transform: none;
}

.tile-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
  margin-bottom: 4px;
}
.tile-meta {
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: 0.02em;
}

.no-results {
  padding: 64px 0;
  text-align: center;
  color: var(--text-2);
}
.no-results p { margin-bottom: 12px; }

/* ===================================================
   6. FOOTER
   =================================================== */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 36px;
  font-size: 12px;
  color: var(--text-3);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* ===================================================
   7. GAME PLAY STAGE
   =================================================== */
.game-compact-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 8px 16px;
  margin-bottom: 12px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.gcb-left, .gcb-center, .gcb-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gcb-back-btn {
  padding: 6px 4px;
  background: none;
  border: 0;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s;
}
.gcb-back-btn:hover { color: var(--text); }

.active-game-title {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

.player-box {
  display: flex;
  align-items: center;
}
.p-name {
  font-size: 13px;
  font-weight: 700;
}
.p1-box .p-name { color: #a9bce3; }
.p2-box .p-name { color: #e3b394; }

.vs-badge {
  font-size: 12px;
  color: var(--text-3);
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.emote-inline-group {
  display: flex;
  gap: 4px;
}
.emote-btn {
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.emote-btn:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.game-mount-point {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: stretch;
  width: 100%;
  min-height: 520px;
  padding: 24px;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.chat-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  padding: 10px 22px;
  background: var(--text);
  color: var(--text-inverse);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  animation: toastIn 0.25s var(--ease);
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
}

/* ===================================================
   8. BUTTONS
   =================================================== */
.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.06em;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.btn-primary,
.btn-success {
  background: var(--text);
  color: var(--text-inverse);
}
.btn-primary:hover,
.btn-success:hover {
  background: #ffffff;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line-strong);
}
.btn-secondary:hover {
  background: var(--surface-hover);
}

.btn-ghost,
.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.28);
}
.btn-ghost:hover,
.btn-outline:hover {
  border-color: rgba(255, 255, 255, 0.6);
}

.btn-subtle {
  background: none;
  border: 0;
  color: var(--text-2);
  font-size: 14px;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 4px;
  cursor: pointer;
}
.btn-subtle:hover { color: var(--text); }

.btn-block { width: 100%; }
.btn-lg { padding: 14px 32px; font-size: 15px; }
.btn-sm { padding: 6px 12px; font-size: 12px; letter-spacing: 0.04em; }

/* ===================================================
   9. MODALS
   =================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  background: rgba(5, 5, 6, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-card {
  width: 100%;
  max-width: 460px;
  padding: 32px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  box-shadow: 0 40px 80px -24px rgba(0, 0, 0, 0.7);
  animation: modalIn 0.25s var(--ease);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px); }
}

.modal-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.modal-title {
  font-size: 20px;
  font-weight: 700;
}
.modal-desc {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.7;
  margin: 8px 0 24px;
}

.btn-close-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text-2);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.btn-close-icon:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.modal-divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
  color: var(--text-3);
  font-size: 12px;
}
.modal-divider::before,
.modal-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--line);
}
.modal-divider span { padding: 0 12px; }

.room-info-card {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
}
.room-code-tag {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}
.room-code-tag span {
  letter-spacing: 0.2em;
}
.guide-text {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 12px;
}
.toast-msg {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ok);
}

.join-input-group {
  display: flex;
  gap: 8px;
}
.join-input-group input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  background: var(--bg-sunken);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  outline: none;
}
.join-input-group input:focus { border-color: var(--text-2); }
.modal-footer { margin-top: 20px; }

/* 詳細・遊び方 */
.rule-modal-card {
  max-width: 640px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.rule-head {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  align-items: end;
  gap: 20px;
  padding: 28px 28px 24px;
  border-bottom: 1px solid var(--line);
}
.rule-head .btn-close-icon { align-self: start; }
.rule-cover { width: 88px; }
.rule-cover .cover { border-radius: 2px; }
.rule-head-text h2 {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 6px;
}
.rule-meta {
  font-size: 13px;
  color: var(--text-3);
}

.rule-modal-body {
  overflow-y: auto;
  padding: 0 28px;
}
.rule-block {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}
.rule-block:last-child { border-bottom: 0; }
.rule-block-title {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--text-3);
  margin-bottom: 10px;
}
.rule-block-text {
  font-size: 14px;
  line-height: 1.85;
  color: var(--text-2);
}
.rule-list-items {
  padding-left: 1.4em;
  font-size: 14px;
  line-height: 1.85;
  color: var(--text-2);
}
.rule-list-items li { margin-bottom: 6px; }
.rule-list-items li::marker {
  font-family: var(--font-display);
  color: var(--text-3);
}

.rule-footer {
  margin-top: 0;
  padding: 20px 28px 28px;
  border-top: 1px solid var(--line);
}

/* プロフィール */
.profile-modal-card {
  max-width: 520px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}
.profile-summary-box {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.avatar-current {
  width: 56px;
  height: 56px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 30px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}
.avatar-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}
.av-opt {
  padding: 4px;
  font-size: 16px;
  border-radius: var(--radius);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s, background 0.2s;
}
.av-opt:hover,
.av-opt.selected {
  opacity: 1;
  background: var(--surface);
}
.name-edit-group { flex: 1; }
.input-lbl {
  display: block;
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 6px;
}
.modal-input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-sunken);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.modal-input:focus { border-color: var(--text-2); }

.stats-counters-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 28px;
}
.stat-pill {
  display: flex;
  flex-direction: column;
  padding: 0 16px;
  border-left: 1px solid var(--line);
}
.stat-pill:first-child {
  padding-left: 0;
  border-left: 0;
}
.stat-val {
  font-size: 28px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.stat-lbl {
  font-size: 12px;
  color: var(--text-3);
}

.achievements-section {
  overflow-y: auto;
  max-height: 260px;
}
.ach-title {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--text-3);
  margin-bottom: 8px;
}
.achievements-list {
  display: flex;
  flex-direction: column;
}
.ach-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.ach-item:last-child { border-bottom: 0; }
.ach-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}
.ach-info h5 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 2px;
}
.ach-info p {
  font-size: 12px;
  color: var(--text-2);
}
.ach-status {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
}
.ach-item.unlocked .ach-status { color: var(--text); }
.ach-item:not(.unlocked) .ach-icon,
.ach-item:not(.unlocked) .ach-info { opacity: 0.45; }

/* ===================================================
   10. RESPONSIVE
   =================================================== */
@media (max-width: 900px) {
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .hero-art {
    order: -1;
    padding: 0 0 32px;
  }
  .hero-box { width: clamp(150px, 38vw, 220px); }
  .hero-art::after { width: clamp(150px, 42vw, 240px); bottom: 12px; }
  .hero-title { font-size: clamp(30px, 8vw, 44px); }
}

@media (max-width: 640px) {
  .net-status { display: none; }
  .header-right { gap: 12px; }
  .profile-name { display: none; }
  .wordmark { font-size: 15px; letter-spacing: 0.26em; }

  .hero { min-height: 0; }
  .hero-desc { font-size: 15px; }
  .hero-actions .btn { flex: 1; }
  .hero-nav { gap: 24px; }

  .library { padding-top: 48px; padding-bottom: 72px; }
  .library-head { flex-direction: column; align-items: stretch; gap: 16px; }
  .search-field { width: 100%; }
  .library-tabs { gap: 22px; margin-bottom: 28px; }
  .library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 32px 16px;
  }

  .rule-head { grid-template-columns: 64px minmax(0, 1fr) auto; padding: 20px; gap: 16px; }
  .rule-cover { width: 64px; }
  .rule-head-text h2 { font-size: 20px; }
  .rule-modal-body { padding: 0 20px; }
  .rule-footer { padding: 16px 20px 20px; }

  #game-view.view-panel { padding: 10px 10px 24px; }
  .game-compact-bar { padding: 10px 12px; flex-direction: column; align-items: stretch; gap: 10px; }
  .gcb-left, .gcb-center, .gcb-right { flex-wrap: wrap; justify-content: flex-start; gap: 8px; min-width: 0; }
  .gcb-center { font-size: 12px; }
  .p-name {
    display: inline-block;
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
  }
  .emote-inline-group {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .emote-inline-group::-webkit-scrollbar { display: none; }
  .emote-btn { flex: 0 0 auto; white-space: nowrap; }
  .gcb-right .btn { flex: 1 1 auto; }
  .game-mount-point { padding: 8px; }
}

@media (hover: none) {
  .tile-play { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hero { transition: none; }
  .is-entering .hero-title,
  .is-entering .hero-desc,
  .is-entering .hero-meta,
  .is-entering .hero-box { animation: none; }
  .hero-nav-item.active .hero-nav-bar {
    animation: none;
    transform: scaleX(1);
  }
  .tile-art, .tile .cover { transition: none; }
}

/* ===================================================
   11. GAME HUD
   2D盤面ゲーム (3D表示の13作) の操作パネルを共通の見た目にそろえる。
   各ゲームが注入する CSS より優先させるため #game-mount-point から指定する。
   =================================================== */
#game-mount-point :is(
  .othello-status-bar, .gomoku-status-bar, .c4-status-bar, .chk-status-bar, .qd-status-bar,
  .qrt-status-bar, .mancala-status-bar, .blokus-top-bar, .dab-status-bar, .bs-status-bar,
  .yct-status-bar, .cn-header-panel, .qd-action-bar, .bs-placement-bar, .cn-clue-banner,
  .cn-log-panel, .blokus-piece-controls, .blokus-tray-wrapper, .qrt-pool-card,
  .yct-score-sheet-card, .active-piece-box
) {
  background: var(--bg-raised) !important;
  border: 1px solid var(--line) !important;
  border-radius: 6px !important;
  box-shadow: none !important;
  color: var(--text);
  font-family: var(--font-ui);
}

/* 手番表示は色付きの枠をやめ、文字だけで示す */
#game-mount-point :is(.turn-badge, .cn-turn-indicator) {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding-left: 0 !important;
  color: var(--text) !important;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* CPU 対戦の切り替えなど */
#game-mount-point [class*="-mode-btn"] {
  background: transparent !important;
  border: 1px solid var(--line-strong) !important;
  border-radius: 4px !important;
  box-shadow: none !important;
  color: var(--text-2) !important;
  font: 500 12px/1.4 var(--font-ui) !important;
  letter-spacing: 0.04em;
  padding: 5px 12px !important;
}
#game-mount-point [class*="-mode-btn"]:hover {
  color: var(--text) !important;
  border-color: rgba(255, 255, 255, 0.34) !important;
}

/* 得点・残り数の小さな表示。プレイヤーの色は左の細い線で示す */
#game-mount-point :is(.sc-item, .score-pill, .blk-sc, .wall-badge, .cn-score-card, .bs-ship-counter, .yct-rolls-left) {
  background: var(--surface) !important;
  border: 1px solid var(--line) !important;
  border-radius: 3px !important;
  box-shadow: none !important;
  color: var(--text) !important;
  font-weight: 500;
}
#game-mount-point :is(.sc-item.black) { border-left: 3px solid #0b0b0b !important; }
#game-mount-point :is(.sc-item.white) { border-left: 3px solid #dcd6ca !important; }
#game-mount-point :is(.score-pill.p1-pill, .wall-badge.p1-badge, .cn-score-card.blue-card) { border-left: 3px solid #4f78a6 !important; }
#game-mount-point :is(.score-pill.p2-pill, .wall-badge.p2-badge, .cn-score-card.red-card) { border-left: 3px solid #a5473b !important; }
#game-mount-point .blk-sc.p1 { border-left: 3px solid #6f5bb0 !important; }
#game-mount-point .blk-sc.p2 { border-left: 3px solid #cf7a2b !important; }
#game-mount-point .cn-score-card.active-turn { border-color: var(--line-strong) !important; background: var(--surface-hover) !important; }
#game-mount-point .score-count { color: var(--text) !important; }
#game-mount-point :is(.sc-vs, .blk-sc-vs) { color: var(--text-3) !important; }

/* 補足の説明文 */
#game-mount-point :is(.gomoku-rule, .mancala-hint, .placement-hint, .keep-guide, .pool-header, .tray-title, .qd-hint) {
  color: var(--text-3) !important;
  font-weight: 500;
}

/* 勝敗の結果 */
#game-mount-point [class$="-result-banner"]:not(.hidden),
#game-mount-point [class*="-result-banner "]:not(.hidden) {
  background: var(--bg-raised) !important;
  border: 1px solid var(--line-strong) !important;
  border-radius: 6px !important;
  box-shadow: none !important;
  color: var(--text) !important;
}

/* 入力欄 (コードネームのヒント入力など) */
#game-mount-point :is(.clue-input, .clue-select) {
  background: var(--bg-sunken) !important;
  border: 1px solid var(--line-strong) !important;
  border-radius: 4px !important;
  color: var(--text) !important;
  font-family: var(--font-ui);
}
#game-mount-point .log-entry { color: var(--text-2); border-color: var(--line) !important; }
#game-mount-point .log-red { color: #c97a6f !important; }
#game-mount-point .log-blue { color: #7f9fc6 !important; }

/* ヨット: 3D トレイを包む枠と得点表 */
#game-mount-point .yct-dice-tray {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}
#game-mount-point .yct-score-table :is(th, td) { border-bottom-color: var(--line) !important; color: var(--text-2); }
#game-mount-point .yct-score-table th:first-child,
#game-mount-point .yct-score-table td:first-child { color: var(--text); }
#game-mount-point :is(.p1-header, .p2-header) { color: var(--text) !important; }
#game-mount-point .total-row { background: var(--surface) !important; }
#game-mount-point .score-cell.selectable {
  background: rgba(226, 184, 103, 0.12) !important;
  color: #e2b867 !important;
}
#game-mount-point .score-cell.selectable:hover { background: rgba(226, 184, 103, 0.24) !important; }

/* クアルト: 手持ちのコマを 3D と同じ木の色に */
#game-mount-point .qrt-piece { box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45) !important; }
#game-mount-point .qrt-piece.light { background: #d2b085 !important; border: 1px solid #a8835a !important; }
#game-mount-point .qrt-piece.dark { background: #7a3f28 !important; border: 1px solid #4a2214 !important; }
#game-mount-point .qrt-piece.hollow::after { background: #1a110b !important; }
#game-mount-point .qrt-piece.selected { box-shadow: 0 0 0 2px #e2b867 !important; }
#game-mount-point .active-piece-box { color: var(--text-2) !important; }

/* ブロックス: 手持ちのピース */
#game-mount-point .tray-card {
  background: var(--surface) !important;
  border: 1px solid var(--line) !important;
  box-shadow: none !important;
}
#game-mount-point .tray-card:hover { border-color: var(--line-strong) !important; }
#game-mount-point .tray-card.active { border-color: #e2b867 !important; background: var(--surface-hover) !important; }
#game-mount-point .mini-block.on-p1 { background: #6f5bb0 !important; }
#game-mount-point .mini-block.on-p2 { background: #cf7a2b !important; }

/* ゲーム内の副ボタン (2D の見た目のまま残っていた種類) */
#game-mount-point :is(.btn-warning, .btn-action, .btn-spymaster) {
  background: var(--surface) !important;
  border: 1px solid var(--line-strong) !important;
  color: var(--text) !important;
  box-shadow: none !important;
}
#game-mount-point :is(.btn-action.active, .act-btn.active) {
  background: var(--text) !important;
  color: var(--text-inverse) !important;
  border-color: var(--text) !important;
}
