﻿/* Consolidated current app overrides after CSS cleanup. */
:root {
  --primary-goban-max-size: 608px;
}

.auth-landing-nav nav a,
.auth-landing-nav nav a.active,
.qa-reference-nav nav a,
.qa-reference-nav nav a.active,
.topbar-primary-nav button,
.topbar-primary-nav button.active,
.topbar-actions .topbar-primary-nav button,
.topbar-actions .topbar-primary-nav button.active,
.topbar-actions .topbar-primary-nav button:nth-of-type(1),
.topbar-actions .topbar-primary-nav button:nth-of-type(2),
.topbar-actions .topbar-primary-nav button.active:nth-of-type(1) {
  font-weight: 400 !important;
  font-synthesis: none !important;
  font-synthesis-weight: none !important;
  text-shadow: none !important;
  -webkit-text-stroke: 0 !important;
}

.board-panel {
  min-width: 0;
  overflow: visible;
}


.goban {
  flex: 0 0 auto;
  max-width: min(100%, var(--primary-goban-max-size));
}

/* iPhone Safari: draw grid and star points from the same integer-cell canvas. */
.goban.board-canvas-grid::before,
.goban.board-canvas-grid .point.star::after {
  display: none !important;
}

.board-panel > #board.goban {
  justify-self: center !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

.analysis-right-stack {
  align-self: start;
  gap: 14px;
  min-width: 0;
}

.analysis-right-stack .study-panel {
  grid-area: auto !important;
  width: 100%;
}

body[data-mode="analysis"] .analysis-right-stack {
  gap: 0;
}

body[data-mode="study"] .analysis-right-stack {
  gap: 14px;
}

/* Main-board seekbar: フラット表示（棋譜作成と同じ背景・幅感） */
.board-panel > .move-controls {
  grid-template-columns: 36px 36px 36px minmax(0, 1fr) 36px 36px 36px 112px !important;
  width: min(100%, 646px) !important;
  box-sizing: border-box !important;
  margin: 8px auto 10px !important;
  padding: 4px 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.board-panel > .move-controls .seek-wrapper {
  display: flex !important;
  align-items: center !important;
  min-width: 0 !important;
  height: 32px !important;
  padding-top: 0 !important;
}

.board-panel > .move-controls input[type="range"] {
  margin: 0 !important;
}

.board-panel > .move-controls #moveNumberLabel {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 112px !important;
  min-width: 112px !important;
  box-sizing: border-box !important;
  padding: 0 !important;
  color: var(--muted) !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  text-align: center !important;
  white-space: nowrap !important;
  line-height: 1.2 !important;
}

/* 透明アイコンボタン */
.board-panel > .move-controls button {
  min-width: 36px !important;
  min-height: 32px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 6px !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #17231d !important;
  font-size: 0 !important;
}

.board-panel > .move-controls button:hover:not(:disabled) {
  background: rgba(15, 104, 66, 0.08) !important;
}

/* ---- AI検討パネル redesign ---- */

.study-candidate-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}


.study-auto-row,
.study-candidate-limit-row {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  white-space: nowrap;
}

.study-auto-row input {
  width: 16px;
  height: 16px;
  accent-color: #0f6842;
}
.study-candidate-limit-row select {
  width: 82px;
  padding: 5px 28px 5px 10px;
  border: 1px solid #c6d4e0;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2365758a' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  cursor: pointer;
}

.study-btn-primary {
  background: var(--brand-green) !important;
  color: #fff !important;
  border-color: var(--brand-green) !important;
  font-weight: 800 !important;
}

.study-btn-primary:hover:not(:disabled) {
  background: #0d5c3a !important;
  border-color: #0d5c3a !important;
}

.study-btn-secondary {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  background: #fff !important;
  border-color: #c6d4e0 !important;
  color: var(--ink) !important;
  font-weight: 700 !important;
}

.study-btn-secondary svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  stroke-width: 1.8;
}

.study-btn-secondary:hover:not(:disabled) {
  border-color: var(--brand-green) !important;
  color: var(--brand-green) !important;
}




/* Unified right panel sizing for AI analysis / study / editor screens. */
:root {
  --app-right-bar-width: 100%;
  --app-right-bar-max-height: calc(100vh - 128px);
}

/* ── ワークスペース・右バー・ヘッダー共通サイジング ── */
.workspace {
  width: 100% !important;
  max-width: 1380px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 18px !important;
  padding-right: 18px !important;
  grid-template-areas: "left board analysis" !important;
  grid-template-columns: 220px minmax(590px, 646px) minmax(400px, 430px) !important;
  gap: 24px 22px !important;
}

@media (max-width: 1180px) and (orientation: portrait) {
  .workspace {
    grid-template-areas:
      "left"
      "board"
      "analysis" !important;
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

.analysis-right-stack,
#editorPanel.editor-panel {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  justify-self: stretch !important;
  max-height: var(--app-right-bar-max-height) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding-right: 6px !important;
  scrollbar-gutter: stable;
}

.analysis-right-stack {
  max-height: none !important;
  overflow-y: visible !important;
  padding-right: 0 !important;
  scrollbar-gutter: auto !important;
}

.side-panel {
  max-height: none !important;
  overflow: visible !important;
}

.analysis-right-stack .study-panel {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

.analysis-right-stack::-webkit-scrollbar,
#editorPanel.editor-panel::-webkit-scrollbar {
  width: 8px;
}

.analysis-right-stack::-webkit-scrollbar-thumb,
#editorPanel.editor-panel::-webkit-scrollbar-thumb {
  background: rgba(15, 104, 66, 0.28);
  border-radius: 999px;
}

.analysis-right-stack::-webkit-scrollbar-track,
#editorPanel.editor-panel::-webkit-scrollbar-track {
  background: rgba(15, 104, 66, 0.06);
  border-radius: 999px;
}

body[data-mode="editor"] .analysis-right-stack {
  display: none !important;
}

@media (max-width: 1180px) and (orientation: portrait) {
  .analysis-right-stack,
  #editorPanel.editor-panel {
    width: 100% !important;
    max-width: none !important;
    max-height: none !important;
    overflow: visible !important;
    padding-right: 0 !important;
  }
}

/* シークバー */
.seek-markers {
  display: none !important;
}

/* ヘッダー */
.topbar {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  margin: 0 0 4px !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  grid-template-columns: 220px minmax(0, 1fr) 190px 44px max-content !important;
  gap: 18px !important;
}

.topbar > *,
.topbar-actions,
.topbar-primary-nav,
.analysis-header-search,
.account-menu {
  min-width: 0 !important;
}

.topbar-primary-nav {
  max-width: 100% !important;
  gap: clamp(18px, 2.4vw, 34px) !important;
  overflow: hidden !important;
}

.analysis-header-search {
  width: 100% !important;
  max-width: 190px !important;
}

.account-menu-button {
  max-width: 170px !important;
}

.analysis-right-stack .result-panel,
.analysis-right-stack .shared-reference-controls,
.analysis-right-stack .winrate-bar-panel,
.analysis-right-stack .candidate-section,
.analysis-right-stack .game-review-panel {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

/* Compact AI study winrate card. */
.winrate-bar-labels {
  display: none !important;
}

.winrate-bar-panel.analysis-study-section {
  display: grid !important;
  gap: 3px !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  overflow: visible !important;
  padding: 5px 14px 7px !important;
  border: 1px solid rgba(15, 104, 66, 0.62) !important;
  border-radius: 10px !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 252, 0.96), rgba(250, 249, 241, 0.92)) !important;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.88) inset,
    0 2px 0 rgba(15, 104, 66, 0.08) !important;
}

.winrate-bar-panel .bar-score {
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  line-height: 1 !important;
  text-align: center !important;
  pointer-events: none !important;
}

.winrate-bar-panel .bar-score-main {
  display: inline-block !important;
  font-family: var(--title-font) !important;
  font-size: 21px !important;
  font-weight: 400 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  color: #0f6842 !important;
}

.winrate-bar-panel .winrate-bar-row {
  display: grid !important;
  grid-template-columns: minmax(58px, max-content) minmax(120px, 1fr) minmax(58px, max-content) !important;
  grid-template-areas: "black bar white" !important;
  align-items: center !important;
  gap: 7px !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  margin: 0 !important;
}

.winrate-bar-panel .winrate-stone-label {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  min-width: 0 !important;
  font-family: var(--body-font) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  line-height: 1 !important;
  color: #111713 !important;
  white-space: nowrap !important;
}

.winrate-bar-panel .winrate-stone-label:first-child {
  grid-area: black !important;
  justify-self: start !important;
}

.winrate-bar-panel .winrate-stone-label:last-child {
  grid-area: white !important;
  justify-self: end !important;
}

.winrate-bar-panel .winrate-stone-label strong {
  color: #111713 !important;
  font-size: 15px !important;
  font-weight: 500 !important;
  font-variant-numeric: tabular-nums;
}

.winrate-bar-panel .winrate-stone {
  display: block !important;
  width: 19px !important;
  height: 19px !important;
  flex: 0 0 19px !important;
  border-radius: 50% !important;
  box-shadow: 0 2px 5px rgba(24, 31, 30, 0.22) !important;
}

.winrate-bar-panel .winrate-stone-black {
  background: radial-gradient(circle at 35% 35%, #4a5060, #1e2329 70%) !important;
}

.winrate-bar-panel .winrate-stone-white {
  border: 1.5px solid #b0bcc8 !important;
  background: radial-gradient(circle at 35% 35%, #fff, #d8dfe6 80%) !important;
}

.winrate-bar-panel .winrate-bar-row .winrate-bar,
.winrate-bar-panel .winrate-bar {
  grid-area: bar !important;
  position: relative !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: 13px !important;
  border: 1px solid rgba(46, 61, 54, 0.24) !important;
  border-radius: 999px !important;
  background: linear-gradient(180deg, #fff, #f2f2ef) !important;
  box-shadow:
    0 2px 0 rgba(25, 35, 31, 0.18),
    0 4px 6px rgba(25, 35, 31, 0.10),
    0 1px 2px rgba(255, 255, 255, 0.88) inset !important;
  overflow: visible !important;
}

.winrate-bar-panel .winrate-bar::after {
  content: none !important;
  display: none !important;
}

.winrate-bar-panel .winrate-fill,
.winrate-bar-panel .winrate-fill.black-side,
.winrate-bar-panel .winrate-fill.white-side {
  overflow: visible !important;
}

.winrate-bar-panel .winrate-fill.white-side {
  display: none !important;
}

.winrate-bar-panel .winrate-fill.black-side {
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  min-width: 0 !important;
  border-radius: 999px 0 0 999px !important;
  background: linear-gradient(180deg, #4a4d50, #171918) !important;
  box-shadow: none !important;
}

.winrate-bar-panel .winrate-fill.black-side.empty {
  opacity: 0 !important;
}

.winrate-bar-panel .winrate-fill.black-side::after {
  content: "" !important;
  position: absolute !important;
  top: -5px !important;
  right: 0 !important;
  bottom: -5px !important;
  width: 2px !important;
  border-radius: 999px !important;
  background: #0b7146 !important;
  box-shadow: none !important;
  transform: translateX(50%) !important;
  z-index: 3 !important;
  pointer-events: none !important;
}

.winrate-bar-panel .winrate-complexity-row {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin: 3px 0 0 !important;
  padding: 0 !important;
  color: #0f6842 !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  line-height: 1 !important;
  text-align: center !important;
  overflow: visible !important;
}

.winrate-bar-panel .winrate-complexity-row::before,
.winrate-bar-panel .winrate-complexity-row::after {
  content: none !important;
  display: none !important;
}

.winrate-bar-panel .winrate-complexity-row span {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  width: auto !important;
  min-width: max-content !important;
  max-width: 100% !important;
  margin: 0 auto !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #0f6842 !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
}

.winrate-bar-panel .winrate-complexity-row strong {
  display: inline !important;
  color: #0f6842 !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  font-variant-numeric: tabular-nums;
}

/* Shared candidate and reference controls under the winrate bar. */
.analysis-right-stack .shared-candidate-section,
.analysis-right-stack .shared-reference-controls {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

.shared-candidate-section.candidate-section {
  overflow-x: hidden !important;
  overflow-y: visible !important;
}

.shared-candidate-section .candidate-list {
  max-height: none !important;
}

.shared-candidate-section .candidate-list-shell {
  display: grid;
  min-width: 0;
}

.shared-candidate-section .candidate-list-top {
  display: none !important;
}

.shared-candidate-section .candidate-list-scroll {
  display: block !important;
  height: clamp(92px, 13vh, 110px) !important;
  max-height: clamp(92px, 13vh, 110px) !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

.shared-candidate-section .candidate-list-scroll:empty {
  display: none !important;
}

.shared-candidate-section .candidate-list li {
  cursor: pointer;
}

.shared-candidate-section .candidate-list li:hover,
.shared-candidate-section .candidate-list li.active {
  background: rgba(15, 104, 66, 0.07) !important;
}

.shared-candidate-section .candidate-list li.active {
  box-shadow: inset 3px 0 0 #0f6842;
}

.shared-candidate-section .candidate-list .candidate-reference-action-row {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  min-height: 42px !important;
  padding: 6px 14px 8px 38px !important;
  border-bottom: 1px solid rgba(68, 88, 100, 0.1) !important;
  background: rgba(15, 104, 66, 0.04) !important;
  cursor: default;
}

.shared-candidate-section .candidate-list .candidate-reference-action-row::after {
  content: none !important;
  display: none !important;
}

.shared-reference-controls {
  display: grid !important;
  gap: 8px !important;
  padding: 12px 14px !important;
  border: 1px solid rgba(68, 88, 100, 0.16) !important;
  border-radius: 7px !important;
  background: #fff !important;
}

.shared-reference-controls #referenceTitle {
  justify-self: stretch !important;
  margin: 0 !important;
  color: #17231d;
  font-size: 14px !important;
  font-weight: 600 !important;
  line-height: 1.45 !important;
  text-align: left !important;
}

.shared-reference-controls .reference-actions,
.shared-reference-controls .reference-coordinate-row {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
}

.shared-reference-controls #closeReferencePreviewBtn {
  border-color: #1d6ee8 !important;
  background: #1d6ee8 !important;
  color: #fff !important;
  box-shadow: 0 6px 14px rgba(29, 110, 232, 0.22) !important;
}

.shared-reference-controls #closeReferencePreviewBtn:hover {
  border-color: #155bc4 !important;
  background: #155bc4 !important;
  color: #fff !important;
}

.game-tree.reference-preview-locked {
  opacity: 0.72;
}

.game-tree.reference-preview-locked .tree-node {
  cursor: not-allowed;
}

.shared-reference-controls .reference-selected-target {
  color: #17231d;
  font-size: 13px;
  font-weight: 600;
}

.shared-reference-controls .reference-diagram-overview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 86px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid rgba(68, 88, 100, 0.14);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.62);
}

.shared-reference-controls .reference-diagram-overview.empty {
  color: #6c7a72;
  font-size: 12px;
}

.shared-reference-controls .reference-diagram-overview-item {
  min-height: 26px;
  padding: 3px 8px;
  border: 1px solid rgba(15, 104, 66, 0.18);
  border-radius: 999px;
  background: #fff;
  color: #17372a;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

.shared-reference-controls .reference-diagram-overview-item.active {
  border-color: rgba(15, 104, 66, 0.48);
  background: rgba(15, 104, 66, 0.1);
}

.shared-reference-controls .reference-coordinate-row label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #445864;
  font-size: 12px;
  font-weight: 600;
}

.shared-reference-controls .reference-coordinate-row input {
  width: 84px;
  min-height: 30px;
  padding: 4px 6px;
  border: 1px solid rgba(68, 88, 100, 0.24);
  border-radius: 6px;
  font: inherit;
  text-align: center;
  text-transform: uppercase;
}

.shared-reference-controls .reference-commentary {
  margin: 0 !important;
  padding: 8px 10px !important;
  border: 1px solid rgba(15, 104, 66, 0.14);
  border-radius: 7px;
  background: rgba(15, 104, 66, 0.04);
  color: #445864;
  font-size: 12px;
  line-height: 1.55;
}

body[data-mode="analysis"] .analysis-study-section {
  display: none !important;
}

body[data-mode="analysis"] .winrate-bar-panel.analysis-study-section {
  display: grid !important;
  visibility: visible !important;
}

body[data-mode="analysis"] .game-review-panel.hidden {
  display: grid !important;
}

body[data-mode="study"] .analysis-study-section {
  display: grid !important;
}

body[data-mode="study"] .shared-candidate-section.analysis-study-section,
body[data-mode="study"] .shared-reference-controls.analysis-study-section,
body[data-mode="study"] .winrate-bar-panel.analysis-study-section {
  display: grid !important;
  visibility: visible !important;
}

body[data-mode="study"] .shared-candidate-section.analysis-study-section {
  position: relative !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: 145px !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

body[data-mode="study"] .shared-candidate-section .candidate-list-shell,
body[data-mode="study"] .shared-candidate-section .candidate-list-scroll {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

body[data-mode="study"] .game-review-panel {
  display: none !important;
}

/* =====================================================================
   左サイドバー（aside#leftNav）リデザイン  v20260622-left-nav-v1
   main-grid を3カラムに拡張し、白背景の縦ナビゲーションを追加。
   ===================================================================== */

/* --- main-grid を3カラムに --- */
.main-grid {
  grid-template-columns: 220px minmax(590px, 646px) minmax(520px, 1fr) !important;
  gap: 14px !important;
}

/* --- dropZone を非表示（ファイル入力は維持） --- */
#dropZone {
  display: none !important;
}

/* --- 左ナビゲーション本体 --- */
.left-nav {
  width: 220px;
  background: #fff;
  border: 1px solid rgba(68, 88, 100, 0.18);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  box-shadow: 0 2px 8px rgba(22, 34, 42, 0.07);
  flex-shrink: 0;
}

/* --- ロゴ --- */
.left-nav-logo {
  padding: 16px 16px 10px;
  border-bottom: 1px solid rgba(68, 88, 100, 0.10);
}
.left-nav-logo img {
  width: 100%;
  max-width: 170px;
  height: auto;
  display: block;
}

/* --- ナビゲーション項目共通 --- */
.left-nav-item,
.left-nav-section-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: #2c3e35;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  text-align: left;
  cursor: pointer;
  line-height: 1.3;
  transition: background 0.12s;
  box-sizing: border-box;
  text-decoration: none;
}

body[data-page="kifu-editor"] .left-nav-history {
  display: none;
}
.left-nav-item:hover {
  background: rgba(74, 140, 104, 0.07);
}
.left-nav-item.active {
  background: rgba(74, 140, 104, 0.12) !important;
  border-left-color: #4a8c68 !important;
  color: #1a5c38 !important;
  font-weight: 700 !important;
}
.left-nav-item svg,
.left-nav-section-item svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  stroke: currentColor;
}

/* --- AI解析 ヘッダー項目（常時アクティブ表示） --- */
.left-nav-section-item {
  cursor: default;
  font-weight: 700;
  font-size: 15px;
}
.left-nav-section-active {
  background: rgba(74, 140, 104, 0.14) !important;
  border-left-color: #4a8c68 !important;
  color: #1a5c38 !important;
}

/* --- 区切り線 --- */
.left-nav-divider {
  height: 1px;
  background: rgba(68, 88, 100, 0.12);
  margin: 4px 0;
  flex-shrink: 0;
}

/* --- ナビグループ --- */
.left-nav-modes,
.left-nav-files {
  display: flex;
  flex-direction: column;
  padding: 4px 0;
}

/* --- 解析履歴セクション --- */
.left-nav-history {
  border-top: 1px solid rgba(68, 88, 100, 0.12);
  padding: 6px 0 4px;
  flex-shrink: 0;
}
.left-nav-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 14px 6px;
}
.left-nav-history-title {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: #445864;
  letter-spacing: 0.01em;
}
.left-nav-history-title svg {
  width: 13px;
  height: 13px;
  stroke: #4a8c68;
  flex-shrink: 0;
}
.left-nav-history-all {
  background: none;
  border: none;
  cursor: pointer;
  color: #4a8c68;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 0;
  text-decoration: none;
}
.left-nav-history-all:hover {
  text-decoration: underline;
}
.left-nav-history-list {
  display: flex;
  flex-direction: column;
}

/* --- 履歴アイテム --- */
.left-nav-history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-top: 1px solid rgba(68, 88, 100, 0.08);
  cursor: pointer;
  transition: background 0.12s;
}
.left-nav-history-item:first-child {
  border-top: none;
}
.left-nav-history-item:hover {
  background: rgba(74, 140, 104, 0.07);
}
.left-nav-history-thumb {
  display: none !important;
}
.left-nav-history-thumb canvas {
  display: none !important;
}
.left-nav-history-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.left-nav-history-info strong {
  font-size: 11.5px;
  font-weight: 700;
  color: #1a2a22;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.left-nav-history-info span {
  font-size: 10.5px;
  color: #7a8c98;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.left-nav-history-arrow {
  width: 13px;
  height: 13px;
  color: #b0bec5;
  flex-shrink: 0;
  stroke: currentColor;
}
.left-nav-history-empty {
  font-size: 12px;
  color: #7a8c98;
  padding: 8px 14px 10px;
  margin: 0;
  font-style: italic;
}

/* --- グローバルDnDオーバーレイ --- */
body.global-drag-over::after {
  content: 'SGFファイルをドロップ';
  position: fixed;
  inset: 0;
  background: rgba(74, 140, 104, 0.15);
  border: 3px dashed #4a8c68;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: #1a5c38;
  pointer-events: none;
  border-radius: 0;
}

@media (max-width: 1280px) {
  .main-grid {
    grid-template-columns: 200px minmax(460px, 700px) minmax(340px, 1fr) !important;
  }
  .left-nav {
    width: 200px;
  }
}

@media (max-width: 1024px) {
  .main-grid {
    grid-template-columns: 1fr !important;
  }
  .left-nav {
    width: 100%;
    position: static;
    max-height: none;
    flex-direction: row;
    flex-wrap: wrap;
    border-radius: 10px;
  }
  .left-nav-logo {
    display: none;
  }
  .left-nav-history {
    display: none;
  }
}

/* Remove unintended brown decorative backgrounds from the left sidebar. */
#leftNav.left-nav,
aside#leftNav.left-nav,
.left-nav {
  background: rgba(255, 253, 248, 0.96) !important;
  background-image: none !important;
  color: #17231d !important;
}

#leftNav.left-nav::before,
#leftNav.left-nav::after,
aside#leftNav.left-nav::before,
aside#leftNav.left-nav::after,
.left-nav::before,
.left-nav::after {
  content: none !important;
  display: none !important;
  background: none !important;
  background-image: none !important;
}

#leftNav .left-nav-logo,
aside#leftNav .left-nav-logo,
.left-nav-logo {
  display: none !important;
}

#leftNav .left-nav-modes,
#leftNav .left-nav-files,
#leftNav .left-nav-history,
#leftNav .left-nav-history-list,
#leftNav .left-nav-history-item,
#leftNav .left-nav-history-thumb,
#leftNav .left-nav-item,
#leftNav .left-nav-section-item,
#leftNav .side-save-panel,
#leftNav .mode-tabs {
  background-image: none !important;
}

/* AI検討: 作業優先ナビ + 盤面サムネイル付き履歴カード */
body[data-page="ai-review"] .analysis-workspace-nav {
  gap: 14px;
  padding: 16px 14px 14px;
  background: #fbfcf9 !important;
  border-color: rgba(40, 73, 56, 0.16);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(33, 55, 43, 0.08);
  overflow-x: hidden;
}

body[data-page="ai-review"] .analysis-workspace-nav-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 2px;
}

body[data-page="ai-review"] .analysis-workspace-nav-head span {
  color: #6d7f74;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

body[data-page="ai-review"] .analysis-workspace-nav-head strong {
  color: #173c29;
  font-family: "Noto Serif JP", serif;
  font-size: 16px;
  line-height: 1.4;
}

body[data-page="ai-review"] .analysis-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: #edf2ed;
  border: 1px solid rgba(49, 85, 64, 0.08);
  border-radius: 10px;
}

body[data-page="ai-review"] .analysis-mode-switch .left-nav-item {
  justify-content: center;
  gap: 5px;
  min-width: 0;
  padding: 8px 5px;
  color: #607067;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  border: 0;
  border-radius: 7px;
}

body[data-page="ai-review"] .analysis-mode-switch .left-nav-item svg {
  width: 14px;
  height: 14px;
}

body[data-page="ai-review"] .analysis-mode-switch .left-nav-item:hover {
  background: rgba(255, 255, 255, 0.62);
}

body[data-page="ai-review"] .analysis-mode-switch .left-nav-item.active {
  color: #1d5637 !important;
  background: #fff !important;
  border: 0 !important;
  box-shadow: 0 2px 8px rgba(34, 64, 47, 0.1);
}

body[data-page="ai-review"] .analysis-left-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 11px 12px;
  color: #fff;
  background: linear-gradient(135deg, #356e4c, #4d8562);
  border: 0;
  border-radius: 10px;
  box-shadow: 0 5px 12px rgba(43, 101, 68, 0.18);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}

body[data-page="ai-review"] .analysis-left-primary:hover {
  background: linear-gradient(135deg, #2d6242, #417755);
  transform: translateY(-1px);
}

body[data-page="ai-review"] .analysis-left-server-games {
  color: #2f5f43;
  background: #f1f7f1;
  border: 1px solid rgba(48, 101, 69, 0.22);
  box-shadow: none;
}

body[data-page="ai-review"] .analysis-left-server-games:hover {
  color: #244d36;
  background: #e8f2e9;
}

body[data-page="ai-review"] .analysis-left-primary svg,
body[data-page="ai-review"] .analysis-file-actions svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

body[data-page="ai-review"] .analysis-current-kifu {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 11px;
  background: #fff;
  border: 1px solid rgba(48, 78, 59, 0.12);
  border-radius: 10px;
}

body[data-page="ai-review"] .analysis-current-kifu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: #64756b;
  font-size: 10.5px;
  font-weight: 700;
}

body[data-page="ai-review"] .analysis-current-save-state {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #7b8981;
  font-size: 9.5px;
  white-space: nowrap;
}

body[data-page="ai-review"] .analysis-current-save-state::before {
  width: 6px;
  height: 6px;
  background: #a4afa8;
  border-radius: 50%;
  content: "";
}

body[data-page="ai-review"] .analysis-current-save-state[data-state="dirty"] {
  color: #b45b36;
}

body[data-page="ai-review"] .analysis-current-save-state[data-state="dirty"]::before {
  background: #df754b;
}

body[data-page="ai-review"] .analysis-current-save-state[data-state="saved"] {
  color: #3f7954;
}

body[data-page="ai-review"] .analysis-current-save-state[data-state="saved"]::before {
  background: #4e9166;
}

body[data-page="ai-review"] .analysis-current-kifu > strong {
  overflow: hidden;
  color: #203c2d;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-page="ai-review"] .analysis-current-kifu > span:last-child {
  color: #77867e;
  font-size: 10.5px;
}

body[data-page="ai-review"] .analysis-file-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

body[data-page="ai-review"] .analysis-file-actions button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  padding: 8px 4px;
  color: #365344;
  background: #fff;
  border: 1px solid rgba(49, 82, 62, 0.17);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

body[data-page="ai-review"] .analysis-file-actions button:hover {
  color: #1c5a37;
  background: #f2f7f1;
  border-color: rgba(45, 108, 69, 0.32);
}

body[data-page="ai-review"] .left-nav-history {
  padding: 13px 0 0;
  border-top-color: rgba(49, 82, 62, 0.12);
}

body[data-page="ai-review"] .left-nav-history-header {
  padding: 0 2px 9px;
}

body[data-page="ai-review"] .left-nav-history-title {
  color: #294b38;
  font-size: 11px;
}

body[data-page="ai-review"] .left-nav-history-all {
  padding: 2px 0;
  color: #397451;
  font-size: 10px;
}

body[data-page="ai-review"] .left-nav-history-list {
  gap: 7px;
}

body[data-page="ai-review"] .left-nav-history-item {
  position: relative;
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 9px;
  min-height: 62px;
  padding: 7px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(48, 78, 59, 0.12);
  border-radius: 9px;
  box-shadow: 0 2px 7px rgba(36, 58, 45, 0.04);
}

body[data-page="ai-review"] .left-nav-history-item:first-child {
  border-top: 1px solid rgba(48, 78, 59, 0.12);
}

body[data-page="ai-review"] .left-nav-history-item:hover {
  background: #f6faf5;
  border-color: rgba(45, 108, 69, 0.28);
  transform: translateY(-1px);
}

body[data-page="ai-review"] .left-nav-history-thumb {
  display: block !important;
  width: 60px;
  height: 60px;
  min-width: 0;
  flex: none;
  overflow: hidden;
  background: #d9b36c;
  border: 1px solid rgba(108, 75, 31, 0.2);
  border-radius: 6px;
}

body[data-page="ai-review"] .left-nav-history-thumb canvas {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
}

body[data-page="ai-review"] .left-nav-history-info {
  justify-content: center;
  gap: 3px;
}

body[data-page="ai-review"] .left-nav-history-info strong {
  color: #203a2c;
  font-size: 10.5px;
  line-height: 1.35;
}

body[data-page="ai-review"] .left-nav-history-info span {
  color: #7a887f;
  font-size: 9.5px;
  line-height: 1.3;
}

body[data-page="ai-review"] .left-nav-history-info .left-nav-history-kind {
  width: fit-content;
  padding: 2px 5px;
  color: #376c4c;
  background: #edf6ee;
  border-radius: 999px;
  font-size: 8.5px;
  font-weight: 700;
}

body[data-page="ai-review"] .left-nav-history-arrow {
  display: none;
}

body[data-page="ai-review"] .left-nav-history-empty {
  padding: 11px 8px;
  color: #7c8981;
  background: #fff;
  border: 1px dashed rgba(48, 78, 59, 0.18);
  border-radius: 9px;
  font-size: 10.5px;
  font-style: normal;
  line-height: 1.5;
  text-align: center;
}

@media (max-width: 1280px) {
  body[data-page="ai-review"] .analysis-workspace-nav {
    gap: 11px;
    padding: 13px 10px;
  }

  body[data-page="ai-review"] .analysis-workspace-nav-head strong {
    font-size: 14px;
  }

  body[data-page="ai-review"] .left-nav-history-item {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  body[data-page="ai-review"] .left-nav-history-thumb {
    width: 54px;
    height: 54px;
  }
}

@media (max-width: 1024px) {
  body[data-page="ai-review"] .analysis-workspace-nav {
    display: grid;
    grid-template-columns: minmax(170px, 0.9fr) minmax(210px, 1.2fr) minmax(150px, 0.8fr);
    align-items: center;
    gap: 9px;
  }

  body[data-page="ai-review"] .analysis-workspace-nav-head {
    grid-column: 1 / -1;
  }

  body[data-page="ai-review"] .analysis-left-primary {
    min-height: 43px;
  }

  body[data-page="ai-review"] .analysis-current-kifu {
    grid-column: span 1;
  }

  body[data-page="ai-review"] .analysis-file-actions {
    grid-column: span 1;
  }
}

@media (orientation: portrait) and (max-width: 1439px) {
  body[data-mode="analysis"].workspace-mobile-minimal {
    --study-mobile-pink: #ef6872;
    --study-mobile-pink-soft: #fff2f1;
    --study-mobile-line: rgba(224, 124, 118, 0.28);
    --study-mobile-ink: #352621;
  }

  body[data-mode="analysis"].workspace-mobile-minimal.has-analysis-position-evaluation .study-mobile-intro {
    display: block;
    width: 100%;
    padding: 8px 10px 10px;
    box-sizing: border-box;
  }

  body[data-mode="analysis"].workspace-mobile-minimal .study-mobile-intro > :not(.study-mobile-evaluation-host) {
    display: none !important;
  }

  body[data-mode="analysis"].workspace-mobile-minimal .study-mobile-intro > .study-mobile-evaluation-host {
    margin-top: 0;
  }

  body[data-page="ai-review"] .analysis-workspace-nav {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  body[data-page="ai-review"] .analysis-workspace-nav-head,
  body[data-page="ai-review"] .analysis-current-kifu,
  body[data-page="ai-review"] .analysis-file-actions {
    grid-column: 1;
  }
}

/* 棋譜エディタ: 作成・編集・自動復元をまとめた作業ナビ */
body[data-page="kifu-editor"] .editor-workspace-nav {
  gap: 14px;
  padding: 16px 14px 14px;
  background: #fbfcf9 !important;
  border-color: rgba(40, 73, 56, 0.16);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(33, 55, 43, 0.08);
  overflow-x: hidden;
}

body[data-page="kifu-editor"] .editor-workspace-nav-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 2px;
}

body[data-page="kifu-editor"] .editor-workspace-nav-head span {
  color: #6d7f74;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

body[data-page="kifu-editor"] .editor-workspace-nav-head strong {
  color: #173c29;
  font-family: "Noto Serif JP", serif;
  font-size: 16px;
  line-height: 1.4;
}

body[data-page="kifu-editor"] .editor-start-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

/* Portrait compact header: keep the smartphone hamburger through tablet widths. */
@media (orientation: portrait) and (min-width: 701px) and (max-width: 1439px) {
  :root {
    --mobile-header-height: 48px;
    --mobile-top-nav-height: 0px;
  }

  body .site-header.site-header {
    position: fixed !important;
    top: 0;
    right: 0;
    left: 0;
    z-index: 260;
    width: 100%;
    height: auto !important;
    min-height: var(--mobile-header-height) !important;
    transform: translateY(0);
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
  }

  body.has-mobile-bottom-nav {
    padding-top: var(--mobile-header-height);
  }

  body .site-header.site-header.is-scroll-hidden:not(.is-menu-open) {
    transform: translateY(calc(-100% - 2px)) !important;
    pointer-events: none;
  }

  .site-header .site-header-inner {
    width: 100%;
    max-width: none;
    height: var(--mobile-header-height) !important;
    min-height: var(--mobile-header-height) !important;
    gap: 8px;
    padding: 7px 10px;
  }

  .site-header .qa-topnav-logo {
    width: auto !important;
    min-width: 0;
    flex: 1 1 auto;
    gap: 0;
  }

  .site-header .qa-topnav-logo .qa-brand-wordmark {
    width: 132px !important;
    max-width: 36vw;
    height: auto;
  }

  .site-header .qa-topnav-logo::after {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    margin-left: -10px;
  }

  body .site-header.site-header .site-header-menu-button {
    display: flex !important;
    visibility: visible !important;
    width: 40px;
    min-width: 40px;
    height: 40px;
    flex: 0 0 40px;
    order: 2;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .site-header .qa-topnav-nav {
    display: none !important;
  }

  body .site-header.site-header.is-menu-open .qa-topnav-nav {
    position: absolute;
    top: calc(100% + 1px);
    right: 8px;
    left: 8px;
    z-index: 230;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    padding: 10px;
    border: 1px solid rgba(226, 194, 185, 0.92);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 14px 30px rgba(82, 52, 42, 0.16);
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .site-header.is-menu-open .qa-topnav-nav a {
    display: grid;
    min-height: 48px;
    grid-template-columns: 24px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 12px;
    text-align: left;
  }

  .site-header.is-menu-open .qa-topnav-nav > .site-header-game-menu {
    display: grid;
    min-width: 0;
  }

  .site-header.is-menu-open .site-header-game-trigger {
    display: grid;
    width: 100%;
    min-height: 48px;
    grid-template-columns: 24px minmax(0, 1fr) 16px;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    text-align: left;
  }

  .site-header.is-menu-open .site-header-game-menu.is-open {
    grid-column: 1 / -1;
  }

  .site-header.is-menu-open .site-header-game-menu.is-open .site-header-game-dropdown {
    position: static;
    display: grid;
    width: 100%;
    max-width: 100%;
    visibility: visible;
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }

  .site-header .qa-topnav-right {
    display: flex !important;
    min-width: 0;
    align-self: center;
    gap: 5px;
    order: 1;
    margin-left: auto;
    padding-left: 0;
    border-left: 0;
  }

  .site-header .qa-bell {
    display: inline-flex !important;
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
  }

  .site-header .qa-account-menu {
    min-width: 0;
    flex: 0 0 auto;
  }

  .site-header .qa-account-menu-button {
    width: auto;
    min-width: 96px;
    max-width: 112px;
    height: 40px;
    min-height: 40px;
    gap: 5px;
    margin-left: 0;
    padding: 3px 6px 3px 3px;
  }

  .site-header .qa-header-avatar {
    display: block;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
  }

  .site-header .qa-topnav-user {
    display: block !important;
    min-width: 0;
    max-width: 56px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .site-header .qa-topnav-chevron {
    display: block !important;
    flex: 0 0 auto;
    margin-left: 0;
  }

  .site-header .qa-topnav-ask-btn {
    display: none !important;
  }

  .site-header[data-site-context="guest"] .guest-login-link {
    display: inline-flex !important;
  }

  .mobile-bottom-nav {
    display: none !important;
  }
}

/*
 * Board workspace responsive layout r3
 * 1 column: portrait or landscape below 760px.
 * 2 columns: landscape 760-1439px, or a low-height wide viewport.
 * 3 columns: at least 1440x720 CSS pixels.
 * In 2/3-column modes only the control rails scroll; the board stays in the viewport.
 */
.workspace-landscape-left-scroll,
.ai-game-responsive-controls-scroll {
  min-width: 0;
  min-height: 0;
}

@media (orientation: landscape) and (max-width: 759px) {
  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) {
    height: auto !important;
    min-height: 100dvh !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) :is(.workspace, .main-grid) {
    display: flex !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    flex-direction: column !important;
    overflow: visible !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-board-only {
    order: 1 !important;
    position: static !important;
    width: calc(100dvw - 10px) !important;
    max-width: calc(100dvw - 10px) !important;
    max-height: none !important;
    overflow: visible !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-landscape-left-scroll {
    order: 2 !important;
    display: flex !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    flex-direction: column;
    overflow: visible !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) :is(#leftNav, .side-panel[data-board-focus-ready="true"]) {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    zoom: 1 !important;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell:is(
    [data-phase="playing"],
    [data-phase="suspended"],
    [data-phase="scoring"],
    [data-phase="ended"]
  ) {
    display: flex !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    flex-direction: column !important;
    overflow: visible !important;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell:is(
    [data-phase="playing"],
    [data-phase="suspended"],
    [data-phase="scoring"],
    [data-phase="ended"]
  ) .ai-game-board-area {
    order: 1 !important;
    position: static !important;
    width: calc(100dvw - 10px) !important;
    max-width: calc(100dvw - 10px) !important;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell:is(
    [data-phase="playing"],
    [data-phase="suspended"],
    [data-phase="scoring"],
    [data-phase="ended"]
  ) :is(.ai-game-left-panel, .ai-game-right-panel) {
    order: 2 !important;
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
  }
}

@media (orientation: landscape) and (min-width: 760px) and (max-width: 1439px),
       (orientation: landscape) and (min-width: 1440px) and (max-height: 719px) {
  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-landscape-left-scroll > .side-panel {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-landscape-left-scroll > .side-panel[data-board-focus-ready="true"] > :not([hidden]) {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    zoom: 1 !important;
    box-sizing: border-box;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) {
    --workspace-responsive-top: 70px;
    --workspace-responsive-gap: clamp(6px, 0.8vw, 10px);
    --workspace-responsive-board: min(calc(100dvh - 86px), calc(58dvw - 14px));
    height: 100dvh !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .app-shell {
    height: calc(100dvh - var(--workspace-responsive-top)) !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace {
    --workspace-primary-board-stage-size: var(--workspace-responsive-board) !important;
    display: grid !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-width: none !important;
    grid-template-columns: minmax(280px, 1fr) minmax(0, var(--workspace-responsive-board)) !important;
    grid-template-rows: minmax(0, 1fr) !important;
    align-items: start !important;
    gap: var(--workspace-responsive-gap) !important;
    padding: 6px !important;
    overflow: hidden !important;
    box-sizing: border-box;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .main-grid {
    display: contents !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-landscape-left-scroll {
    display: flex !important;
    grid-column: 1;
    grid-row: 1;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-height: 100% !important;
    flex-direction: column;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    touch-action: pan-y;
    scrollbar-gutter: stable;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-landscape-left-scroll > :is(#leftNav, .side-panel[data-board-focus-ready="true"]) {
    position: static !important;
    flex: 0 0 auto;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    max-height: none !important;
    inset: auto !important;
    overflow: visible !important;
    zoom: 1 !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-board-only {
    grid-column: 2;
    grid-row: 1;
    position: sticky !important;
    top: 0 !important;
    align-self: start;
    width: var(--workspace-responsive-board) !important;
    min-width: 0 !important;
    max-width: var(--workspace-responsive-board) !important;
    max-height: 100% !important;
    margin: 0 !important;
    overflow: hidden !important;
    overscroll-behavior: none;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-board-only > .board-stage {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  body.ai-game-page:not(.ai-teaching-game-page):has(.ai-game-shell:is(
    [data-phase="playing"],
    [data-phase="suspended"],
    [data-phase="scoring"],
    [data-phase="ended"]
  )) {
    height: 100dvh !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell:is(
    [data-phase="playing"],
    [data-phase="suspended"],
    [data-phase="scoring"],
    [data-phase="ended"]
  ) {
    --ai-game-responsive-board: min(calc(100dvh - 86px), calc(58dvw - 14px));
    display: grid !important;
    width: calc(100% - 12px) !important;
    height: calc(100dvh - 76px) !important;
    min-height: 0 !important;
    max-width: none !important;
    grid-template-areas: "controls board" !important;
    grid-template-columns: minmax(280px, 1fr) minmax(0, var(--ai-game-responsive-board)) !important;
    grid-template-rows: minmax(0, 1fr) !important;
    align-items: start !important;
    gap: clamp(6px, 0.8vw, 10px) !important;
    margin: 6px auto 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-responsive-controls-scroll {
    display: flex !important;
    grid-area: controls;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    scrollbar-gutter: stable;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-responsive-controls-scroll > :is(
    .ai-game-left-panel,
    .ai-game-right-panel
  ) {
    position: static !important;
    flex: 0 0 auto;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    max-height: none !important;
    inset: auto !important;
    overflow: visible !important;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell:is(
    [data-phase="playing"],
    [data-phase="suspended"],
    [data-phase="scoring"],
    [data-phase="ended"]
  ) .ai-game-board-area {
    grid-area: board;
    position: sticky !important;
    top: 0 !important;
    align-self: start;
    width: var(--ai-game-responsive-board) !important;
    min-width: 0 !important;
    max-width: var(--ai-game-responsive-board) !important;
    max-height: 100% !important;
    margin: 0 !important;
    overflow: hidden !important;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell[data-phase="setup"] {
    display: block !important;
    width: min(720px, calc(100% - 20px)) !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 10px auto 32px !important;
    overflow: visible !important;
  }
}

@media (orientation: landscape) and (min-width: 1440px) and (min-height: 720px) {
  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) {
    --workspace-responsive-left: clamp(240px, 18vw, 300px);
    --workspace-responsive-right: clamp(260px, 21vw, 340px);
    --workspace-responsive-gap: clamp(8px, 0.8vw, 12px);
    --workspace-responsive-board: min(
      calc(100dvh - 86px),
      calc(100dvw - var(--workspace-responsive-left) - var(--workspace-responsive-right) - 40px)
    );
    height: 100dvh !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .app-shell {
    height: calc(100dvh - 70px) !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace {
    --workspace-primary-board-stage-size: var(--workspace-responsive-board) !important;
    display: grid !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-width: none !important;
    grid-template-columns:
      minmax(0, var(--workspace-responsive-left))
      minmax(0, var(--workspace-responsive-board))
      minmax(0, var(--workspace-responsive-right)) !important;
    grid-template-rows: minmax(0, 1fr) !important;
    align-items: start !important;
    gap: var(--workspace-responsive-gap) !important;
    padding: 6px !important;
    overflow: hidden !important;
    box-sizing: border-box;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) :is(.main-grid, .workspace-landscape-left-scroll) {
    display: contents !important;
  }

  body.study-desktop-redesign[data-mode="study"] #leftNav.analysis-workspace-nav,
  body.editor-desktop-redesign[data-mode="editor"] #leftNav.editor-workspace-nav,
  body.analysis-desktop-redesign[data-mode="analysis"] #leftNav.analysis-workspace-nav {
    grid-column: 1;
    grid-row: 1;
    position: sticky !important;
    top: 0 !important;
    width: var(--workspace-responsive-left) !important;
    min-width: 0 !important;
    max-width: 100% !important;
    max-height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    zoom: 1 !important;
    scrollbar-gutter: stable;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-board-only {
    grid-column: 2;
    grid-row: 1;
    position: sticky !important;
    top: 0 !important;
    align-self: start;
    width: var(--workspace-responsive-board) !important;
    max-width: var(--workspace-responsive-board) !important;
    max-height: 100% !important;
    margin: 0 !important;
    overflow: hidden !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .side-panel[data-board-focus-ready="true"] {
    grid-column: 3;
    grid-row: 1;
    position: sticky !important;
    top: 0 !important;
    width: var(--workspace-responsive-right) !important;
    min-width: 0 !important;
    max-width: 100% !important;
    max-height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    zoom: 1 !important;
    scrollbar-gutter: stable;
  }

  body.ai-game-page:not(.ai-teaching-game-page):has(.ai-game-shell:is(
    [data-phase="playing"],
    [data-phase="suspended"],
    [data-phase="scoring"],
    [data-phase="ended"]
  )) {
    height: 100dvh !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell:is(
    [data-phase="playing"],
    [data-phase="suspended"],
    [data-phase="scoring"],
    [data-phase="ended"]
  ) {
    height: calc(100dvh - 76px) !important;
    min-height: 0 !important;
    max-height: calc(100dvh - 76px) !important;
    align-items: start !important;
    overflow: hidden !important;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell:is(
    [data-phase="playing"],
    [data-phase="suspended"],
    [data-phase="scoring"],
    [data-phase="ended"]
  ) :is(.ai-game-left-panel, .ai-game-right-panel) {
    position: sticky !important;
    top: 0 !important;
    max-height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    scrollbar-gutter: stable;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell:is(
    [data-phase="playing"],
    [data-phase="suspended"],
    [data-phase="scoring"],
    [data-phase="ended"]
  ) .ai-game-board-area {
    position: sticky !important;
    top: 0 !important;
    align-self: start;
    max-height: 100% !important;
    overflow: hidden !important;
  }
}

/* Shared match-room chooser in the global header. */
.site-header .site-header-game-menu {
  position: relative;
}

.site-header .site-header-game-trigger {
  border: 0;
  color: #57362c;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.site-header .site-header-game-chevron {
  display: inline-grid;
  width: 14px;
  height: 14px;
  place-items: center;
  color: #a36b60;
  font-size: 15px;
  line-height: 1;
  transition: transform .18s ease;
}

.site-header .site-header-game-menu.is-open .site-header-game-chevron {
  transform: rotate(180deg);
}

.site-header .site-header-game-dropdown {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

@media (min-width: 701px) {
  .site-header .site-header-game-menu {
    display: flex;
    align-self: stretch;
    align-items: center;
  }

  .site-header .site-header-game-trigger {
    position: relative;
    display: inline-flex;
    min-height: 58px;
    align-items: center;
    gap: 7px;
    padding: 0 10px 0 13px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    transition: color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease;
  }

  .site-header .site-header-game-trigger:hover,
  .site-header .site-header-game-trigger:focus-visible,
  .site-header .site-header-game-menu.is-open .site-header-game-trigger {
    color: #b9505c;
    background: rgba(255, 244, 245, .94);
    box-shadow: 0 5px 14px rgba(143, 79, 76, .08);
    outline: none;
    transform: translateY(-1px);
  }

  .site-header .site-header-game-trigger.active {
    color: #b94855;
    background: linear-gradient(145deg, rgba(255, 242, 244, .98), rgba(250, 226, 230, .96));
    box-shadow: inset 0 0 0 1px rgba(224, 145, 154, .16), 0 6px 16px rgba(151, 83, 80, .09);
  }

  .site-header .site-header-game-trigger.active::after {
    position: absolute;
    right: 18px;
    bottom: 7px;
    left: 18px;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, #db7f8a 22%, #db7f8a 78%, transparent);
    content: "";
  }

  .site-header .site-header-game-dropdown {
    position: absolute;
    top: calc(100% - 6px);
    left: 50%;
    z-index: 520;
    display: grid;
    width: 270px;
    gap: 5px;
    padding: 10px;
    border: 1px solid rgba(232, 190, 184, .92);
    border-radius: 16px;
    background: rgba(255, 253, 252, .98);
    box-shadow: 0 18px 42px rgba(82, 52, 42, .18);
    transform: translate(-50%, -7px);
    transition: opacity .16s ease, visibility .16s ease, transform .16s ease;
  }

  .site-header .site-header-game-menu:hover .site-header-game-dropdown,
  .site-header .site-header-game-menu:focus-within .site-header-game-dropdown,
  .site-header .site-header-game-menu.is-open .site-header-game-dropdown {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0);
  }
}

.site-header .site-header-game-dropdown .site-header-game-option {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  min-height: 0;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 11px;
  color: #57362c;
  text-decoration: none;
  transform: none;
}

.site-header .site-header-game-dropdown .site-header-game-option:hover,
.site-header .site-header-game-dropdown .site-header-game-option:focus-visible {
  color: #b94855 !important;
  background: #fff1f3 !important;
  box-shadow: none;
  outline: none;
  transform: none;
}

.site-header .site-header-game-option > span:last-child {
  display: grid;
  gap: 4px;
}

.site-header .site-header-game-option strong {
  font-size: 13px;
  line-height: 1.25;
}

.site-header .site-header-game-option small {
  color: #8b746d;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.35;
}

.site-header .site-header-game-option-stone {
  position: relative;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #6a6e6c, #111 72%);
  box-shadow: 0 2px 5px rgba(54, 35, 30, .22);
}

.site-header .site-header-game-option:nth-child(2) .site-header-game-option-stone {
  border: 4px solid #ef8991;
  background: #fff8f5;
  box-shadow: none;
}

.site-header .site-header-game-option:nth-child(3) .site-header-game-option-stone {
  border: 1px solid #d7d1ca;
  background: radial-gradient(circle at 35% 30%, #fff, #e4e0da 74%);
}

.site-header .site-header-game-option.active {
  color: #b94855;
  background: #fff3f4;
}

@media (max-width: 700px) {
  .site-header.is-menu-open .qa-topnav-nav > .site-header-game-menu {
    display: grid;
    min-width: 0;
  }

  .site-header.is-menu-open .site-header-game-trigger {
    display: grid;
    width: 100%;
    min-height: 48px;
    grid-template-columns: 24px minmax(0, 1fr) 16px;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    text-align: left;
  }

  .site-header.is-menu-open .site-header-game-trigger:hover,
  .site-header.is-menu-open .site-header-game-trigger:focus-visible,
  .site-header.is-menu-open .site-header-game-trigger.active,
  .site-header.is-menu-open .site-header-game-menu.is-open .site-header-game-trigger {
    color: #b94855;
    background: #fff0f2;
    outline: none;
  }

  .site-header.is-menu-open .site-header-game-menu.is-open {
    grid-column: 1 / -1;
  }

  .site-header.is-menu-open .site-header-game-menu.is-open .site-header-game-dropdown {
    position: static;
    display: grid;
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    gap: 4px;
    margin-top: 5px;
    padding: 6px;
    border: 1px solid rgba(232, 190, 184, .72);
    border-radius: 12px;
    background: #fffaf9;
  }

  .site-header.is-menu-open .site-header-game-dropdown .site-header-game-option {
    display: grid;
    min-height: 48px;
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 9px;
    padding: 8px 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-header .site-header-game-trigger,
  .site-header .site-header-game-chevron,
  .site-header .site-header-game-dropdown {
    transition: none;
  }
}

body[data-page="kifu-editor"] .editor-start-actions button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  padding: 10px 5px;
  border-radius: 9px;
  cursor: pointer;
  font: inherit;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

body[data-page="kifu-editor"] .editor-start-actions svg,
body[data-page="kifu-editor"] .editor-left-file-actions svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

body[data-page="kifu-editor"] .editor-left-primary {
  color: #fff;
  background: linear-gradient(135deg, #356e4c, #4d8562);
  border: 0;
  box-shadow: 0 5px 12px rgba(43, 101, 68, 0.18);
}

body[data-page="kifu-editor"] .editor-left-primary:hover {
  background: linear-gradient(135deg, #2d6242, #417755);
  transform: translateY(-1px);
}

body[data-page="kifu-editor"] .editor-left-secondary {
  color: #365344;
  background: #fff;
  border: 1px solid rgba(49, 82, 62, 0.17);
}

body[data-page="kifu-editor"] .editor-left-secondary:hover {
  color: #1c5a37;
  background: #f2f7f1;
  border-color: rgba(45, 108, 69, 0.32);
}

body[data-page="kifu-editor"] .editor-left-saved {
  color: #5f8f47;
  border-color: rgba(95, 143, 71, 0.28);
  background: linear-gradient(180deg, #fff, #f8fbf4);
}

body[data-page="kifu-editor"] .editor-current-kifu {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 11px;
  background: #fff;
  border: 1px solid rgba(48, 78, 59, 0.12);
  border-radius: 10px;
}

body[data-page="kifu-editor"] .editor-current-kifu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: #64756b;
  font-size: 10.5px;
  font-weight: 700;
}

body[data-page="kifu-editor"] .editor-current-save-state {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #7b8981;
  font-size: 9.5px;
  white-space: nowrap;
}

body[data-page="kifu-editor"] .editor-current-save-state::before {
  width: 6px;
  height: 6px;
  background: #a4afa8;
  border-radius: 50%;
  content: "";
}

body[data-page="kifu-editor"] .editor-current-save-state[data-state="dirty"] {
  color: #ad6a36;
}

body[data-page="kifu-editor"] .editor-current-save-state[data-state="dirty"]::before {
  background: #d99a50;
}

body[data-page="kifu-editor"] .editor-current-save-state[data-state="saved"] {
  color: #3f7954;
}

body[data-page="kifu-editor"] .editor-current-save-state[data-state="saved"]::before {
  background: #4e9166;
}

body[data-page="kifu-editor"] .editor-current-kifu > strong {
  overflow: hidden;
  color: #203c2d;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-page="kifu-editor"] .editor-current-kifu > span:last-child {
  color: #77867e;
  font-size: 10.5px;
}

body[data-page="kifu-editor"] .editor-left-file-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

body[data-page="kifu-editor"] .editor-left-file-actions button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  padding: 8px 4px;
  color: #365344;
  background: #fff;
  border: 1px solid rgba(49, 82, 62, 0.17);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

body[data-page="kifu-editor"] .editor-left-file-actions #editorSaveServerBtn {
  grid-column: auto;
}

body[data-page="kifu-editor"] .editor-left-file-actions button:hover {
  color: #1c5a37;
  background: #f2f7f1;
  border-color: rgba(45, 108, 69, 0.32);
}

body[data-page="kifu-editor"] .editor-left-tools {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid rgba(49, 82, 62, 0.12);
}

body[data-page="kifu-editor"] .editor-left-tools h2 {
  margin: 0 2px 2px;
  color: #294b38;
  font-size: 11px;
  font-weight: 700;
}

body[data-page="kifu-editor"] .editor-left-tools button {
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 8px;
  color: #365344;
  background: #fff;
  border: 1px solid rgba(48, 78, 59, 0.12);
  border-radius: 9px;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

body[data-page="kifu-editor"] .editor-left-tools button:hover {
  color: #1c5a37;
  background: #f6faf5;
  border-color: rgba(45, 108, 69, 0.27);
  transform: translateY(-1px);
}

body[data-page="kifu-editor"] .editor-left-tools button > svg {
  width: 18px;
  height: 18px;
  justify-self: center;
}

body[data-page="kifu-editor"] .editor-left-tools button > span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

body[data-page="kifu-editor"] .editor-left-tools strong {
  color: #284535;
  font-size: 10.5px;
  line-height: 1.35;
}

body[data-page="kifu-editor"] .editor-left-tools small {
  overflow: hidden;
  color: #7a887f;
  font-size: 8.5px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-page="kifu-editor"] .editor-left-autosave {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: start;
  gap: 7px;
  padding: 9px;
  color: #42654f;
  background: #eef6ef;
  border: 1px solid rgba(61, 115, 78, 0.14);
  border-radius: 9px;
}

body[data-page="kifu-editor"] .editor-left-autosave > svg {
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

body[data-page="kifu-editor"] .editor-left-autosave > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

body[data-page="kifu-editor"] .editor-left-autosave strong {
  font-size: 9.5px;
}

body[data-page="kifu-editor"] .editor-left-autosave span {
  color: #698072;
  font-size: 8.5px;
  line-height: 1.45;
}

@media (max-width: 1280px) {
  body[data-page="kifu-editor"] .editor-workspace-nav {
    gap: 11px;
    padding: 13px 10px;
  }

  body[data-page="kifu-editor"] .editor-workspace-nav-head strong {
    font-size: 14px;
  }
}

@media (max-width: 1024px) {
  body[data-page="kifu-editor"] .editor-workspace-nav {
    display: grid;
    grid-template-columns: minmax(170px, 0.9fr) minmax(210px, 1.2fr) minmax(160px, 0.9fr);
    align-items: center;
    gap: 9px;
  }

  body[data-page="kifu-editor"] .editor-workspace-nav-head {
    grid-column: 1 / -1;
  }

  body[data-page="kifu-editor"] .editor-left-tools {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  body[data-page="kifu-editor"] .editor-left-tools h2 {
    grid-column: 1 / -1;
  }

  body[data-page="kifu-editor"] .editor-left-autosave {
    grid-column: 1 / -1;
  }
}

@media (orientation: portrait) and (max-width: 1439px) {
  body[data-page="kifu-editor"] .editor-workspace-nav,
  body[data-page="kifu-editor"] .editor-left-tools {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  body[data-page="kifu-editor"] .editor-workspace-nav-head,
  body[data-page="kifu-editor"] .editor-left-tools,
  body[data-page="kifu-editor"] .editor-left-tools h2,
  body[data-page="kifu-editor"] .editor-left-autosave {
    grid-column: 1;
  }
}
/* 参考図を作るインラインボタン */
.reference-create-inline-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  padding: 5px 10px !important;
  margin: 0 !important;
  white-space: nowrap !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  color: #0f6842 !important;
  background: #fff !important;
  border: 1.5px solid rgba(15, 104, 66, 0.6) !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  transition: background 0.12s, border-color 0.12s !important;
  line-height: 1.2 !important;
}

.reference-create-inline-btn:hover {
  background: rgba(15, 104, 66, 0.08) !important;
  border-color: #0f6842 !important;
}

.reference-create-inline-btn svg {
  width: 14px !important;
  height: 14px !important;
  stroke: currentColor !important;
  flex-shrink: 0 !important;
}

.reference-create-inline-btn span {
  display: inline !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  color: inherit !important;
  margin: 0 !important;
}






.board-reference-popover {
  position: absolute;
  z-index: 45;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transform: translate(12px, -50%);
  padding: 7px;
  border: 1px solid rgba(15, 104, 66, 0.24);
  border-radius: 8px;
  background: #f8fcfa;
  box-shadow: 0 3px 0 rgba(15, 38, 28, 0.12);
  pointer-events: auto;
}

.reference-clear-inline-btn {
  color: #56635c !important;
  border-color: rgba(86, 99, 92, 0.35) !important;
}

.board-reference-popover::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-left: 1px solid rgba(15, 104, 66, 0.24);
  border-bottom: 1px solid rgba(15, 104, 66, 0.24);
  background: #f8fcfa;
  transform: translateY(-50%) rotate(45deg);
}
.sequence-label {
  position: absolute;
  z-index: 7;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.sequence-label.black-move {
  color: #fff;
  text-shadow: 0 1px 0 #111, 1px 0 0 #111, 0 -1px 0 #111, -1px 0 0 #111;
}

.sequence-label.white-move {
  color: #111;
  text-shadow: 0 1px 0 #fff, 1px 0 0 #fff, 0 -1px 0 #fff, -1px 0 0 #fff;
}

/* 棋譜エディタ: 参考図・初期配置ダイアログを盤面中心の編集ワークスペースへ再構成 */
#editorBoardDialog.editor-board-dialog {
  place-items: center !important;
  padding: 18px !important;
}

#editorBoardDialog .editor-board-dialog-backdrop {
  background: rgba(15, 28, 21, 0.54);
  backdrop-filter: blur(5px);
}

#editorBoardDialog .editor-board-dialog-panel {
  display: flex;
  width: min(1060px, calc(100vw - 36px)) !important;
  max-height: min(92vh, 900px);
  flex-direction: column;
  overflow: hidden;
  background: #f7f9f5;
  border: 1px solid rgba(38, 75, 52, 0.19);
  border-radius: 18px;
  box-shadow: 0 28px 80px rgba(12, 31, 20, 0.3);
}

#editorBoardDialog .editor-board-dialog-head {
  position: relative;
  z-index: 3;
  align-items: center;
  padding: 16px 18px 15px;
  background:
    radial-gradient(circle at 72% 0, rgba(92, 145, 105, 0.1), transparent 42%),
    #fff;
  border-bottom: 1px solid rgba(42, 76, 55, 0.12);
}

#editorBoardDialog .editor-board-dialog-heading {
  display: grid;
  min-width: 0;
  gap: 3px;
}

#editorBoardDialog .editor-board-dialog-eyebrow {
  color: #708078;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

#editorBoardDialog .editor-board-dialog-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#editorBoardDialog .editor-board-dialog-head h2 {
  margin: 0;
  color: #173c28;
  font-size: 21px;
  font-weight: 700;
}

#editorBoardDialog .editor-board-dialog-mode {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  margin: 0;
  padding: 0 9px;
  color: #2b6845;
  background: #edf5ed;
  border: 1px solid rgba(50, 105, 68, 0.12);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
}

#editorBoardDialog .editor-board-dialog-lead {
  margin: 0;
  color: #6f7d75;
  font-size: 10.5px;
  line-height: 1.5;
}

#editorBoardDialog #editorBoardDialogCloseBtn {
  display: inline-flex;
  width: auto;
  height: 34px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 0 0 auto;
  padding: 0 10px;
  color: #53655a;
  background: #f7f9f6;
  border: 1px solid rgba(42, 76, 55, 0.14);
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
}

#editorBoardDialog #editorBoardDialogCloseBtn:hover {
  color: #264b36;
  background: #eef3ed;
}

#editorBoardDialog #editorBoardDialogCloseBtn svg {
  width: 14px;
  height: 14px;
}

#editorBoardDialog .editor-board-dialog-body {
  display: grid !important;
  grid-template-columns: minmax(0, 674px) minmax(280px, 1fr) !important;
  justify-content: center !important;
  justify-items: stretch !important;
  align-items: start;
  gap: 16px !important;
  min-height: 0;
  padding: 16px !important;
  overflow: auto;
}

#editorBoardDialog .editor-board-dialog-workspace {
  display: grid;
  min-width: 0;
  gap: 10px;
}

#editorBoardDialog .editor-board-dialog-toolbar {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  background: #fff;
  border: 1px solid rgba(42, 76, 55, 0.13);
  border-radius: 12px;
  box-shadow: 0 5px 16px rgba(33, 59, 42, 0.05);
}

#editorBoardDialog .editor-board-dialog-current-tool {
  display: grid;
  min-width: 0;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
}

#editorBoardDialog .editor-board-dialog-current-icon {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  color: #2d6b47;
  background: #eaf4eb;
  border-radius: 9px;
}

#editorBoardDialog .editor-board-dialog-current-icon svg {
  width: 18px;
  height: 18px;
}

#editorBoardDialog .editor-board-dialog-current-tool > div {
  display: grid;
  min-width: 0;
  gap: 1px;
}

#editorBoardDialog .editor-board-dialog-current-tool small {
  color: #839087;
  font-size: 8.5px;
  font-weight: 700;
}

#editorBoardDialog .editor-board-dialog-current-tool strong {
  color: #234b34;
  font-size: 11.5px;
  line-height: 1.35;
}

#editorBoardDialog .editor-board-dialog-current-tool p {
  overflow: hidden;
  margin: 0;
  color: #718077;
  font-size: 9.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#editorBoardDialog .editor-board-dialog-history {
  display: flex;
  flex: 0 0 auto;
  gap: 5px;
}

#editorBoardDialog .editor-board-dialog-history button {
  display: inline-flex;
  min-width: 58px;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 7px;
  color: #40574a;
  background: #f5f7f4;
  border: 1px solid rgba(42, 76, 55, 0.13);
  border-radius: 8px;
  font-size: 9.5px;
  font-weight: 700;
}

#editorBoardDialog .editor-board-dialog-history button:hover:not(:disabled) {
  color: #225d3b;
  background: #ebf3eb;
}

#editorBoardDialog .editor-board-dialog-history button:disabled {
  opacity: 0.38;
}

#editorBoardDialog .editor-board-dialog-history svg {
  width: 13px;
  height: 13px;
}

#editorBoardDialog .editor-board-dialog-board-stage {
  --editor-dialog-board-frame-extra: 28px;
  display: grid;
  width: 100%;
  max-width: min(100%, calc(var(--editor-dialog-board-size, var(--primary-goban-max-size)) + var(--editor-dialog-board-frame-extra)));
  min-width: 0;
  justify-self: center;
  place-items: center;
  padding: 14px;
  overflow: hidden;
  box-sizing: border-box;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.66), transparent 52%),
    #e8eee7;
  border: 1px solid rgba(42, 76, 55, 0.13);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

#editorBoardDialog #editorBoardDialogBoard.goban {
  width: min(100%, var(--editor-dialog-board-size, var(--primary-goban-max-size))) !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin: 0 auto !important;
  justify-self: center !important;
  overflow: hidden !important;
  background: var(--board-wood-bg) !important;
  border-radius: 9px;
  box-shadow: 0 9px 24px rgba(57, 43, 23, 0.16);
}

#editorBoardDialog .editor-board-dialog-board-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding-inline: 3px;
  color: #74827a;
  font-size: 9.5px;
  line-height: 1.45;
}

#editorBoardDialog .editor-board-dialog-board-note svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

#editorBoardDialog .editor-board-dialog-tools {
  display: grid;
  width: 100% !important;
  max-width: none !important;
  min-width: 0;
  grid-column: auto !important;
  grid-row: auto !important;
  align-content: start;
  gap: 9px;
}

#editorBoardDialog .editor-board-dialog-tools-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  padding: 1px 2px 2px;
}

#editorBoardDialog .editor-board-dialog-tools-head > div {
  display: grid;
  gap: 1px;
}

#editorBoardDialog .editor-board-dialog-tools-head span {
  color: #829087;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

#editorBoardDialog .editor-board-dialog-tools-head h3 {
  margin: 0;
  color: #244734;
  font-size: 14px;
}

#editorBoardDialog .editor-board-dialog-tools-head p {
  margin: 0 0 1px;
  color: #8a968f;
  font-size: 8px;
}

#editorBoardDialog .editor-board-dialog-tool-group,
#editorBoardDialog .editor-board-dialog-comment,
#editorBoardDialog .editor-board-dialog-sequence {
  display: grid;
  gap: 7px;
  padding: 10px;
  background: #fff;
  border: 1px solid rgba(42, 76, 55, 0.12);
  border-radius: 11px;
}

#editorBoardDialog .editor-board-dialog-tool-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

#editorBoardDialog .editor-board-dialog-tool-title strong,
#editorBoardDialog .editor-board-dialog-comment > span {
  color: #294a37;
  font-size: 10.5px;
  font-weight: 800;
}

#editorBoardDialog .editor-board-dialog-tool-title small {
  color: #87938c;
  font-size: 8.5px;
}

#editorBoardDialog .editor-board-dialog-tool-row {
  display: grid;
  gap: 6px;
}

#editorBoardDialog .editor-board-dialog-tool-row button {
  min-width: 0;
  min-height: 32px;
  padding: 0 7px;
  color: #40554a;
  background: #f6f8f5;
  border: 1px solid rgba(42, 76, 55, 0.13);
  border-radius: 8px;
  box-shadow: none;
  font-size: 9.5px;
  font-weight: 700;
}

#editorBoardDialog .editor-board-dialog-tool-row button:hover:not(:disabled) {
  color: #1f5a39;
  background: #edf4ec;
  border-color: rgba(42, 101, 63, 0.24);
}

#editorBoardDialog .editor-board-dialog-tool-row button.active {
  color: #fff;
  background: #2d6e48;
  border-color: #2d6e48;
  box-shadow: 0 4px 10px rgba(39, 102, 65, 0.19);
}

#editorBoardDialog .editor-board-dialog-tool-row button:disabled {
  opacity: 0.38;
}

#editorBoardDialog .editor-board-dialog-move-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#editorBoardDialog .editor-board-dialog-move-row button[data-dialog-tool="move"] {
  grid-column: 1 / -1;
}

#editorBoardDialog .editor-board-dialog-stone-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#editorBoardDialog .editor-board-dialog-stone-row button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

#editorBoardDialog .editor-board-dialog-stone-swatch {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 50%;
}

#editorBoardDialog .editor-board-dialog-stone-swatch.black {
  background: #202420;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.18);
}

#editorBoardDialog .editor-board-dialog-stone-swatch.white {
  background: #fff;
  border: 1px solid rgba(38, 51, 42, 0.23);
  box-shadow: 0 1px 2px rgba(29, 42, 33, 0.12);
}

#editorBoardDialog .editor-board-dialog-tool-row.marks {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#editorBoardDialog .editor-board-dialog-tool-row.marks button[data-dialog-tool^="mark-"] {
  width: 100%;
  min-width: 0;
  font-size: 16px;
}

#editorBoardDialog .editor-board-dialog-tool-row.marks button[data-dialog-tool="label"] {
  grid-column: span 2;
  width: 100%;
}

#editorBoardDialog .editor-board-dialog-label-field {
  display: grid;
  min-height: 32px;
  grid-column: span 2;
  grid-template-columns: 1fr 34px;
  align-items: center;
  gap: 5px;
  padding: 3px 4px 3px 8px;
  color: #748179;
  background: #fafbf9;
  border: 1px solid rgba(42, 76, 55, 0.13);
  border-radius: 8px;
  font-size: 8.5px;
}

#editorBoardDialog .editor-board-dialog-label-field input {
  width: 34px;
  min-width: 34px;
  height: 24px;
  padding: 0;
  background: #fff;
  border: 1px solid rgba(42, 76, 55, 0.15);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

#editorBoardDialog .editor-board-dialog-label-field input:disabled {
  color: #9ba49f;
  background: #eef1ed;
}

#editorBoardDialog .editor-board-dialog-sequence {
  background: #f3f7f2;
}

#editorBoardDialog .editor-board-dialog-sequence.hidden,
#editorBoardDialog .editor-board-dialog-move-tools.hidden,
#editorBoardDialog .editor-board-dialog-comment.hidden {
  display: none;
}

#editorBoardDialog .editor-board-dialog-sequence-title {
  color: #2a5139;
  font-size: 10px;
  font-weight: 800;
}

#editorBoardDialog .editor-board-dialog-sequence-empty {
  color: #75837a;
  font-size: 9px;
  line-height: 1.45;
}

#editorBoardDialog .editor-board-dialog-comment textarea {
  width: 100%;
  max-width: none !important;
  min-height: 72px;
  resize: vertical;
  padding: 8px 9px;
  color: #33463a;
  background: #fafbf9;
  border: 1px solid rgba(42, 76, 55, 0.14);
  border-radius: 8px;
  font-family: var(--body-font);
  font-size: 9.5px;
  line-height: 1.55;
}

#editorBoardDialog .editor-board-dialog-comment textarea:focus {
  outline: 2px solid rgba(49, 111, 72, 0.22);
  border-color: rgba(49, 111, 72, 0.35);
}

#editorBoardDialog .editor-board-dialog-actions {
  position: sticky;
  bottom: -1px;
  z-index: 2;
  display: grid;
  gap: 7px;
  padding: 10px;
  background: rgba(247, 249, 245, 0.96);
  border: 1px solid rgba(42, 76, 55, 0.13);
  border-radius: 11px;
  box-shadow: 0 -5px 16px rgba(31, 55, 39, 0.06);
  backdrop-filter: blur(6px);
}

#editorBoardDialog .editor-board-dialog-actions > p {
  margin: 0;
  color: #7e8b83;
  font-size: 8.5px;
  line-height: 1.4;
}

#editorBoardDialog .editor-board-dialog-actions > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

#editorBoardDialog .editor-board-dialog-actions button {
  min-width: 0 !important;
  min-height: 36px;
  padding: 0 10px !important;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 800;
}

#editorBoardDialog .editor-board-dialog-actions #editorBoardDialogSaveBtn {
  color: #fff;
  background: #2c6d47;
  border-color: #2c6d47;
  box-shadow: 0 5px 12px rgba(39, 100, 64, 0.2);
}

#editorBoardDialog .editor-board-dialog-actions #editorBoardDialogSaveBtn:hover {
  background: #235c3b;
}

#editorBoardDialog .editor-board-dialog-actions #editorBoardDialogCancelBtn {
  color: #5d6d63;
  background: #fff;
  border-color: rgba(42, 76, 55, 0.15);
}

@media (max-width: 1050px) {
  #editorBoardDialog .editor-board-dialog-panel {
    width: min(760px, calc(100vw - 24px)) !important;
  }

  #editorBoardDialog .editor-board-dialog-body {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  #editorBoardDialog .editor-board-dialog-tools {
    width: 100% !important;
  }
}

@media (max-width: 620px) {
  #editorBoardDialog.editor-board-dialog {
    padding: 0 !important;
  }

  #editorBoardDialog .editor-board-dialog-panel {
    width: 100vw !important;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
  }

  #editorBoardDialog .editor-board-dialog-head {
    padding: 12px;
  }

  #editorBoardDialog .editor-board-dialog-head h2 {
    font-size: 17px;
  }

  #editorBoardDialog .editor-board-dialog-lead {
    display: none;
  }

  #editorBoardDialog #editorBoardDialogCloseBtn {
    width: 34px;
    padding: 0;
  }

  #editorBoardDialog #editorBoardDialogCloseBtn span {
    display: none;
  }

  #editorBoardDialog .editor-board-dialog-body {
    gap: 11px !important;
    padding: 4px !important;
    overflow-x: hidden;
  }

  #editorBoardDialog .editor-board-dialog-toolbar {
    align-items: flex-start;
  }

  #editorBoardDialog .editor-board-dialog-current-tool p {
    white-space: normal;
  }

  #editorBoardDialog .editor-board-dialog-history button {
    min-width: 34px;
  }

  #editorBoardDialog .editor-board-dialog-history button span {
    display: none;
  }

  #editorBoardDialog .editor-board-dialog-board-stage {
    --editor-dialog-board-frame-extra: 4px;
    padding: 2px;
    overflow: hidden;
  }

  #editorBoardDialog #editorBoardDialogBoard.goban {
    width: min(100%, var(--editor-dialog-board-size, 100%)) !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
}

/* Board editor dialog: keep the actual board visible, not browser button cells. */
#editorBoardDialog #editorBoardDialogBoard.goban > .point {
  appearance: none !important;
  -webkit-appearance: none !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  color: inherit !important;
}

/* AI game board: keep point buttons as a transparent hit layer over the board grid. */
.ai-game-board.goban > .ai-game-point {
  appearance: none !important;
  -webkit-appearance: none !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  color: inherit !important;
}

.ai-game-board-header.board-header {
  grid-template-columns: minmax(82px, auto) minmax(0, 1fr) minmax(64px, auto) !important;
}

.ai-game-board-header .ai-game-board-meta-row {
  min-width: 64px !important;
}

.ai-game-board-header #aiGameBoardMeta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}


.board-reference-popover.edge-right {
  transform: translate(calc(-100% - 12px), -50%) !important;
}

.board-reference-popover.edge-right::before {
  left: auto;
  right: -5px;
  border-left: 0;
  border-bottom: 0;
  border-right: 1px solid rgba(15, 104, 66, 0.24);
  border-top: 1px solid rgba(15, 104, 66, 0.24);
}

.board-reference-popover.edge-bottom {
  transform: translate(12px, calc(-100% - 8px)) !important;
}

.board-reference-popover.edge-right.edge-bottom {
  transform: translate(calc(-100% - 12px), calc(-100% - 8px)) !important;
}
.board-view-toggles {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.board-view-toggles button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(15, 104, 66, 0.28);
  border-radius: 8px;
  background: #fff;
  color: #0f6842;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.board-view-toggles button.active {
  background: #0f6842;
  color: #fff;
}

.board-workspace-panel .board-stage > #board.goban.coordinates-active {
  overflow: visible;
  margin-top: 24px;
  left: 6px;
}

#board.goban.coordinates-active > .board-coordinate {
  position: absolute;
  z-index: 9;
  color: rgba(42, 55, 47, 0.78);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-align: center;
  pointer-events: none;
  user-select: none;
}

#board.goban.coordinates-active > .board-coordinate-col {
  min-width: 14px;
  transform: translateX(-50%);
}

#board.goban.coordinates-active > .board-coordinate-col.top {
  top: -18px;
}

#board.goban.coordinates-active > .board-coordinate-row {
  width: 18px;
  text-align: right;
  transform: translateY(-50%);
}

#board.goban.coordinates-active > .board-coordinate-row.left {
  left: -18px;
}

.board-move-number {
  position: absolute;
  z-index: 7;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  user-select: none;
  text-shadow: none;
}

.board-move-number.on-black {
  color: #fff;
}

.board-move-number.on-white {
  color: #111;
}





.board-header {
  align-items: center !important;
  column-gap: 12px !important;
  white-space: nowrap;
}

.board-header > div:first-child {
  display: inline-flex !important;
  align-items: baseline !important;
  gap: 6px !important;
  min-width: 0;
}

.board-header > div:first-child .label {
  display: none;
}

.board-header .capture-table {
  justify-self: start !important;
}

.board-header .board-view-toggles {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  flex-wrap: nowrap !important;
  gap: 8px !important;
  min-width: 270px;
}

.board-header #boardMeta {
  width: 52px;
  text-align: right;
  flex: 0 0 52px;
}

.board-view-toggles button {
  width: 92px;
  flex: 0 0 92px;
  text-align: center;
}
.move-number-jump {
  gap: 4px;
}

.move-number-jump input {
  width: 42px;
  min-width: 42px;
  height: 28px;
  padding: 0 5px;
  border: 1px solid rgba(68, 88, 100, 0.24);
  border-radius: 6px;
  background: #fff;
  color: #1f2933;
  font: inherit;
  font-size: 13px;
  text-align: right;
}

.move-number-jump input:focus {
  outline: 2px solid rgba(15, 104, 66, 0.18);
  border-color: rgba(15, 104, 66, 0.55);
}
/* Keep JS-controlled panels actually hidden despite stronger redesign selectors. */
#editorPanel.editor-panel.hidden,
.study-panel.hidden,
.analysis-right-stack .study-panel.hidden {
  display: none !important;
}

/* AI検討・棋譜エディタ共通: 中央盤面ワークスペース */
.board-workspace-panel {
  width: min(100%, 646px);
  margin-inline: auto;
}

.board-workspace-header {
  display: grid !important;
  grid-template-columns: minmax(118px, auto) minmax(182px, 1fr) minmax(236px, auto) !important;
  align-items: center !important;
  gap: 10px !important;
  width: min(100%, 646px) !important;
  box-sizing: border-box;
  margin: 0 auto 10px !important;
  padding: 9px 10px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  border: 1px solid rgba(45, 78, 58, 0.14) !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 14px rgba(35, 58, 44, 0.06);
  white-space: normal;
}

.board-workspace-header .board-workspace-context {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  min-width: 0;
}

.board-workspace-mode {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  color: #2e6747;
  background: #edf6ee;
  border: 1px solid rgba(53, 111, 75, 0.13);
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.board-turn-status {
  display: flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
}

.board-turn-status > span {
  color: #7b8981;
  font-size: 9px;
  font-weight: 700;
}

.board-turn-status #turnLabel {
  color: #1e382a;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
}

.board-workspace-header .capture-table {
  justify-self: center !important;
  border: 0;
  background: #f6f8f5;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(47, 76, 58, 0.09);
  font-size: 10px;
}

.board-workspace-header .capture-table th,
.board-workspace-header .capture-table td {
  padding: 5px 5px;
  border-color: rgba(47, 76, 58, 0.08);
}

.board-workspace-header .capture-table th {
  color: #6f7e75;
  font-size: 9px;
  font-weight: 700;
}

.board-workspace-header .capture-table th::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 4px;
  border-radius: 50%;
  content: "";
  vertical-align: 1px;
}

.board-workspace-header .capture-table th:first-child::before {
  background: #1d211f;
}

.board-workspace-header .capture-table th:nth-child(3)::before {
  background: #fff;
  border: 1px solid #aeb7b1;
  box-sizing: border-box;
}

.board-workspace-header .capture-table td {
  min-width: 20px;
  color: #2f4639;
  font-size: 11px;
}

.board-workspace-header .board-view-toggles {
  display: grid !important;
  grid-template-columns: 48px 82px 82px;
  align-items: center !important;
  justify-content: end !important;
  gap: 5px !important;
  min-width: 0;
}

body[data-mode="editor"] .board-workspace-header .board-view-toggles {
  grid-template-columns: 48px repeat(3, minmax(68px, 82px));
}

.board-workspace-header #boardMeta {
  width: auto;
  color: #728077;
  font-size: 10px;
  font-weight: 700;
  text-align: right;
}

.board-workspace-header .board-view-toggles button {
  width: auto;
  min-height: 28px;
  padding: 0 7px;
  color: #466153;
  background: #fff;
  border: 1px solid rgba(47, 83, 61, 0.16);
  border-radius: 7px;
  font-size: 10px;
  font-weight: 700;
}

.board-workspace-header .board-view-toggles button:hover {
  color: #1e603b;
  background: #f1f7f1;
}

.board-workspace-header .board-view-toggles button.active {
  color: #fff;
  background: #356e4c;
  border-color: #356e4c;
}

.board-stage {
  width: min(100%, 646px);
  box-sizing: border-box;
  margin-inline: auto;
  padding: 11px 18px 18px;
  overflow: visible;
  background:
    radial-gradient(circle at 100% 0, rgba(92, 137, 102, 0.09), transparent 34%),
    linear-gradient(145deg, #f7f9f4, #eef3ec);
  border: 1px solid rgba(47, 76, 58, 0.13);
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(34, 56, 43, 0.09);
}

.board-stage > #board.goban {
  justify-self: center !important;
  margin-right: auto !important;
  margin-left: auto !important;
  border-radius: 4px;
  box-shadow:
    0 2px 0 rgba(90, 61, 25, 0.18),
    0 12px 24px rgba(67, 49, 25, 0.2) !important;
}

.board-workspace-panel > .move-controls {
  grid-template-columns: 34px 34px 34px minmax(0, 1fr) 34px 34px 34px 104px !important;
  gap: 5px !important;
  width: min(100%, 646px) !important;
  box-sizing: border-box !important;
  margin: 9px auto 0 !important;
  padding: 7px 8px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  border: 1px solid rgba(47, 76, 58, 0.13) !important;
  border-radius: 11px !important;
  box-shadow: 0 4px 14px rgba(34, 56, 43, 0.05) !important;
}

.board-workspace-panel > .move-controls button {
  min-width: 32px !important;
  min-height: 32px !important;
  color: #385244 !important;
  background: #f7f9f6 !important;
  border: 1px solid rgba(47, 76, 58, 0.11) !important;
  border-radius: 8px !important;
}

.board-workspace-panel > .move-controls button:hover:not(:disabled) {
  color: #175d37 !important;
  background: #eaf4eb !important;
  border-color: rgba(38, 103, 62, 0.2) !important;
}

.board-workspace-panel > .move-controls button:disabled {
  opacity: 0.36;
}

.board-workspace-panel > .move-controls .seek-wrapper {
  height: 32px !important;
}

.board-workspace-panel > .move-controls input[type="range"] {
  accent-color: #3e7b55;
}

.board-workspace-panel > .move-controls #moveNumberLabel {
  width: 104px !important;
  min-width: 104px !important;
  color: #51645a !important;
  background: #f7f9f6;
  border: 1px solid rgba(47, 76, 58, 0.11);
  border-radius: 8px;
}

.board-workspace-panel .move-number-jump input {
  width: 38px;
  min-width: 38px;
  height: 25px;
  border: 0;
  background: transparent;
  font-size: 11px;
  font-weight: 800;
}

.board-tree-panel {
  width: min(100%, 646px) !important;
  margin: 9px auto 0 !important;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(47, 76, 58, 0.13);
  border-radius: 11px;
  box-shadow: 0 4px 14px rgba(34, 56, 43, 0.04);
}

.board-tree-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(47, 76, 58, 0.09);
}

.board-tree-header > div {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}

.board-tree-header strong {
  color: #2b4938;
  font-size: 10.5px;
}

.board-tree-header div > span {
  overflow: hidden;
  color: #819087;
  font-size: 8.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-tree-header button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 27px;
  padding: 0 7px;
  color: #52675b;
  background: #f6f8f5;
  border: 1px solid rgba(47, 76, 58, 0.12);
  border-radius: 7px;
  cursor: pointer;
  font: inherit;
  font-size: 9px;
  font-weight: 700;
}

.board-tree-header button:hover {
  color: #1e603b;
  background: #edf5ed;
}

.board-tree-header button svg {
  width: 13px;
  height: 13px;
  transition: transform 0.16s ease;
}

.board-tree-panel.collapsed .board-tree-header {
  border-bottom: 0;
}

.board-tree-panel.collapsed .board-tree-header button svg {
  transform: rotate(-90deg);
}

.board-tree-panel.collapsed .game-tree {
  display: none;
}

.board-tree-panel .game-tree {
  min-height: 76px;
  max-height: 154px;
  background:
    linear-gradient(90deg, rgba(225, 233, 226, 0.72) 1px, transparent 1px) 0 0 / 24px 100%,
    #fff;
}

.board-workspace-feedback {
  display: grid;
  gap: 5px;
  width: min(100%, 646px);
  margin: 7px auto 0;
}

.board-workspace-feedback .message {
  min-height: 0;
  margin: 0;
  padding: 7px 9px;
  color: #68786f;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(47, 76, 58, 0.09);
  border-radius: 8px;
  font-size: 10px;
  line-height: 1.45;
}

.board-workspace-feedback .message:empty {
  display: none;
}

.board-workspace-feedback .message.error {
  color: var(--danger);
  background: #fff6f4;
  border-color: rgba(174, 65, 51, 0.16);
}

.board-workspace-feedback #queueStatus {
  display: block !important;
  margin: 0;
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 9.5px;
}

.board-workspace-feedback #queueStatus[data-state="ok"] {
  display: none !important;
}

@media (max-width: 1280px) {
  .board-workspace-header {
    grid-template-columns: minmax(112px, auto) minmax(130px, 1fr) minmax(186px, auto) !important;
    gap: 6px !important;
    padding-inline: 8px !important;
  }

  .board-workspace-header .board-view-toggles {
    grid-template-columns: 40px 69px 69px;
    gap: 4px !important;
  }

  .board-workspace-header .board-view-toggles button {
    font-size: 9px;
  }

  .board-workspace-header .capture-table th,
  .board-workspace-header .capture-table td {
    padding-inline: 3px;
  }

  .board-workspace-panel > .move-controls {
    grid-template-columns: 32px 32px 32px minmax(72px, 1fr) 32px 32px 32px 94px !important;
    gap: 4px !important;
    padding-inline: 6px !important;
  }

  .board-workspace-panel > .move-controls #moveNumberLabel {
    width: 94px !important;
    min-width: 94px !important;
  }
}

@media (max-width: 600px) {
  .board-workspace-header {
    grid-template-columns: 1fr auto !important;
  }

  .board-workspace-header .capture-table {
    justify-self: end !important;
  }

  .board-workspace-header .board-view-toggles {
    grid-column: 1 / -1;
    grid-template-columns: minmax(46px, 1fr) 84px 84px;
    justify-content: stretch !important;
  }

  .board-stage {
    padding: 9px 10px 11px;
    border-radius: 12px;
  }

  .board-workspace-panel .board-stage > #board.goban.coordinates-active {
    margin-top: 20px;
    left: 3px;
  }

  #board.goban.coordinates-active > .board-coordinate {
    font-size: 10px;
  }

  #board.goban.coordinates-active > .board-coordinate-col.top {
    top: -15px;
  }

  #board.goban.coordinates-active > .board-coordinate-row {
    width: 12px;
  }

  #board.goban.coordinates-active > .board-coordinate-row.left {
    left: -13px;
  }

  .board-workspace-panel > .move-controls {
    grid-template-columns: 29px 29px 29px minmax(54px, 1fr) 29px 29px 29px 82px !important;
    gap: 3px !important;
    padding: 5px !important;
  }

  .board-workspace-panel > .move-controls button {
    min-width: 27px !important;
    min-height: 30px !important;
  }

  .board-workspace-panel > .move-controls #moveNumberLabel {
    width: 82px !important;
    min-width: 82px !important;
    font-size: 10px !important;
  }

  .board-workspace-panel .move-number-jump input {
    width: 31px;
    min-width: 31px;
  }

  .board-tree-header div > span {
    display: none;
  }
}

/* 棋譜エディタ: 右バーを編集ツールボックスとして再構成 */
body[data-page="kifu-editor"] #editorPanel.editor-toolbox {
  display: flex;
  flex-direction: column;
  gap: 11px !important;
  padding: 14px 13px 16px !important;
  background: #f8faf7 !important;
  border: 1px solid rgba(42, 76, 55, 0.15) !important;
  border-radius: 16px !important;
  box-shadow: 0 9px 26px rgba(32, 54, 41, 0.08) !important;
}

body[data-page="kifu-editor"] #editorPanel.editor-toolbox.hidden {
  display: none !important;
}

#editorPanel .editor-toolbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 1px 2px 0;
}

#editorPanel .editor-toolbox-header > div:first-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

#editorPanel .editor-toolbox-header > div:first-child > span {
  color: #75847b;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

#editorPanel .editor-toolbox-header h2 {
  margin: 0;
  color: #183b29;
  font-family: "Noto Serif JP", serif;
  font-size: 17px;
  line-height: 1.35;
}

#editorPanel .editor-toolbox-autosave {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  min-width: 0;
  max-width: 210px;
  color: #62766a;
}

#editorPanel .editor-toolbox-autosave > span {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  background: #54a06d;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(84, 160, 109, 0.12);
}

#editorPanel .editor-toolbox-autosave p {
  overflow: hidden;
  margin: 0;
  font-size: 8.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#editorPanel .editor-live-card {
  display: grid;
  gap: 5px;
  padding: 10px 11px;
  background:
    radial-gradient(circle at 100% 0, rgba(70, 126, 87, 0.08), transparent 48%),
    #fff;
  border: 1px solid rgba(42, 76, 55, 0.13);
  border-radius: 11px;
}

#editorPanel .editor-live-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#editorPanel #editorModeBadge {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 0 7px;
  color: #2d6847;
  background: #edf6ee;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
}

#editorPanel .editor-history-actions {
  display: flex;
  gap: 4px;
}

#editorPanel .editor-history-actions button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 62px;
  min-height: 28px !important;
  padding: 0 7px !important;
  color: #425a4d !important;
  background: #f6f8f5 !important;
  border: 1px solid rgba(43, 76, 56, 0.13) !important;
  border-radius: 7px !important;
  box-shadow: none !important;
  font-size: 9.5px !important;
  font-weight: 700 !important;
}

#editorPanel .editor-history-actions button:hover:not(:disabled) {
  color: #1d603a !important;
  background: #edf5ed !important;
}

#editorPanel .editor-history-actions button:disabled {
  opacity: 0.38;
}

#editorPanel .editor-history-actions svg {
  width: 13px;
  height: 13px;
}

#editorPanel .editor-live-card .editor-status {
  margin: 0;
  color: #30483b;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.5;
}

#editorPanel .editor-live-card .editor-mode-help {
  margin: 0;
  color: #77867e;
  font-size: 9px;
  line-height: 1.5;
}

#editorPanel .editor-quick-actions {
  display: grid;
  gap: 7px;
  padding: 10px;
  background: #fff;
  border: 1px solid rgba(42, 76, 55, 0.13);
  border-radius: 11px;
}

#editorPanel .editor-quick-actions-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-inline: 1px;
}

#editorPanel .editor-quick-actions-head h3 {
  margin: 0;
  color: #2d4939;
  font-size: 10px;
  font-weight: 800;
}

#editorPanel .editor-quick-actions-head > span {
  color: #89968f;
  font-size: 8.5px;
}

#editorPanel .editor-quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

#editorPanel .editor-quick-action {
  display: grid !important;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  min-height: 58px !important;
  align-items: center;
  padding: 7px 8px !important;
  color: #294739 !important;
  background: #f4f8f3 !important;
  border: 1px solid rgba(53, 96, 68, 0.14) !important;
  border-radius: 9px !important;
  box-shadow: none !important;
  text-align: left;
}

#editorPanel .editor-quick-action:hover {
  color: #194f31 !important;
  background: #ebf4ea !important;
  border-color: rgba(49, 105, 68, 0.28) !important;
  transform: translateY(-1px);
}

#editorPanel .editor-quick-action:focus-visible {
  outline: 2px solid rgba(48, 109, 70, 0.42);
  outline-offset: 2px;
}

#editorPanel .editor-quick-action-marks {
  color: #635127 !important;
  background: #fbf7eb !important;
  border-color: rgba(150, 119, 48, 0.16) !important;
}

#editorPanel .editor-quick-action-marks:hover {
  color: #574313 !important;
  background: #f7f0da !important;
  border-color: rgba(150, 119, 48, 0.3) !important;
}

#editorPanel .editor-quick-action-icon {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  color: #31704b;
  background: rgba(66, 125, 82, 0.1);
  border-radius: 8px;
}

#editorPanel .editor-quick-action-marks .editor-quick-action-icon {
  color: #8a6b21;
  background: rgba(179, 139, 48, 0.11);
}

#editorPanel .editor-quick-action-icon svg {
  width: 18px;
  height: 18px;
}

#editorPanel .editor-quick-action-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

#editorPanel .editor-quick-action-copy strong {
  font-size: 10.5px;
  line-height: 1.35;
}

#editorPanel .editor-quick-action-copy small {
  overflow: hidden;
  color: #7b8981;
  font-size: 8.5px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#editorPanel .editor-tool-tabs {
  position: static;
  top: auto;
  z-index: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  background: #eaf0e9;
  border: 1px solid rgba(43, 76, 56, 0.09);
  border-radius: 10px;
}

#editorPanel .editor-tool-tabs button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  min-height: 34px !important;
  padding: 0 7px !important;
  color: #5d6e64 !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 7px !important;
  box-shadow: none !important;
  font-size: 10.5px !important;
  font-weight: 800 !important;
}

#editorPanel .editor-tool-tabs button:hover {
  color: #2b6042 !important;
  background: rgba(255, 255, 255, 0.58) !important;
}

#editorPanel .editor-tool-tabs button.active {
  color: #1f603b !important;
  background: #fff !important;
  box-shadow: 0 2px 8px rgba(34, 61, 44, 0.1) !important;
}

#editorPanel .editor-tool-tabs svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

#editorPanel .editor-tool-panels {
  min-width: 0;
}

#editorPanel .editor-tool-tab-panel {
  display: grid;
  gap: 10px;
}

#editorPanel .editor-tool-tab-panel[hidden] {
  display: none !important;
}

#editorPanel .editor-tool-card {
  display: grid;
  gap: 9px;
  padding: 11px;
  background: #fff;
  border: 1px solid rgba(42, 76, 55, 0.12);
  border-radius: 11px;
}

#editorPanel .editor-tool-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#editorPanel .editor-tool-card-head > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

#editorPanel .editor-tool-card-head > div > span {
  color: #7b8981;
  font-size: 8.5px;
  font-weight: 700;
}

#editorPanel .editor-tool-card-head strong {
  color: #294738;
  font-size: 11px;
}

#editorPanel .editor-tool-card-head #editorInfoToggleBtn {
  min-height: 27px !important;
  padding: 0 8px !important;
  color: #2f6f4a !important;
  background: #f1f7f1 !important;
  border: 1px solid rgba(43, 106, 68, 0.16) !important;
  border-radius: 7px !important;
  box-shadow: none !important;
  font-size: 9px !important;
  text-decoration: none !important;
}

#editorPanel .editor-game-card .editor-info-bar {
  gap: 6px;
  padding: 7px 8px;
  background: #f3f7f2;
  border-radius: 8px;
}

#editorPanel .editor-game-card .editor-info-summary {
  margin: 0 !important;
  color: #4c6256;
  font-size: 9.5px;
  font-weight: 600;
  line-height: 1.45;
}

#editorPanel .editor-game-card .editor-info-fields {
  gap: 7px;
  padding: 9px;
  background: #f8faf7;
  border-color: rgba(42, 76, 55, 0.11);
}

#editorPanel .editor-game-card .editor-info-fields label {
  gap: 3px;
  color: #5a6c62;
  font-size: 9px;
}

#editorPanel .editor-game-card .editor-info-fields input,
#editorPanel .editor-game-card .editor-info-fields select {
  min-height: 31px;
  font-size: 10px;
}

#editorPanel .editor-game-card .editor-info-links {
  display: flex !important;
  justify-content: flex-end;
}

#editorPanel .editor-game-card .editor-info-links button {
  min-height: 27px !important;
  padding: 0 8px !important;
  color: #607267 !important;
  background: transparent !important;
  border: 0 !important;
  font-size: 9px !important;
  text-decoration: underline;
}

#editorPanel .editor-game-card .editor-file-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin: 0;
  padding: 0;
  border: 0;
}

#editorPanel .editor-game-card .editor-file-actions button,
#editorPanel .editor-game-card .editor-file-actions .editor-switch {
  min-height: 34px !important;
  padding: 0 5px !important;
  color: #40574a !important;
  background: #f8faf7 !important;
  border: 1px solid rgba(42, 76, 55, 0.13) !important;
  border-radius: 8px !important;
  font-size: 9.5px !important;
  font-weight: 700 !important;
}

#editorPanel .editor-game-card .editor-sgf-load-btn {
  color: #fff !important;
  background: #3b7652 !important;
  border-color: #3b7652 !important;
}

#editorPanel .editor-move-tools,
#editorPanel .editor-board-tools,
#editorPanel .editor-reference-tools {
  display: grid !important;
  gap: 10px !important;
  padding: 11px !important;
  background: #fff !important;
  border: 1px solid rgba(42, 76, 55, 0.12) !important;
  border-radius: 11px !important;
}

#editorPanel .editor-move-tools .editor-action-group,
#editorPanel .editor-board-tools .editor-diagram-group,
#editorPanel .editor-board-tools .editor-selection-group {
  margin: 0;
  padding: 0 !important;
  border: 0;
}

#editorPanel .editor-move-tools .editor-tool-label,
#editorPanel .editor-board-tools .editor-tool-label,
#editorPanel .editor-reference-tools .editor-tool-label {
  margin: 0 0 7px;
  color: #294738 !important;
  font-size: 11px !important;
  font-weight: 800 !important;
}

#editorPanel .editor-move-tools .editor-actions {
  grid-template-columns: 1fr 1fr !important;
  gap: 6px !important;
}

#editorPanel .editor-move-tools .editor-actions button {
  min-height: 38px !important;
  color: #3e5549 !important;
  background: #f8faf7 !important;
  border-color: rgba(42, 76, 55, 0.14) !important;
  font-size: 10px !important;
}

#editorPanel .editor-move-tools #editorDeleteModeBtn:not(:disabled) {
  color: #99513c !important;
}

#editorPanel .editor-move-tools #saveSgfBtn {
  min-height: 42px !important;
  color: #fff !important;
  background: linear-gradient(135deg, #356e4c, #4b835f) !important;
  border-color: transparent !important;
}

#editorPanel .editor-move-tools #saveSgfBtn svg {
  width: 14px;
  height: 14px;
}

#editorPanel .editor-board-tool-card > p {
  margin: 0;
  color: #748178;
  font-size: 9.5px;
  line-height: 1.55;
}

#editorPanel .editor-board-tools .diagram-tool-marks {
  grid-template-columns: repeat(5, 1fr) !important;
  gap: 5px;
}

#editorPanel .editor-board-tools .diagram-tool-row button {
  min-height: 40px !important;
  color: #344d40 !important;
  background: #f8faf7 !important;
  border-color: rgba(42, 76, 55, 0.14) !important;
}

#editorPanel .editor-board-tools .diagram-tool-row button.active {
  color: #21633e !important;
  background: #eaf4eb !important;
  border-color: rgba(37, 105, 63, 0.28) !important;
}

#editorPanel .editor-board-tools .diagram-label-row {
  margin-top: 6px;
}

#editorPanel .editor-board-tools .diagram-label-row input {
  min-height: 35px !important;
  background: #f8faf7 !important;
  font-size: 10px !important;
}

#editorPanel .editor-board-tools .diagram-selection-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

#editorPanel .editor-board-tools .diagram-delete-selection {
  min-height: 36px !important;
  margin: 0;
  color: #40574a !important;
  background: #f8faf7 !important;
  border-color: rgba(42, 76, 55, 0.14) !important;
  font-size: 9.5px !important;
}

#editorPanel .editor-reference-tools .editor-start-group {
  margin: 0;
}

#editorPanel .editor-reference-actions {
  display: grid;
  gap: 6px;
}

#editorPanel .editor-reference-actions .editor-start-btn {
  width: 100% !important;
  min-height: 42px !important;
  color: #236640 !important;
  background: #edf6ee !important;
  border: 1px solid rgba(40, 108, 64, 0.2) !important;
  border-radius: 9px !important;
  box-shadow: none !important;
  font-size: 11px !important;
}

#editorPanel .editor-reference-actions #editorReferenceCancelBtn {
  min-height: 34px;
  color: #9a4e3a;
  background: #fff7f4;
  border: 1px solid rgba(156, 76, 55, 0.16);
  border-radius: 8px;
  font-size: 10px;
}

#editorPanel .editor-comment-card {
  display: grid;
  gap: 6px;
  padding: 11px;
  background: #fff;
  border: 1px solid rgba(42, 76, 55, 0.12) !important;
  border-radius: 11px !important;
}

#editorPanel .editor-comment-card > span {
  color: #294738;
  font-size: 11px;
  font-weight: 800;
}

#editorPanel .editor-comment-card textarea {
  min-height: 112px;
  margin: 0;
  padding: 10px !important;
  color: #30473b;
  background: #f8faf7;
  border-color: rgba(42, 76, 55, 0.14) !important;
  border-radius: 8px !important;
  font-size: 11px !important;
  line-height: 1.6;
  resize: vertical;
}

#editorPanel .editor-tool-tab-panel #editorReferenceList:empty,
#editorPanel .editor-tool-tab-panel #editorAiExplainResults:empty {
  display: none;
}

#editorPanel .editor-tool-tab-panel .editor-reference-list {
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
}

@media (max-width: 1180px) {
  body[data-page="kifu-editor"] #editorPanel.editor-toolbox {
    max-width: 760px !important;
    margin-inline: auto;
  }
}

@media (max-width: 520px) {
  #editorPanel .editor-toolbox-header {
    align-items: flex-start;
  }

  #editorPanel .editor-toolbox-autosave {
    max-width: 150px;
  }

  #editorPanel .editor-history-actions button {
    min-width: 48px;
  }

  #editorPanel .editor-history-actions button span {
    display: none;
  }

  #editorPanel .editor-tool-tabs button {
    gap: 3px;
    padding-inline: 4px !important;
  }

  #editorPanel .editor-game-card .editor-file-actions {
    grid-template-columns: 1fr;
  }
}

/* 自由検討: 右バーは局面評価のみ */
body[data-mode="study"] #studyPanel.study-panel {
  gap: 10px;
}

/* Free-study character page for smartphones r1 (2026-08-13). */
.study-mobile-intro,
.study-mobile-after-board {
  display: none;
}

.study-mobile-entry-icon {
  display: none;
}

@media (orientation: portrait) and (max-width: 1439px) {
  body[data-mode="study"].workspace-mobile-minimal {
    --study-mobile-pink: #ef6872;
    --study-mobile-pink-soft: #fff2f1;
    --study-mobile-line: rgba(224, 124, 118, 0.28);
    --study-mobile-ink: #352621;
    background:
      radial-gradient(circle at 7% 15%, rgba(246, 185, 181, 0.17), transparent 20rem),
      linear-gradient(180deg, #fffaf7 0%, #fffdfb 100%);
    color: var(--study-mobile-ink);
  }

  body[data-mode="study"].workspace-mobile-minimal .app-shell {
    padding-top: 0;
  }

  body[data-mode="study"].workspace-mobile-minimal .board-workspace-panel {
    display: flex !important;
    flex-direction: column;
    gap: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-intro,
  body[data-mode="study"].workspace-mobile-minimal .study-mobile-after-board {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-intro {
    padding: 8px 10px 10px;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-hero {
    position: relative;
    height: 190px;
    overflow: hidden;
    border: 2px solid rgba(239, 104, 114, 0.34);
    border-radius: 18px;
    background:
      radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.94) 0 4px, transparent 5px),
      radial-gradient(circle at 84% 20%, rgba(244, 163, 169, 0.3) 0 38px, transparent 39px),
      linear-gradient(105deg, #fffdfb 4%, #fff8f6 48%, #fdeae7 100%);
    box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.68);
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-hero::before,
  body[data-mode="study"].workspace-mobile-minimal .study-mobile-hero::after {
    position: absolute;
    color: rgba(239, 104, 114, 0.33);
    content: "✿";
    font-size: 34px;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-hero::before {
    top: 7px;
    left: 10px;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-hero::after {
    right: 11px;
    bottom: 5px;
    font-size: 44px;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-hero-copy {
    position: relative;
    z-index: 2;
    width: 48%;
    padding: 55px 0 0 22px;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-kicker {
    display: none;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-hero h1 {
    margin: 0 0 8px;
    color: #2d1d19;
    font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
    font-size: clamp(26px, 8.2vw, 34px);
    font-weight: 500;
    letter-spacing: 0.06em;
    line-height: 1.15;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-hero-copy p {
    margin: 0;
    font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
    font-size: 12px;
    line-height: 1.65;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-hero > img {
    position: absolute;
    z-index: 1;
    right: 22px;
    bottom: -52px;
    width: 224px;
    height: auto;
    max-width: none;
    object-fit: contain;
    filter: drop-shadow(0 8px 8px rgba(79, 44, 36, 0.13));
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-hero-balloon {
    position: absolute;
    z-index: 3;
    top: 25px;
    right: 7px;
    width: 74px;
    margin: 0;
    padding: 7px 8px;
    color: #473530;
    border: 1px solid rgba(225, 146, 142, 0.46);
    border-radius: 999px;
    background: rgba(255, 252, 249, 0.92);
    font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
    font-size: 9px;
    line-height: 1.5;
    text-align: center;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-start-host {
    margin-top: 10px;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-intro > .study-mobile-evaluation-host {
    margin-top: 8px;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-start-host .study-start-section {
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-start-host .study-section-title,
  body[data-mode="study"].workspace-mobile-minimal .study-mobile-start-host #studyStartCurrentBtn,
  body[data-mode="study"].workspace-mobile-minimal .study-mobile-start-host #studyOpenAiGamesBtn {
    display: none !important;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-start-host .study-start-actions {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 7px;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-start-host .study-start-actions > button {
    min-width: 0 !important;
    min-height: 78px;
    padding: 7px 3px !important;
    grid-template-columns: 1fr !important;
    grid-template-rows: 42px auto !important;
    place-items: center;
    gap: 4px;
    color: #3a2b27;
    border: 1px solid var(--study-mobile-line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.76);
    box-shadow: 0 4px 14px rgba(95, 58, 49, 0.04);
    font-size: 12px;
    text-align: center;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-start-host .study-start-actions svg {
    width: 29px !important;
    height: 29px !important;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-start-host .study-start-actions > button > svg:first-child {
    display: none !important;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-entry-icon {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-entry-icon > svg {
    width: 40px !important;
    height: 40px !important;
    overflow: visible;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-start-host #studyStartEmptyBtn {
    order: 1;
    color: #e55764;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-start-host #studyOpenSavedBtn {
    order: 2;
    color: #73984e;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-start-host #studyOpenSavedBtn > span:not(.study-mobile-entry-icon) {
    display: none;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-start-host #studyOpenSavedBtn::after {
    color: #3a2b27;
    content: "保存対局";
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-start-host #studyOpenSgfBtn {
    order: 3;
    color: #397fba;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-start-host #studyNewGamePanel {
    margin: 8px 0 0 !important;
    border-color: var(--study-mobile-line) !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.9) !important;
  }

  body[data-mode="study"].workspace-mobile-minimal .board-workspace-panel > .board-stage {
    order: initial;
    margin-top: 2px;
    background: #edbc72 !important;
  }

  body[data-mode="study"].workspace-mobile-minimal .board-workspace-panel > .move-controls {
    margin: 0 !important;
    padding: 8px 8px 6px !important;
    border: 1px solid rgba(224, 124, 118, 0.18) !important;
    border-top: 0 !important;
    border-radius: 0 0 14px 14px !important;
    background: rgba(255, 252, 249, 0.94) !important;
  }

  body[data-mode="study"].workspace-mobile-minimal .board-workspace-panel > .move-controls > button {
    color: #5b403a !important;
    border-color: rgba(224, 124, 118, 0.3) !important;
    background: #fffaf7 !important;
    box-shadow: none !important;
  }

  body[data-mode="study"].workspace-mobile-minimal .board-workspace-panel > .move-controls input[type="range"] {
    accent-color: #ed6a78;
    touch-action: pan-y;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-after-board {
    padding: 10px;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-after-board > div {
    margin-bottom: 10px;
  }

  body:is([data-mode="study"], [data-mode="analysis"]).workspace-mobile-minimal .study-mobile-evaluation-host .workspace-mobile-evaluation {
    display: block;
    margin: 0;
  }

  body:is([data-mode="study"], [data-mode="analysis"]).workspace-mobile-minimal .study-mobile-evaluation-host .winrate-bar-panel.analysis-study-section {
    display: grid !important;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 12px 14px !important;
    border: 1px solid var(--study-mobile-line) !important;
    border-radius: 14px !important;
    background: rgba(255, 255, 255, 0.77) !important;
    box-shadow: 0 5px 18px rgba(93, 55, 46, 0.04) !important;
  }

  body:is([data-mode="study"], [data-mode="analysis"]).workspace-mobile-minimal .study-mobile-evaluation-host .study-result-heading {
    display: none !important;
  }

  body:is([data-mode="study"], [data-mode="analysis"]).workspace-mobile-minimal .study-mobile-evaluation-host .study-result-heading > div > span,
  body:is([data-mode="study"], [data-mode="analysis"]).workspace-mobile-minimal .study-mobile-evaluation-host .study-result-heading > small {
    display: none !important;
  }

  body:is([data-mode="study"], [data-mode="analysis"]).workspace-mobile-minimal .study-mobile-evaluation-host .study-result-heading strong {
    font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
    font-size: 0 !important;
    font-weight: 600;
  }

  body:is([data-mode="study"], [data-mode="analysis"]).workspace-mobile-minimal .study-mobile-evaluation-host .study-result-heading strong::after {
    color: var(--study-mobile-ink);
    content: "形勢";
    font-size: 19px;
  }

  body:is([data-mode="study"], [data-mode="analysis"]).workspace-mobile-minimal .study-mobile-evaluation-host .study-result-heading strong::before,
  body[data-mode="study"].workspace-mobile-minimal .study-mobile-tree-host .board-tree-heading strong::before {
    margin-right: 7px;
    color: rgba(239, 104, 114, 0.52);
    content: "✿";
  }

  body:is([data-mode="study"], [data-mode="analysis"]).workspace-mobile-minimal .study-mobile-evaluation-host .bar-score {
    display: block !important;
    grid-column: 1;
    margin: 0 !important;
    white-space: nowrap;
  }

  body:is([data-mode="study"], [data-mode="analysis"]).workspace-mobile-minimal .study-mobile-evaluation-host .bar-score-main {
    font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
    font-size: 20px !important;
    font-weight: 600;
  }

  body:is([data-mode="study"], [data-mode="analysis"]).workspace-mobile-minimal .study-mobile-evaluation-host .winrate-bar-row {
    display: grid !important;
    grid-column: 2;
    grid-template-columns: max-content minmax(0, 1fr) max-content !important;
    min-width: 0;
    gap: 6px !important;
  }

  body:is([data-mode="study"], [data-mode="analysis"]).workspace-mobile-minimal .study-mobile-evaluation-host .winrate-stone {
    display: none !important;
  }

  body:is([data-mode="study"], [data-mode="analysis"]).workspace-mobile-minimal .study-mobile-evaluation-host .winrate-stone-label {
    color: #252729 !important;
    font-size: 13px !important;
    font-weight: 500;
  }

  body:is([data-mode="study"], [data-mode="analysis"]).workspace-mobile-minimal .study-mobile-evaluation-host .winrate-stone-label:last-child {
    color: #3d8fd8 !important;
  }

  body:is([data-mode="study"], [data-mode="analysis"]).workspace-mobile-minimal .study-mobile-evaluation-host .winrate-stone-label strong {
    font-size: 14px !important;
    font-weight: 600;
  }

  body:is([data-mode="study"], [data-mode="analysis"]).workspace-mobile-minimal .study-mobile-evaluation-host .winrate-bar {
    height: 8px !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: #b9d9f5 !important;
    box-shadow: none !important;
    overflow: hidden !important;
  }

  body:is([data-mode="study"], [data-mode="analysis"]).workspace-mobile-minimal .study-mobile-evaluation-host .winrate-fill.black-side {
    height: 100% !important;
    border-radius: 999px 0 0 999px !important;
    background: #505254 !important;
  }

  body:is([data-mode="study"], [data-mode="analysis"]).workspace-mobile-minimal .study-mobile-evaluation-host .winrate-fill.black-side::after {
    display: none !important;
    content: none !important;
  }

  body:is([data-mode="study"], [data-mode="analysis"]).workspace-mobile-minimal .study-mobile-evaluation-host .winrate-fill.white-side {
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    border-radius: 0 999px 999px 0 !important;
    background: #b9d9f5 !important;
  }

  body:is([data-mode="study"], [data-mode="analysis"]).workspace-mobile-minimal .study-mobile-evaluation-host .winrate-complexity-row {
    display: none !important;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-question-host .analysis-qa-section {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-question-host .analysis-qa-action {
    width: 100% !important;
    min-height: 66px;
    justify-content: center;
    color: #fff !important;
    border: 3px double rgba(255, 255, 255, 0.88) !important;
    border-radius: 13px !important;
    background: linear-gradient(135deg, #ef6670, #df5964) !important;
    box-shadow: 0 7px 16px rgba(215, 83, 94, 0.18) !important;
    font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
    font-size: 17px !important;
    letter-spacing: 0.03em;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-question-host .analysis-qa-action svg {
    width: 34px !important;
    height: 34px !important;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-save-host .study-save-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 7px;
    margin: 0 !important;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-save-host .study-btn-secondary {
    min-width: 0 !important;
    min-height: 62px;
    justify-content: center;
    gap: 7px;
    padding: 8px 4px !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.66) !important;
    font-size: 14px;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-save-host #studySaveServerBtn {
    order: 1;
    color: #e85e68;
    border-color: rgba(232, 94, 104, 0.56) !important;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-save-host #studyExportSgfBtn {
    order: 2;
    color: #679247;
    border-color: rgba(103, 146, 71, 0.56) !important;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-save-host #studySaveLocalBtn {
    display: none !important;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-tree-host .board-tree-panel {
    display: block !important;
    margin: 0 !important;
    padding: 12px 10px 10px !important;
    border: 1px solid var(--study-mobile-line) !important;
    border-radius: 14px !important;
    background: rgba(255, 255, 255, 0.76) !important;
    box-shadow: 0 5px 18px rgba(93, 55, 46, 0.04) !important;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-tree-host .board-tree-heading-icon,
  body[data-mode="study"].workspace-mobile-minimal .study-mobile-tree-host .board-tree-eyebrow,
  body[data-mode="study"].workspace-mobile-minimal .study-mobile-tree-host .board-tree-heading small,
  body[data-mode="study"].workspace-mobile-minimal .study-mobile-tree-host .board-tree-summary,
  body[data-mode="study"].workspace-mobile-minimal .study-mobile-tree-host #gameTreeToggleBtn,
  body[data-mode="study"].workspace-mobile-minimal .study-mobile-tree-host .board-tree-legend,
  body[data-mode="study"].workspace-mobile-minimal .study-mobile-tree-host .board-tree-help {
    display: none !important;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-tree-host .board-tree-heading strong {
    font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
    font-size: 18px;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-tree-host .board-tree-toolbar {
    justify-content: flex-end;
    margin: -38px 0 10px;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-tree-host #gameTreeFocusBtn {
    min-height: 34px;
    color: #4c3d38;
    border-color: var(--study-mobile-line);
    border-radius: 9px;
    background: #fffaf7;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-tree-host .game-tree {
    min-height: 126px;
    padding: 8px 2px !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    background: transparent !important;
    touch-action: pan-x pan-y;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-character-tip {
    position: relative;
    display: flex;
    min-height: 80px;
    align-items: center;
    justify-content: flex-end;
    overflow: hidden;
    padding: 8px 13px;
    border: 1px solid var(--study-mobile-line);
    border-radius: 14px;
    background: linear-gradient(90deg, #fff5f2, #fffdfa);
    box-sizing: border-box;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-character-tip img {
    position: absolute;
    left: -4px;
    bottom: -64px;
    width: 154px;
    height: auto;
    max-width: none;
    object-fit: contain;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-character-tip p {
    position: relative;
    width: calc(100% - 105px);
    margin: 0;
    padding: 11px 9px;
    border: 1px solid rgba(229, 143, 139, 0.45);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.8);
    font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
    font-size: 14px;
    text-align: center;
  }

  body[data-mode="study"].workspace-mobile-minimal .workspace-mobile-study-actions,
  body[data-mode="study"].workspace-mobile-minimal .workspace-mobile-tools-below {
    display: none !important;
  }
}

/* 自由検討: 候補手の評価値は数値向け書体で、目数差を主・勝率を従に見せる */
body:is([data-mode="study"], [data-mode="analysis"]) #board.goban > .candidate .candidate-metrics {
  width: 122%;
  row-gap: 2px;
  justify-items: center;
}

body:is([data-mode="study"], [data-mode="analysis"]) #board.goban > .candidate.rank-1 {
  background: rgba(102, 177, 238, 0.9);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.96),
    0 0 0 3px rgba(49, 113, 166, 0.78),
    0 2px 7px rgba(0, 0, 0, 0.2);
}

.ai-game-page .ai-game-board .candidate.ai-game-candidate-evaluation.rank-1 {
  background: rgba(102, 177, 238, 0.9);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.96),
    0 0 0 3px rgba(49, 113, 166, 0.78),
    0 2px 7px rgba(0, 0, 0, 0.2);
}

body:is([data-mode="study"], [data-mode="analysis"]) #board.goban > .candidate.rank-2 {
  background: rgba(105, 196, 140, 0.78);
}

body:is([data-mode="study"], [data-mode="analysis"]) #board.goban > .candidate.rank-3 {
  background: rgba(177, 149, 225, 0.66);
}

/* 候補手を表示中、棋譜上で次に実際に打たれた交点を最善候補とは別の印で示す。 */
body:is([data-mode="study"], [data-mode="analysis"]) #board.goban > .next-played-move-marker {
  position: absolute;
  z-index: 9;
  width: calc(108% / var(--board-size));
  height: calc(108% / var(--board-size));
  box-sizing: border-box;
  transform: translate(-50%, -50%);
  border: 2px solid #e4576b;
  border-radius: 50%;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.92),
    0 2px 7px rgba(111, 38, 50, 0.28);
  pointer-events: none;
}

.candidate-played-label {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border: 1px solid rgba(228, 87, 107, 0.28);
  border-radius: 999px;
  color: #b33b50;
  background: rgba(255, 239, 242, 0.96);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.candidate-list li.is-next-played {
  box-shadow: inset 3px 0 0 #e4576b;
}

body:is([data-mode="study"], [data-mode="analysis"]) #board.goban > .candidate .candidate-score {
  width: 150%;
  left: auto;
  justify-self: center;
  font-size: clamp(13px, 50cqi, 17px);
  font-family: "Segoe UI Variable Text", "Segoe UI", Arial, sans-serif;
  font-weight: 700;
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
  letter-spacing: 0.035em;
  line-height: 1.05;
  transform: none;
}

body:is([data-mode="study"], [data-mode="analysis"]) #board.goban > .candidate .candidate-score.candidate-score-wide {
  width: 100%;
  font-size: clamp(9px, 35cqi, 12px);
  letter-spacing: 0.005em;
}

body:is([data-mode="study"], [data-mode="analysis"]) #board.goban > .candidate .candidate-score.candidate-score-extra-wide {
  width: 100%;
  font-size: clamp(7px, 27cqi, 9px);
  letter-spacing: 0;
}

body:is([data-mode="study"], [data-mode="analysis"]) #board.goban > .candidate .candidate-winrate {
  width: 135%;
  max-width: none;
  justify-self: center;
  font-size: clamp(9px, 34cqi, 12px);
  font-family: "Segoe UI Variable Text", "Segoe UI", Arial, sans-serif;
  font-weight: 650;
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
  letter-spacing: 0.035em;
  line-height: 1.05;
  opacity: 0.95;
  overflow: visible;
  transform: translateY(1px);
}

/* AI検討: 自由検討モードの右バーを作業順に整理 */
.study-result-heading {
  display: none;
}

body[data-mode="study"] #analysisRightStack.analysis-right-stack {
  gap: 12px;
}

body[data-mode="study"] #studyPanel.study-panel {
  display: grid;
  gap: 10px;
  padding: 13px;
  background:
    radial-gradient(circle at 100% 0, rgba(75, 132, 91, 0.09), transparent 34%),
    #f7f9f6;
  border: 1px solid rgba(42, 76, 55, 0.15);
  border-radius: 15px;
  box-shadow: 0 8px 24px rgba(31, 56, 39, 0.07);
}

body[data-mode="study"] #studyPanel.study-panel.hidden {
  display: none !important;
}

#studyPanel .study-command-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 1px 2px 2px;
}

#studyPanel .study-command-header > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

#studyPanel .study-command-header > div > span {
  color: #77877e;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

#studyPanel .study-command-header h2 {
  margin: 0;
  color: #183d29;
  font-family: "Noto Serif JP", serif;
  font-size: 18px;
  line-height: 1.35;
}

#studyPanel .study-command-header p {
  margin: 0;
  color: #748179;
  font-size: 9.5px;
  line-height: 1.5;
}

#studyPanel .study-session-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  flex: 0 0 auto;
  padding: 0 9px;
  color: #7b837f;
  background: #eef1ee;
  border: 1px solid rgba(60, 78, 67, 0.1);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
}

#studyPanel .study-session-badge[data-state="ready"] {
  color: #28633f;
  background: #e9f4e9;
  border-color: rgba(42, 104, 64, 0.14);
}

#studyPanel .study-session-badge[data-state="analyzing"] {
  color: #8a651b;
  background: #fbf2da;
  border-color: rgba(159, 118, 31, 0.17);
}

#studyPanel .study-session-summary {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  padding: 10px;
  background: #fff;
  border: 1px solid rgba(42, 76, 55, 0.13);
  border-radius: 11px;
}

#studyPanel .study-session-icon {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  color: #34724d;
  background: #ebf4eb;
  border-radius: 9px;
}

#studyPanel .study-session-icon svg {
  width: 18px;
  height: 18px;
}

#studyPanel .study-session-summary > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

#studyPanel .study-session-summary small {
  color: #87938c;
  font-size: 8.5px;
  font-weight: 700;
}

#studyPanel .study-session-summary .study-source-label {
  overflow: hidden;
  margin: 0;
  color: #284a37;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#studyPanel .study-status {
  margin: 0;
  color: #738178;
  font-size: 9px;
  line-height: 1.5;
}

#studyPanel .study-status.error {
  color: #b34438;
}

#studyPanel .study-primary-action {
  position: relative;
}

#studyPanel .study-primary-action #studyAnalyzeBtn {
  display: grid !important;
  width: 100%;
  min-height: 58px;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 8px 12px !important;
  text-align: left;
  border-radius: 10px !important;
  box-shadow: 0 7px 16px rgba(31, 98, 60, 0.2);
}

#studyPanel .study-primary-action #studyAnalyzeBtn:disabled {
  color: #8b9690 !important;
  background: #e8ece8 !important;
  border-color: #dde3dd !important;
  box-shadow: none;
  opacity: 1;
}

#studyPanel .study-primary-action #studyAnalyzeBtn > svg {
  width: 24px;
  height: 24px;
  justify-self: center;
}

#studyPanel .study-primary-action #studyAnalyzeBtn > span {
  display: grid;
  min-width: 0;
  gap: 1px;
}

#studyPanel .study-primary-action #studyAnalyzeBtn strong {
  font-size: 11.5px;
  line-height: 1.35;
}

#studyPanel .study-primary-action #studyAnalyzeBtn small {
  color: rgba(255, 255, 255, 0.74);
  font-size: 8.5px;
  font-weight: 600;
}

#studyPanel .study-primary-action #studyAnalyzeBtn:disabled small {
  color: #98a19c;
}

#studyPanel .study-primary-action .thinking-indicator {
  position: absolute;
  right: 12px;
  bottom: 8px;
  z-index: 2;
  pointer-events: none;
}

#studyPanel .study-start-section,
#studyPanel .study-candidate-row {
  display: grid;
  gap: 8px;
  padding: 10px;
  background: #fff;
  border: 1px solid rgba(42, 76, 55, 0.12);
  border-radius: 11px;
}

#studyPanel .study-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

#studyPanel .study-section-title strong {
  color: #2a4b38;
  font-size: 10.5px;
  font-weight: 800;
}

#studyPanel .study-section-title small {
  color: #89958e;
  font-size: 8.5px;
}

#studyPanel .study-start-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

#studyPanel .study-start-actions button {
  display: grid !important;
  min-width: 0;
  min-height: 52px;
  grid-template-rows: 19px auto;
  align-content: center;
  justify-items: center;
  gap: 4px !important;
  padding: 6px 4px !important;
  border-radius: 8px !important;
  font-size: 9px !important;
  line-height: 1.25;
  text-align: center;
}

#studyPanel .study-start-actions button svg {
  width: 18px;
  height: 18px;
}

#studyPanel .study-start-actions button[aria-expanded="true"] {
  color: #245f3d !important;
  background: #edf5ed !important;
  border-color: rgba(45, 107, 70, 0.28) !important;
}

#studyPanel .study-new-game-panel {
  display: grid;
  gap: 9px;
  padding: 10px;
  background: #f2f7f1;
  border: 1px solid rgba(43, 103, 67, 0.16);
  border-radius: 11px;
}

#studyPanel .study-new-game-panel.hidden {
  display: none !important;
}

#studyPanel .study-new-game-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}

#studyPanel .study-new-game-head > div {
  display: grid;
  gap: 1px;
}

#studyPanel .study-new-game-head span {
  color: #7d8d84;
  font-size: 7.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

#studyPanel .study-new-game-head h3 {
  margin: 0;
  color: #294d38;
  font-size: 11px;
}

#studyPanel .study-new-game-head > small {
  color: #89958e;
  font-size: 8px;
}

#studyPanel .study-new-game-grid {
  gap: 6px;
}

#studyPanel .study-new-game-grid label {
  gap: 3px;
  color: #718078;
  font-size: 8.5px;
}

#studyPanel .study-new-game-grid input,
#studyPanel .study-new-game-grid select {
  min-height: 32px;
  padding: 5px 7px;
  border-color: rgba(42, 76, 55, 0.15);
  border-radius: 7px;
  font-size: 10px;
}

#studyPanel .study-new-game-actions button {
  width: 100%;
  min-height: 34px;
  color: #fff;
  background: #34734d;
  border-color: #34734d;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 800;
}

#studyPanel .study-candidate-limit-row,
#studyPanel .study-auto-row {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 7px;
  background: #f7f9f6;
  border: 1px solid rgba(42, 76, 55, 0.1);
  border-radius: 8px;
  cursor: pointer;
}

#studyPanel .study-setting-copy {
  display: grid;
  min-width: 0;
  flex: 1 1 auto;
  gap: 1px;
}

#studyPanel .study-setting-copy strong {
  color: #354f40;
  font-size: 9.5px;
  line-height: 1.35;
}

#studyPanel .study-setting-copy small {
  color: #89948e;
  font-size: 8px;
  font-weight: 500;
  line-height: 1.35;
}

#studyPanel .study-candidate-limit-row select {
  width: 64px;
  min-height: 30px;
  flex: 0 0 auto;
  padding: 4px 24px 4px 8px;
  border-color: rgba(42, 76, 55, 0.16);
  border-radius: 7px;
  font-size: 10px;
}

#studyPanel .study-auto-row {
  position: relative;
}

#studyPanel .study-auto-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

#studyPanel .study-switch-ui {
  position: relative;
  width: 32px;
  height: 18px;
  flex: 0 0 auto;
  background: #cfd7d1;
  border-radius: 999px;
  transition: background 0.16s ease;
}

#studyPanel .study-switch-ui i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(28, 46, 34, 0.2);
  transition: transform 0.16s ease;
}

#studyPanel .study-auto-row input:checked + .study-switch-ui {
  background: #3e8058;
}

#studyPanel .study-auto-row input:checked + .study-switch-ui i {
  transform: translateX(14px);
}

#studyPanel .study-auto-row input:focus-visible + .study-switch-ui {
  outline: 2px solid rgba(48, 111, 71, 0.34);
  outline-offset: 2px;
}

body[data-mode="study"] .shared-candidate-section.analysis-study-section,
body[data-mode="study"] .shared-reference-controls.analysis-study-section {
  overflow: hidden;
  background: #fff !important;
  border: 1px solid rgba(42, 76, 55, 0.14) !important;
  border-radius: 13px !important;
  box-shadow: 0 6px 18px rgba(31, 56, 39, 0.055);
}

body[data-mode="study"] .shared-candidate-section .candidate-table-head-main {
  padding-block: 9px !important;
  color: #294a37;
  background: #f6f9f5;
  border-bottom-color: rgba(42, 76, 55, 0.11);
  font-size: 10px !important;
}

body[data-mode="study"] .shared-candidate-section .candidate-reload-btn {
  color: #2f6d49;
  background: #fff;
  border-color: rgba(47, 109, 73, 0.18);
  border-radius: 6px;
  font-size: 8.5px;
}

body[data-mode="study"] .shared-reference-controls.analysis-study-section {
  gap: 9px;
  padding: 12px !important;
}

body[data-mode="study"] .shared-reference-controls > h3 {
  margin: 0;
  padding: 0 0 8px;
  color: #294a37;
  border-bottom: 1px solid rgba(42, 76, 55, 0.1);
  font-size: 10.5px;
  line-height: 1.5;
}

@media (max-width: 520px) {
  #studyPanel .study-start-actions {
    grid-template-columns: 1fr;
  }

  #studyPanel .study-start-actions button {
    min-height: 38px;
    grid-template-columns: 20px minmax(0, 1fr);
    grid-template-rows: none;
    justify-items: start;
    padding-inline: 10px !important;
    text-align: left;
  }

  #studyPanel .study-new-game-grid {
    grid-template-columns: 1fr;
  }
}

/* AI検討・自由検討: 候補手一覧を選択しやすいカード型リストへ再構成 */
body[data-mode="study"] .shared-candidate-section.analysis-study-section {
  min-height: 0 !important;
}

body[data-mode="study"] .shared-candidate-section .candidate-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px 9px;
  background:
    radial-gradient(circle at 100% 0, rgba(65, 125, 83, 0.08), transparent 48%),
    #fff;
  border-bottom: 1px solid rgba(42, 76, 55, 0.1);
}

body[data-mode="study"] .shared-candidate-section .candidate-card-header > div:first-child {
  display: grid;
  min-width: 0;
  gap: 1px;
}

body[data-mode="study"] .shared-candidate-section .candidate-card-header > div:first-child > span {
  color: #829087;
  font-size: 7.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

body[data-mode="study"] .shared-candidate-section .candidate-card-header h3 {
  margin: 0 !important;
  padding: 0 !important;
  color: #294a37;
  border: 0;
  font-size: 12px !important;
  line-height: 1.4;
}

body[data-mode="study"] .shared-candidate-section .candidate-card-header-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 6px;
}

body[data-mode="study"] .shared-candidate-section .candidate-count-label {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  padding: 0 8px;
  color: #607168;
  background: #f0f3f0;
  border-radius: 999px;
  font-size: 8.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

body[data-mode="study"] .shared-candidate-section .candidate-reload-btn {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 8px;
  color: #2e6c48;
  background: #f4f8f3;
  border: 1px solid rgba(47, 109, 73, 0.17);
  border-radius: 7px;
  font-size: 8.5px;
  font-weight: 800;
}

body[data-mode="study"] .shared-candidate-section .candidate-reload-btn:hover {
  color: #205a39;
  background: #eaf3e9;
  border-color: rgba(47, 109, 73, 0.29);
}

body[data-mode="study"] .shared-candidate-section .candidate-reload-btn svg {
  width: 12px;
  height: 12px;
}

body[data-mode="study"] .shared-candidate-section .candidate-column-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 62px 58px 54px;
  align-items: center;
  gap: 6px;
  padding: 6px 17px;
  color: #8a968f;
  background: #f7f9f6;
  border-bottom: 1px solid rgba(42, 76, 55, 0.08);
  font-size: 8px;
  font-weight: 700;
}

body[data-mode="study"] .shared-candidate-section .candidate-column-head span:not(:first-child) {
  text-align: right;
}

body[data-mode="study"] .shared-candidate-section .candidate-list-shell {
  display: block !important;
  min-height: 0;
  background: #f5f8f4;
}

body[data-mode="study"] .shared-candidate-section .candidate-list-scroll {
  display: block !important;
  height: auto !important;
  max-height: min(340px, 42vh) !important;
  padding: 8px !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  scrollbar-color: rgba(61, 102, 74, 0.24) transparent;
  scrollbar-width: thin;
}

body[data-mode="study"] .shared-candidate-section .candidate-list-scroll::-webkit-scrollbar {
  width: 6px;
}

body[data-mode="study"] .shared-candidate-section .candidate-list-scroll::-webkit-scrollbar-thumb {
  background: rgba(61, 102, 74, 0.22);
  border-radius: 999px;
}

body[data-mode="study"] .shared-candidate-section .candidate-list li {
  position: relative;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 62px 58px 54px !important;
  align-items: center;
  gap: 6px;
  min-height: 58px !important;
  margin: 0 0 6px;
  padding: 8px 9px !important;
  color: #30483a;
  background: #fff !important;
  border: 1px solid rgba(42, 76, 55, 0.12) !important;
  border-radius: 10px !important;
  box-shadow: 0 2px 7px rgba(32, 55, 40, 0.035);
  cursor: pointer;
  transition: border-color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
}

body[data-mode="study"] .shared-candidate-section .candidate-list li:last-child {
  margin-bottom: 0;
  border-bottom: 1px solid rgba(42, 76, 55, 0.12) !important;
}

body[data-mode="study"] .shared-candidate-section .candidate-list li:hover {
  background: #fbfdfb !important;
  border-color: rgba(43, 105, 66, 0.27) !important;
  box-shadow: 0 5px 13px rgba(32, 70, 45, 0.08);
  transform: translateY(-1px);
}

body[data-mode="study"] .shared-candidate-section .candidate-list li:focus-visible {
  outline: 2px solid rgba(47, 111, 71, 0.36);
  outline-offset: 1px;
}

body[data-mode="study"] .shared-candidate-section .candidate-list li.is-best {
  background: linear-gradient(100deg, rgba(247, 242, 221, 0.72), #fff 55%) !important;
  border-color: rgba(160, 126, 45, 0.22) !important;
}

body[data-mode="study"] .shared-candidate-section .candidate-list li.active {
  background: linear-gradient(100deg, rgba(232, 244, 232, 0.95), #fff 62%) !important;
  border-color: rgba(42, 109, 66, 0.34) !important;
  box-shadow: inset 3px 0 0 #34734d, 0 5px 13px rgba(32, 70, 45, 0.08);
}

body[data-mode="study"] .shared-candidate-section .candidate-main-cell {
  display: grid;
  min-width: 0;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
}

body[data-mode="study"] .shared-candidate-section .candidate-main-cell,
body[data-mode="study"] .shared-candidate-section .candidate-move-copy,
body[data-mode="study"] .shared-candidate-section .candidate-move-line {
  margin: 0 !important;
}

body[data-mode="study"] .shared-candidate-section .rank-dot {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: #fff;
  background: #7c8981;
  border-radius: 7px;
  font-size: 9px;
  font-weight: 900;
}

body[data-mode="study"] .shared-candidate-section .rank-dot.rank-1 {
  background: #b28a31;
}

body[data-mode="study"] .shared-candidate-section .rank-dot.rank-2 {
  background: #3f8059;
}

body[data-mode="study"] .shared-candidate-section .rank-dot.rank-3 {
  background: #637d6a;
}

body[data-mode="study"] .shared-candidate-section .candidate-move-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

body[data-mode="study"] .shared-candidate-section .candidate-move-line {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 4px;
}

body[data-mode="study"] .shared-candidate-section .candidate-move-text {
  overflow: hidden;
  color: #213f2e !important;
  font-size: 12px !important;
  font-weight: 900;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-mode="study"] .shared-candidate-section .candidate-move-copy > small {
  overflow: hidden;
  color: #89958e;
  font-size: 7.5px;
  font-weight: 600;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-mode="study"] .shared-candidate-section .candidate-best-label,
body[data-mode="study"] .shared-candidate-section .candidate-diagram-label {
  display: inline-flex;
  min-height: 16px;
  align-items: center;
  flex: 0 0 auto;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 7px;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

body[data-mode="study"] .shared-candidate-section .candidate-best-label {
  color: #82631d;
  background: #f6edcf;
  border: 1px solid rgba(150, 113, 31, 0.14);
}

body[data-mode="study"] .shared-candidate-section .candidate-diagram-label {
  color: #2f6d49;
  background: #e9f4e9;
  border: 1px solid rgba(45, 108, 71, 0.13);
}

body[data-mode="study"] .shared-candidate-section .candidate-metrics-row {
  display: contents !important;
}

body[data-mode="study"] .shared-candidate-section .candidate-lead,
body[data-mode="study"] .shared-candidate-section .candidate-rate,
body[data-mode="study"] .shared-candidate-section .candidate-complexity {
  display: grid;
  min-width: 0;
  justify-items: end;
  gap: 1px;
  margin: 0 !important;
  color: #32483b !important;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

body[data-mode="study"] .shared-candidate-section .candidate-lead small,
body[data-mode="study"] .shared-candidate-section .candidate-rate small,
body[data-mode="study"] .shared-candidate-section .candidate-complexity small {
  display: none;
  color: #8a968f;
  font-size: 7px;
  font-weight: 600;
}

body[data-mode="study"] .shared-candidate-section .candidate-lead b,
body[data-mode="study"] .shared-candidate-section .candidate-rate b,
body[data-mode="study"] .shared-candidate-section .candidate-complexity b {
  color: inherit;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.3;
}

body[data-mode="study"] .shared-candidate-section .candidate-complexity b {
  color: #66756d;
}

body[data-mode="study"] .shared-candidate-section .candidate-reference-action {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  margin-top: 2px;
  padding-top: 7px;
  border-top: 1px solid rgba(42, 76, 55, 0.1);
}

body[data-mode="study"] .shared-candidate-section .candidate-reference-action .reference-create-inline-btn {
  width: 100%;
  min-height: 30px;
  justify-content: center !important;
  color: #286542 !important;
  background: #fff !important;
  border-color: rgba(43, 103, 67, 0.19) !important;
  border-radius: 7px !important;
  font-size: 9px !important;
}

body[data-mode="study"] .shared-candidate-section .candidate-empty-state {
  display: grid;
  min-height: 112px;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin: 8px;
  padding: 14px;
  color: #75837a;
  background: #fbfcfa;
  border: 1px dashed rgba(42, 76, 55, 0.18);
  border-radius: 10px;
}

body[data-mode="study"] .shared-candidate-section .candidate-empty-state.hidden {
  display: none;
}

body[data-mode="study"] .shared-candidate-section .candidate-empty-state > span {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  color: #5d8068;
  background: #edf4ec;
  border-radius: 10px;
}

body[data-mode="study"] .shared-candidate-section .candidate-empty-state svg {
  width: 19px;
  height: 19px;
}

body[data-mode="study"] .shared-candidate-section .candidate-empty-state > div {
  display: grid;
  gap: 3px;
}

body[data-mode="study"] .shared-candidate-section .candidate-empty-state strong {
  color: #385141;
  font-size: 10.5px;
}

body[data-mode="study"] .shared-candidate-section .candidate-empty-state small {
  color: #849088;
  font-size: 8.5px;
  line-height: 1.5;
}

body[data-mode="study"] .shared-candidate-section .candidate-card-help {
  margin: 0;
  padding: 7px 12px 9px;
  color: #7f8c84;
  background: #fff;
  border-top: 1px solid rgba(42, 76, 55, 0.08);
  font-size: 8px;
  line-height: 1.45;
}

@media (max-width: 520px) {
  body[data-mode="study"] .shared-candidate-section .candidate-column-head {
    display: none;
  }

  body[data-mode="study"] .shared-candidate-section .candidate-list li {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body[data-mode="study"] .shared-candidate-section .candidate-metrics-row {
    display: grid !important;
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding-top: 7px;
    border-top: 1px solid rgba(42, 76, 55, 0.08);
  }

  body[data-mode="study"] .shared-candidate-section .candidate-lead,
  body[data-mode="study"] .shared-candidate-section .candidate-rate,
  body[data-mode="study"] .shared-candidate-section .candidate-complexity {
    justify-items: start;
    text-align: left;
  }

  body[data-mode="study"] .shared-candidate-section .candidate-lead small,
  body[data-mode="study"] .shared-candidate-section .candidate-rate small,
  body[data-mode="study"] .shared-candidate-section .candidate-complexity small {
    display: block;
  }
}

/* AI検討: 棋譜解析と自由検討を独立ページとして表示 */
body[data-mode="analysis"] .study-page-only,
body[data-mode="study"] .analysis-page-only {
  display: none !important;
}

body[data-page="ai-review"] .analysis-workspace-nav-head p {
  margin: 4px 0 0;
  color: #75837b;
  font-size: 10px;
  line-height: 1.55;
}

body[data-page="ai-review"] .analysis-workspace-sibling-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px;
  color: #42634f;
  font-size: 10.5px;
  font-weight: 700;
  text-decoration: none;
  background: #f1f5f0;
  border: 1px solid rgba(42, 76, 55, 0.13);
  border-radius: 9px;
}

body[data-page="ai-review"] .analysis-workspace-sibling-link:hover {
  color: #1f603b;
  background: #e9f1e9;
  border-color: rgba(47, 111, 71, 0.27);
}

body[data-page="ai-review"] .study-left-command {
  display: grid;
  gap: 10px;
  padding: 11px;
  background:
    radial-gradient(circle at 100% 0, rgba(75, 132, 91, 0.1), transparent 40%),
    #f7f9f6;
  border: 1px solid rgba(42, 76, 55, 0.15);
  border-radius: 12px;
}

#leftNav .study-left-command-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #284a37;
  font-size: 10.5px;
  font-weight: 800;
}

#leftNav .study-session-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 8px;
  color: #7b8780;
  font-size: 8px;
  font-weight: 800;
  background: #edf0ed;
  border: 1px solid rgba(42, 76, 55, 0.12);
  border-radius: 999px;
}

#leftNav .study-session-badge[data-state="ready"] {
  color: #28633f;
  background: #e9f4e9;
  border-color: rgba(47, 111, 71, 0.2);
}

#leftNav .study-session-badge[data-state="analyzing"] {
  color: #8a651b;
  background: #fbf2da;
  border-color: rgba(167, 118, 27, 0.22);
}

#leftNav .study-session-summary {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 9px;
  background: #fff;
  border: 1px solid rgba(42, 76, 55, 0.1);
  border-radius: 9px;
}

#leftNav .study-session-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  color: #2f6f47;
  background: #eaf3e9;
  border-radius: 8px;
}

#leftNav .study-session-icon svg {
  width: 16px;
  height: 16px;
}

#leftNav .study-session-summary > div {
  display: grid;
  min-width: 0;
  gap: 4px;
}

#leftNav .study-source-label,
#leftNav .study-status {
  margin: 0;
}

#leftNav .study-source-label {
  overflow: hidden;
  color: #2b4837;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#leftNav .study-status {
  color: #738178;
  font-size: 9px;
  line-height: 1.5;
}

#leftNav .study-status.error {
  color: #b34438;
}

#leftNav .study-primary-action {
  position: relative;
}

#leftNav .study-primary-action #studyAnalyzeBtn {
  display: grid !important;
  width: 100%;
  min-height: 54px;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 7px 9px !important;
  text-align: left;
  border-radius: 9px !important;
  box-shadow: 0 6px 14px rgba(31, 98, 60, 0.18);
}

#leftNav .study-primary-action #studyAnalyzeBtn:disabled {
  color: #8b9690 !important;
  background: #e8ece8 !important;
  border-color: #dde3dd !important;
  box-shadow: none;
  opacity: 1;
}

#leftNav .study-primary-action #studyAnalyzeBtn > svg {
  width: 21px;
  height: 21px;
  justify-self: center;
}

#leftNav .study-primary-action #studyAnalyzeBtn > span {
  display: grid;
  min-width: 0;
  gap: 1px;
}

#leftNav .study-primary-action #studyAnalyzeBtn strong {
  font-size: 10.5px;
  line-height: 1.35;
}

#leftNav .study-primary-action #studyAnalyzeBtn small {
  color: rgba(255, 255, 255, 0.74);
  font-size: 7.5px;
  font-weight: 600;
}

#leftNav .study-primary-action #studyAnalyzeBtn:disabled small {
  color: #98a19c;
}

#leftNav .study-primary-action .thinking-indicator {
  position: absolute;
  right: 9px;
  bottom: 6px;
  z-index: 2;
  pointer-events: none;
}

#leftNav .study-save-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

#leftNav .study-edit-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

#leftNav .study-edit-actions .study-btn-secondary {
  min-height: 36px;
  justify-content: center;
  gap: 5px;
  padding: 6px 7px;
  font-size: 8.5px;
}

#leftNav .study-edit-actions .study-btn-secondary svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

#leftNav .study-edit-actions .study-btn-secondary:disabled {
  color: #929b96;
  background: #edf0ed;
  border-color: rgba(42, 76, 55, 0.1);
  cursor: not-allowed;
  opacity: 1;
}

#leftNav .study-save-actions .study-btn-secondary {
  min-height: 38px;
  justify-content: center;
  gap: 5px;
  padding: 6px 7px;
  font-size: 8.5px;
  line-height: 1.25;
}

#leftNav .study-save-actions .study-btn-secondary svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

#leftNav .study-save-actions .study-btn-secondary:disabled {
  color: #929b96;
  background: #edf0ed;
  border-color: rgba(42, 76, 55, 0.1);
  cursor: not-allowed;
  opacity: 1;
}

#leftNav .study-save-actions #studySaveLocalBtn {
  grid-column: 1 / -1;
}

@media (max-width: 1024px) {
  body[data-page="ai-review"] .study-left-command {
    grid-column: span 2;
  }
}

@media (orientation: portrait) and (max-width: 1439px) {
  body[data-page="ai-review"] .analysis-workspace-sibling-link,
  body[data-page="ai-review"] .study-left-command {
    grid-column: 1;
  }
}

/* 自由検討: 開始方法と解析設定を左バーへ集約 */
body[data-page="ai-review"] .study-left-tools {
  display: grid;
  gap: 10px;
}

#leftNav .study-start-section,
#leftNav .study-candidate-row {
  display: grid;
  gap: 8px;
  padding: 10px;
  background: #fff;
  border: 1px solid rgba(42, 76, 55, 0.12);
  border-radius: 11px;
}

#leftNav .study-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

#leftNav .study-section-title strong {
  color: #2a4b38;
  font-size: 10.5px;
  font-weight: 800;
}

#leftNav .study-section-title small {
  color: #89958e;
  font-size: 8px;
}

#leftNav .study-start-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

#leftNav .study-start-actions button {
  display: grid !important;
  min-width: 0;
  min-height: 46px;
  grid-template-rows: 17px auto;
  align-content: center;
  justify-items: center;
  gap: 3px !important;
  padding: 5px 3px !important;
  border-radius: 8px !important;
  font-size: 8.5px !important;
  line-height: 1.25;
  text-align: center;
}

#leftNav .study-start-actions button svg {
  width: 17px;
  height: 17px;
}

#leftNav .study-start-actions #studyOpenSgfBtn {
  grid-column: auto;
}

#leftNav .study-start-actions button[aria-expanded="true"] {
  color: #245f3d !important;
  background: #edf5ed !important;
  border-color: rgba(45, 107, 70, 0.28) !important;
}

#leftNav .study-new-game-panel {
  display: grid;
  gap: 9px;
  padding: 10px;
  background: #f2f7f1;
  border: 1px solid rgba(43, 103, 67, 0.16);
  border-radius: 11px;
}

#leftNav .study-new-game-panel.hidden {
  display: none !important;
}

#leftNav .study-new-game-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}

#leftNav .study-new-game-head > div {
  display: grid;
  gap: 1px;
}

#leftNav .study-new-game-head span {
  color: #7d8d84;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

#leftNav .study-new-game-head h3 {
  margin: 0;
  color: #294d38;
  font-size: 10.5px;
}

#leftNav .study-new-game-head > small {
  color: #89958e;
  font-size: 7.5px;
}

#leftNav .study-new-game-grid {
  grid-template-columns: 1fr;
  gap: 6px;
}

#leftNav .study-new-game-grid label {
  gap: 3px;
  color: #718078;
  font-size: 8px;
}

#leftNav .study-new-game-grid input,
#leftNav .study-new-game-grid select {
  min-height: 30px;
  padding: 4px 7px;
  border-color: rgba(42, 76, 55, 0.15);
  border-radius: 7px;
  font-size: 9.5px;
}

#leftNav .study-new-game-actions button {
  width: 100%;
  min-height: 34px;
  color: #fff;
  background: #34734d;
  border-color: #34734d;
  border-radius: 8px;
  font-size: 9.5px;
  font-weight: 800;
}

#leftNav .study-candidate-limit-row,
#leftNav .study-auto-row {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 6px 7px;
  white-space: normal;
  background: #f7f9f6;
  border: 1px solid rgba(42, 76, 55, 0.1);
  border-radius: 8px;
  cursor: pointer;
}

#leftNav .study-setting-copy {
  display: grid;
  min-width: 0;
  flex: 1 1 auto;
  gap: 1px;
}

#leftNav .study-setting-copy strong {
  color: #354f40;
  font-size: 9px;
  line-height: 1.35;
}

#leftNav .study-setting-copy small {
  color: #89948e;
  font-size: 7.5px;
  font-weight: 500;
  line-height: 1.35;
}

#leftNav .study-candidate-limit-row select {
  width: 58px;
  min-height: 28px;
  flex: 0 0 auto;
  padding: 3px 22px 3px 7px;
  border-color: rgba(42, 76, 55, 0.16);
  border-radius: 7px;
  font-size: 9.5px;
}

#leftNav .study-auto-row {
  position: relative;
}

#leftNav .study-auto-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

#leftNav .study-switch-ui {
  position: relative;
  width: 30px;
  height: 17px;
  flex: 0 0 auto;
  background: #cfd7d1;
  border-radius: 999px;
  transition: background 0.16s ease;
}

#leftNav .study-switch-ui i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 11px;
  height: 11px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(28, 46, 34, 0.2);
  transition: transform 0.16s ease;
}

#leftNav .study-auto-row input:checked + .study-switch-ui {
  background: #3e8058;
}

#leftNav .study-auto-row input:checked + .study-switch-ui i {
  transform: translateX(13px);
}

#leftNav .study-auto-row input:focus-visible + .study-switch-ui {
  outline: 2px solid rgba(48, 111, 71, 0.34);
  outline-offset: 2px;
}

@media (max-width: 1024px) {
  body[data-page="ai-review"] .study-left-tools {
    grid-column: span 2;
  }
}

@media (orientation: portrait) and (max-width: 1439px) {
  body[data-page="ai-review"] .study-left-tools {
    grid-column: 1;
  }
}

/* 中央ワークスペース: 棋譜ツリーを状態把握しやすいムーブマップへ再設計 */
.board-tree-panel {
  overflow: hidden;
  background: #fbfcfa !important;
  border-color: rgba(39, 77, 56, 0.17) !important;
  border-radius: 14px !important;
  box-shadow: 0 8px 22px rgba(31, 56, 39, 0.07) !important;
}

.board-tree-header {
  min-height: 40px;
  padding: 5px 7px 5px 8px;
  background: linear-gradient(135deg, #f8fbf7, #f1f6f0);
  border-bottom-color: rgba(39, 77, 56, 0.1);
}

.board-tree-header > .board-tree-heading {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.board-tree-heading-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  color: #2f7049;
  background: #e8f2e7;
  border: 1px solid rgba(47, 112, 73, 0.12);
  border-radius: 8px;
}

.board-tree-heading-icon svg {
  width: 15px;
  height: 15px;
}

.board-tree-heading > div {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.board-tree-header .board-tree-eyebrow {
  display: none;
}

.board-tree-header .board-tree-heading strong {
  color: #244633;
  font-family: "Noto Serif JP", serif;
  font-size: 11px;
  line-height: 1.2;
}

.board-tree-heading small {
  display: none;
}

.board-tree-header > .board-tree-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
}

.board-tree-summary {
  display: flex;
  align-items: center;
  gap: 4px;
}

.board-tree-header .board-tree-summary > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 21px;
  padding: 0 6px;
  color: #52675b;
  font-size: 8px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(39, 77, 56, 0.12);
  border-radius: 999px;
}

.board-tree-header #gameTreeBranchBadge.has-branches {
  color: #2b6743;
  background: #e8f3e7;
  border-color: rgba(47, 112, 73, 0.18);
}

.board-tree-header #gameTreeToggleBtn {
  width: 25px;
  min-height: 25px;
  padding: 0;
  justify-content: center;
  background: #fff;
  border-color: rgba(39, 77, 56, 0.14);
}

.board-tree-header #gameTreeToggleLabel {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.board-tree-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  min-height: 27px;
  padding: 3px 6px;
  background: #fff;
  border-bottom: 1px solid rgba(39, 77, 56, 0.08);
}

.board-tree-legend {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 3px 6px;
  min-width: 0;
}

.board-tree-legend span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: #748179;
  font-size: 7px;
  font-weight: 700;
  white-space: nowrap;
}

.board-tree-legend i {
  display: inline-block;
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.tree-legend-main {
  background: #47564e;
}

.tree-legend-branch {
  background: linear-gradient(135deg, #26905a 0 34%, #d88a2b 34% 67%, #3d78ca 67%);
}

.tree-legend-current {
  background: #fff;
  border: 2px solid #36a064;
  box-shadow: 0 0 0 2px rgba(54, 160, 100, 0.14);
}

.tree-legend-analysis {
  background: #2878d0;
  box-shadow: 0 0 0 2px #e1edf9;
}

.board-tree-toolbar #gameTreeFocusBtn {
  min-height: 21px;
  flex: 0 0 auto;
  padding: 0 6px;
  color: #2d6644;
  font-size: 7.5px;
  font-weight: 800;
  background: #eef5ed;
  border: 1px solid rgba(47, 112, 73, 0.15);
  border-radius: 7px;
  cursor: pointer;
}

.board-tree-toolbar #gameTreeFocusBtn:hover {
  color: #fff;
  background: #357650;
  border-color: #357650;
}

.board-tree-panel.collapsed .board-tree-toolbar,
.board-tree-panel.collapsed .board-tree-help {
  display: none;
}

.board-tree-panel .game-tree {
  height: 22vh;
  min-height: 132px;
  max-height: 206px;
  overflow-x: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #aebdb3 #f2f6f1;
  scrollbar-width: thin;
  background:
    linear-gradient(90deg, rgba(210, 223, 213, 0.68) 1px, transparent 1px) 0 0 / 30px 100%,
    linear-gradient(180deg, rgba(220, 230, 222, 0.5) 1px, transparent 1px) 0 0 / 100% 38px,
    #fff;
}

.board-tree-panel .game-tree:focus-visible {
  outline: 2px solid rgba(47, 112, 73, 0.42);
  outline-offset: -2px;
}

.board-tree-panel .game-tree::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.board-tree-panel .game-tree::-webkit-scrollbar-track {
  background: #f2f6f1;
}

.board-tree-panel .game-tree::-webkit-scrollbar-thumb {
  background: #aebdb3;
  border: 2px solid #f2f6f1;
  border-radius: 999px;
}

.board-workspace-panel .game-tree-canvas {
  transition: width 0.16s ease, height 0.16s ease;
}

.board-workspace-panel .tree-line {
  stroke-width: 2.2;
}

.board-workspace-panel .main-line {
  stroke: #8c9c92;
}

.board-workspace-panel .analysis-branch-line {
  stroke: #29915a;
}

.board-workspace-panel .manual-branch-line {
  stroke: #d58b2c;
}

.board-workspace-panel .study-branch-line {
  stroke: #3e79c9;
}

.board-workspace-panel .tree-node {
  width: 24px;
  height: 24px;
  border-color: rgba(31, 48, 38, 0.22);
  font-size: 8.5px;
  box-shadow: 0 2px 5px rgba(20, 38, 27, 0.18);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.board-workspace-panel .tree-node:hover,
.board-workspace-panel .tree-node:focus-visible {
  z-index: 5;
  outline: 2px solid rgba(47, 112, 73, 0.34);
  outline-offset: 2px;
  transform: translate(-50%, -50%) scale(1.12);
}

.board-workspace-panel .root-node {
  width: 26px;
  height: 26px;
  color: #2f4939;
  background: #eef3ee;
  border-color: rgba(47, 83, 61, 0.2);
  border-radius: 8px;
}

.board-workspace-panel .branch-node {
  border-width: 2px;
}

.board-workspace-panel .analysis-branch-node {
  border-color: #29915a;
}

.board-workspace-panel .manual-branch-node {
  border-color: #d58b2c;
}

.board-workspace-panel .study-branch-node {
  border-color: #3e79c9;
}

.board-workspace-panel .tree-node.current {
  z-index: 4;
  outline: 3px solid #39a467;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(57, 164, 103, 0.13), 0 3px 8px rgba(25, 72, 43, 0.22);
}

.board-workspace-panel .tree-node.selected-branch {
  box-shadow: 0 0 0 4px rgba(44, 127, 78, 0.16), 0 2px 6px rgba(20, 38, 27, 0.2);
}

.board-workspace-panel .tree-node.has-comment::after,
.board-workspace-panel .tree-node.has-analysis::before {
  width: 7px;
  height: 7px;
  border-width: 1.5px;
}

.board-tree-help {
  display: none;
}

@media (max-width: 600px) {
  .board-tree-header {
    align-items: center;
    flex-wrap: nowrap;
  }

  .board-tree-header > .board-tree-header-actions {
    width: auto;
    justify-content: flex-end;
  }

  .board-tree-header .board-tree-heading-icon,
  .board-tree-header .board-tree-summary > span {
    display: inline-flex;
  }

  .board-tree-toolbar {
    align-items: center;
  }

  .board-tree-legend {
    gap: 4px 7px;
  }

  .board-tree-help {
    display: none;
  }
}

/* ══════════════════════════════════════════════════════
   AI対局場 中央盤面UI再設計 (2026-07-22)
══════════════════════════════════════════════════════ */

.ai-game-page .ai-game-shell {
  gap: 20px;
}

.ai-game-page .ai-game-board-area {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 11px;
  padding: 18px;
  border: 1px solid #d7e0d8;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 14px 36px rgba(28, 48, 36, 0.08);
}

.ai-game-page .ai-game-board-header {
  display: grid !important;
  grid-template-columns: minmax(145px, 1fr) auto minmax(76px, 1fr);
  align-items: center;
  gap: 14px;
  width: min(100%, 760px) !important;
  min-height: 54px;
  margin: 0 auto !important;
  padding: 10px 13px;
  border: 1px solid #e0e6df;
  border-radius: 12px;
  background: #f7f9f6;
  box-sizing: border-box;
}

.ai-game-page .ai-game-board-context {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  flex-direction: column;
  gap: 5px;
}

.ai-game-page .ai-game-board-context #aiGameBoardMeta {
  overflow: hidden;
  max-width: 100%;
  color: #727e76;
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-game-page .ai-game-mode-badge {
  min-height: 22px;
  padding: 1px 8px;
  font-size: 10px !important;
}

.ai-game-page .ai-game-turn-status {
  display: inline-flex;
  min-width: 142px;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.ai-game-page .ai-game-turn-status > span:last-child {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 1px;
}

.ai-game-page .ai-game-turn-status small {
  color: #748078;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.ai-game-page .ai-game-turn-status strong {
  color: #203328;
  font-size: 17px;
  line-height: 1.25;
}

.ai-game-page .ai-game-board-progress {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 2px;
  text-align: right;
}

.ai-game-page .ai-game-board-progress span {
  color: #879089;
  font-size: 9px;
  font-weight: 700;
}

.ai-game-page .ai-game-board-progress strong {
  color: #2c4334;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.ai-game-page .ai-game-player-strip {
  position: relative;
  display: flex;
  width: min(100%, 760px);
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 auto;
  padding: 9px 13px;
  overflow: hidden;
  border: 1px solid #dee5de;
  border-radius: 12px;
  background: #fafcfa;
  box-sizing: border-box;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.ai-game-page .ai-game-player-strip::before {
  position: absolute;
  top: 11px;
  bottom: 11px;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: transparent;
  content: "";
}

.ai-game-page .ai-game-player-strip[data-active="true"] {
  border-color: #8fb29a;
  background: #f2f7f2;
  box-shadow: 0 5px 16px rgba(40, 91, 57, 0.08);
}

.ai-game-page .ai-game-player-strip[data-active="true"]::before {
  background: #34744b;
}

.ai-game-page .ai-game-player-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.ai-game-page .ai-game-player-identity > div {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  flex-direction: column;
  gap: 1px;
}

.ai-game-page .ai-game-player-role {
  color: #879189;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.ai-game-page .ai-game-player-identity strong {
  color: #223129;
  font-size: 13px;
  line-height: 1.35;
}

.ai-game-page .ai-game-player-identity small {
  overflow: hidden;
  max-width: 330px;
  color: #748078;
  font-size: 9px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-game-page .ai-game-player-stone {
  display: block;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 50%;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.ai-game-page .ai-game-turn-status .ai-game-player-stone {
  width: 25px;
  height: 25px;
  flex-basis: 25px;
}

.ai-game-page .ai-game-player-stone[data-color="B"] {
  background-image: url("./assets/go-stones/black-stone.svg");
}

.ai-game-page .ai-game-player-stone[data-color="W"] {
  background-image: url("./assets/go-stones/white-stone.svg");
}

.ai-game-page .ai-game-player-stone[data-color="random"] {
  border: 1px solid #cbd2cc;
  background: linear-gradient(135deg, #151a17 0 48%, #fff 49% 100%);
  box-shadow: inset 0 0 0 2px #f4f1e9;
  box-sizing: border-box;
}

.ai-game-page .ai-game-player-metrics {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
  margin: 0;
}

.ai-game-page .ai-game-player-metrics > div {
  min-width: 67px;
  padding: 5px 8px;
  border: 1px solid #e4e9e4;
  border-radius: 8px;
  background: #fff;
  text-align: right;
}

.ai-game-page .ai-game-player-metrics dt {
  color: #89928c;
  font-size: 8px;
  font-weight: 700;
}

.ai-game-page .ai-game-player-metrics dd {
  margin: 1px 0 0;
  color: #24362b;
  font-size: 14px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.ai-game-page .ai-game-board-notice {
  width: min(100%, 760px);
  min-height: 34px;
  margin: 0 auto !important;
  padding: 8px 12px;
  border: 1px solid #dce4dc;
  border-radius: 9px;
  background: #f6f8f5;
  color: #506058 !important;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.55;
  box-sizing: border-box;
}

.ai-game-page .ai-game-board-notice[data-state="your-turn"] {
  border-color: #abd0b5;
  background: #edf7ef;
  color: #27603d !important;
}

.ai-game-page .ai-game-board-notice[data-state="thinking"] {
  border-color: #d8d9e7;
  background: #f5f5fa;
  color: #4d557d !important;
}

.ai-game-page .ai-game-board-notice[data-state="history"] {
  border-color: #d8e2ea;
  background: #f3f7fa;
  color: #42637b !important;
}

.ai-game-page .ai-game-board-notice[data-state="ended"] {
  border-color: #d8c89b;
  background: #fff9e9;
  color: #74571b !important;
}

.ai-game-page .ai-game-board-notice[data-state="scoring"] {
  border-color: #dfc883;
  background: #fff8e3;
  color: #73561b !important;
}

.ai-game-page .ai-game-board-notice[data-state="error"] {
  border-color: #e4b2ad;
  background: #fff3f1;
  color: #963d35 !important;
}

.ai-game-page .ai-game-board-frame {
  display: block;
  width: min(100%, calc(100vh - 130px));
  width: min(100%, calc(100dvh - 130px));
  max-width: none !important;
  aspect-ratio: auto;
  margin: 0 auto;
  padding: 10px;
  border: 1px solid #d8dfd8;
  border-radius: 16px;
  background: #edf1ec;
  box-sizing: border-box;
}

.ai-game-page .ai-game-board.goban {
  width: 100%;
  max-width: none;
  margin-inline: auto;
}

:root[data-board-coordinates="on"] .ai-game-page .ai-game-board-frame {
  padding: 26px 10px 12px 28px;
}

:root[data-board-coordinates="on"] .ai-game-page .ai-game-board.goban {
  overflow: visible;
}

.ai-game-page .ai-game-board.goban > .ai-game-board-coordinate {
  position: absolute;
  z-index: 9;
  color: rgba(42, 55, 47, 0.8);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  user-select: none;
}

.ai-game-page .ai-game-board.goban > .ai-game-board-coordinate-col {
  top: -20px;
  min-width: 14px;
  text-align: center;
  transform: translateX(-50%);
}

.ai-game-page .ai-game-board.goban > .ai-game-board-coordinate-row {
  left: -22px;
  width: 18px;
  text-align: right;
  transform: translateY(-50%);
}

.ai-game-page .ai-game-last-move-marker {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 6;
  width: 27%;
  min-width: 5px;
  max-width: 10px;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: #d84f43;
  box-shadow: 0 0 0 1px rgba(91, 29, 24, 0.35);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* Match the shared boards: size stones from the actual intersection cell, without a pixel cap. */
.ai-game-page .ai-game-board .ai-game-point > .stone {
  width: 97% !important;
  height: 97% !important;
  max-width: none !important;
  max-height: none !important;
}

.ai-game-page .ai-game-board[data-playable="true"][data-turn="B"] > .ai-game-point[data-occupied="false"]:not(:disabled):hover::before,
.ai-game-page .ai-game-board[data-playable="true"][data-turn="W"] > .ai-game-point[data-occupied="false"]:not(:disabled):hover::before {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: 92%;
  height: 92%;
  border-radius: 50%;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  content: "";
  opacity: 0.42;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.ai-game-page .ai-game-board[data-playable="true"][data-turn="B"] > .ai-game-point[data-occupied="false"]:not(:disabled):hover::before {
  background-image: url("./assets/go-stones/black-stone.svg");
}

.ai-game-page .ai-game-board[data-playable="true"][data-turn="W"] > .ai-game-point[data-occupied="false"]:not(:disabled):hover::before {
  background-image: url("./assets/go-stones/white-stone.svg");
}

.ai-game-page .ai-game-board.goban > .ai-game-point:focus-visible {
  outline: 3px solid #1769aa !important;
  outline-offset: -3px !important;
  border-radius: 50% !important;
}

.ai-game-page .ai-game-board-toolbar {
  display: flex;
  width: min(100%, 760px);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 1px auto 0;
  padding-top: 11px;
  border-top: 1px solid #e4e9e4;
  box-sizing: border-box;
}

.ai-game-page .ai-game-shell[data-phase="setup"] .ai-game-board-toolbar {
  display: none;
}

.ai-game-page .ai-game-view-controls,
.ai-game-page .ai-game-play-controls {
  display: flex;
  align-items: center;
  gap: 7px;
}

.ai-game-page .ai-game-view-seek {
  display: grid;
  flex: 1 1 280px;
  grid-template-columns: auto minmax(120px, 1fr) minmax(72px, auto);
  align-items: center;
  gap: 9px;
  color: #56635b;
  font-size: 10px;
  font-weight: 800;
}

.ai-game-page .ai-game-view-seek[hidden] {
  display: none;
}

.ai-game-page .ai-game-view-seek input[type="range"] {
  width: 100%;
  min-width: 0;
  margin: 0;
  accent-color: #397653;
  cursor: pointer;
}

.ai-game-page .ai-game-view-seek output {
  min-width: 72px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ai-game-page .ai-game-shell[data-phase="ended"] .ai-game-board-toolbar {
  flex-wrap: wrap;
}

.ai-game-page .ai-game-view-controls button,
.ai-game-page .ai-game-play-controls button {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid #ccd7ce;
  border-radius: 9px;
  background: #fff;
  color: #33483a;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.ai-game-page .ai-game-view-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.ai-game-page .ai-game-view-controls button > span[aria-hidden="true"] {
  margin-top: -2px;
  font-size: 20px;
  font-weight: 500;
  line-height: 0.7;
}

.ai-game-page .ai-game-view-controls output {
  min-width: 106px;
  color: #56635b;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.ai-game-page .ai-game-play-controls #aiGamePassBtn {
  border-color: #2f6d48;
  background: #2f6d48;
  color: #fff;
}

.ai-game-page .ai-game-play-controls #aiGameUndoBtn {
  background: #f5f7f4;
}

.ai-game-page .ai-game-play-controls .ai-game-toolbar-danger {
  border-color: #e1b6b1;
  background: #fff5f3;
  color: #a13c34;
}

.ai-game-page .ai-game-view-controls button:hover:not(:disabled),
.ai-game-page .ai-game-play-controls button:hover:not(:disabled) {
  border-color: #89aa93;
  background: #f0f6f1;
}

.ai-game-page .ai-game-play-controls #aiGamePassBtn:hover:not(:disabled) {
  background: #265b3c;
}

.ai-game-page .ai-game-play-controls .ai-game-toolbar-danger:hover:not(:disabled) {
  border-color: #d49189;
  background: #ffebe7;
}

.ai-game-page .ai-game-view-controls button:disabled,
.ai-game-page .ai-game-play-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.ai-game-page .ai-game-shell[data-phase="ended"] .ai-game-play-controls {
  display: none;
}

.ai-game-page .ai-game-shell[data-phase="scoring"] .ai-game-play-controls {
  display: none;
}

.ai-game-page .ai-game-board[data-scoring="true"] > .ai-game-point[data-occupied="true"] {
  cursor: pointer;
}

.ai-game-page .ai-game-board .ai-game-point.is-scoring-dead-candidate > .stone {
  outline: 3px solid #d99a28;
  outline-offset: -2px;
  filter: saturate(0.82);
}

.ai-game-page .ai-game-board .ai-game-point.is-scoring-seki-candidate > .stone {
  outline: 3px dashed #3581a8;
  outline-offset: -2px;
}

.ai-game-page .ai-game-board .ai-game-point.is-scoring-seki-confirmed > .stone {
  outline: 4px solid #24749d;
  outline-offset: -3px;
  box-shadow: 0 0 0 2px rgba(221, 242, 251, 0.9);
}

.ai-game-page .ai-game-board .ai-game-point.is-scoring-dead > .stone {
  opacity: 0.48;
  filter: grayscale(0.45);
}

.ai-game-page .ai-game-board .ai-game-point.is-scoring-dead > .stone::after {
  position: absolute;
  top: 50%;
  left: 50%;
  color: #c53f36;
  content: "×";
  font-size: clamp(14px, 2vw, 30px);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 2px #fff, 0 -1px 2px #fff;
  transform: translate(-50%, -54%);
}

.ai-game-page .ai-game-scoring-panel {
  border-color: #d7e2d8;
  background: linear-gradient(180deg, #fff 0%, #f8fbf8 100%);
}

.ai-game-page .ai-game-scoring-lead,
.ai-game-page .ai-game-scoring-note,
.ai-game-page .ai-game-scoring-candidates {
  margin: 0 0 11px;
  color: #58685e;
  font-size: 11px;
  line-height: 1.65;
}

.ai-game-page .ai-game-scoring-note {
  margin-top: 10px;
  color: #7b684d;
  font-size: 10px;
}

.ai-game-page .ai-game-scoring-legend {
  display: grid;
  gap: 6px;
  margin-bottom: 11px;
  padding: 9px 10px;
  border: 1px solid #e1e7e1;
  border-radius: 9px;
  background: #fff;
}

.ai-game-page .ai-game-scoring-legend span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #4f5e54;
  font-size: 10px;
  font-weight: 700;
}

.ai-game-page .ai-game-scoring-legend i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-sizing: border-box;
}

.ai-game-page .ai-game-scoring-legend i[data-kind="candidate"] { border: 3px solid #d99a28; }
.ai-game-page .ai-game-scoring-legend i[data-kind="dead"] { background: #dc665d; }
.ai-game-page .ai-game-scoring-legend i[data-kind="seki"] { border: 3px dashed #3581a8; }

.ai-game-page .ai-game-scoring-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 9px;
}

.ai-game-page .ai-game-scoring-mode button {
  min-height: 36px;
  border: 1px solid #cfd9d1;
  border-radius: 8px;
  background: #fff;
  color: #425448;
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.ai-game-page .ai-game-scoring-mode button[aria-pressed="true"] {
  border-color: #397653;
  background: #eaf4ed;
  color: #245a3b;
  box-shadow: inset 0 0 0 1px rgba(57, 118, 83, 0.16);
}

.ai-game-page .ai-game-adopt-candidates {
  margin: 0 0 11px;
  padding: 8px 9px;
  font-size: 10px;
}

.ai-game-page .ai-game-scoring-score {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin: 0;
  overflow: hidden;
  border: 1px solid #dfe6df;
  border-radius: 9px;
  background: #dfe6df;
}

.ai-game-page .ai-game-scoring-score > div {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 7px 8px;
  background: #fff;
}

.ai-game-page .ai-game-scoring-score dt {
  color: #68746c;
  font-size: 9px;
}

.ai-game-page .ai-game-scoring-score dd {
  margin: 0;
  color: #26382d;
  font-size: 10px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.ai-game-page .ai-game-scoring-score > .is-total {
  background: #eef5ef;
}

.ai-game-page .ai-game-scoring-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0 0;
  padding: 9px 10px;
  border-radius: 9px;
  background: #253d2e;
  color: #fff;
}

.ai-game-page .ai-game-scoring-result span {
  font-size: 9px;
  font-weight: 700;
  opacity: 0.75;
}

.ai-game-page .ai-game-scoring-result strong {
  font-size: 13px;
}

.ai-game-page .ai-game-record-help {
  margin-top: 10px;
  color: #7b867f;
  font-size: 10px;
  line-height: 1.6;
}

@media (max-width: 1320px) {
  .ai-game-page .ai-game-shell {
    grid-template-areas:
      "board left"
      "board right";
    grid-template-columns: minmax(560px, 1fr) 320px !important;
    width: min(1180px, calc(100vw - 28px));
  }

  .ai-game-page .ai-game-left-panel { grid-area: left; }
  .ai-game-page .ai-game-board-area { grid-area: board; align-self: start; }
  .ai-game-page .ai-game-right-panel { grid-area: right; }
}

@media (max-width: 980px) {
  .ai-game-page .ai-game-shell,
  .ai-game-page .ai-game-shell[data-phase="playing"],
  .ai-game-page .ai-game-shell[data-phase="suspended"],
  .ai-game-page .ai-game-shell[data-phase="scoring"],
  .ai-game-page .ai-game-shell[data-phase="ended"] {
    grid-template-areas:
      "board"
      "left"
      "right";
    grid-template-columns: minmax(0, 1fr) !important;
    width: min(820px, calc(100vw - 24px));
  }

  .ai-game-page .ai-game-shell[data-phase="setup"],
  .ai-game-page .ai-game-shell[data-phase="suspended"] {
    grid-template-areas:
      "left"
      "board"
      "right";
  }

  .ai-game-page .ai-game-board-frame {
    max-width: none !important;
  }
}

@media (max-width: 620px) {
  .ai-game-page .ai-game-shell,
  .ai-game-page .ai-game-shell[data-phase="playing"],
  .ai-game-page .ai-game-shell[data-phase="suspended"],
  .ai-game-page .ai-game-shell[data-phase="scoring"],
  .ai-game-page .ai-game-shell[data-phase="ended"],
  .ai-game-page .ai-game-shell[data-phase="setup"] {
    width: calc(100vw - 16px);
    margin: 8px auto 24px;
    gap: 12px;
  }

  .ai-game-page .ai-game-board-area {
    gap: 8px;
    padding: 9px;
    border-radius: 13px;
  }

  .ai-game-page .ai-game-board-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 12px;
    min-height: 0;
    padding: 9px 10px;
  }

  .ai-game-page .ai-game-turn-status {
    grid-column: 1 / -1;
    grid-row: 1;
    min-width: 0;
    justify-self: start;
  }

  .ai-game-page .ai-game-board-context {
    grid-column: 1;
    grid-row: 2;
  }

  .ai-game-page .ai-game-board-progress {
    grid-column: 2;
    grid-row: 2;
  }

  .ai-game-page .ai-game-player-strip {
    gap: 8px;
    padding: 8px 9px;
    border-radius: 10px;
  }

  .ai-game-page .ai-game-player-stone {
    width: 27px;
    height: 27px;
    flex-basis: 27px;
  }

  .ai-game-page .ai-game-player-identity {
    gap: 7px;
  }

  .ai-game-page .ai-game-player-identity small {
    max-width: 160px;
  }

  .ai-game-page .ai-game-player-metrics {
    gap: 4px;
  }

  .ai-game-page .ai-game-player-metrics > div {
    min-width: 54px;
    padding: 4px 6px;
  }

  .ai-game-page .ai-game-player-metrics dd {
    font-size: 12px;
  }

  .ai-game-page .ai-game-board-frame {
    width: min(100%, calc(100vh - 176px));
    width: min(100%, calc(100dvh - 176px));
    padding: 4px;
    border-radius: 10px;
  }

  :root[data-board-coordinates="on"] .ai-game-page .ai-game-board-frame {
    padding: 22px 6px 8px 24px;
  }

  .ai-game-page .ai-game-board.goban > .ai-game-board-coordinate {
    font-size: 9px;
  }

  .ai-game-page .ai-game-board.goban > .ai-game-board-coordinate-col {
    top: -17px;
  }

  .ai-game-page .ai-game-board.goban > .ai-game-board-coordinate-row {
    left: -19px;
    width: 16px;
  }

  .ai-game-page .ai-game-board-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding-top: 9px;
  }

  .ai-game-page .ai-game-view-controls {
    display: grid;
    grid-template-columns: minmax(76px, 1fr) minmax(92px, auto) minmax(76px, 1fr);
  }

  .ai-game-page .ai-game-view-controls output {
    min-width: 0;
    align-self: center;
  }

  .ai-game-page .ai-game-view-seek {
    width: 100%;
    flex-basis: auto;
    grid-template-columns: auto minmax(0, 1fr) minmax(68px, auto);
  }

  .ai-game-page .ai-game-play-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ai-game-page .ai-game-view-controls button,
  .ai-game-page .ai-game-play-controls button {
    min-height: 42px;
    padding: 7px 8px;
  }
}

.ai-game-page .ai-game-suspended-lead,
.ai-game-page .ai-game-suspended-summary {
  margin: 0 0 14px;
  color: #66736a;
  font-size: 12px;
  line-height: 1.7;
}

.ai-game-page .ai-game-suspended-summary {
  padding: 12px;
  border: 1px solid #d9e2d8;
  border-radius: 10px;
  background: #f6f9f4;
  color: #2f4635;
  font-weight: 700;
}

.ai-game-page .ai-game-suspended-panel .ai-game-primary,
.ai-game-page .ai-game-suspended-panel .ai-game-secondary {
  width: 100%;
  margin-top: 8px;
}

@media (max-width: 390px) {
  .ai-game-page .ai-game-player-role,
  .ai-game-page .ai-game-player-metrics dt {
    display: none;
  }

  .ai-game-page .ai-game-player-identity small {
    max-width: 118px;
  }

  .ai-game-page .ai-game-player-metrics > div {
    min-width: 44px;
    padding: 4px;
  }

  .ai-game-page .ai-game-view-controls button > span:not([aria-hidden="true"]) {
    font-size: 10px;
  }
}

/* ══════════════════════════════════════════════════════
   AI対局場 右サイドバーUI再設計 (2026-07-22)
══════════════════════════════════════════════════════ */

.ai-game-page .ai-game-right-panel {
  position: sticky;
  top: 76px;
  width: 100%;
  min-width: 0;
  align-self: start;
  max-height: calc(100dvh - 92px);
  padding: 0 4px 10px 0;
  overflow-x: hidden;
  overflow-y: auto;
  box-sizing: border-box;
  scrollbar-color: #bdc9c0 transparent;
  scrollbar-width: thin;
}

.ai-game-page .ai-game-right-panel::-webkit-scrollbar {
  width: 6px;
}

.ai-game-page .ai-game-right-panel::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #bdc9c0;
}

.ai-game-page .ai-game-right-panel > .ai-game-panel {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 15px;
  border-color: #dfe6df;
  border-radius: 14px;
  box-sizing: border-box;
  box-shadow: 0 7px 22px rgba(32, 55, 41, 0.055);
}

.ai-game-page .ai-game-right-panel > .ai-game-panel > header {
  margin-bottom: 12px;
}

.ai-game-page .ai-game-match-panel { order: 1; }
.ai-game-page .ai-game-study-panel,
.ai-game-page .ai-game-spectator-eval-panel { order: 2; }
.ai-game-page .ai-game-moves-panel { order: 3; }

.ai-game-page .ai-game-shell[data-phase="ended"] .ai-game-moves-panel { order: 3; }

.ai-game-page .ai-game-match-panel {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #fff 0%, #fbfcfa 100%);
}

.ai-game-page .ai-game-match-panel::before {
  position: absolute;
  top: 0;
  right: 18px;
  left: 18px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, #315f43, #84a989);
  content: "";
}

.ai-game-page .ai-game-match-header {
  padding: 2px 1px 0;
}

.ai-game-page .ai-game-match-header > span {
  margin-bottom: 4px;
  color: #6f7d73;
  font-size: 9px;
  letter-spacing: 0.12em;
}

.ai-game-page .ai-game-match-header > h2 {
  font-size: 18px;
  letter-spacing: 0.01em;
}

.ai-game-page .ai-game-match-summary {
  margin: -2px 0 13px !important;
  padding: 8px 10px;
  border: 1px solid #e3e8e2;
  border-radius: 8px;
  background: #f5f7f4;
  color: #647068 !important;
  font-size: 10px !important;
  font-weight: 700;
  line-height: 1.55 !important;
}

.ai-game-page .ai-game-match-players {
  display: grid;
  gap: 7px;
}

.ai-game-page .ai-game-right-panel .ai-game-player-strip {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin: 0;
  padding: 11px 12px;
  border-color: #e2e7e2;
  border-radius: 11px;
  background: #fff;
}

.ai-game-page .ai-game-right-panel .ai-game-player-strip::before {
  top: 10px;
  bottom: 10px;
}

.ai-game-page .ai-game-right-panel .ai-game-player-strip[data-active="true"] {
  border-color: #7faa8b;
  background: #f1f7f2;
  box-shadow: 0 5px 16px rgba(40, 91, 57, 0.1);
}

.ai-game-page .ai-game-right-panel .ai-game-player-identity {
  align-items: center;
}

.ai-game-page .ai-game-right-panel .ai-game-player-identity strong {
  font-size: 14px;
}

.ai-game-page .ai-game-right-panel .ai-game-player-identity small {
  display: -webkit-box;
  max-width: none;
  overflow: hidden;
  font-size: 9px;
  line-height: 1.5;
  text-overflow: clip;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ai-game-page .ai-game-right-panel .ai-game-player-metrics {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 0.8fr);
  gap: 6px;
}

.ai-game-page .ai-game-right-panel .ai-game-player-metrics > div {
  min-width: 0;
  padding: 7px 9px;
  border-color: #e6ebe6;
  background: #f8faf8;
  text-align: left;
}

.ai-game-page .ai-game-right-panel .ai-game-player-metrics dt {
  margin-bottom: 2px;
  font-size: 8px;
  letter-spacing: 0.03em;
}

.ai-game-page .ai-game-right-panel .ai-game-player-metrics dd {
  font-size: 15px;
}

.ai-game-page .ai-game-versus {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 0 4px;
  color: #939c96;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.ai-game-page .ai-game-versus::before,
.ai-game-page .ai-game-versus::after {
  height: 1px;
  background: #e3e8e3;
  content: "";
}

.ai-game-page .ai-game-section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.ai-game-page .ai-game-section-header > div > span {
  margin-bottom: 3px;
}

.ai-game-page .ai-game-panel-count {
  display: inline-flex;
  min-width: 42px;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border: 1px solid #dae4dc;
  border-radius: 999px;
  background: #f3f7f4;
  color: #42604d;
  font-size: 10px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  box-sizing: border-box;
}

.ai-game-page .ai-game-moves-panel .ai-game-move-list {
  max-height: 232px;
  margin-bottom: 0;
  border-color: #e2e8e3;
  border-radius: 10px;
  background: #fbfcfb;
}

.ai-game-page .ai-game-moves-panel .ai-game-move-list li {
  min-height: 37px;
  grid-template-columns: 30px 48px minmax(0, 1fr);
  gap: 7px;
  padding: 7px 10px;
  border-color: #e7ece8;
  cursor: pointer;
  box-sizing: border-box;
}

.ai-game-page .ai-game-moves-panel .ai-game-move-list li:hover,
.ai-game-page .ai-game-moves-panel .ai-game-move-list li:focus-visible {
  background: #f1f5f2;
  outline: none;
}

.ai-game-page .ai-game-moves-panel .ai-game-move-list li.active {
  box-shadow: inset 3px 0 #3e7951;
}

.ai-game-page .ai-game-moves-panel .ai-game-move-list li.empty {
  min-height: 68px;
  padding: 23px 12px;
  text-align: center;
  cursor: default;
}

.ai-game-page .ai-game-moves-panel .ai-game-record-help {
  margin: 9px 2px 0;
}

.ai-game-page .ai-game-kifu-tree {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 80px;
  max-height: 96px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  border: 1px solid #e2e8e3;
  border-radius: 10px;
  background:
    linear-gradient(90deg, rgba(202, 215, 206, 0.35) 1px, transparent 1px) 0 0 / 31px 100%,
    linear-gradient(180deg, #fcfdfc 0%, #f6f9f7 100%);
  box-sizing: border-box;
  contain: inline-size;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #afbeb4 #eef3ef;
}

.ai-game-page .ai-game-kifu-tree::-webkit-scrollbar {
  height: 8px;
}

.ai-game-page .ai-game-kifu-tree::-webkit-scrollbar-track {
  background: #eef3ef;
}

.ai-game-page .ai-game-kifu-tree::-webkit-scrollbar-thumb {
  border: 2px solid #eef3ef;
  border-radius: 999px;
  background: #afbeb4;
}

.ai-game-page .ai-game-kifu-tree-canvas {
  position: relative;
  min-width: 100%;
  max-width: none;
}

.ai-game-page .ai-game-kifu-tree .main-line {
  stroke: #91a69a;
  stroke-width: 2;
}

.ai-game-page .ai-game-kifu-tree-node {
  width: 24px;
  height: 24px;
  border-color: rgba(31, 48, 38, 0.26);
  font-size: 9px;
  box-shadow: 0 2px 5px rgba(31, 55, 39, 0.18);
}

.ai-game-page .ai-game-kifu-tree-node.root-node {
  border-radius: 7px;
  background: #edf3ef;
  color: #365241;
  font-size: 10px;
}

@media (min-width: 701px) {
  .ai-game-page .ai-game-kifu-tree-node,
  .ai-game-page .ai-game-kifu-tree-node.root-node {
    width: clamp(24px, 1.6vw, 30px);
    min-width: clamp(24px, 1.6vw, 30px);
    height: clamp(24px, 1.6vw, 30px);
    min-height: clamp(24px, 1.6vw, 30px);
    padding: 0;
    align-items: center;
    justify-content: center;
    font-size: clamp(10px, 0.72vw, 14px);
    line-height: 1;
    text-align: center;
  }
}

@media (max-width: 700px) {
  .ai-game-page .ai-game-kifu-tree-node,
  .ai-game-page .ai-game-kifu-tree-node.root-node {
    display: flex;
    width: 24px;
    min-width: 24px;
    height: 24px;
    min-height: 24px;
    padding: 0 !important;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    line-height: 1;
    text-align: center;
    text-indent: 0;
  }
}

/* Reference-matched three-column logged-in home dashboard v20260810. */
.portal-home-sidebar {
  display: none;
}

/* Keep compact sidebar portraits independent from the legacy character atlas. */
.portal-home-page [data-character-sprite] {
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: cover !important;
}

.portal-home-page [data-character-sprite="mina"] {
  background-image: url("/assets/ai-character-mina-avatar-v1.png") !important;
}

.portal-home-page [data-character-sprite="yuki"] {
  background-image: url("/assets/ai-character-yuki-avatar-v1.png") !important;
}

.portal-home-page [data-character-sprite="akari"] {
  background-image: url("/assets/ai-character-akari-avatar-v1.png") !important;
}

.portal-home-page [data-character-sprite="riri"] {
  background-image: url("/assets/ai-character-riri-avatar-v1.png") !important;
}

.portal-home-page [data-character-sprite="haru"] {
  background-image: url("/assets/ai-character-haru-avatar-v1.png") !important;
}

.portal-home-page [data-character-sprite="sakura"] {
  background-image: url("/assets/ai-character-sakura-avatar-v1.png") !important;
}

.portal-home-page [data-character-sprite="ren"] {
  background-image: url("/assets/ai-character-ren-avatar-v1.png") !important;
}

.portal-home-page [data-character-sprite="sota"] {
  background-image: url("/assets/ai-character-sota-avatar-v1.png") !important;
}

/* Dedicated close-up assets render cleanly without browser-side crop enlargement. */
.portal-home-page .portal-side-avatar,
.portal-home-page .portal-side-character {
  background-position: center !important;
  background-size: cover !important;
}

@media (min-width: 1201px) {
  .portal-home-page {
    background:
      radial-gradient(circle at 11% 20%, rgba(255, 225, 230, 0.26), transparent 22%),
      radial-gradient(circle at 89% 18%, rgba(201, 236, 249, 0.42), transparent 26%),
      linear-gradient(180deg, #eaf8fe 0%, #f3fbfa 64%, #f4fbea 100%);
  }

  .portal-home-page .portal-shell {
    display: grid;
    width: min(1500px, calc(100% - 30px));
    grid-template-columns: minmax(195px, 220px) minmax(0, 1fr) minmax(195px, 220px);
    grid-template-areas:
      "left hero right"
      "left characters right"
      "left lower right";
    gap: 9px 12px;
    align-items: start;
    padding: 10px 0 28px;
  }

  .portal-home-page .portal-home-sidebar {
    display: grid;
    gap: 10px;
    align-self: start;
  }

  .portal-home-page .portal-home-sidebar--left {
    grid-area: left;
  }

  .portal-home-page .portal-home-sidebar--right {
    grid-area: right;
  }

  .portal-home-page .portal-hero {
    grid-area: hero;
    grid-template-columns: minmax(190px, 220px) minmax(190px, 220px) minmax(0, 1fr);
    gap: 12px;
    min-height: 252px;
    padding: 8px 12px 5px;
  }

  .portal-home-page .portal-hero::before {
    inset: 0 0 -18px;
    background:
      linear-gradient(90deg, rgba(250, 253, 251, 0) 0%, rgba(250, 253, 251, 0.02) 57%, rgba(250, 253, 251, 0.28) 82%, rgba(250, 253, 251, 0.64) 100%),
      linear-gradient(180deg, rgba(244, 251, 250, 0) 0%, rgba(244, 251, 250, 0.02) 70%, rgba(244, 251, 250, 0.7) 94%, #f3fbfa 100%),
      image-set(url("/assets/portal-spring-landscape-v1.avif") type("image/avif"), url("/assets/portal-spring-landscape-v1.webp") type("image/webp"), url("/assets/portal-spring-landscape-v1.png") type("image/png")) center 58% / cover no-repeat;
    -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 78%, rgba(0, 0, 0, 0.88) 88%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 0%, #000 78%, rgba(0, 0, 0, 0.88) 88%, transparent 100%);
  }

  .portal-home-page .portal-hero-character {
    width: 220px;
    height: 244px;
    margin: 0 auto -5px;
    background-size: 328px auto;
  }

  .portal-home-page .portal-hero-character::before {
    top: 18px;
    left: 4px;
    font-size: 23px;
    text-shadow: 31px -8px 0 #ffd7df, -3px 49px 0 #f9c1cb;
  }

  .portal-home-page .portal-hero-character::after {
    top: 52px;
    right: 0;
    font-size: 19px;
    text-shadow: -4px 49px 0 #f3a9b8, 19px 26px 0 #ffe0e5;
  }

  .portal-home-page .portal-hero-copy {
    padding: 14px 17px;
    border-width: 1px;
    border-radius: 21px;
    box-shadow: 0 7px 18px rgba(93, 65, 57, 0.09);
  }

  .portal-home-page .portal-hero-copy h1 {
    font-size: clamp(21px, 1.55vw, 27px);
    line-height: 1.4;
  }

  .portal-home-page .portal-hero-copy p {
    margin-top: 8px;
    font-size: 12px;
  }

  .portal-home-page .portal-hero-actions {
    gap: 10px;
    align-self: end;
    margin-bottom: 7px;
    transform: none;
  }

  .portal-home-page .portal-action-card {
    min-height: 146px;
    padding: 12px 8px;
    border-radius: 17px;
  }

  .portal-home-page .portal-action-card strong {
    font-size: 17px;
  }

  .portal-home-page .portal-action-card small {
    font-size: 9px;
  }

  .portal-home-page .portal-action-icon {
    width: 58px;
    height: 49px;
  }

  .portal-home-page .portal-hero-secondary {
    display: none;
  }

  .portal-home-page .portal-character-showcase {
    position: relative;
    z-index: 3;
    grid-area: characters;
    margin-top: -8px;
    padding: 12px;
    border-radius: 15px;
  }

  .portal-home-page .portal-character-showcase .portal-eyebrow {
    display: none;
  }

  .portal-home-page .portal-section-heading h2 {
    font-size: 18px;
  }

  .portal-home-page .portal-character-grid--home {
    gap: 8px;
    margin-top: 8px;
  }

  .portal-home-page .portal-character-card {
    border-radius: 12px;
    box-shadow: 0 5px 13px rgba(87, 61, 53, 0.07);
  }

  .portal-home-page .portal-character-body {
    padding: 8px;
  }

  .portal-home-page .portal-character-body h3 {
    font-size: 17px;
  }

  .portal-home-page .portal-character-meta {
    min-height: 29px;
    margin-top: 4px;
    font-size: 9px;
  }

  .portal-home-page .portal-character-description {
    min-height: 31px;
    margin: 3px 0 7px;
    font-size: 9px;
    line-height: 1.45;
  }

  .portal-home-page .portal-character-body > a {
    min-height: 29px;
    border-radius: 7px;
    font-size: 11px;
  }

  .portal-home-page .portal-home-columns {
    grid-area: lower;
    grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
    gap: 10px;
    margin-top: 0;
  }

  .portal-home-page .portal-home-columns .portal-card {
    padding: 12px;
    border-radius: 15px;
  }

  .portal-home-page .portal-home-columns .portal-card-heading h2 {
    font-size: 17px;
  }

  .portal-home-page .portal-qa-list {
    margin-top: 5px;
  }

  .portal-home-page .portal-qa-row {
    min-height: 46px;
  }

  .portal-home-page .portal-learning-card > a {
    min-height: 50px;
  }

  .portal-home-page .portal-mypage-card {
    display: none;
  }

  .portal-home-page .portal-side-card {
    padding: 12px;
    border: 1px solid rgba(232, 220, 211, 0.9);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.89);
    box-shadow: 0 7px 20px rgba(91, 69, 58, 0.075);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .portal-home-page .portal-side-card > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
  }

  .portal-home-page .portal-side-card h2 {
    margin: 0;
    color: #563127;
    font-family: "Noto Serif JP", serif;
    font-size: 15px;
  }

  .portal-home-page .portal-side-card h2 span {
    color: #4e94b8;
    font-family: "Noto Sans JP", sans-serif;
    font-size: 11px;
  }

  .portal-home-page .portal-side-card header > a {
    color: #4b91b6;
    font-size: 10px;
    font-weight: 700;
    text-decoration: none;
  }

  .portal-home-page .portal-side-notices nav a,
  .portal-home-page .portal-side-recent nav a {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
    align-items: center;
    min-height: 43px;
    border-top: 1px solid #f0e8e3;
    color: #5d4c46;
    font-size: 10px;
    line-height: 1.45;
    text-decoration: none;
  }

  .portal-home-page .portal-side-notices nav a:first-child,
  .portal-home-page .portal-side-recent nav a:first-child {
    border-top: 0;
  }

  .portal-home-page .portal-side-notices nav b,
  .portal-home-page .portal-side-recent nav b {
    color: #82a9b9;
  }

  .portal-home-page .portal-side-quote > div,
  .portal-home-page .portal-side-favorite > div {
    position: relative;
    display: flex;
    min-height: 78px;
    align-items: center;
    overflow: hidden;
    border-radius: 10px;
    background: linear-gradient(135deg, #fffdf8, #f8fbff);
  }

  .portal-home-page .portal-side-quote p {
    position: relative;
    z-index: 1;
    margin: 0;
    padding-left: 10px;
    color: #5c463e;
    font-family: "Noto Serif JP", serif;
    font-size: 12px;
    line-height: 1.65;
  }

  .portal-home-page .portal-side-character,
  .portal-home-page .portal-side-avatar {
    display: block;
    flex: 0 0 auto;
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
  }

  .portal-home-page .portal-side-quote .portal-side-character {
    position: absolute;
    right: -6px;
    bottom: -7px;
    width: 86px;
    height: 86px;
  }

  .portal-home-page .portal-side-opponents ol {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: portal-opponent;
  }

  .portal-home-page .portal-side-opponents li {
    display: grid;
    grid-template-columns: 18px 35px minmax(0, 1fr);
    grid-template-areas: "rank avatar name" "rank avatar meta";
    gap: 0 7px;
    align-items: center;
    min-height: 54px;
    border-top: 1px solid #f0e8e3;
    counter-increment: portal-opponent;
  }

  .portal-home-page .portal-side-opponents li:first-child {
    border-top: 0;
  }

  .portal-home-page .portal-side-opponents li::before {
    grid-area: rank;
    color: #d26a49;
    font-size: 13px;
    font-weight: 800;
    content: counter(portal-opponent);
  }

  .portal-home-page .portal-side-avatar {
    grid-area: avatar;
    width: 35px;
    height: 35px;
    border: 1px solid #f0dcd7;
    border-radius: 50%;
    background-color: #fff7f5;
  }

  .portal-home-page .portal-side-opponents strong {
    grid-area: name;
    align-self: end;
    color: #523b34;
    font-size: 11px;
  }

  .portal-home-page .portal-side-opponents small {
    grid-area: meta;
    align-self: start;
    color: #8a7770;
    font-size: 9px;
  }

  .portal-home-page .portal-side-record dl {
    display: grid;
    gap: 7px;
    margin: 0 0 9px;
  }

  .portal-home-page .portal-side-record dl > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 8px;
    border-radius: 9px;
    background: #fffdf9;
  }

  .portal-home-page .portal-side-record dt {
    color: #7e6b64;
    font-size: 10px;
  }

  .portal-home-page .portal-side-record dd {
    margin: 0;
    color: #b55b42;
    font-size: 13px;
    font-weight: 800;
  }

  .portal-home-page .portal-side-card-button {
    display: flex;
    min-height: 31px;
    align-items: center;
    justify-content: center;
    border: 1px solid #eadad2;
    border-radius: 999px;
    background: #fffaf4;
    color: #7a584b;
    font-size: 10px;
    font-weight: 700;
    text-decoration: none;
  }

  .portal-home-page .portal-side-favorite > div {
    gap: 7px;
  }

  .portal-home-page .portal-side-favorite .portal-side-character {
    width: 78px;
    height: 78px;
  }

  .portal-home-page .portal-side-favorite p {
    display: grid;
    gap: 4px;
    margin: 0;
  }

  .portal-home-page .portal-side-favorite strong {
    color: #594038;
    font-size: 12px;
  }

  .portal-home-page .portal-side-favorite small {
    color: #85736c;
    font-size: 9px;
  }

  .portal-home-page .portal-side-favorite .portal-side-card-button {
    margin-top: 8px;
  }

  .portal-home-page .portal-side-promo {
    display: grid;
    min-height: 178px;
    padding: 18px 14px;
    align-content: center;
    gap: 10px;
    overflow: hidden;
    border: 1px solid #f3ced7;
    border-radius: 14px;
    background:
      radial-gradient(circle at 88% 78%, rgba(238, 132, 160, 0.23), transparent 34%),
      linear-gradient(145deg, rgba(255, 247, 249, 0.97), rgba(255, 232, 238, 0.94));
    color: #c34f70;
    text-align: center;
    text-decoration: none;
    box-shadow: 0 7px 20px rgba(116, 70, 75, 0.075);
  }

  .portal-home-page .portal-side-promo strong {
    font-family: "Noto Serif JP", serif;
    font-size: 20px;
    line-height: 1.5;
  }

  .portal-home-page .portal-side-promo span {
    font-size: 11px;
    font-weight: 700;
    line-height: 1.6;
  }

  .portal-home-page .portal-side-promo small {
    color: #8c6470;
    font-size: 10px;
  }

  .portal-home-page .portal-bottom-scenery {
    height: 210px;
    margin-top: -148px;
  }
}

.ai-game-page .ai-game-kifu-tree-node.current {
  z-index: 4;
  outline: 3px solid #39a467;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(57, 164, 103, 0.13), 0 3px 8px rgba(25, 72, 43, 0.22);
}

.ai-game-page .ai-game-kifu-tree-node:disabled {
  cursor: default;
  opacity: 0.62;
}

.ai-game-page .ai-game-kifu-tree-node.is-pass::after {
  position: absolute;
  top: -12px;
  left: 50%;
  padding: 1px 3px;
  border-radius: 4px;
  color: #6f5841;
  background: #f4eadc;
  content: "P";
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
  transform: translateX(-50%);
}

.ai-game-page .ai-game-kifu-tree-empty {
  position: absolute;
  top: 29px;
  left: 54px;
  color: #7b867f;
  font-size: 10px;
  white-space: nowrap;
}

.ai-game-page .ai-game-study-panel {
  border-color: #d9e4dc !important;
  background: linear-gradient(180deg, #fff 0%, #f9fbf9 100%);
}

.ai-game-page .ai-game-study-panel .ai-game-eval-summary {
  margin-bottom: 9px;
  padding: 9px 10px;
  border: 1px solid #d7e4da;
  border-radius: 9px;
  background: #eef5f0;
  color: #315841;
}

.ai-game-page .ai-game-study-panel .ai-game-graph {
  height: 102px;
  margin-bottom: 9px;
  border-radius: 9px;
}

.ai-game-page .ai-game-study-panel .ai-game-candidate-list {
  margin-bottom: 10px;
  padding: 8px 8px 8px 27px;
  border: 1px solid #e4e9e4;
  border-radius: 9px;
  background: #fff;
}

.ai-game-page .ai-game-study-actions button {
  min-height: 39px;
  border-radius: 9px;
}

.ai-game-page .ai-game-study-actions #aiGameHintBtn {
  border-color: #326e48;
  background: #326e48;
  color: #fff;
}

.ai-game-page .ai-game-spectator-eval-panel {
  border-color: #d9e1dc !important;
  background:
    radial-gradient(circle at 88% 12%, rgba(54, 78, 63, 0.08), transparent 34%),
    linear-gradient(180deg, #fff 0%, #f8faf8 100%);
}

.ai-game-page .ai-game-spectator-eval-summary {
  margin-bottom: 9px;
  padding: 11px 12px;
  border: 1px solid #dce4de;
  border-radius: 10px;
  background: #f2f5f3;
  color: #263a2e;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.4;
}

.ai-game-page .ai-game-spectator-graph-wrap {
  position: relative;
  overflow: hidden;
  margin-bottom: 9px;
  border: 1px solid #e1e6e2;
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(28, 35, 31, 0.035) 0%, transparent 48%, rgba(255, 255, 255, 0.7) 52%, rgba(28, 35, 31, 0.018) 100%),
    #fbfcfb;
}

.ai-game-page .ai-game-spectator-graph-wrap .ai-game-graph {
  height: 116px;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.ai-game-page .ai-game-spectator-side-label {
  position: absolute;
  left: 11px;
  z-index: 1;
  color: #6f7972;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.06em;
  pointer-events: none;
}

.ai-game-page .ai-game-spectator-side-label--black { top: 7px; }
.ai-game-page .ai-game-spectator-side-label--white { bottom: 7px; }

.ai-game-page .ai-game-spectator-eval-panel .ai-game-graph .series {
  stroke: #315f43;
  stroke-width: 2.75;
}

.ai-game-page .ai-game-spectator-eval-panel .ai-game-graph .point-dot {
  fill: #315f43;
  stroke: #fff;
  stroke-width: 1;
}

.ai-game-page .ai-game-spectator-eval-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #68736b;
  font-size: 9px;
  font-weight: 700;
}

.ai-game-page .ai-game-spectator-eval-footer > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.ai-game-page .ai-game-spectator-eval-footer i {
  width: 14px;
  height: 3px;
  border-radius: 999px;
  background: #315f43;
}

.ai-game-page .ai-game-spectator-eval-footer strong {
  color: #263a2e;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.ai-game-page .ai-game-study-actions button:hover:not(:disabled) {
  border-color: #8cab95;
  background: #edf4ef;
}

.ai-game-page .ai-game-study-actions #aiGameHintBtn:hover:not(:disabled) {
  border-color: #285d3b;
  background: #285d3b;
}

@media (max-width: 1320px) {
  .ai-game-page .ai-game-right-panel {
    position: static;
    max-height: none;
    padding-right: 0;
    overflow: visible;
  }
}

@media (max-width: 620px) {
  .ai-game-page .ai-game-right-panel {
    gap: 10px;
  }

  .ai-game-page .ai-game-right-panel > .ai-game-panel {
    padding: 13px;
    border-radius: 12px;
  }

  .ai-game-page .ai-game-right-panel .ai-game-player-strip {
    gap: 9px;
    padding: 10px;
  }

}

/* ══════════════════════════════════════════════════════
   ログイン・招待登録UI再設計 (2026-07-22)
══════════════════════════════════════════════════════ */

#authOverlay #authForm.auth-login-dialog {
  position: fixed;
  z-index: 160;
  top: 50%;
  right: auto;
  bottom: auto;
  left: 50%;
  width: min(780px, calc(100vw - 36px));
  max-height: calc(100dvh - 32px);
  grid-template-columns: 282px minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid rgba(64, 82, 69, 0.2);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(20, 30, 23, 0.25), 0 8px 24px rgba(20, 30, 23, 0.12);
  transform: translate(-50%, -50%);
  scrollbar-color: #b9c7bd transparent;
  scrollbar-width: thin;
  isolation: isolate;
}

#authOverlay #authForm.auth-login-dialog:target {
  display: grid;
  animation: auth-dialog-enter 180ms ease-out both;
}

#authOverlay.guest-login-overlay {
  padding: 0;
  overflow: hidden;
  background: transparent;
}

#authOverlay.guest-login-overlay.is-open #authForm.auth-login-dialog {
  display: grid;
  animation: auth-dialog-enter 180ms ease-out both;
}

body.guest-login-modal-open {
  overflow: hidden;
}

#authOverlay #authForm.auth-login-dialog.auth-dialog-dismissed {
  display: none !important;
}

#authOverlay .auth-login-dialog + .auth-dialog-backdrop {
  position: fixed;
  z-index: 150;
  inset: 0;
  display: none;
  background: rgba(19, 27, 21, 0.44);
  backdrop-filter: blur(4px);
}

#authOverlay .auth-login-dialog:target + .auth-dialog-backdrop {
  display: block;
  animation: auth-backdrop-enter 160ms ease-out both;
}

#authOverlay.guest-login-overlay.is-open .auth-login-dialog + .auth-dialog-backdrop {
  display: block;
  animation: auth-backdrop-enter 160ms ease-out both;
}

#authOverlay .auth-login-dialog.auth-dialog-dismissed + .auth-dialog-backdrop {
  display: none !important;
}

@supports selector(:has(*)) {
  #authOverlay:has(.auth-login-dialog:target) {
    overflow: hidden;
  }

  #authOverlay:has(.auth-login-dialog.auth-dialog-dismissed) {
    overflow: auto !important;
  }
}

#authOverlay #authForm .auth-login-intro {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: flex-start;
  flex-direction: column;
  padding: 38px 30px 34px;
  overflow: hidden;
  border-right: 1px solid #dfe5dc;
  background:
    radial-gradient(circle at 14% 14%, rgba(255, 255, 255, 0.9), transparent 32%),
    linear-gradient(150deg, #f6f3e9 0%, #eef2e8 100%);
}

#authOverlay #authForm .auth-login-intro::after {
  position: absolute;
  right: -76px;
  bottom: -84px;
  width: 220px;
  height: 220px;
  border: 1px solid rgba(55, 92, 65, 0.1);
  border-radius: 50%;
  box-shadow: 0 0 0 28px rgba(55, 92, 65, 0.035), 0 0 0 58px rgba(55, 92, 65, 0.025);
  content: "";
}

#authOverlay #authForm .auth-login-symbol {
  position: relative;
  width: 50px;
  height: 50px;
  margin-bottom: 27px;
  flex: 0 0 auto;
  border: 1px solid #ccd5c9;
  border-radius: 14px;
  background-color: rgba(255, 255, 255, 0.68);
  background-image:
    linear-gradient(rgba(87, 103, 91, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(87, 103, 91, 0.14) 1px, transparent 1px);
  background-position: center;
  background-size: 16px 16px;
  box-shadow: 0 8px 18px rgba(45, 68, 51, 0.08);
}

#authOverlay #authForm .auth-login-symbol span {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

#authOverlay #authForm .auth-login-symbol span:first-child {
  top: 9px;
  left: 24px;
  background: radial-gradient(circle at 32% 28%, #626862, #111512 67%);
  box-shadow: 0 2px 4px rgba(17, 21, 18, 0.28);
}

#authOverlay #authForm .auth-login-symbol span:last-child {
  top: 25px;
  left: 9px;
  border: 1px solid #c9cec8;
  background: radial-gradient(circle at 32% 28%, #fff, #e9e9e4 70%);
  box-shadow: 0 2px 4px rgba(17, 21, 18, 0.16);
}

#authOverlay #authForm .auth-login-beta {
  display: inline-flex;
  margin-bottom: 11px;
  padding: 5px 8px;
  border: 1px solid #cad7ca;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  color: #53705c;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

#authOverlay #authForm .auth-login-intro h2 {
  position: relative;
  z-index: 1;
  margin: 0 0 13px;
  color: #173522;
  font-family: var(--title-font);
  font-size: 27px;
  font-weight: 700;
  line-height: 1.48;
  letter-spacing: 0.025em;
}

#authOverlay #authForm .auth-login-intro p {
  position: relative;
  z-index: 1;
  margin: 0;
  color: #607066;
  font-size: 12px;
  line-height: 1.8;
}

#authOverlay #authForm .auth-login-intro ul {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  margin: auto 0 0;
  padding: 29px 0 0;
  list-style: none;
}

#authOverlay #authForm .auth-login-intro li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #496052;
  font-size: 11px;
  font-weight: 700;
}

#authOverlay #authForm .auth-login-intro li > span {
  display: grid;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  place-items: center;
  border-radius: 50%;
  background: #dfe9df;
  color: #315d3e;
  font-size: 10px;
  font-weight: 900;
}

#authOverlay #authForm .auth-login-main {
  display: grid;
  min-width: 0;
  align-content: center;
  gap: 20px;
  padding: 38px 42px 34px;
  background: #fff;
}

#authOverlay #authForm .auth-login-main > header {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-right: 30px;
}

#authOverlay #authForm .auth-login-main > header > span {
  color: #4e795b;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.17em;
}

#authOverlay #authForm .auth-login-main h2 {
  margin: 0;
  color: #17251c;
  font-family: var(--title-font);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.35;
}

#authOverlay #authForm .auth-login-main > header p {
  margin: 1px 0 0;
  color: #6f7b73;
  font-size: 12px;
  line-height: 1.7;
}

#authOverlay #authForm .auth-login-fields {
  display: grid;
  gap: 15px;
}

#authOverlay #authForm .auth-login-fields > label {
  display: grid;
  gap: 7px;
  margin: 0;
  color: #35463b;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.auth-input-shell {
  display: flex;
  min-width: 0;
  min-height: 49px;
  align-items: center;
  overflow: hidden;
  border: 1px solid #cad5cc;
  border-radius: 10px;
  background: #fbfcfa;
  box-shadow: inset 0 1px 2px rgba(29, 45, 34, 0.025);
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.auth-input-shell:focus-within {
  border-color: #538264;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(63, 121, 81, 0.12);
}

#authOverlay #authForm .auth-input-shell input,
.register-shell .auth-input-shell input {
  width: 100%;
  min-width: 0;
  min-height: 47px;
  padding: 11px 13px;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  color: #1d2a21;
  font-family: var(--body-font);
  font-size: 14px;
}

#authOverlay #authForm .auth-input-shell input::placeholder,
.register-shell .auth-input-shell input::placeholder {
  color: #a0aaa3;
}

#authOverlay #authForm .auth-password-toggle {
  min-width: 58px;
  min-height: 35px;
  margin-right: 6px;
  padding: 6px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  box-shadow: none;
  color: #477255;
  font-family: var(--body-font);
  font-size: 10px;
  font-weight: 900;
  cursor: pointer;
}

#authOverlay #authForm .auth-password-toggle:hover:not(:disabled) {
  border: 0;
  background: #eaf2eb;
  box-shadow: none;
  color: #315d3e;
  transform: none;
}

#authOverlay #authForm .auth-message {
  position: relative;
  min-height: 0;
  margin: -5px 0 0;
  padding: 9px 11px 9px 31px;
  border: 1px solid #e8c9c3;
  border-radius: 9px;
  background: #fff5f3;
  color: #9a3e34 !important;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.55;
}

#authOverlay #authForm .auth-message::before {
  position: absolute;
  top: 9px;
  left: 11px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #b95448;
  color: #fff;
  content: "!";
  font-size: 9px;
  font-weight: 900;
  line-height: 15px;
  text-align: center;
}

#authOverlay #authForm .auth-message[data-state="info"] {
  border-color: #cfdfd2;
  background: #f1f7f2;
  color: #315d3e !important;
}

#authOverlay #authForm .auth-message[data-state="info"]::before {
  background: #477a56;
  content: "i";
}

#authOverlay #authForm .auth-message:empty {
  display: none;
}

#authOverlay #authForm #authLoginBtn.auth-login-submit,
.register-shell #registerSubmitBtn.auth-login-submit {
  position: relative;
  width: 100%;
  min-height: 50px;
  padding: 12px 46px 12px 18px;
  border: 1px solid #275f3d;
  border-radius: 10px;
  background: #275f3d;
  box-shadow: 0 8px 18px rgba(39, 95, 61, 0.17);
  color: #fff;
  font-family: var(--body-font);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.04em;
  cursor: pointer;
}

#authOverlay #authForm #authLoginBtn.auth-login-submit::after,
.register-shell #registerSubmitBtn.auth-login-submit::after {
  position: absolute;
  top: 50%;
  right: 18px;
  content: "→";
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  transform: translateY(-54%);
}

#authOverlay #authForm #authLoginBtn.auth-login-submit:hover:not(:disabled),
.register-shell #registerSubmitBtn.auth-login-submit:hover:not(:disabled) {
  border-color: #1f4e31;
  background: #1f4e31;
  box-shadow: 0 10px 22px rgba(31, 78, 49, 0.22);
  color: #fff;
  transform: translateY(-1px);
}

#authOverlay #authForm #authLoginBtn.auth-login-submit:disabled,
.register-shell #registerSubmitBtn.auth-login-submit:disabled {
  cursor: wait;
  opacity: 0.62;
}

#authOverlay #authForm .auth-login-divider {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin: -1px 0;
  color: #929b95;
  font-size: 9px;
  font-weight: 700;
}

#authOverlay #authForm .auth-login-divider::before,
#authOverlay #authForm .auth-login-divider::after,
.register-shell .auth-login-divider::before,
.register-shell .auth-login-divider::after {
  height: 1px;
  background: #e2e7e3;
  content: "";
}

.auth-oauth-section {
  display: grid;
  gap: 12px;
}

.auth-oauth-section[hidden] {
  display: none !important;
}

.register-shell .auth-login-divider {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  color: #929b95;
  font-size: 9px;
  font-weight: 700;
}

.auth-provider-login {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 12px;
  box-sizing: border-box;
  border-radius: 4px;
  font-size: 14px;
  line-height: 20px;
  text-decoration: none;
}

.auth-provider-login[hidden] {
  display: none !important;
}

.auth-google-login {
  border: 1px solid #747775;
  background: #ffffff;
  box-shadow: none;
  color: #1f1f1f;
  font-family: Roboto, Arial, sans-serif;
  font-weight: 500;
  transition: background-color 150ms ease, box-shadow 150ms ease;
}

.auth-google-login:hover {
  border-color: #747775;
  background: #f8faff;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
  color: #1f1f1f;
}

.auth-google-mark {
  display: block;
  width: 18px;
  height: auto;
  flex: 0 0 auto;
}

.auth-line-login {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid #06c755;
  background: #06c755;
  color: #ffffff;
  font-family: Arial, "Noto Sans JP", sans-serif;
  font-weight: 700;
  transition: background-color 150ms ease;
}

.auth-line-login::after {
  content: "";
}

.auth-line-login > span {
  width: 100%;
  text-align: center;
}

.auth-line-login:hover {
  border-color: #06c755;
  background: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1)), #06c755;
  color: #ffffff;
}

.auth-line-login:active {
  background: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3)), #06c755;
}

.auth-line-mark {
  display: block;
  width: 44px;
  height: 44px;
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
  object-fit: contain;
}

.register-shell .register-oauth-section {
  gap: 14px;
}

#authOverlay #authForm .auth-register-card {
  display: flex;
  width: 100%;
  min-height: 59px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  justify-self: stretch;
  padding: 10px 14px;
  border: 1px solid #d6e0d7;
  border-radius: 10px;
  background: #f8faf7;
  color: #2b5437;
  text-decoration: none;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

#authOverlay #authForm .auth-register-card > span:first-child {
  display: grid;
  gap: 2px;
}

#authOverlay #authForm .auth-register-card small {
  color: #7a867e;
  font-size: 9px;
  font-weight: 700;
}

#authOverlay #authForm .auth-register-card strong {
  color: #2c5739;
  font-size: 12px;
  font-weight: 900;
}

#authOverlay #authForm .auth-register-card > span:last-child {
  color: #4e7859;
  font-size: 17px;
}

#authOverlay #authForm .auth-register-card:hover {
  border-color: #9fbaa5;
  background: #f0f6f0;
  transform: translateY(-1px);
}

#authOverlay #authForm .auth-dialog-close {
  position: absolute;
  z-index: 2;
  top: 13px;
  right: 13px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid #d9e1da;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 3px 10px rgba(27, 43, 32, 0.06);
  color: #647169;
  font-family: var(--body-font);
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  text-decoration: none;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease, transform 150ms ease;
}

#authOverlay #authForm .auth-dialog-close:hover {
  border-color: #aab9ad;
  background: #f5f7f4;
  color: #25382b;
  transform: rotate(4deg);
}

#authOverlay #authForm .auth-password-toggle:focus-visible,
#authOverlay #authForm .auth-login-submit:focus-visible,
#authOverlay #authForm .auth-register-card:focus-visible,
#authOverlay #authForm .auth-provider-login:focus-visible,
#authOverlay #authForm .auth-dialog-close:focus-visible,
.register-shell .auth-login-submit:focus-visible,
.register-shell .auth-provider-login:focus-visible,
.register-shell .register-back-link:focus-visible {
  outline: 3px solid rgba(56, 113, 73, 0.26);
  outline-offset: 3px;
}

@keyframes auth-dialog-enter {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 12px)) scale(0.985); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes auth-backdrop-enter {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 招待コード登録ページ。ログイン導線から遷移しても確実に表示する。 */
.register-page {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 15% 10%, rgba(255, 255, 255, 0.92), transparent 34%),
    linear-gradient(145deg, #f6f3e9 0%, #edf2eb 100%);
}

.register-page .register-shell {
  min-height: 100dvh;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 20px;
  padding: 28px 18px;
}

.register-page .register-brand {
  display: inline-flex;
  align-items: center;
}

.register-page .register-brand img {
  display: block;
  width: 184px;
  height: auto;
}

.register-shell #registerForm.register-dialog {
  position: static;
  width: min(500px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  padding: 32px 34px;
  border: 1px solid rgba(64, 82, 69, 0.18);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 60px rgba(29, 47, 34, 0.13);
}

.register-shell .register-dialog-header {
  display: grid;
  gap: 6px;
  padding: 0;
}

.register-shell .register-beta {
  width: fit-content;
  margin-bottom: 3px;
  padding: 5px 8px;
  border: 1px solid #cad7ca;
  border-radius: 999px;
  background: #f3f7f2;
  color: #53705c;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.register-shell .register-dialog h1 {
  margin: 0;
  color: #17251c;
  font-family: var(--title-font);
  font-size: 28px;
  font-weight: 700;
}

.register-shell .register-dialog-header p {
  margin: 0;
  color: #6f7b73;
  font-size: 12px;
  line-height: 1.7;
}

.register-shell .register-fields {
  display: grid;
  gap: 14px;
}

.register-shell .register-fields label {
  display: grid;
  gap: 7px;
  margin: 0;
  color: #35463b;
  font-size: 11px;
  font-weight: 800;
}

.register-shell .register-note {
  margin: -4px 0 0;
  color: #7b867f;
  font-size: 10px;
  line-height: 1.6;
}

.register-shell .auth-message {
  min-height: 0;
  margin: 0;
  padding: 9px 11px;
  border: 1px solid #d7e3d9;
  border-radius: 9px;
  background: #f1f7f2;
  color: #28603b !important;
  font-size: 11px;
  line-height: 1.6;
}

.register-shell .auth-message[data-state="error"] {
  border-color: #e8c9c3;
  background: #fff5f3;
  color: #9a3e34 !important;
}

.register-shell .auth-message:empty {
  display: none;
}

.register-shell .register-back-link {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 12px;
  border: 1px solid #d4ded5;
  border-radius: 9px;
  background: #f8faf7;
  color: #355e42;
  font-size: 11px;
  font-weight: 900;
  text-decoration: none;
}

.register-shell .register-back-link:hover {
  border-color: #a6bba9;
  background: #eef5ef;
}

@media (max-width: 720px) {
  #authOverlay #authForm.auth-login-dialog {
    width: min(540px, calc(100vw - 24px));
    grid-template-columns: minmax(0, 1fr);
  }

  #authOverlay #authForm .auth-login-intro {
    min-height: 174px;
    padding: 24px 68px 23px 24px;
    border-right: 0;
    border-bottom: 1px solid #dfe5dc;
  }

  #authOverlay #authForm .auth-login-symbol {
    width: 42px;
    height: 42px;
    margin-bottom: 15px;
    border-radius: 12px;
    background-size: 14px 14px;
  }

  #authOverlay #authForm .auth-login-symbol span {
    width: 12px;
    height: 12px;
  }

  #authOverlay #authForm .auth-login-symbol span:first-child { top: 8px; left: 21px; }
  #authOverlay #authForm .auth-login-symbol span:last-child { top: 22px; left: 8px; }

  #authOverlay #authForm .auth-login-beta {
    position: absolute;
    top: 28px;
    left: 77px;
  }

  #authOverlay #authForm .auth-login-intro h2 {
    margin: 0;
    font-size: 22px;
    line-height: 1.42;
  }

  #authOverlay #authForm .auth-login-intro p,
  #authOverlay #authForm .auth-login-intro ul {
    display: none;
  }

  #authOverlay #authForm .auth-login-main {
    gap: 17px;
    padding: 25px 25px 24px;
  }
}

@media (max-width: 560px) {
  #authOverlay #authForm.auth-login-dialog {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: calc(100dvh - 10px);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 20px 20px 0 0;
    transform: none;
  }

  #authOverlay #authForm.auth-login-dialog:target,
  #authOverlay.guest-login-overlay.is-open #authForm.auth-login-dialog {
    animation-name: auth-sheet-enter;
  }

  #authOverlay #authForm .auth-login-intro {
    min-height: 118px;
    padding: 20px 56px 19px 20px;
  }

  #authOverlay #authForm .auth-login-symbol {
    width: 38px;
    height: 38px;
    margin-bottom: 12px;
    background-size: 13px 13px;
  }

  #authOverlay #authForm .auth-login-symbol span:first-child { top: 7px; left: 19px; }
  #authOverlay #authForm .auth-login-symbol span:last-child { top: 20px; left: 7px; }

  #authOverlay #authForm .auth-login-beta {
    top: 22px;
    left: 66px;
  }

  #authOverlay #authForm .auth-login-intro h2 {
    font-size: 19px;
    line-height: 1.35;
  }

  #authOverlay #authForm .auth-login-intro h2 br {
    display: none;
  }

  #authOverlay #authForm .auth-login-main {
    gap: 15px;
    padding: 21px 20px 22px;
  }

  #authOverlay #authForm .auth-login-main h2 {
    font-size: 24px;
  }

  #authOverlay #authForm .auth-dialog-close {
    top: 10px;
    right: 10px;
  }

  .register-page .register-shell {
    align-content: start;
    gap: 16px;
    padding: 20px 12px;
  }

  .register-shell #registerForm.register-dialog {
    padding: 25px 20px;
    border-radius: 16px;
  }
}

@keyframes auth-sheet-enter {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  #authOverlay #authForm.auth-login-dialog:target,
  #authOverlay .auth-login-dialog:target + .auth-dialog-backdrop,
  #authOverlay.guest-login-overlay.is-open #authForm.auth-login-dialog,
  #authOverlay.guest-login-overlay.is-open .auth-login-dialog + .auth-dialog-backdrop {
    animation: none;
  }

  #authOverlay #authForm .auth-register-card,
  #authOverlay #authForm .auth-dialog-close,
  #authOverlay #authForm .auth-input-shell {
    transition: none;
  }
}

/* User-selectable board and play environment (2026-07-22) */
:root,
[data-board-theme="kaya"] {
  --board-line-color: rgba(80, 52, 20, 0.72);
  --board-star-color: rgba(66, 43, 17, 0.86);
  --board-frame-bg: #edf1ec;
  --board-frame-border: #d8dfd8;
  --board-surface-shadow:
    inset 0 0 0 999px rgba(255, 255, 255, 0.04),
    0 12px 24px rgba(49, 38, 20, 0.12);
  --board-wood-bg:
    linear-gradient(rgba(245, 210, 142, 0.20), rgba(245, 210, 142, 0.20)),
    linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent 28%),
    linear-gradient(90deg, rgba(255, 240, 192, 0.20), rgba(109, 70, 27, 0.04)),
    url("./assets/board-wood-texture-kaya-light.jpg") center / cover no-repeat,
    #d8a45d;
}

[data-board-theme="masame"] {
  --board-line-color: rgba(68, 49, 27, 0.75);
  --board-star-color: rgba(53, 38, 21, 0.88);
  --board-frame-bg: #f0eee8;
  --board-frame-border: #d8d2c5;
  --board-surface-shadow:
    inset 0 0 0 999px rgba(255, 255, 255, 0.06),
    0 12px 24px rgba(54, 43, 28, 0.13);
  --board-wood-bg:
    linear-gradient(90deg, rgba(255, 249, 224, 0.16), rgba(130, 91, 40, 0.04)),
    url("./assets/board-wood-grain-masame.svg") center / cover no-repeat,
    #dfbb78;
}

[data-board-theme="natural"] {
  --board-line-color: rgba(67, 43, 20, 0.76);
  --board-star-color: rgba(52, 33, 15, 0.9);
  --board-frame-bg: #ebe6dc;
  --board-frame-border: #d4cbbb;
  --board-surface-shadow:
    inset 0 0 0 999px rgba(255, 255, 255, 0.025),
    0 12px 24px rgba(49, 35, 20, 0.16);
  --board-wood-bg:
    linear-gradient(110deg, rgba(255, 232, 175, 0.10), rgba(89, 52, 22, 0.08)),
    url("./assets/board-wood-grain-natural.svg") center / cover no-repeat,
    #c99452;
}

[data-board-theme="calm-lime"] {
  --board-line-color: rgba(39, 61, 37, 0.78);
  --board-star-color: #253c25;
  --board-frame-bg: #e8eee2;
  --board-frame-border: #c8d4bd;
  --board-surface-shadow: 0 3px 10px rgba(38, 58, 35, 0.12);
  --board-wood-bg: #a9bd72;
}

[data-board-theme="simple-wood"] {
  --board-line-color: rgba(69, 49, 25, 0.78);
  --board-star-color: #4d351c;
  --board-frame-bg: #eee9df;
  --board-frame-border: #d5ccbc;
  --board-surface-shadow: 0 3px 10px rgba(60, 43, 24, 0.12);
  --board-wood-bg: #d4aa68;
}

/* Board surface themes (2026-08-18) */
[data-board-theme="spring-sakura"] {
  --board-line-color: rgba(126, 67, 82, 0.62);
  --board-star-color: #944d64;
  --board-frame-bg: #fffdfd;
  --board-frame-border: #f4e2e6;
  --board-surface-shadow: inset 0 0 36px rgba(255, 255, 255, 0.72), 0 12px 26px rgba(137, 74, 91, 0.09);
  --board-wood-bg:
    linear-gradient(rgba(215, 166, 181, 0.30), rgba(226, 184, 195, 0.28)),
    url("./assets/board-themes/spring-sakura-surface-v2.jpg") center / cover no-repeat;
  --theme-last-move-color: #f7bf48;
}

[data-board-theme="summer-water"] {
  --board-line-color: rgba(12, 73, 92, 0.66);
  --board-star-color: #07566b;
  --board-frame-bg: #fcffff;
  --board-frame-border: #dceff1;
  --board-surface-shadow: inset 0 0 34px rgba(255, 255, 255, 0.72), 0 12px 26px rgba(22, 101, 124, 0.09);
  --board-wood-bg:
    linear-gradient(rgba(139, 193, 204, 0.30), rgba(165, 207, 214, 0.28)),
    url("./assets/board-themes/summer-water-surface-v2.jpg") center / cover no-repeat;
  --theme-last-move-color: #ff6e67;
}

[data-board-theme="autumn-maple"] {
  --board-line-color: rgba(87, 42, 16, 0.70);
  --board-star-color: #6d2b13;
  --board-frame-bg: #fffdf9;
  --board-frame-border: #eadfce;
  --board-surface-shadow: inset 0 0 32px rgba(255, 250, 239, 0.52), 0 12px 27px rgba(112, 53, 18, 0.09);
  --board-wood-bg:
    linear-gradient(rgba(213, 176, 122, 0.30), rgba(224, 191, 143, 0.28)),
    url("./assets/board-themes/autumn-maple-surface-v2.jpg") center / cover no-repeat;
  --theme-last-move-color: #fff0a8;
}

[data-board-theme="winter-ice"] {
  --board-line-color: rgba(46, 87, 113, 0.58);
  --board-star-color: #356f91;
  --board-frame-bg: #fff;
  --board-frame-border: #dce9f0;
  --board-surface-shadow: inset 0 0 40px rgba(255, 255, 255, 0.86), 0 12px 28px rgba(52, 102, 132, 0.08);
  --board-wood-bg:
    linear-gradient(rgba(164, 190, 208, 0.30), rgba(187, 208, 221, 0.28)),
    url("./assets/board-themes/winter-ice-surface-v2.jpg") center / cover no-repeat;
  --theme-last-move-color: #e95c72;
}

[data-board-theme="space-galaxy"] {
  --board-line-color: rgba(237, 201, 113, 0.52);
  --board-star-color: #f1cd78;
  --board-frame-bg: #17172c;
  --board-frame-border: #4a416e;
  --board-surface-shadow: inset 0 0 44px rgba(91, 68, 153, 0.35), 0 12px 30px rgba(8, 7, 24, 0.42);
  --board-wood-bg:
    linear-gradient(rgba(10, 13, 39, 0.10), rgba(21, 14, 48, 0.10)),
    url("./assets/board-themes/space-galaxy-surface-v1.jpg") center / cover no-repeat;
  --theme-last-move-color: #ff6f91;
}

[data-board-theme="moonlit-night"] {
  --board-line-color: rgba(211, 210, 225, 0.47);
  --board-star-color: #eee9ca;
  --board-frame-bg: #171b26;
  --board-frame-border: #5a6170;
  --board-surface-shadow: inset 0 0 42px rgba(159, 170, 202, 0.20), 0 12px 30px rgba(8, 11, 18, 0.40);
  --board-wood-bg:
    linear-gradient(rgba(16, 22, 38, 0.08), rgba(28, 26, 49, 0.08)),
    url("./assets/board-themes/moonlit-night-surface-v1.jpg") center / cover no-repeat;
  --theme-last-move-color: #e66c8e;
}

[data-stone-theme="matte"] .stone.black,
[data-stone-theme="matte"] .qa-stone.black,
[data-stone-theme="matte"] .auth-mini-board .stone.black,
[data-stone-theme="matte"] .mp-theme-stone--black {
  border: 1px solid #080b08 !important;
  background: #151a15 !important;
  box-shadow: 0 1px 1px rgba(10, 17, 10, 0.24) !important;
}

[data-stone-theme="matte"] .stone.white,
[data-stone-theme="matte"] .qa-stone.white,
[data-stone-theme="matte"] .auth-mini-board .stone.white,
[data-stone-theme="matte"] .mp-theme-stone--white {
  border: 1px solid #aeb7aa !important;
  background: #f1f3ed !important;
  box-shadow: 0 1px 1px rgba(35, 48, 33, 0.18) !important;
}

[data-stone-theme="matte"] .point > .stone,
[data-stone-theme="matte"] .qa-point > .qa-stone,
[data-stone-theme="matte"] .point > .ghost-stone,
[data-stone-theme="matte"] .qa-point > .ghost-stone {
  width: 94% !important;
  height: 94% !important;
}

[data-stone-theme="matte"] .ai-game-board .ai-game-point > .stone,
[data-stone-theme="matte"] .ai-game-board .ai-game-point > .ghost-stone {
  width: 94% !important;
  height: 94% !important;
  max-width: none !important;
  max-height: none !important;
}

[data-stone-theme="matte"] .goban > .stone,
[data-stone-theme="matte"] .goban > .ghost-stone {
  width: calc(94% / var(--board-size)) !important;
  height: calc(94% / var(--board-size)) !important;
  max-width: none !important;
  max-height: none !important;
}

.register-shell .register-legal-consent {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  margin: -2px 0 0;
  padding: 12px 13px;
  border: 1px solid #d8e2d9;
  border-radius: 10px;
  background: #f7faf6;
  color: #526158;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.75;
}

.register-shell .register-legal-consent input {
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  accent-color: #4d795a;
}

.register-shell .register-legal-consent a {
  color: #2e6640;
  font-weight: 900;
  text-underline-offset: 2px;
}

.register-shell .register-legal-consent:has(input:focus-visible) {
  outline: 3px solid rgba(56, 113, 73, 0.22);
  outline-offset: 2px;
}

/* 利用規約・プライバシーポリシー共通ページ */
.legal-page {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 12% 4%, rgba(255, 255, 255, 0.94), transparent 27%),
    linear-gradient(145deg, #f6f3e9 0%, #edf2eb 100%);
  color: #26352b;
}

.legal-shell {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.legal-brand {
  display: flex;
  width: fit-content;
  margin: 0 auto 22px;
}

.legal-brand img {
  display: block;
  width: 190px;
  height: auto;
}

.legal-document {
  padding: clamp(26px, 5vw, 56px);
  border: 1px solid rgba(64, 82, 69, 0.16);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 24px 60px rgba(29, 47, 34, 0.11);
  font-size: 14px;
  line-height: 1.9;
}

.legal-document-header {
  margin-bottom: 30px;
  padding-bottom: 22px;
  border-bottom: 1px solid #dfe7df;
}

.legal-document-header > span {
  color: #bc6c77;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.legal-document h1 {
  margin: 7px 0 4px;
  color: #1f3326;
  font-family: var(--title-font);
  font-size: clamp(28px, 5vw, 38px);
}

.legal-document-header p {
  margin: 0;
  color: #77827a;
  font-size: 12px;
}

.legal-document section {
  margin-top: 30px;
  scroll-margin-top: 24px;
}

.legal-document h2 {
  margin: 0 0 8px;
  padding-left: 12px;
  border-left: 4px solid #83a78d;
  color: #27412f;
  font-size: 17px;
  line-height: 1.55;
}

.legal-document p,
.legal-document ul,
.legal-document ol {
  margin-top: 8px;
  margin-bottom: 0;
}

.legal-document ul,
.legal-document ol {
  padding-left: 1.6em;
}

.legal-document li + li {
  margin-top: 5px;
}

.legal-document a {
  color: #2c6740;
  font-weight: 800;
  text-underline-offset: 3px;
}

.legal-document-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 38px;
  padding-top: 24px;
  border-top: 1px solid #dfe7df;
}

.legal-document-nav a {
  padding: 9px 13px;
  border: 1px solid #d4ded5;
  border-radius: 999px;
  background: #f6f9f5;
  text-decoration: none;
}

@media (max-width: 600px) {
  .legal-shell {
    width: min(100% - 20px, 920px);
    padding: 18px 0 28px;
  }

  .legal-brand {
    margin-bottom: 14px;
  }

  .legal-brand img {
    width: 164px;
  }

  .legal-document {
    padding: 24px 19px 28px;
    border-radius: 18px;
    font-size: 13px;
    line-height: 1.85;
  }

  .legal-document h2 {
    font-size: 15px;
  }
}

/* Keep main-board stones proportional when browser zoom changes the rendered cell size. */
.goban > .stone {
  max-width: none !important;
  max-height: none !important;
}

.goban .point > .ghost-stone {
  max-width: none;
  max-height: none;
}

[data-stone-theme="matte"] .ghost-stone {
  background: rgba(25, 31, 25, 0.5) !important;
  box-shadow: none !important;
}

.goban,
.qa-board,
.reference-board,
.mini-goban,
.auth-mini-board {
  background: var(--board-wood-bg) !important;
  box-shadow: var(--board-surface-shadow);
}

.qa-board.thumbnail {
  box-shadow: none;
}

.goban::before,
.auth-mini-board::before {
  background:
    linear-gradient(to right, var(--board-line-color) 1px, transparent 1px) 0 0 / var(--line-gap) var(--line-gap),
    linear-gradient(to bottom, var(--board-line-color) 1px, transparent 1px) 0 0 / var(--line-gap) var(--line-gap);
  box-shadow: inset -1px 0 0 var(--board-line-color), inset 0 -1px 0 var(--board-line-color);
}

.point.star::after,
.qa-point.star::after {
  left: 50% !important;
  top: 50% !important;
  width: 16% !important;
  height: 16% !important;
  max-width: 5.5px !important;
  max-height: 5.5px !important;
  transform: translate(calc(-50% + 0.5px), calc(-50% + 0.5px)) !important;
}

.auth-mini-board .star-point {
  width: 1.8%;
  height: 1.8%;
  max-width: 5.5px;
  max-height: 5.5px;
  transform: translate(calc(-50% + 0.5px), calc(-50% + 0.5px)) !important;
}

.point.star::after,
.qa-point.star::after,
.auth-mini-board .star-point {
  background: var(--board-star-color);
}

.ai-game-page .ai-game-board-frame,
#editorBoardDialog .editor-board-dialog-board-stage {
  border-color: var(--board-frame-border);
  background: var(--board-frame-bg);
}

@media (min-width: 701px) {
  .ai-game-page .ai-game-board-area {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .ai-game-page .ai-game-board-frame {
    padding: 11px 18px 18px;
    border: 1px solid rgba(47, 76, 58, 0.13);
    border-radius: 16px;
    background:
      radial-gradient(circle at 100% 0, rgba(92, 137, 102, 0.09), transparent 34%),
      linear-gradient(145deg, #f7f9f4, #eef3ec);
    box-shadow: 0 10px 28px rgba(34, 56, 43, 0.09);
  }

  .ai-game-page .ai-game-board.goban {
    border-radius: 4px;
    box-shadow:
      0 2px 0 rgba(90, 61, 25, 0.18),
      0 12px 24px rgba(67, 49, 25, 0.2) !important;
  }
}

@media (min-width: 1321px) {
  .ai-game-page .ai-game-shell {
    --ai-game-desktop-board-size: min(
      calc(100dvh - 130px),
      calc(100vw - 690px)
    );
    width: fit-content;
    max-width: calc(100vw - 32px);
    grid-template-columns: 300px var(--ai-game-desktop-board-size) 330px !important;
    gap: 14px;
    justify-content: center;
  }

  .ai-game-page .ai-game-board-frame {
    width: 100%;
  }
}

:root[data-board-coordinates="off"] .board-coordinate,
:root[data-board-last-move="off"] .last-move-ring,
:root[data-board-last-move="off"] .ai-game-last-move-marker,
:root[data-board-move-preview="off"] .ghost-stone {
  display: none !important;
}

:root[data-board-move-preview="off"] .ai-game-page .ai-game-board[data-playable="true"] > .ai-game-point[data-occupied="false"]:not(:disabled):hover::before {
  display: none !important;
  content: none !important;
}

:root[data-ui-motion="off"] *,
:root[data-ui-motion="off"] *::before,
:root[data-ui-motion="off"] *::after {
  scroll-behavior: auto !important;
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}

.mp-play-settings-section {
  overflow: hidden;
  padding: 0;
  border-color: #dce6dc;
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(38, 64, 47, 0.055);
}

.mp-settings-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 24px 20px;
  border-bottom: 1px solid #e3ebe3;
  background:
    radial-gradient(circle at 94% 18%, rgba(99, 137, 106, 0.13), transparent 23%),
    linear-gradient(135deg, #f6faf6, #fbfcf8);
}

.mp-settings-eyebrow {
  display: block;
  margin-bottom: 6px;
  color: #67806c;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.17em;
}

.mp-settings-section-heading .mp-settings-section-title {
  margin: 0;
  padding: 0;
  border: 0;
  color: #20392a;
  font-family: var(--title-font);
  font-size: 22px;
  line-height: 1.35;
}

.mp-settings-section-lead {
  margin: 6px 0 0;
  color: #6b786f;
  font-size: 12px;
  line-height: 1.65;
}

.mp-settings-section[aria-labelledby="mpBillingTitle"] > .mp-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  max-width: 100%;
  margin-top: 16px;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
}

.mp-device-save-badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 6px;
  margin-top: 4px;
  padding: 6px 10px;
  border: 1px solid #ceddce;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: #526c59;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.mp-device-save-badge::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4d8a5d;
  content: "";
}

.mp-preference-fieldset {
  min-width: 0;
  margin: 0;
  padding: 24px;
  border: 0;
  border-bottom: 1px solid #edf0eb;
}

.mp-preference-fieldset legend {
  padding: 0;
  color: #24382c;
  font-size: 14px;
  font-weight: 800;
}

.mp-preference-fieldset > p {
  margin: 5px 0 16px;
  color: #778178;
  font-size: 11px;
  line-height: 1.65;
}

.mp-board-theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mp-board-theme-card {
  position: relative;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 10px;
  border: 1px solid #dfe5dd;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.mp-board-theme-card:hover {
  border-color: #aebfaf;
  transform: translateY(-1px);
}

.mp-board-theme-card:has(input:checked) {
  border-color: #4d7958;
  box-shadow: 0 0 0 2px rgba(77, 121, 88, 0.12), 0 8px 18px rgba(42, 70, 50, 0.08);
}

.mp-board-theme-card:has(input:focus-visible) {
  outline: 3px solid rgba(31, 111, 67, 0.28);
  outline-offset: 2px;
}

.mp-board-theme-card > input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.mp-board-theme-preview {
  position: relative;
  display: block;
  width: 74px;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid rgba(75, 54, 28, 0.22);
  border-radius: 8px;
  background: var(--board-wood-bg);
  box-shadow: inset 0 0 12px rgba(74, 49, 21, 0.05);
}

.mp-board-theme-preview::before {
  position: absolute;
  inset: 8px;
  background:
    repeating-linear-gradient(to right, var(--board-line-color) 0 1px, transparent 1px 11.5px),
    repeating-linear-gradient(to bottom, var(--board-line-color) 0 1px, transparent 1px 11.5px);
  content: "";
}

.mp-theme-stone {
  position: absolute;
  z-index: 1;
  width: 13px;
  height: 13px;
  border-radius: 50%;
}

.mp-theme-stone--black {
  top: 25px;
  left: 25px;
  background: radial-gradient(circle at 36% 28%, #5a5a58, #171817 48%, #050605 75%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.36);
}

.mp-theme-stone--white {
  top: 36px;
  left: 36px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  background: radial-gradient(circle at 35% 28%, #fff, #f2f0e9 63%, #d9d4c8);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16);
}

.mp-theme-stone--third {
  top: 47px;
  left: 47px;
}

.mp-board-theme-copy {
  min-width: 0;
}

.mp-board-theme-copy strong,
.mp-board-theme-copy small {
  display: block;
}

.mp-board-theme-copy strong {
  color: #27372d;
  font-size: 13px;
}

.mp-board-theme-copy small {
  margin-top: 4px;
  color: #7b867e;
  font-size: 10px;
  line-height: 1.5;
}

.mp-board-theme-check {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid #d6ddd6;
  border-radius: 50%;
  color: transparent;
  font-size: 10px;
  font-weight: 900;
}

.mp-board-theme-card:has(input:checked) .mp-board-theme-check {
  border-color: #477853;
  background: #477853;
  color: #fff;
}

.mp-preference-groups {
  display: grid;
  grid-template-columns: minmax(0, 0.84fr) minmax(0, 1.16fr);
  gap: 0;
  padding: 0 24px;
}

.mp-preference-group {
  min-width: 0;
  padding: 24px 22px 14px 0;
}

.mp-preference-group + .mp-preference-group {
  padding-right: 0;
  padding-left: 22px;
  border-left: 1px solid #edf0eb;
}

.mp-preference-group-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.mp-preference-group-heading h4 {
  margin: 0;
  color: #293a30;
  font-size: 13px;
}

.mp-preference-group-heading p {
  margin: 2px 0 0;
  color: #889189;
  font-size: 10px;
}

.mp-preference-group-icon {
  position: relative;
  display: block;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 1px solid #dce7dd;
  border-radius: 9px;
  background: #f3f8f3;
}

.mp-preference-group-icon--sound::before {
  position: absolute;
  top: 9px;
  left: 8px;
  width: 7px;
  height: 10px;
  border-radius: 2px 0 0 2px;
  background: #56735d;
  clip-path: polygon(0 30%, 38% 30%, 100% 0, 100% 100%, 38% 70%, 0 70%);
  content: "";
}

.mp-preference-group-icon--sound::after {
  position: absolute;
  top: 9px;
  left: 16px;
  width: 6px;
  height: 10px;
  border-right: 1.5px solid #56735d;
  border-radius: 50%;
  content: "";
}

.mp-preference-group-icon--board::before {
  position: absolute;
  inset: 7px;
  border: 1px solid #6d846f;
  background:
    linear-gradient(to right, transparent 47%, #8fa292 47% 53%, transparent 53%),
    linear-gradient(to bottom, transparent 47%, #8fa292 47% 53%, transparent 53%);
  content: "";
}

.mp-play-settings-section .mp-settings-toggle-row {
  min-height: 55px;
  padding: 10px 0;
  border-color: #edf0eb;
}

.mp-settings-toggle-copy {
  display: block;
  min-width: 0;
}

.mp-settings-toggle-copy strong,
.mp-settings-toggle-copy small {
  display: block;
}

.mp-settings-toggle-copy strong {
  color: #35443a;
  font-size: 12px;
  line-height: 1.4;
}

.mp-settings-toggle-copy small {
  margin-top: 3px;
  color: #89928b;
  font-size: 9.5px;
  line-height: 1.45;
}

.mp-play-settings-section .mp-toggle {
  width: 40px;
  height: 22px;
}

.mp-play-settings-section .mp-toggle-track {
  border: 1px solid #c7d0c8;
  background: #d8ddd8;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.mp-play-settings-section .mp-toggle-track::after {
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
}

.mp-play-settings-section .mp-toggle input:checked + .mp-toggle-track {
  border-color: #477853;
  background: #477853;
}

.mp-play-settings-section .mp-toggle input:checked + .mp-toggle-track::after {
  transform: translateX(18px);
}

.mp-coordinate-mode-control select {
  min-width: 168px;
  min-height: 36px;
  padding: 7px 30px 7px 10px;
  border: 1px solid #c7d0c8;
  border-radius: 8px;
  background: #fff;
  color: #35443a;
  font: inherit;
  font-size: 11px;
}

.mp-coordinate-mode-control select:focus-visible {
  outline: 3px solid rgba(31, 111, 67, 0.28);
  outline-offset: 2px;
}

.mp-bgm-volume-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mp-bgm-volume-control input[type="range"] {
  width: 140px;
  accent-color: #477853;
  cursor: pointer;
}

.mp-bgm-volume-control output {
  min-width: 38px;
  color: #477853;
  font-size: 11px;
  font-weight: 700;
  text-align: right;
}

.mp-bgm-credit {
  margin: 0;
  padding: 0 0 10px;
  border-bottom: 1px solid #edf0eb;
  color: #929a94;
  font-size: 9px;
  text-align: right;
}

.mp-bgm-credit a {
  color: #557960;
  text-underline-offset: 2px;
}

.mp-toggle input:focus-visible + .mp-toggle-track {
  outline: 3px solid rgba(31, 111, 67, 0.28);
  outline-offset: 3px;
}

.mp-preference-message {
  margin: 0;
  padding: 11px 24px 13px;
  border-top: 1px solid #edf0eb;
  background: #fbfcfa;
  color: #7d897f;
  font-size: 10px;
  text-align: right;
  transition: color 0.18s ease, background 0.18s ease;
}

.mp-preference-message.is-saved {
  background: #f3f8f3;
  color: #3e744c;
  font-weight: 700;
}

@media (max-width: 860px) {
  .mp-board-theme-grid {
    grid-template-columns: 1fr;
  }

  .mp-board-theme-card {
    grid-template-columns: 66px minmax(0, 1fr) 20px;
  }

  .mp-board-theme-preview {
    width: 66px;
  }

  .mp-theme-stone--black { top: 22px; left: 22px; }
  .mp-theme-stone--white { top: 32px; left: 32px; }
  .mp-theme-stone--third { top: 42px; left: 42px; }
}

@media (max-width: 620px) {
  .mp-settings-section-heading {
    display: block;
    padding: 20px;
  }

  .mp-device-save-badge {
    margin-top: 12px;
  }

  .mp-preference-fieldset {
    padding: 20px;
  }

  .mp-preference-groups {
    grid-template-columns: 1fr;
    padding: 0 20px;
  }

  .mp-preference-group,
  .mp-preference-group + .mp-preference-group {
    padding: 20px 0 12px;
    border-left: 0;
  }

  .mp-preference-group + .mp-preference-group {
    border-top: 1px solid #edf0eb;
  }

  .mp-coordinate-mode-control select {
    min-width: 152px;
    max-width: 48vw;
  }

  .mp-bgm-volume-control input[type="range"] {
    width: min(130px, 36vw);
  }

  .mp-preference-message {
    padding-right: 20px;
    padding-left: 20px;
    text-align: left;
  }
}
/* AI game: compact VOICEVOX control inside the match card. */
.ai-game-voice-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 11px;
  border: 1px solid rgba(61, 91, 70, 0.11);
  border-radius: 10px;
  background: #f7f9f6;
}

.ai-game-voice-identity,
.ai-game-voice-actions {
  display: flex;
  align-items: center;
}

.ai-game-voice-identity {
  min-width: 0;
  gap: 9px;
}

.ai-game-voice-identity > span:last-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.ai-game-voice-identity strong {
  color: #2f4537;
  font-size: 12px;
  font-weight: 850;
}

.ai-game-voice-identity small {
  overflow: hidden;
  color: #738078;
  font-size: 10px;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-game-voice-identity small[data-state="ready"] {
  color: #39714d;
}

.ai-game-voice-identity small[data-state="speaking"] {
  color: #a4631d;
}

.ai-game-voice-identity small[data-state="unavailable"] {
  color: #a14c42;
}

.ai-game-voice-mark {
  width: 29px;
  height: 29px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 9px 9px 9px 3px;
  background: #dfeadf;
  box-shadow: inset 0 0 0 1px rgba(57, 104, 72, 0.1);
}

.ai-game-voice-mark i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #4f725a;
}

.ai-game-voice-actions {
  gap: 5px;
}

.ai-game-voice-actions button {
  min-height: 29px;
  padding: 5px 8px;
  border: 1px solid rgba(57, 86, 66, 0.18);
  border-radius: 7px;
  background: #fff;
  color: #526158;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.ai-game-voice-actions button:hover:not(:disabled) {
  border-color: rgba(43, 99, 60, 0.34);
  color: #2f6841;
}

#aiGameVoiceToggleBtn[aria-pressed="true"] {
  border-color: #51765c;
  background: #51765c;
  color: #fff;
}

.ai-game-voice-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.ai-game-voice-caption {
  position: relative;
  margin: 8px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff9eb;
  color: #5e5137;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.5;
}

.ai-game-voice-caption::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 18px;
  width: 10px;
  height: 10px;
  background: inherit;
  transform: rotate(45deg);
}

.ai-game-voice-credit {
  margin: 5px 1px 0;
  color: #8a938d;
  font-size: 9px;
  line-height: 1.3;
  text-align: right;
}

@media (max-width: 420px) {
  .ai-game-voice-control {
    grid-template-columns: 1fr;
  }

  .ai-game-voice-actions {
    justify-content: flex-end;
  }
}

/* AI対局場: 中央は固定碁盤専用、案内と操作は左サイドバーへ */
.ai-game-page .ai-game-board-area {
  position: sticky;
  top: 76px;
  align-self: start;
  max-height: calc(100dvh - 92px);
  gap: 0;
  overflow: hidden;
}

.ai-game-page .ai-game-setup-guidance {
  margin: 12px 0 10px;
  padding: 10px 12px;
  border: 1px solid #d8e5da;
  border-radius: 9px;
  background: #f3f8f4;
  color: #41604b;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.55;
}

.ai-game-page .ai-game-left-notice {
  width: 100%;
  margin: 0 !important;
}

.ai-game-page .ai-game-shell[data-phase="setup"] .ai-game-left-notice {
  display: none;
}

.ai-game-page .ai-game-left-toolbar {
  width: 100%;
  align-items: stretch;
  flex-direction: column;
  gap: 9px;
  margin: 0;
  padding: 12px;
  border: 1px solid #dfe6df;
  border-radius: 12px;
  background: #fff;
  box-sizing: border-box;
}

.ai-game-page .ai-game-left-toolbar .ai-game-view-controls {
  display: grid;
  grid-template-columns: minmax(68px, 1fr) minmax(82px, auto) minmax(68px, 1fr);
  width: 100%;
}

.ai-game-page .ai-game-left-toolbar .ai-game-view-controls output {
  align-self: center;
  text-align: center;
}

.ai-game-page .ai-game-left-toolbar .ai-game-view-seek {
  flex: 0 0 auto;
  width: 100%;
  grid-template-columns: auto minmax(0, 1fr);
}

.ai-game-page .ai-game-left-toolbar .ai-game-view-seek output {
  grid-column: 1 / -1;
  min-width: 0;
  text-align: right;
}

.ai-game-page .ai-game-shell[data-phase="ended"] .ai-game-left-toolbar {
  gap: 6px;
  padding: 8px 10px;
}

.ai-game-page .ai-game-shell[data-phase="ended"] .ai-game-left-toolbar .ai-game-view-controls {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.ai-game-page .ai-game-shell[data-phase="ended"] .ai-game-left-toolbar .ai-game-view-controls output {
  display: none;
}

.ai-game-page .ai-game-shell[data-phase="ended"] .ai-game-left-toolbar .ai-game-view-controls button {
  min-height: 34px;
  padding: 5px 9px;
  white-space: nowrap;
}

.ai-game-page .ai-game-shell[data-phase="ended"] .ai-game-left-toolbar .ai-game-view-seek {
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 7px;
}

.ai-game-page .ai-game-shell[data-phase="ended"] .ai-game-left-toolbar .ai-game-view-seek label,
.ai-game-page .ai-game-shell[data-phase="ended"] .ai-game-left-toolbar .ai-game-view-seek output {
  min-width: 0;
  white-space: nowrap;
}

.ai-game-page .ai-game-shell[data-phase="ended"] .ai-game-left-toolbar .ai-game-view-seek output {
  grid-column: auto;
  text-align: right;
}

.ai-game-page .ai-game-left-toolbar .ai-game-play-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
}

.ai-game-page .ai-game-shell[data-mode="study"] .ai-game-left-toolbar .ai-game-play-controls {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ai-game-page .ai-game-play-controls #aiGameToolbarHintBtn {
  border-color: #90b29a;
  background: #eef6f0;
  color: #245b39;
}

.ai-game-page .ai-game-left-summary.ai-game-board-header {
  display: grid !important;
  width: 100% !important;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px 12px;
  margin: 0 !important;
  padding: 12px;
}

.ai-game-page .ai-game-left-summary .ai-game-board-context {
  grid-row: 1;
  grid-column: 1;
}

.ai-game-page .ai-game-left-summary .ai-game-turn-status {
  min-width: 0;
  grid-row: 2;
  grid-column: 1;
  justify-content: flex-start;
}

.ai-game-page .ai-game-left-summary .ai-game-board-progress {
  align-self: center;
  grid-row: 1 / span 2;
  grid-column: 2;
}

@media (max-width: 980px) {
  .ai-game-page .ai-game-board-area {
    position: relative;
    top: auto;
    max-height: none;
    overflow: visible;
  }
}

/* 棋譜解析・自由検討・棋譜エディタ: 中央は碁盤専用、操作は右レールへ集約 */
.workspace-board-focus .workspace-board-only {
  align-self: start;
}

@media (min-width: 1181px) {
  body.workspace-board-focus {
    --workspace-primary-board-stage-size: min(calc(100vw - 684px), calc(100vh - 130px)) !important;
    --workspace-primary-board-stage-size: min(calc(100dvw - 684px), calc(100dvh - 130px)) !important;
  }

  .workspace-board-focus .workspace-board-only {
    position: sticky;
    top: 76px;
    z-index: 4;
    max-height: calc(100dvh - 92px);
    overflow: hidden;
  }
}

.workspace-board-focus .workspace-board-only > .board-stage {
  width: min(100%, calc(100vh - 130px)) !important;
  width: min(100%, var(--workspace-primary-board-stage-size, calc(100dvh - 130px))) !important;
  padding: 8px;
}

.workspace-board-focus .workspace-board-only > .board-stage > #board.goban {
  width: 100%;
  max-width: none;
}

.side-panel[data-board-focus-ready="true"] {
  display: flex !important;
  min-width: 0;
  flex-direction: column;
  gap: 12px;
}

.workspace-right-fixed,
.workspace-right-rail {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(42, 76, 55, 0.13);
  border-radius: 13px;
  box-shadow: 0 8px 22px rgba(34, 56, 43, 0.07);
}

.workspace-right-fixed {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 9px;
  padding: 11px;
}

.workspace-right-fixed > * {
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.workspace-right-fixed .board-workspace-header {
  width: 100% !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 8px 10px !important;
  margin: 0 !important;
  padding: 9px !important;
  box-shadow: none;
}

.workspace-right-fixed .board-workspace-header .board-workspace-context {
  grid-row: 1;
  grid-column: 1;
}

.workspace-right-fixed .board-workspace-header .capture-table {
  grid-row: 1;
  grid-column: 2;
  justify-self: end !important;
}

.workspace-right-fixed .board-workspace-header .board-view-toggles {
  width: 100%;
  grid-row: 2;
  grid-column: 1 / -1;
  grid-template-columns: minmax(48px, 1fr) repeat(2, minmax(82px, auto));
}

.workspace-right-fixed .board-workspace-header #boardMeta {
  text-align: left;
}

.workspace-right-fixed .move-controls {
  display: grid !important;
  width: 100% !important;
  min-width: 0;
  grid-template-columns: repeat(3, 34px) minmax(40px, 1fr) repeat(3, 34px) !important;
  align-items: center;
  gap: 5px !important;
  box-sizing: border-box;
  margin: 0 !important;
  padding: 8px !important;
  background: #f8faf7;
  border: 1px solid rgba(47, 76, 58, 0.12);
  border-radius: 10px;
}

.workspace-right-fixed .move-controls button {
  min-width: 32px !important;
  min-height: 32px !important;
  color: #385244 !important;
  background: #fff !important;
  border: 1px solid rgba(47, 76, 58, 0.12) !important;
  border-radius: 8px !important;
}

.workspace-right-fixed .move-controls .seek-wrapper {
  min-width: 0;
  height: 32px !important;
}

.workspace-right-fixed .move-controls .move-number-jump {
  width: auto !important;
  min-width: 104px !important;
  grid-column: 1 / -1;
  justify-self: end;
  color: #51645a !important;
  background: #fff;
  border: 1px solid rgba(47, 76, 58, 0.11);
  border-radius: 8px;
}

.workspace-right-fixed .analysis-qa-section {
  margin: 0;
}

.workspace-right-fixed .board-workspace-feedback {
  display: grid;
  gap: 4px;
  margin: 0;
}

.workspace-right-rail {
  overflow: hidden;
}

.workspace-right-tabs {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 4px;
  padding: 7px;
  background: #f1f5f0;
  border-bottom: 1px solid rgba(42, 76, 55, 0.11);
}

.workspace-right-tabs button {
  min-width: 0;
  min-height: 34px;
  padding: 7px 8px;
  color: #627168;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
}

.workspace-right-tabs button:hover {
  color: #245f3d;
  background: rgba(255, 255, 255, 0.68);
}

.workspace-right-tabs button.active {
  color: #1b6039;
  background: #fff;
  border-color: rgba(42, 97, 61, 0.16);
  box-shadow: 0 3px 9px rgba(34, 56, 43, 0.07);
}

.workspace-right-panels {
  min-width: 0;
}

.workspace-right-tab-panel {
  max-height: calc(100vh - 500px);
  min-height: 180px;
  padding: 10px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.workspace-right-tab-panel[hidden] {
  display: none !important;
}

.workspace-right-tab-panel > .analysis-right-stack,
.workspace-right-tab-panel > #editorPanel.editor-panel {
  max-height: none !important;
  overflow: visible !important;
  padding-right: 0 !important;
}

body.workspace-board-focus[data-mode="editor"] .workspace-right-tab-panel > .analysis-right-stack {
  display: grid !important;
}

.workspace-right-tab-panel .board-tree-panel {
  width: 100% !important;
  margin: 0 !important;
  box-shadow: none;
}

/* Free study: give the move tree enough vertical room and keep large trees navigable. */
body[data-mode="study"] .workspace-right-tab-panel[data-workspace-right-panel="moves"] .board-tree-panel .game-tree {
  height: clamp(260px, 36dvh, 420px);
  min-height: 260px;
  max-height: 420px;
  overflow-x: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  touch-action: pan-x pan-y;
  -webkit-overflow-scrolling: touch;
}

.workspace-right-tab-panel .study-edit-actions,
.study-workspace-tools .study-edit-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 9px;
}

.workspace-right-tab-panel .study-edit-actions .study-btn-secondary,
.study-workspace-tools .study-edit-actions .study-btn-secondary {
  min-height: 38px;
  justify-content: center;
  gap: 6px;
  padding: 7px 9px;
}

.workspace-right-tab-panel .study-edit-actions .study-btn-secondary svg,
.study-workspace-tools .study-edit-actions .study-btn-secondary svg {
  width: 16px;
  height: 16px;
}

.workspace-right-tab-panel .study-candidate-row,
.study-workspace-tools .study-candidate-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #fff;
  border: 1px solid rgba(42, 76, 55, 0.12);
  border-radius: 11px;
}

.workspace-right-tab-panel .study-candidate-row .study-section-title,
.study-workspace-tools .study-candidate-row .study-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.workspace-right-tab-panel .study-candidate-row .study-candidate-limit-row,
.workspace-right-tab-panel .study-candidate-row .study-auto-row,
.study-workspace-tools .study-candidate-row .study-candidate-limit-row,
.study-workspace-tools .study-candidate-row .study-auto-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.workspace-right-tab-panel .study-candidate-row .study-setting-copy,
.study-workspace-tools .study-candidate-row .study-setting-copy {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 1px;
}

.workspace-right-tabs[hidden] {
  display: none !important;
}

.study-workspace-tools {
  display: grid;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  flex: 0 0 auto;
  gap: 8px;
  box-sizing: border-box;
}

.study-workspace-tools .study-edit-actions {
  margin: 0;
}

.study-workspace-tools .study-edit-actions .study-btn-secondary {
  min-width: 0;
  min-height: 40px;
}

.study-workspace-tools .study-candidate-row {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.workspace-right-rail[data-workspace-right-layout="flow"] {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.workspace-right-rail[data-workspace-right-layout="flow"] .workspace-right-tab-panel[data-workspace-right-panel="moves"] {
  padding: 0;
}

.workspace-right-rail[data-workspace-right-layout="flow"] .workspace-right-tab-panel[data-workspace-right-panel="moves"] {
  display: grid !important;
  align-content: start;
  gap: 9px;
}

.workspace-right-rail[data-workspace-right-layout="flow"] .study-edit-actions {
  margin-bottom: 0;
}

.study-settings-details > summary {
  cursor: pointer;
  list-style: none;
}

.study-settings-details > summary::-webkit-details-marker {
  display: none;
}

.study-settings-details > summary > span {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.study-settings-details > summary::after {
  content: "+";
  flex: 0 0 auto;
  color: #437158;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.study-settings-details[open] > summary::after {
  content: "−";
}

body[data-mode="study"] .workspace-right-fixed {
  gap: 7px;
  padding: 9px;
}

body[data-mode="study"] .workspace-right-fixed .board-workspace-header,
body[data-mode="study"] .workspace-right-fixed .move-controls {
  padding: 7px !important;
}

body[data-mode="study"] .workspace-right-fixed #studyPanel.study-panel {
  gap: 7px;
  padding: 9px;
  border-radius: 11px;
  box-shadow: none;
}

body[data-mode="study"] .workspace-right-fixed #studyPanel .study-primary-action #studyAnalyzeBtn {
  min-height: 48px;
  grid-template-columns: 27px minmax(0, 1fr);
  padding: 6px 10px !important;
}

body[data-mode="study"] .workspace-right-fixed #studyPanel .study-primary-action #studyAnalyzeBtn > svg {
  width: 20px;
  height: 20px;
}

@media (min-width: 1181px) {
  body[data-mode="study"] .side-panel[data-board-focus-ready="true"] {
    position: sticky;
    top: 76px;
    height: calc(100vh - 92px);
    height: calc(100dvh - 92px);
    max-height: calc(100dvh - 92px);
    overflow: hidden !important;
  }

  body[data-mode="study"] .workspace-right-fixed {
    flex: 0 0 auto;
  }

  body[data-mode="study"] .workspace-right-rail[data-workspace-right-layout="flow"] {
    min-height: 0;
    flex: 1 1 auto;
  }

  body[data-mode="study"] .workspace-right-rail[data-workspace-right-layout="flow"] .workspace-right-panels,
  body[data-mode="study"] .workspace-right-rail[data-workspace-right-layout="flow"] .workspace-right-tab-panel[data-workspace-right-panel="moves"] {
    height: 100%;
    min-height: 0;
  }

  body[data-mode="study"] .workspace-right-rail[data-workspace-right-layout="flow"] .workspace-right-tab-panel[data-workspace-right-panel="moves"] {
    max-height: none;
    overflow-y: auto;
  }
}

/* Free study may extend below the viewport; do not clip the move tree in the right rail. */
@media (min-width: 1181px) {
  body[data-mode="study"] .side-panel[data-board-focus-ready="true"] {
    position: static;
    top: auto;
    height: auto;
    max-height: none;
    overflow: visible !important;
  }

  body[data-mode="study"] .workspace-right-rail[data-workspace-right-layout="flow"] {
    min-height: auto;
    flex: 0 0 auto;
    overflow: visible;
  }

  body[data-mode="study"] .workspace-right-rail[data-workspace-right-layout="flow"] .workspace-right-panels,
  body[data-mode="study"] .workspace-right-rail[data-workspace-right-layout="flow"] .workspace-right-tab-panel[data-workspace-right-panel="moves"] {
    height: auto;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 1180px) and (orientation: portrait) {
  .workspace-right-tab-panel {
    max-height: none;
    min-height: 0;
    overflow: visible;
  }

  .workspace-board-focus .workspace-board-only {
    order: 1;
  }

  .workspace-board-focus #leftNav {
    order: 2;
  }

  .workspace-board-focus .side-panel[data-board-focus-ready="true"] {
    order: 3;
  }
}

/* =====================================================================
   Desktop board workspace polish v20260803
   Use wide screens for the board and tools instead of leaving dead space.
   ===================================================================== */
@media (min-width: 1181px) and (max-width: 1359px) {
  body.workspace-board-focus .workspace {
    max-width: none !important;
    padding-inline: 18px !important;
    box-sizing: border-box;
    grid-template-columns: 220px minmax(0, var(--workspace-primary-board-stage-size, 646px)) 400px !important;
    gap: 14px !important;
    justify-content: center;
  }

  body.workspace-board-focus .main-grid {
    width: 100% !important;
    grid-template-columns: 220px minmax(0, var(--workspace-primary-board-stage-size, 646px)) 400px !important;
    gap: 14px !important;
    align-items: start;
    justify-content: center;
  }

  body.workspace-board-focus .workspace-board-only {
    width: 100%;
    max-width: none;
  }
}

@media (min-width: 1360px) {
  .site-header .site-header-inner {
    max-width: 1520px;
    padding-inline: 24px;
  }

  body.workspace-board-focus .workspace {
    max-width: none !important;
    padding: 12px 18px 20px !important;
    box-sizing: border-box;
    grid-template-columns: 220px minmax(0, var(--workspace-primary-board-stage-size, 646px)) 400px !important;
    gap: 14px !important;
    justify-content: center;
  }

  body.workspace-board-focus .main-grid {
    width: 100% !important;
    grid-template-columns: 220px minmax(0, var(--workspace-primary-board-stage-size, 646px)) 400px !important;
    gap: 14px !important;
    align-items: start;
    justify-content: center;
  }

  body.workspace-board-focus #leftNav {
    width: 224px;
    top: 76px;
    max-height: calc(100dvh - 92px);
    border-color: rgba(42, 76, 55, 0.14);
    box-shadow: 0 10px 28px rgba(34, 56, 43, 0.08);
  }

  body.workspace-board-focus #leftNav button,
  body.workspace-board-focus #leftNav a {
    font-size: 11px;
  }

  body.workspace-board-focus #leftNav small {
    font-size: 9.5px;
  }

  body.workspace-board-focus .workspace-board-only {
    width: 100%;
    max-width: none;
  }

  body.workspace-board-focus .workspace-board-only > .board-stage {
    width: min(100%, calc(100vh - 130px)) !important;
    width: min(100%, var(--workspace-primary-board-stage-size, calc(100dvh - 130px))) !important;
    padding: 8px;
    border-color: rgba(42, 76, 55, 0.13);
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(48, 63, 44, 0.09);
  }

  body.workspace-board-focus .side-panel[data-board-focus-ready="true"] {
    position: sticky;
    top: 76px;
    height: calc(100dvh - 92px);
    max-height: calc(100dvh - 92px);
    overflow: hidden !important;
  }

  body.workspace-board-focus .workspace-right-fixed,
  body.workspace-board-focus .workspace-right-rail {
    border-color: rgba(42, 76, 55, 0.14);
    box-shadow: 0 10px 28px rgba(34, 56, 43, 0.08);
  }

  body.workspace-board-focus .workspace-right-fixed {
    gap: 8px;
    padding: 10px;
  }

  body.workspace-board-focus .workspace-right-fixed .move-controls {
    grid-template-columns: repeat(3, 34px) minmax(70px, 1fr) repeat(3, 34px) 96px !important;
    gap: 5px !important;
    padding: 7px !important;
  }

  body.workspace-board-focus .workspace-right-fixed .move-controls .move-number-jump,
  body.workspace-board-focus .workspace-right-fixed .move-controls #moveNumberLabel {
    width: 96px !important;
    min-width: 96px !important;
    max-width: 96px !important;
    grid-column: auto !important;
    justify-self: stretch !important;
  }

  body.workspace-board-focus .workspace-right-tabs button {
    min-height: 38px;
    font-size: 11.5px;
  }

  body.workspace-board-focus .workspace-right-rail {
    min-height: 0;
    flex: 1 1 auto;
  }

  body.workspace-board-focus .workspace-right-panels,
  body.workspace-board-focus .workspace-right-tab-panel {
    height: 100%;
    min-height: 0;
  }

  body.workspace-board-focus .workspace-right-tab-panel {
    max-height: none;
    padding: 12px;
  }
}

/* =====================================================================
   Smartphone application layout v20260803
   Shared header/bottom navigation, board workspaces, AI game and QA.
   ===================================================================== */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 700px) {
  :root {
    --mobile-header-height: 48px;
    --mobile-top-nav-height: 44px;
    --mobile-bottom-nav-height: 0px;
    --mobile-page-gutter: 8px;
  }

  html {
    scroll-padding-top: calc(var(--mobile-header-height) + var(--mobile-top-nav-height) + 8px);
    scroll-padding-bottom: calc(env(safe-area-inset-bottom) + 12px);
  }

  body.has-mobile-bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
    max-width: 100%;
    overflow-x: clip;
  }

  body.has-mobile-bottom-nav.workspace-board-focus,
  body.has-mobile-bottom-nav.ai-game-page {
    padding-bottom: calc(env(safe-area-inset-bottom) + 8px);
  }

  .site-header.qa-topnav {
    position: sticky;
    top: 0;
    z-index: 120;
    display: block;
    height: auto;
    min-height: var(--mobile-header-height);
    gap: 0;
    padding: 0;
  }

  body.ai-game-page {
    padding-top: calc(var(--mobile-header-height) + var(--mobile-top-nav-height));
  }

  body.ai-game-page .site-header.qa-topnav {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    width: 100%;
  }

  .site-header .site-header-inner {
    height: var(--mobile-header-height);
    min-height: var(--mobile-header-height);
    padding: 7px 10px;
  }

  .site-header .qa-topnav-logo img {
    width: 150px;
    max-width: 42vw;
    height: auto;
  }

  .site-header .site-header-menu-button,
  .site-header .qa-topnav-nav,
  .site-header .qa-topnav-ask-btn {
    display: none !important;
  }

  .site-header .qa-topnav-right {
    display: flex !important;
    margin-left: auto;
    gap: 5px;
  }

  .site-header .qa-bell,
  .site-header .qa-account-menu-button {
    display: inline-flex !important;
    width: 40px;
    min-width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
  }

  .site-header .qa-topnav-user,
  .site-header .qa-topnav-chevron {
    display: none !important;
  }

  .site-header .qa-account-menu-panel {
    position: fixed;
    top: calc(var(--mobile-header-height) + var(--mobile-top-nav-height) + 4px);
    right: 8px;
    left: 8px;
    width: auto;
    max-height: calc(100dvh - var(--mobile-header-height) - var(--mobile-top-nav-height) - 24px);
    overflow-y: auto;
  }

  .mobile-bottom-nav {
    position: relative;
    z-index: 140;
    display: grid;
    width: 100%;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    min-height: var(--mobile-top-nav-height);
    padding: 2px 4px;
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid rgba(42, 76, 55, 0.1);
    border-bottom: 1px solid rgba(42, 76, 55, 0.16);
    box-shadow: 0 5px 14px rgba(28, 48, 36, 0.07);
    backdrop-filter: blur(14px);
  }

  .mobile-bottom-nav a {
    display: flex;
    min-width: 0;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1px;
    color: #657169;
    border-radius: 10px;
    font-size: 8.5px;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    touch-action: manipulation;
  }

  .mobile-bottom-nav a svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
  }

  .mobile-bottom-nav a.active {
    color: #12683f;
    background: #edf7f0;
  }

  button,
  a,
  input,
  select,
  textarea {
    touch-action: manipulation;
  }

  /* Shared board workspace: board first, controls/results second, file tools last. */
  .app-shell,
  .workspace {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
  }

  .app-shell {
    padding: 6px 0 18px;
  }

  .workspace {
    padding-inline: var(--mobile-page-gutter);
  }

  .main-grid {
    display: flex !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    flex-direction: column;
    gap: 10px !important;
    overflow-x: clip;
  }

  .workspace-board-focus .workspace-board-only {
    order: 1;
    width: 100%;
    min-width: 0;
  }

  .workspace-board-focus .side-panel[data-board-focus-ready="true"] {
    order: 2;
    width: 100%;
    min-width: 0;
    gap: 9px;
  }

  .workspace-board-focus #leftNav {
    order: 3;
    width: 100%;
    min-width: 0;
  }

  .board-workspace-panel,
  .workspace-board-focus .workspace-board-only > .board-stage {
    width: 100%;
    max-width: none;
  }

  .workspace-board-focus .workspace-board-only > .board-stage,
  .board-stage {
    margin: 0;
    padding: 5px;
    border-radius: 11px;
  }

  .board-stage > #board.goban,
  .workspace-board-focus .workspace-board-only > .board-stage > #board.goban {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    touch-action: manipulation;
  }

  .board-workspace-panel .board-stage > #board.goban.coordinates-active {
    width: calc(100% - 20px) !important;
    margin-top: 18px !important;
    margin-right: 0 !important;
    margin-left: 18px !important;
    left: 0;
  }

  .workspace-right-fixed,
  .workspace-right-rail {
    border-radius: 11px;
  }

  .workspace-right-fixed {
    gap: 7px;
    padding: 8px;
  }

  .workspace-right-fixed .board-workspace-header {
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 6px 8px !important;
    padding: 7px !important;
  }

  .workspace-right-fixed .board-workspace-header .board-view-toggles {
    grid-column: 1 / -1;
    width: 100%;
  }

  .workspace-right-fixed .move-controls {
    position: fixed;
    z-index: 130;
    right: 8px;
    bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom) + 5px);
    left: 8px;
    display: grid !important;
    grid-template-columns: 44px minmax(80px, 1fr) 44px 88px !important;
    width: auto !important;
    margin: 0 !important;
    padding: 6px !important;
    gap: 5px !important;
    border: 1px solid rgba(42, 76, 55, 0.18);
    border-radius: 12px !important;
    box-shadow: 0 8px 26px rgba(30, 51, 38, 0.2) !important;
    backdrop-filter: blur(12px);
    max-width: calc(100vw - 16px) !important;
    min-width: 0 !important;
    overflow: hidden;
  }

  .workspace-right-fixed .move-controls #firstMoveBtn,
  .workspace-right-fixed .move-controls #backFiveMoveBtn,
  .workspace-right-fixed .move-controls #forwardFiveMoveBtn,
  .workspace-right-fixed .move-controls #lastMoveBtn {
    display: none !important;
  }

  .workspace-right-fixed .move-controls #prevMoveBtn,
  .workspace-right-fixed .move-controls #nextMoveBtn {
    display: inline-flex !important;
    min-width: 44px !important;
    min-height: 44px !important;
  }

  .workspace-right-fixed .move-controls .seek-wrapper {
    display: flex !important;
    min-width: 0 !important;
    max-width: 100%;
    height: 44px !important;
    align-items: center;
    padding-top: 0 !important;
    overflow: hidden;
    box-sizing: border-box;
  }

  .workspace-right-fixed .move-controls .seek-wrapper input[type="range"] {
    display: block;
    width: 100% !important;
    max-width: 100%;
    min-width: 0 !important;
    margin: 0 !important;
    box-sizing: border-box;
  }

  .workspace-right-fixed .move-controls #moveNumberLabel {
    width: 88px !important;
    min-width: 88px !important;
    max-width: 88px !important;
    grid-column: auto !important;
    justify-self: stretch !important;
    overflow: hidden;
    box-sizing: border-box;
  }

  .workspace-right-tabs {
    position: sticky;
    top: calc(var(--mobile-header-height) + var(--mobile-top-nav-height) + 4px);
    z-index: 20;
    padding: 6px;
    background: rgba(255, 255, 255, 0.97);
  }

  .workspace-right-tabs button {
    min-height: 42px;
  }

  .workspace-right-panels,
  .workspace-right-tab-panel,
  .analysis-right-stack,
  .result-panel,
  .editor-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  body[data-mode="study"] .workspace-right-fixed #studyPanel.study-panel {
    position: sticky;
    top: calc(var(--mobile-header-height) + var(--mobile-top-nav-height) + 4px);
    z-index: 18;
    border: 1px solid rgba(42, 76, 55, 0.16);
    box-shadow: 0 7px 20px rgba(34, 56, 43, 0.1);
  }

  body[data-mode="study"] .workspace-right-rail[data-workspace-right-layout="flow"] .workspace-right-tab-panel[data-workspace-right-panel="moves"] {
    overflow: visible;
  }

  body[data-page="ai-review"] .analysis-workspace-nav,
  body[data-page="kifu-editor"] .editor-workspace-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
    border-radius: 11px;
  }

  body[data-page="ai-review"] .analysis-workspace-nav > section,
  body[data-page="ai-review"] .analysis-workspace-nav > div,
  body[data-page="kifu-editor"] .editor-workspace-nav > section,
  body[data-page="kifu-editor"] .editor-workspace-nav > div {
    grid-column: 1 / -1;
    min-width: 0;
  }

  body[data-page="ai-review"] .analysis-workspace-nav > button,
  body[data-page="kifu-editor"] .editor-workspace-nav button {
    min-height: 44px;
  }

  .left-nav-history-list {
    max-height: 260px;
    overflow-y: auto;
  }

  .board-tree-panel,
  .game-tree {
    max-width: 100%;
  }

  .board-tree-header {
    gap: 7px;
    padding: 9px;
  }

  .board-tree-toolbar,
  .board-tree-header-actions {
    flex-wrap: wrap;
  }

  /* AI game: full-width board and persistent play controls above bottom nav. */
  .ai-game-page .ai-game-shell,
  .ai-game-page .ai-game-shell[data-phase="playing"],
  .ai-game-page .ai-game-shell[data-phase="suspended"],
  .ai-game-page .ai-game-shell[data-phase="scoring"],
  .ai-game-page .ai-game-shell[data-phase="ended"],
  .ai-game-page .ai-game-shell[data-phase="setup"] {
    width: calc(100vw - 12px);
    max-width: none;
    margin: 6px auto 18px;
    gap: 9px;
  }

  .ai-game-page .ai-game-board-area,
  .ai-game-page .ai-game-left-panel,
  .ai-game-page .ai-game-right-panel {
    width: 100%;
    min-width: 0;
  }

  .ai-game-page .ai-game-board-area {
    padding: 5px;
    border-radius: 11px;
    overflow: hidden;
  }

  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-board-area {
    position: fixed;
    top: calc(var(--mobile-header-height) + var(--mobile-top-nav-height));
    right: 6px;
    left: 6px;
    z-index: 40;
    width: auto;
    margin: 0;
    box-sizing: border-box;
  }

  .ai-game-page .ai-game-board-frame,
  :root[data-board-coordinates="on"] .ai-game-page .ai-game-board-frame {
    width: 100%;
    max-width: none !important;
    padding: 4px;
    border-radius: 9px;
  }

  :root[data-board-coordinates="on"] .ai-game-page .ai-game-board-frame {
    padding: 21px 5px 6px 22px;
  }

  .ai-game-page .ai-game-board.goban {
    width: 100%;
    max-width: 100%;
    touch-action: manipulation;
  }

  .ai-game-page .ai-game-panel {
    padding: 11px;
    border-radius: 11px;
  }

  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-left-toolbar {
    position: fixed;
    z-index: 130;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100vw;
    margin: 0;
    padding: 6px 8px max(6px, env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid rgba(42, 76, 55, 0.18);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 8px 26px rgba(30, 51, 38, 0.2);
    backdrop-filter: blur(12px);
    box-sizing: border-box;
  }

  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-left-toolbar .ai-game-view-controls,
  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-left-toolbar .ai-game-view-seek {
    display: none !important;
  }

  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-left-toolbar .ai-game-play-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .ai-game-page .ai-game-shell[data-phase="playing"][data-mode="study"] .ai-game-left-toolbar .ai-game-play-controls {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .ai-game-page .ai-game-shell[data-phase="playing"] {
    padding-top: calc(100vw - 3px);
    padding-bottom: calc(62px + env(safe-area-inset-bottom));
  }

  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-left-toolbar button {
    min-height: 44px;
  }

  .ai-game-page .ai-game-left-toolbar,
  .ai-game-page .ai-game-view-controls,
  .ai-game-page .ai-game-view-seek,
  .ai-game-page .ai-game-play-controls {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .ai-game-page .ai-game-view-seek {
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    overflow: hidden;
  }

  .ai-game-page .ai-game-view-seek input[type="range"] {
    display: block;
    width: 100% !important;
    max-width: 100%;
    min-width: 0 !important;
    margin: 0;
    box-sizing: border-box;
  }

  .ai-game-page .ai-game-view-seek label,
  .ai-game-page .ai-game-view-seek output {
    min-width: 0 !important;
    max-width: 84px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  :is(.workspace-right-fixed, .board-workspace-panel) > .move-controls {
    position: fixed;
    z-index: 130;
    right: 8px;
    bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom) + 5px);
    left: 8px;
    display: grid !important;
    grid-template-columns: 44px minmax(0, 1fr) 44px 88px !important;
    width: auto !important;
    max-width: calc(100vw - 16px) !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 6px !important;
    gap: 5px !important;
    overflow: hidden;
    box-sizing: border-box !important;
  }

  :is(.workspace-right-fixed, .board-workspace-panel) > .move-controls #firstMoveBtn,
  :is(.workspace-right-fixed, .board-workspace-panel) > .move-controls #backFiveMoveBtn,
  :is(.workspace-right-fixed, .board-workspace-panel) > .move-controls #forwardFiveMoveBtn,
  :is(.workspace-right-fixed, .board-workspace-panel) > .move-controls #lastMoveBtn {
    display: none !important;
  }

  :is(.workspace-right-fixed, .board-workspace-panel) > .move-controls .seek-wrapper {
    display: flex !important;
    width: 100%;
    max-width: 100%;
    min-width: 0 !important;
    height: 44px !important;
    align-items: center;
    padding-top: 0 !important;
    overflow: hidden;
    box-sizing: border-box;
  }

  :is(.workspace-right-fixed, .board-workspace-panel) > .move-controls .seek-wrapper input[type="range"] {
    display: block;
    width: 100% !important;
    max-width: 100%;
    min-width: 0 !important;
    margin: 0 !important;
  }

  :is(.workspace-right-fixed, .board-workspace-panel) > .move-controls .move-number-jump {
    width: 88px !important;
    max-width: 88px !important;
    min-width: 0 !important;
    grid-column: auto !important;
    justify-self: stretch !important;
    overflow: hidden;
    box-sizing: border-box;
  }

  .ai-game-page .ai-game-mode-grid,
  .ai-game-page .ai-game-ai-vs-ai-settings,
  .ai-game-page .ai-game-match-players,
  .ai-game-page .ai-game-study-actions {
    grid-template-columns: 1fr;
  }

  .ai-game-page .ai-game-voice-actions {
    gap: 7px;
  }

  .ai-game-page .ai-game-study-actions button {
    min-height: 44px;
  }

  /* QA, history and settings: remove fixed desktop widths and stack forms/cards. */
  .qa-page-content,
  .qa-question-page,
  .qk-shell,
  .mp-body,
  .mp-layout {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .qa-page-content,
  .qa-question-page,
  .qk-shell {
    padding-right: 10px;
    padding-left: 10px;
  }

  .qa-home-layout,
  .qa-answer-compose-grid,
  .qk-layout,
  .qk-editor-grid,
  .mp-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px;
  }

  .qa-entry-panel,
  .qa-question-card,
  .qa-answer-form,
  .qk-card,
  .mp-card {
    max-width: 100%;
    min-width: 0;
    padding: 14px;
    border-radius: 12px;
    box-sizing: border-box;
  }

  .qa-entry-tools,
  .qa-entry-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    gap: 8px;
  }

  .qa-entry-action,
  .qa-entry-search,
  .qa-answer-form button,
  .qk-shell button,
  .mp-mobile-tabs button {
    min-height: 44px;
  }

  .qa-board,
  .qk-shell .qa-board,
  .qa-answer-form .qa-board {
    width: var(--qa-rendered-board-size, 100%) !important;
    max-width: calc(100vw - 32px) !important;
    height: auto;
    aspect-ratio: 1;
    touch-action: manipulation;
  }

  /* All mobile seekbars must be allowed to shrink below their browser intrinsic width. */
  input[type="range"] {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-inline: 0;
    box-sizing: border-box;
  }

  .qk-move-nav {
    display: grid;
    grid-template-columns: 36px 36px minmax(0, 1fr) 36px 36px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    gap: 5px;
    overflow: hidden;
    box-sizing: border-box;
  }

  .qk-move-nav > .qk-nav-btn {
    width: 36px;
    min-width: 0;
    max-width: 36px;
  }

  .qk-move-nav > .qk-move-slider {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    align-self: center;
  }

  .mp-mobile-tabs {
    position: sticky;
    top: calc(var(--mobile-header-height) + var(--mobile-top-nav-height));
    z-index: 20;
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    background: rgba(255, 255, 255, 0.97);
  }

  .mp-mobile-tabs::-webkit-scrollbar {
    display: none;
  }

  .mp-mobile-tabs .mp-tab-btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

/* AI game mobile menu: keep the board primary and expose supporting panels from the header. */
.ai-game-page .ai-game-mobile-accordion-toggle {
  display: none;
}

@media (max-width: 700px) {
  body.ai-game-mobile-menu-enabled .site-header .site-header-menu-button {
    display: flex !important;
    flex: 0 0 40px;
    order: 2;
  }

  body.ai-game-mobile-menu-enabled .site-header .qa-topnav-nav {
    display: none !important;
  }

  .ai-game-mobile-menu-body .ai-game-mobile-menu-link:not([hidden]) {
    display: flex;
    width: 100%;
    min-height: 44px;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid rgba(42, 76, 55, 0.14);
    border-radius: 9px;
    background: #fff;
    color: #2d4d39;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    text-align: left;
  }

  .ai-game-mobile-menu-body .ai-game-mobile-menu-link:not([hidden])::after {
    content: "→";
    color: #6d8977;
  }

  .ai-game-page .ai-game-mobile-collapsible > .ai-game-mobile-accordion-header {
    position: relative;
    min-height: 36px;
    padding-right: 42px !important;
    cursor: pointer;
  }

  .ai-game-page .ai-game-mobile-collapsible > .ai-game-mobile-accordion-header > .ai-game-mobile-accordion-toggle {
    position: absolute;
    top: 50%;
    right: 0;
    display: inline-flex;
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    transform: translateY(-50%);
    border: 1px solid rgba(42, 76, 55, 0.16);
    border-radius: 9px;
    background: #f7faf7;
    color: #315e42;
    font-size: 16px;
    line-height: 1;
  }

  .ai-game-page .ai-game-mobile-collapsible.is-mobile-collapsed > .ai-game-mobile-accordion-header {
    margin-bottom: 0 !important;
  }

  .ai-game-page .ai-game-mobile-collapsible.is-mobile-collapsed > :not(.ai-game-mobile-accordion-header) {
    display: none !important;
  }
}

@media (max-width: 390px) {
  .mobile-bottom-nav a {
    font-size: 8.5px;
  }

  .mobile-bottom-nav a svg {
    width: 17px;
    height: 17px;
  }

  .qk-move-nav {
    grid-template-columns: 32px 32px minmax(0, 1fr) 32px 32px;
    gap: 4px;
  }

  .qk-move-nav > .qk-nav-btn {
    width: 32px;
    max-width: 32px;
  }

  .workspace-right-fixed .move-controls {
    grid-template-columns: 42px minmax(64px, 1fr) 42px 80px !important;
  }

  .workspace-right-fixed .move-controls #moveNumberLabel {
    width: 80px !important;
    min-width: 80px !important;
    font-size: 9px !important;
  }

  :is(.workspace-right-fixed, .board-workspace-panel) > .move-controls {
    grid-template-columns: 42px minmax(0, 1fr) 42px 80px !important;
  }

  :is(.workspace-right-fixed, .board-workspace-panel) > .move-controls .move-number-jump {
    width: 80px !important;
    max-width: 80px !important;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .board-stage > #board.goban,
  .ai-game-page .ai-game-board-frame {
    width: min(100%, calc(100dvh - 126px)) !important;
    margin-inline: auto !important;
  }
}

/* Final mobile inline-size guard: keep relocated controls tied to the viewport. */
@media (max-width: 700px) {
  html,
  body.has-mobile-bottom-nav {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body.has-mobile-bottom-nav .app-shell,
  body.has-mobile-bottom-nav .workspace,
  body.has-mobile-bottom-nav .main-grid,
  body.has-mobile-bottom-nav .main-grid > *,
  body.has-mobile-bottom-nav .workspace-right-fixed,
  body.has-mobile-bottom-nav .workspace-right-rail,
  body.has-mobile-bottom-nav .workspace-right-panels,
  body.has-mobile-bottom-nav .workspace-right-tab-panel,
  body.has-mobile-bottom-nav .qk-shell,
  body.has-mobile-bottom-nav .qk-card,
  body.has-mobile-bottom-nav .qa-page-content,
  body.has-mobile-bottom-nav .qa-question-page {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  body.has-mobile-bottom-nav :is(.workspace-right-fixed, .board-workspace-panel) > .move-controls {
    right: auto !important;
    left: 50% !important;
    width: calc(100vw - 16px) !important;
    max-width: 520px !important;
    transform: translateX(-50%);
    box-sizing: border-box !important;
  }

  body.has-mobile-bottom-nav :is(.workspace-right-fixed, .board-workspace-panel) > .move-controls > *,
  body.has-mobile-bottom-nav .qk-move-nav > *,
  body.has-mobile-bottom-nav .ai-game-view-seek > * {
    min-width: 0;
  }

  body.has-mobile-bottom-nav .move-number-jump input {
    min-width: 0;
    max-width: 38px;
  }
}

/* =====================================================================
   Two-row seek controls v20260803
   Keep navigation compact and reserve the full lower row for scrubbing.
   ===================================================================== */
@media (min-width: 701px) {
  .workspace-right-fixed > .move-controls,
  body.workspace-board-focus .workspace-right-fixed > .move-controls {
    grid-template-columns: repeat(3, 34px) minmax(88px, 1fr) repeat(3, 34px) !important;
    grid-template-rows: 34px 38px;
    gap: 5px !important;
  }

  .workspace-right-fixed > .move-controls #firstMoveBtn {
    grid-column: 1;
    grid-row: 1;
  }

  .workspace-right-fixed > .move-controls #backFiveMoveBtn {
    grid-column: 2;
    grid-row: 1;
  }

  .workspace-right-fixed > .move-controls #prevMoveBtn {
    grid-column: 3;
    grid-row: 1;
  }

  .workspace-right-fixed > .move-controls #nextMoveBtn {
    grid-column: 5;
    grid-row: 1;
  }

  .workspace-right-fixed > .move-controls #forwardFiveMoveBtn {
    grid-column: 6;
    grid-row: 1;
  }

  .workspace-right-fixed > .move-controls #lastMoveBtn {
    grid-column: 7;
    grid-row: 1;
  }

  .workspace-right-fixed > .move-controls .move-number-jump,
  .workspace-right-fixed > .move-controls #moveNumberLabel,
  body.workspace-board-focus .workspace-right-fixed > .move-controls .move-number-jump,
  body.workspace-board-focus .workspace-right-fixed > .move-controls #moveNumberLabel {
    width: auto !important;
    min-width: 88px !important;
    max-width: 100% !important;
    grid-column: 4 !important;
    grid-row: 1;
    justify-self: stretch !important;
    overflow: hidden;
    box-sizing: border-box;
  }

  .workspace-right-fixed > .move-controls > button,
  body.workspace-board-focus .workspace-right-fixed > .move-controls > button {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .workspace-right-fixed > .move-controls .seek-wrapper,
  body.workspace-board-focus .workspace-right-fixed > .move-controls .seek-wrapper {
    width: calc(100% - 16px) !important;
    max-width: calc(100% - 16px) !important;
    min-width: 0;
    height: 38px !important;
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
    padding: 0 !important;
    overflow: hidden;
    box-sizing: border-box;
  }
}

/* =====================================================================
   Mobile board-first tools drawer v20260803
   Keep the board, position evaluation and move navigation visible.
   ===================================================================== */
.workspace-mobile-evaluation,
.workspace-mobile-editor-actions,
.workspace-mobile-study-actions,
.workspace-mobile-menu,
.workspace-mobile-menu-backdrop {
  display: none;
}

@media (orientation: portrait) and (max-width: 1439px) {
  body.workspace-mobile-minimal {
    --mobile-page-gutter: 4px;
  }

  body.workspace-mobile-minimal .app-shell {
    padding: 2px 0 8px;
  }

  body.workspace-mobile-minimal .main-grid {
    gap: 4px !important;
  }

  body.workspace-mobile-minimal .board-workspace-panel > .board-stage {
    padding: 2px;
    border-radius: 8px;
  }

  body.workspace-mobile-minimal .site-header .site-header-menu-button {
    display: flex !important;
    flex: 0 0 40px;
    order: 2;
  }

  body.workspace-mobile-minimal .site-header .qa-topnav-nav {
    display: none !important;
  }

  body.workspace-mobile-menu-open {
    overflow: hidden !important;
  }

  .workspace-mobile-menu-backdrop {
    position: fixed;
    z-index: 238;
    top: calc(var(--mobile-header-height, 48px) + var(--mobile-top-nav-height, 44px));
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: auto;
    padding: 0;
    border: 0;
    background: rgba(18, 31, 23, 0.38);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
  }

  .workspace-mobile-menu {
    position: fixed;
    z-index: 239;
    top: calc(var(--mobile-header-height, 48px) + var(--mobile-top-nav-height, 44px));
    right: 0;
    bottom: 0;
    display: flex;
    width: min(92vw, 420px);
    max-width: calc(100vw - 24px);
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
    color: #25392c;
    background: #f8faf7;
    border-left: 1px solid rgba(42, 76, 55, 0.16);
    box-shadow: -12px 0 34px rgba(24, 42, 30, 0.2);
    transform: translateX(104%);
    pointer-events: none;
    transition: transform 0.2s ease;
    box-sizing: border-box;
  }

  .site-header.is-menu-open .workspace-mobile-menu-backdrop {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  .site-header.is-menu-open .workspace-mobile-menu {
    transform: translateX(0);
    pointer-events: auto;
  }

  .workspace-mobile-menu-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
    padding: 12px 14px;
    background: #fff;
    border-bottom: 1px solid rgba(42, 76, 55, 0.12);
  }

  .workspace-mobile-menu-heading > span {
    grid-column: 1;
    color: #789081;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: 0.16em;
  }

  .workspace-mobile-menu-heading > strong {
    grid-column: 1;
    font-size: 15px;
  }

  .workspace-mobile-menu-heading > small {
    grid-column: 1;
    grid-row: auto;
    color: #718076;
    font-size: 9px;
  }

  .workspace-mobile-menu-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-auto-flow: row;
    grid-auto-columns: minmax(0, 1fr);
    min-height: 0;
    flex: 1 1 auto;
    align-content: start;
    gap: 9px;
    padding: 9px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    box-sizing: border-box;
  }

  .workspace-mobile-menu-body > *,
  .workspace-mobile-menu-body .workspace-right-rail,
  .workspace-mobile-menu-body .workspace-right-panels,
  .workspace-mobile-menu-body .workspace-right-tab-panel,
  .workspace-mobile-menu-body .analysis-right-stack,
  .workspace-mobile-menu-body #leftNav {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    box-sizing: border-box;
  }

  .workspace-mobile-menu-body > * {
    grid-column: 1 !important;
    grid-row: auto !important;
  }

  .workspace-mobile-menu-body .workspace-right-tabs {
    position: sticky !important;
    z-index: 2;
    top: -9px !important;
  }

  .workspace-mobile-menu-body .board-workspace-header,
  .workspace-mobile-menu-body .board-workspace-feedback,
  .workspace-mobile-menu-body .analysis-qa-section,
  .workspace-mobile-menu-body #studyPanel.study-panel {
    display: grid;
    margin: 0 !important;
    box-shadow: none !important;
  }

  .workspace-mobile-menu-body :is(
    .board-view-toggles,
    .workspace-right-tabs,
    .study-edit-actions,
    .study-save-actions,
    .analysis-file-actions,
    .editor-start-actions,
    .editor-left-file-actions,
    .editor-left-tools
  ) {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch !important;
  }

  .workspace-mobile-menu-body :is(
    .board-view-toggles,
    .workspace-right-tabs,
    .study-edit-actions,
    .study-save-actions,
    .analysis-file-actions,
    .editor-start-actions,
    .editor-left-file-actions,
    .editor-left-tools
  ) > * {
    grid-column: 1 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
  }

  .workspace-mobile-menu-body #studySaveLocalBtn {
    display: none !important;
  }

  body.workspace-mobile-minimal #workspaceMobileMenu .workspace-right-tabs[hidden] {
    display: none !important;
  }

  body[data-mode="study"].workspace-mobile-minimal #workspaceMobileMenu .analysis-page-only,
  body[data-mode="analysis"].workspace-mobile-minimal #workspaceMobileMenu .study-page-only {
    display: none !important;
  }

  .workspace-mobile-menu-body :is(
    #leftNav.analysis-workspace-nav,
    #leftNav.editor-workspace-nav,
    [role="group"],
    .analysis-mode-switch,
    .study-start-actions,
    .editor-quick-actions-grid,
    .editor-actions,
    .diagram-selection-actions
  ) {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch !important;
  }

  .workspace-mobile-menu-body :is(
    #leftNav.analysis-workspace-nav,
    #leftNav.editor-workspace-nav,
    [role="group"],
    .analysis-mode-switch,
    .study-start-actions,
    .editor-quick-actions-grid,
    .editor-actions,
    .diagram-selection-actions
  ) > * {
    grid-column: 1 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
  }

  body.workspace-mobile-minimal .workspace-mobile-evaluation {
    display: block;
    width: 100%;
    margin: 2px 0 3px;
  }

  body.workspace-mobile-minimal .workspace-mobile-evaluation:empty {
    display: none;
  }

  body[data-mode="study"].workspace-mobile-minimal .workspace-mobile-study-actions {
    display: block;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0 4px 4px;
    box-sizing: border-box;
  }

  body[data-mode="study"].workspace-mobile-minimal .workspace-mobile-study-actions .study-edit-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px;
    width: 100%;
    margin: 0;
  }

  body[data-mode="study"].workspace-mobile-minimal .workspace-mobile-study-actions .study-btn-secondary {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 38px;
    justify-content: center;
    gap: 6px;
    padding: 7px 9px;
    box-sizing: border-box;
  }

  body[data-mode="study"].workspace-mobile-minimal .workspace-mobile-study-actions .study-btn-secondary svg {
    width: 16px;
    height: 16px;
  }

  body.workspace-mobile-minimal .workspace-mobile-evaluation .winrate-bar-panel.analysis-study-section {
    display: grid !important;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: center;
    width: 100% !important;
    min-width: 0;
    gap: 4px 7px !important;
    margin: 0 !important;
    padding: 4px 6px !important;
    border: 1px solid rgba(42, 76, 55, 0.14);
    border-radius: 8px;
    background: #fff;
    box-shadow: none !important;
    box-sizing: border-box;
    visibility: visible !important;
  }

  .workspace-mobile-evaluation .study-result-heading {
    display: none !important;
  }

  .workspace-mobile-evaluation .study-result-heading > div > span,
  .workspace-mobile-evaluation .study-result-heading > small,
  .workspace-mobile-evaluation .winrate-complexity-row {
    display: none !important;
  }

  .workspace-mobile-evaluation .study-result-heading strong {
    font-size: 11px !important;
  }

  .workspace-mobile-evaluation .bar-score {
    grid-column: 1;
    margin: 0 !important;
  }

  .workspace-mobile-evaluation .bar-score-main {
    font-size: 17px !important;
    line-height: 1.15;
  }

  .workspace-mobile-evaluation .winrate-bar-row {
    grid-column: 2;
    grid-template-columns: max-content minmax(52px, 1fr) max-content !important;
    gap: 4px !important;
  }

  .workspace-mobile-evaluation .winrate-stone-label {
    gap: 2px !important;
    font-size: 10px !important;
  }

  .workspace-mobile-evaluation .winrate-stone-label strong {
    font-size: 11px !important;
  }

  .workspace-mobile-evaluation .winrate-stone {
    width: 13px !important;
    height: 13px !important;
    flex-basis: 13px !important;
  }

  /* スマホの盤上候補値は交点内に収め、周囲の石や別候補を隠さない。 */
  body:is([data-mode="study"], [data-mode="analysis"]) #board.goban > .candidate .candidate-metrics {
    width: 108%;
    row-gap: 0;
  }

  body:is([data-mode="study"], [data-mode="analysis"]) #board.goban > .candidate .candidate-score {
    width: 112%;
    font-size: clamp(7px, 34cqi, 9px);
    letter-spacing: 0;
    line-height: 1;
  }

  body:is([data-mode="study"], [data-mode="analysis"]) #board.goban > .candidate .candidate-score.candidate-score-wide {
    width: 105%;
    font-size: clamp(6px, 27cqi, 8px);
  }

  body:is([data-mode="study"], [data-mode="analysis"]) #board.goban > .candidate .candidate-score.candidate-score-extra-wide {
    width: 102%;
    font-size: clamp(5px, 23cqi, 7px);
  }

  body:is([data-mode="study"], [data-mode="analysis"]) #board.goban > .candidate .candidate-winrate {
    width: 108%;
    font-size: clamp(5px, 22cqi, 6px);
    letter-spacing: 0;
    line-height: 1;
    transform: none;
  }

  body.workspace-mobile-minimal .side-panel[data-board-focus-ready="true"] {
    width: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 0 !important;
    overflow: visible !important;
  }

  body.workspace-mobile-minimal .side-panel[data-board-focus-ready="true"] > .workspace-right-fixed {
    width: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }
}

@media (orientation: portrait) and (max-width: 1439px) {
  body.has-mobile-bottom-nav.workspace-board-focus {
    padding-bottom: calc(env(safe-area-inset-bottom) + 8px);
  }

  body.has-mobile-bottom-nav :is(.workspace-right-fixed, .board-workspace-panel) > .move-controls {
    grid-template-columns: 44px 44px minmax(88px, 1fr) !important;
    grid-template-rows: 44px 38px;
    gap: 4px 6px !important;
  }

  body.has-mobile-bottom-nav :is(.workspace-right-fixed, .board-workspace-panel) > .move-controls #prevMoveBtn {
    grid-column: 1;
    grid-row: 1;
  }

  body.has-mobile-bottom-nav :is(.workspace-right-fixed, .board-workspace-panel) > .move-controls #nextMoveBtn {
    grid-column: 2;
    grid-row: 1;
  }

  body.has-mobile-bottom-nav :is(.workspace-right-fixed, .board-workspace-panel) > .move-controls .move-number-jump,
  body.has-mobile-bottom-nav :is(.workspace-right-fixed, .board-workspace-panel) > .move-controls #moveNumberLabel {
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    grid-column: 3 !important;
    grid-row: 1;
    justify-self: stretch !important;
  }

  body.has-mobile-bottom-nav :is(.workspace-right-fixed, .board-workspace-panel) > .move-controls .seek-wrapper {
    width: calc(100% - 16px) !important;
    max-width: calc(100% - 16px) !important;
    min-width: 0 !important;
    height: 38px !important;
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
    padding: 0 !important;
    overflow: hidden;
    box-sizing: border-box;
  }

  body.has-mobile-bottom-nav .qk-move-nav {
    grid-template-columns: repeat(4, minmax(32px, 1fr));
    grid-template-rows: 40px 36px;
    gap: 5px;
  }

  body.has-mobile-bottom-nav .qk-move-nav > .qk-nav-btn {
    width: 36px;
    max-width: 36px;
    justify-self: center;
  }

  body.has-mobile-bottom-nav .qk-move-nav > .qk-move-slider {
    width: calc(100% - 16px) !important;
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
  }

  body.has-mobile-bottom-nav .ai-game-view-seek {
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-rows: auto 38px;
    gap: 4px 8px;
  }

  body.has-mobile-bottom-nav .ai-game-view-seek label {
    grid-column: 1;
    grid-row: 1;
  }

  body.has-mobile-bottom-nav .ai-game-view-seek output {
    grid-column: 2 !important;
    grid-row: 1;
    justify-self: end;
  }

  body.has-mobile-bottom-nav .ai-game-view-seek input[type="range"] {
    width: calc(100% - 16px) !important;
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
  }
}

/* =====================================================================
   Mobile step navigation containment v20260803
   Keep every navigation button inside its own shrinkable grid track.
   ===================================================================== */
@media (orientation: portrait) and (max-width: 1439px) {
  body.has-mobile-bottom-nav :is(.workspace-right-fixed, .board-workspace-panel) > .move-controls > button {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding-inline: 0 !important;
    overflow: hidden;
    box-sizing: border-box;
  }

  body.has-mobile-bottom-nav :is(.workspace-right-fixed, .board-workspace-panel) > .move-controls .move-number-jump {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    overflow: hidden;
  }

  body.has-mobile-bottom-nav :is(.workspace-right-fixed, .board-workspace-panel) > .move-controls .move-number-jump > * {
    min-width: 0;
  }

  body.has-mobile-bottom-nav .qk-move-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: hidden;
  }

  body.has-mobile-bottom-nav .qk-move-nav > .qk-nav-btn {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding-inline: 0;
    overflow: hidden;
    box-sizing: border-box;
  }

  body.has-mobile-bottom-nav .ai-game-view-controls {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    box-sizing: border-box;
  }

  body.has-mobile-bottom-nav .ai-game-view-controls > button {
    width: 100%;
    max-width: 100%;
    min-width: 0 !important;
    padding-inline: 4px !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-sizing: border-box;
  }

  body.has-mobile-bottom-nav .ai-game-view-controls > output {
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Navigation glyph alignment and range edge guard v20260803 */
:is(.workspace-right-fixed, .board-workspace-panel) > .move-controls > button,
.qk-move-nav > .qk-nav-btn,
.ai-game-page .ai-game-view-controls > button {
  align-items: center;
  justify-content: center;
  text-align: center;
}

:is(.workspace-right-fixed, .board-workspace-panel) > .move-controls > button,
.qk-move-nav > .qk-nav-btn {
  display: grid !important;
  place-items: center;
}

.ai-game-page .ai-game-view-controls > button {
  display: inline-flex;
}

:is(.workspace-right-fixed, .board-workspace-panel) > .move-controls > button svg,
.qk-move-nav > .qk-nav-btn svg {
  margin: auto;
}

:is(.workspace-right-fixed, .board-workspace-panel) > .move-controls .seek-wrapper > input[type="range"] {
  display: block;
  width: 100% !important;
  max-width: 100%;
  min-width: 0 !important;
  margin: 0 !important;
  box-sizing: border-box;
}

/* Center the complete current/maximum move display inside the navigation frame. */
:is(.workspace-right-fixed, .board-workspace-panel) > .move-controls .move-number-jump {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
}

@media (orientation: portrait) and (max-width: 1439px) {
  body.workspace-mobile-minimal .board-workspace-panel > .move-controls {
    position: static;
    z-index: 1;
    right: auto !important;
    bottom: auto;
    left: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    grid-template-columns: 38px minmax(0, 1fr) 38px !important;
    grid-template-rows: 38px 30px;
    gap: 2px 4px !important;
    margin: 3px 0 0 !important;
    padding: 4px !important;
    overflow: hidden;
    transform: none !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
  }

  body.workspace-mobile-minimal .board-workspace-panel > .move-controls #firstMoveBtn,
  body.workspace-mobile-minimal .board-workspace-panel > .move-controls #backFiveMoveBtn,
  body.workspace-mobile-minimal .board-workspace-panel > .move-controls #forwardFiveMoveBtn,
  body.workspace-mobile-minimal .board-workspace-panel > .move-controls #lastMoveBtn {
    display: none !important;
  }

  body.workspace-mobile-minimal .board-workspace-panel > .move-controls #prevMoveBtn {
    display: grid !important;
    grid-column: 1;
    grid-row: 1;
  }

  body.workspace-mobile-minimal .board-workspace-panel > .move-controls .move-number-jump,
  body.workspace-mobile-minimal .board-workspace-panel > .move-controls #moveNumberLabel {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    grid-column: 2 !important;
    grid-row: 1;
    justify-self: stretch !important;
    overflow: hidden;
    box-sizing: border-box;
  }

  body.workspace-mobile-minimal .board-workspace-panel > .move-controls #nextMoveBtn {
    display: grid !important;
    grid-column: 3;
    grid-row: 1;
  }

  body.workspace-mobile-minimal .board-workspace-panel > .move-controls #prevMoveBtn,
  body.workspace-mobile-minimal .board-workspace-panel > .move-controls #nextMoveBtn {
    width: 38px !important;
    max-width: 38px !important;
    min-height: 38px !important;
    height: 38px !important;
    min-width: 0 !important;
    padding: 0 !important;
    place-items: center;
    box-sizing: border-box;
  }

  body.workspace-mobile-minimal .board-workspace-panel > .move-controls .seek-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 30px !important;
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: stretch;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    box-sizing: border-box;
  }
}

/* Free-study mobile drawer: keep every command group in one vertical column. */
@media (orientation: portrait) and (max-width: 1439px) {
  body[data-mode="study"].workspace-mobile-minimal .workspace-mobile-menu-body #leftNav.analysis-workspace-nav,
  body[data-mode="study"].workspace-mobile-minimal .workspace-mobile-menu-body .study-left-tools,
  body[data-mode="study"].workspace-mobile-minimal .workspace-mobile-menu-body .study-start-actions,
  body[data-mode="study"].workspace-mobile-minimal .workspace-mobile-menu-body .study-edit-actions,
  body[data-mode="study"].workspace-mobile-minimal .workspace-mobile-menu-body .study-save-actions,
  body[data-mode="study"].workspace-mobile-minimal .workspace-mobile-menu-body .study-new-game-grid,
  body[data-mode="study"].workspace-mobile-minimal .workspace-mobile-menu-body .study-new-game-actions,
  body[data-mode="study"].workspace-mobile-minimal .workspace-mobile-menu-body .study-workspace-tools {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  body[data-mode="study"].workspace-mobile-minimal .workspace-mobile-menu-body :is(
    .study-start-actions,
    .study-edit-actions,
    .study-save-actions,
    .study-new-game-actions
  ) > * {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    grid-column: 1 !important;
    box-sizing: border-box;
  }

  body[data-mode="study"].workspace-mobile-minimal .workspace-mobile-menu-body .study-start-actions button {
    min-height: 40px;
    grid-template-columns: 20px minmax(0, 1fr) !important;
    grid-template-rows: none !important;
    justify-items: start;
    padding-inline: 10px !important;
    text-align: left;
  }
}

/* Kifu editor mobile drawer: tool tabs scroll with their panel instead of floating over content. */
@media (orientation: portrait) and (max-width: 1439px) {
  body[data-mode="editor"].workspace-mobile-minimal .workspace-mobile-menu-body #editorPanel .editor-tool-tabs {
    position: static !important;
    top: auto !important;
    z-index: auto !important;
  }
}

/* Kifu editor mobile surface: replace position evaluation with common edit actions. */
@media (orientation: portrait) and (max-width: 1439px) {
  body[data-mode="editor"].workspace-mobile-minimal .workspace-mobile-evaluation {
    display: none !important;
  }

  body[data-mode="editor"].workspace-mobile-minimal .workspace-mobile-editor-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    min-width: 0;
    gap: 4px;
    margin: 2px 0 3px;
    padding: 0 2px;
    box-sizing: border-box;
  }

  body[data-mode="editor"].workspace-mobile-minimal .workspace-mobile-editor-actions > button {
    display: flex !important;
    min-width: 0 !important;
    min-height: 38px !important;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 4px 3px !important;
    color: #315541 !important;
    background: #fff !important;
    border: 1px solid rgba(42, 76, 55, 0.14) !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    font-size: 10px !important;
    font-weight: 800 !important;
    line-height: 1.2;
    white-space: normal;
    box-sizing: border-box;
  }

  body[data-mode="editor"].workspace-mobile-minimal .workspace-mobile-editor-actions > button:disabled {
    opacity: 0.38;
  }

  body[data-mode="editor"].workspace-mobile-minimal .workspace-mobile-editor-actions svg {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
  }

  body[data-mode="editor"].workspace-mobile-minimal .workspace-mobile-editor-actions .editor-quick-action-icon {
    display: inline-flex;
    flex: 0 0 auto;
  }

  body[data-mode="editor"].workspace-mobile-minimal .workspace-mobile-editor-actions .editor-quick-action-copy {
    display: inline-flex;
    min-width: 0;
    align-items: center;
  }

  body[data-mode="editor"].workspace-mobile-minimal .workspace-mobile-editor-actions .editor-quick-action-copy strong {
    font-size: 10px;
    line-height: 1.2;
  }

  body[data-mode="editor"].workspace-mobile-minimal .workspace-mobile-editor-actions .editor-quick-action-copy small {
    display: none;
  }
}

/* Mobile surfaces keep local persistence active without repeating save-state copy. */
@media (max-width: 700px) {
  .floating-save-status,
  body[data-mode="editor"] .editor-current-save-state,
  body[data-mode="editor"] .editor-left-autosave,
  body[data-mode="editor"] #editorPanel .editor-toolbox-autosave,
  body[data-mode="study"] .study-settings-autosave-copy,
  .mp-device-save-badge,
  .mobile-browser-save-copy,
  .ai-game-mobile-save-copy,
  .ai-game-result-save-row {
    display: none !important;
  }
}

/* Logged-out landing: keep login visible beside the shared mobile hamburger. */
@media (max-width: 700px) {
  .site-header[data-site-context="guest"] .qa-topnav-nav {
    display: none !important;
  }

  .site-header[data-site-context="guest"] .qa-topnav-right {
    display: flex !important;
    min-width: 0;
    margin-left: auto;
  }

  .site-header[data-site-context="guest"] .guest-login-link {
    display: inline-flex !important;
    min-width: 72px;
    min-height: 36px;
    padding: 0 14px;
    white-space: nowrap;
  }
}

/* Restored five-item smartphone navigation below the shared header. */
@media (max-width: 700px) {
  .site-header.is-menu-open {
    z-index: 260;
  }
}

/* AI game mobile direct setup screen and fixed start action. */
.ai-game-page .ai-game-mobile-lobby-panel,
.ai-game-page .ai-game-setup-close,
.ai-game-page .ai-game-mobile-setup-hero,
.ai-game-page .ai-game-character-preset-details {
  display: none;
}

@media (max-width: 1439px) and (orientation: portrait) {
  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open {
    overflow-x: hidden;
    overflow-y: auto;
  }

  body.ai-game-page:not(.ai-teaching-game-page) .ai-game-shell[data-phase="setup"] {
    display: block;
    width: 100%;
    margin: 0 auto;
    padding: 0;
  }

  body.ai-game-page:not(.ai-teaching-game-page) .ai-game-shell[data-phase="setup"] .ai-game-left-panel {
    display: block;
    width: 100%;
    min-width: 0;
  }

  body.ai-game-page:not(.ai-teaching-game-page) .ai-game-shell[data-phase="setup"] .ai-game-board-area,
  body.ai-game-page:not(.ai-teaching-game-page) .ai-game-shell[data-phase="setup"] .ai-game-right-panel,
  body.ai-game-page:not(.ai-teaching-game-page) .ai-game-shell[data-phase="setup"] .ai-game-mobile-lobby-panel,
  body.ai-game-page:not(.ai-teaching-game-page) .ai-game-shell[data-phase="setup"] .ai-game-saved-panel {
    display: none !important;
  }

  body.ai-game-page:not(.ai-teaching-game-page) .ai-game-shell[data-phase="setup"] .ai-game-left-panel > :not(.ai-game-mobile-lobby-panel):not(.ai-game-setup-panel):not(.ai-game-saved-panel) {
    display: none !important;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-shell[data-phase="setup"] .ai-game-setup-panel {
    position: static;
    display: block !important;
    width: 100%;
    max-width: none;
    height: auto;
    max-height: none;
    padding: 0 12px calc(116px + env(safe-area-inset-bottom));
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    box-sizing: border-box;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-setup-panel > header {
    display: none;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-mobile-setup-hero {
    position: relative;
    display: block;
    min-height: 164px;
    margin: 10px 0 12px;
    overflow: hidden;
    border: 1px solid rgba(237, 173, 177, 0.86);
    border-radius: 20px;
    background:
      radial-gradient(circle at 90% 20%, rgba(255, 190, 200, 0.4) 0 24px, transparent 25px),
      linear-gradient(135deg, rgba(255, 250, 249, 0.98), rgba(255, 233, 236, 0.93));
    box-shadow: 0 8px 20px rgba(168, 91, 96, 0.1);
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-mobile-setup-hero::before,
  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-mobile-setup-hero::after {
    position: absolute;
    z-index: 0;
    color: rgba(237, 118, 135, 0.48);
    font-size: 24px;
    line-height: 1;
    content: "✿";
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-mobile-setup-hero::before {
    top: 11px;
    left: 12px;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-mobile-setup-hero::after {
    right: 10px;
    bottom: 8px;
    font-size: 33px;
    opacity: 0.58;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-mobile-setup-hero-copy {
    position: relative;
    z-index: 2;
    width: 48%;
    padding: 37px 0 22px 22px;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-mobile-setup-hero-copy > span {
    color: #d96270;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.14em;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-mobile-setup-hero-copy h1 {
    margin: 2px 0 8px;
    color: #4f3028;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 29px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: 0.04em;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-mobile-setup-hero-copy p {
    margin: 0;
    color: #71524a;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.75;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-mobile-setup-hero-art {
    position: absolute;
    z-index: 1;
    top: -8px;
    right: 40px;
    bottom: -22px;
    width: 57%;
    background-position: center 18%;
    background-repeat: no-repeat;
    background-size: contain;
    filter: drop-shadow(0 7px 8px rgba(95, 53, 46, 0.15));
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-mobile-setup-hero[data-presentation="custom"] .ai-game-mobile-setup-hero-art {
    display: none;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-mobile-setup-hero[data-presentation="custom"] .ai-game-mobile-setup-hero-copy {
    width: 70%;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-mobile-setup-hero-bubble {
    position: absolute;
    z-index: 3;
    right: 10px;
    bottom: 21px;
    width: 111px;
    margin: 0;
    padding: 10px 8px;
    border: 1px solid #efb9bd;
    border-radius: 24px;
    color: #68463e;
    background: rgba(255, 253, 251, 0.94);
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 9px;
    font-weight: 700;
    line-height: 1.55;
    text-align: center;
    box-shadow: 0 4px 10px rgba(120, 70, 62, 0.08);
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-mobile-setup-hero-bubble::before {
    position: absolute;
    bottom: 12px;
    left: -7px;
    width: 12px;
    height: 12px;
    border-bottom: 1px solid #efb9bd;
    border-left: 1px solid #efb9bd;
    background: rgba(255, 253, 251, 0.96);
    content: "";
    transform: rotate(45deg);
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-setup-actions {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 240;
    margin: 0;
    padding: 9px 14px calc(9px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(232, 163, 168, 0.72);
    background: rgba(255, 252, 250, 0.96);
    box-shadow: 0 -8px 24px rgba(111, 62, 55, 0.13);
    backdrop-filter: blur(12px);
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-setup-actions .ai-game-setup-summary {
    margin: 0 0 7px !important;
    padding: 0;
    overflow: hidden;
    background: transparent;
    font-size: 10px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-setup-actions .ai-game-setup-guidance {
    display: none !important;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-setup-actions .ai-game-primary {
    position: relative;
    min-height: 60px;
    padding: 10px 24px 10px 62px;
    border: 1px solid #e94f62;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(135deg, #f56f7d, #e94e61);
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 19px;
    letter-spacing: 0.08em;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.65), 0 8px 18px rgba(210, 70, 88, 0.25);
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-setup-actions .ai-game-primary::before,
  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-setup-actions .ai-game-primary::after {
    position: absolute;
    border-radius: 50%;
    content: "";
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-setup-actions .ai-game-primary::before {
    top: 15px;
    left: 27px;
    width: 28px;
    height: 28px;
    border: 1px solid rgba(78, 55, 50, 0.2);
    background: radial-gradient(circle at 34% 28%, #fff 0 42%, #e8e2dd 74%, #cfc5bd 100%);
    box-shadow: 0 3px 7px rgba(87, 49, 43, 0.22);
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-setup-actions .ai-game-primary::after {
    top: 25px;
    left: 43px;
    width: 21px;
    height: 21px;
    background: radial-gradient(circle at 34% 28%, #555 0 10%, #171717 54%, #000 100%);
    box-shadow: 0 3px 7px rgba(58, 32, 27, 0.34);
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-custom-settings-start {
    display: none;
  }
}

/* Shared pastel navigation used by the logged-in portal. */
.site-header.qa-topnav {
  border-bottom-color: rgba(229, 188, 181, 0.68);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 4px 18px rgba(100, 65, 54, 0.055);
}

.site-header .qa-topnav-nav a {
  border-radius: 11px;
  color: #5b3a30;
  transition: color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.site-header .qa-topnav-nav a:hover {
  color: #c95460;
  background: #fff5f5;
  transform: translateY(-1px);
}

.site-header .qa-topnav-nav a[aria-current="page"],
.site-header .qa-topnav-nav a.active {
  color: #c94f5c;
  background: #fff0f2;
  font-weight: 800;
}

/* 登録方式が確定するまで通常登録専用要素を描画せず、OAuth登録時のちらつきを防ぐ。 */
.register-shell [hidden] {
  display: none !important;
}

.site-header .qa-topnav-ask-btn {
  border-color: #edc5c1;
  background: #fff5f5;
  color: #a64e50;
}

@media (max-width: 700px) {
  .mobile-bottom-nav a {
    font-size: 8px;
  }

  .mobile-bottom-nav a.active {
    color: #c94f5c;
    background: #fff0f2;
  }
}

/* Reference-matched spring header and portal scenery v20260810. */
@media (min-width: 761px) {
  .site-header.qa-topnav {
    min-height: 78px;
    border-top: 2px solid #f5d4d5;
    border-bottom: 1px solid #ead9d5;
    background: rgba(255, 255, 255, 0.985);
    box-shadow: 0 2px 10px rgba(91, 54, 42, 0.055);
  }

  .site-header .site-header-inner {
    max-width: 1536px;
    min-height: 76px;
    gap: 20px;
    padding: 0 32px;
  }

  .site-header .qa-topnav-logo {
    width: 240px;
  }

  .site-header .qa-topnav-logo img {
    width: 230px;
    height: auto;
  }

  .site-header .qa-topnav-nav {
    align-self: stretch;
    justify-content: center;
    gap: 3px;
  }

  .site-header .qa-topnav-nav a {
    display: inline-flex;
    min-height: 58px;
    align-self: center;
    align-items: center;
    gap: 7px;
    padding: 0 13px;
    border-radius: 12px;
    color: #57362c;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
  }

  .site-header .qa-topnav-nav-icon {
    display: inline-grid;
    width: 25px;
    height: 25px;
    place-items: center;
    color: #7c4b34;
  }

  .site-header .qa-topnav-nav-icon svg {
    width: 24px;
    height: 24px;
    stroke-width: 1.65;
  }

  .site-header .qa-topnav-nav a:hover {
    color: #b9505c !important;
    background: #fff4f5 !important;
  }

  .site-header .qa-topnav-nav a[aria-current="page"],
  .site-header .qa-topnav-nav a.active {
    color: #b94855;
    background: #fdecee;
    box-shadow: inset 0 0 0 1px rgba(231, 151, 160, 0.08);
  }

  .site-header .qa-topnav-right {
    align-self: stretch;
    gap: 2px;
    padding-left: 12px;
    border-left: 1px solid #f0e6e2;
  }

  .site-header .qa-bell {
    display: inline-flex;
    width: 43px;
    min-width: 43px;
    height: 43px;
    min-height: 43px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: #704537;
    text-decoration: none;
  }

  .site-header .qa-bell:hover {
    color: #ba5260;
    background: #fff3f4;
  }

  .site-header .qa-bell svg {
    width: 23px;
    height: 23px;
  }

  .site-header .qa-account-menu-button {
    min-height: 52px;
    gap: 9px;
    margin-left: 4px;
    padding: 4px 7px 4px 4px;
    border: 0;
    border-radius: 12px;
    color: #4f3128;
    font-weight: 700;
  }

  .site-header .qa-account-menu-button:hover {
    background: #fff4f4;
  }

  .site-header .qa-header-avatar {
    display: block;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border: 2px solid #f1d3cf;
    border-radius: 50%;
    background: url("/assets/ai-character-mina-avatar-v1.png") center / cover no-repeat;
    box-shadow: 0 2px 7px rgba(100, 62, 48, 0.12);
  }

  .site-header .qa-topnav-user {
    max-width: 118px;
    overflow: hidden;
    color: #4f3128;
    font-size: 12px;
    line-height: 1.45;
    text-overflow: ellipsis;
  }

  .portal-page .site-header .qa-topnav-ask-btn {
    display: none;
  }
}

.portal-home-page {
  background:
    linear-gradient(180deg, rgba(224, 247, 255, 0.96) 0, rgba(239, 250, 251, 0.94) 390px, rgba(255, 251, 247, 0.98) 820px),
    #eefaff;
}

.portal-characters-page {
  background:
    linear-gradient(180deg, rgba(235, 249, 255, 0.72) 0, rgba(255, 251, 247, 0.96) 560px),
    image-set(url("/assets/portal-spring-landscape-v1.avif") type("image/avif"), url("/assets/portal-spring-landscape-v1.webp") type("image/webp"), url("/assets/portal-spring-landscape-v1.png") type("image/png")) center 78px / 100% auto no-repeat fixed,
    #eefaff;
}

.portal-home-page .portal-shell {
  padding-top: 14px;
}

.portal-home-page .portal-hero {
  border-color: rgba(237, 204, 199, 0.9);
  border-radius: 18px;
  box-shadow: 0 12px 34px rgba(73, 79, 75, 0.12);
}

@media (max-width: 1200px) and (min-width: 761px) {
  .site-header .site-header-inner {
    gap: 10px;
    padding-inline: 16px;
  }

  .site-header .qa-topnav-logo {
    width: 190px;
  }

  .site-header .qa-topnav-logo img {
    width: 184px;
  }

  .site-header .qa-topnav-nav a {
    gap: 5px;
    padding-inline: 8px;
    font-size: 12px;
  }

  .site-header .qa-topnav-nav-icon {
    width: 20px;
    height: 20px;
  }

  .site-header .qa-topnav-nav-icon svg {
    width: 20px;
    height: 20px;
  }
}

@media (max-width: 700px), (orientation: portrait) and (min-width: 701px) and (max-width: 1439px) {
  .site-header .qa-header-avatar {
    display: block;
    width: 32px;
    height: 32px;
    border: 1px solid #f1d3cf;
    border-radius: 50%;
    background: url("/assets/ai-character-mina-avatar-v1.png") center / cover no-repeat;
  }

  .portal-home-page .portal-hero {
    background:
      linear-gradient(180deg, rgba(255,255,255,0.52), rgba(255,255,255,0.78)),
      image-set(url("/assets/portal-spring-landscape-v1.avif") type("image/avif"), url("/assets/portal-spring-landscape-v1.webp") type("image/webp"), url("/assets/portal-spring-landscape-v1.png") type("image/png")) center / cover no-repeat,
      #dff4ff;
  }
}

/* Full-page spring scenery and polished glass header v2. */
.portal-home-page,
.portal-characters-page {
  background:
    linear-gradient(180deg, rgba(235, 249, 255, 0.24) 0%, rgba(247, 253, 251, 0.62) 52%, rgba(248, 252, 241, 0.78) 100%),
    image-set(url("/assets/portal-spring-landscape-v1.avif") type("image/avif"), url("/assets/portal-spring-landscape-v1.webp") type("image/webp"), url("/assets/portal-spring-landscape-v1.png") type("image/png")) center top / cover no-repeat fixed,
    #eefaff;
}

.portal-characters-page {
  background-image:
    linear-gradient(180deg, rgba(235, 249, 255, 0.34) 0%, rgba(255, 251, 247, 0.76) 58%, rgba(248, 252, 241, 0.82) 100%),
    image-set(url("/assets/portal-spring-landscape-v1.avif") type("image/avif"), url("/assets/portal-spring-landscape-v1.webp") type("image/webp"), url("/assets/portal-spring-landscape-v1.png") type("image/png"));
}

.portal-home-page .portal-hero {
  border-color: rgba(237, 204, 199, 0.9);
  background: linear-gradient(90deg, rgba(255,255,255,0.76) 0%, rgba(255,255,255,0.5) 40%, rgba(255,255,255,0.2) 72%, rgba(255,255,255,0.34) 100%);
  box-shadow: 0 14px 38px rgba(73, 79, 75, 0.13);
  backdrop-filter: blur(2px) saturate(1.08);
  -webkit-backdrop-filter: blur(2px) saturate(1.08);
}

.portal-page .portal-section,
.portal-page .portal-card,
.portal-characters-page .portal-page-heading,
.portal-characters-page .portal-character-detail {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(13px) saturate(1.08);
  -webkit-backdrop-filter: blur(13px) saturate(1.08);
}

@media (min-width: 761px) {
  .site-header.qa-topnav {
    border-bottom-color: rgba(223, 190, 184, 0.7);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 7px 24px rgba(82, 52, 42, 0.075);
    backdrop-filter: blur(18px) saturate(1.24);
    -webkit-backdrop-filter: blur(18px) saturate(1.24);
  }

  .site-header .qa-topnav-logo {
    transition: opacity 0.18s ease, transform 0.18s ease;
  }

  .site-header .qa-topnav-logo:hover {
    opacity: 0.86;
    transform: translateY(-1px);
  }

  .site-header .qa-topnav-nav a {
    position: relative;
    transition: color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  }

  .site-header .qa-topnav-nav-icon {
    border-radius: 8px;
    transition: color 0.18s ease, background 0.18s ease, transform 0.18s ease;
  }

  .site-header .qa-topnav-nav a:hover {
    color: #b9505c !important;
    background: rgba(255, 244, 245, 0.88) !important;
    box-shadow: 0 5px 14px rgba(143, 79, 76, 0.07);
    transform: translateY(-1px);
  }

  .site-header .qa-topnav-nav a:hover .qa-topnav-nav-icon {
    background: rgba(255, 255, 255, 0.72);
    transform: scale(1.04);
  }

  .site-header .qa-topnav-nav a[aria-current="page"],
  .site-header .qa-topnav-nav a.active {
    color: #b94855;
    background: linear-gradient(145deg, rgba(255, 242, 244, 0.98), rgba(250, 226, 230, 0.96));
    box-shadow: inset 0 0 0 1px rgba(224, 145, 154, 0.16), 0 6px 16px rgba(151, 83, 80, 0.09);
  }

  .site-header .qa-topnav-nav a[aria-current="page"]::after,
  .site-header .qa-topnav-nav a.active::after {
    position: absolute;
    right: 18px;
    bottom: 7px;
    left: 18px;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, #db7f8a 22%, #db7f8a 78%, transparent);
    content: "";
  }

  .site-header .qa-topnav-nav a[aria-current="page"] .qa-topnav-nav-icon,
  .site-header .qa-topnav-nav a.active .qa-topnav-nav-icon {
    color: #bf5360;
    background: rgba(255, 255, 255, 0.66);
  }

  .site-header .qa-topnav-right {
    border-left-color: rgba(231, 214, 208, 0.88);
  }

  .site-header .qa-bell {
    border: 1px solid transparent;
    transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
  }

  .site-header .qa-bell:hover {
    color: #ba5260;
    border-color: rgba(232, 187, 190, 0.56);
    background: rgba(255, 246, 246, 0.92);
    transform: translateY(-1px);
  }

  .site-header .qa-account-menu-button {
    border: 1px solid transparent;
    transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  }

  .site-header .qa-account-menu-button:hover {
    border-color: rgba(232, 190, 190, 0.55);
    background: rgba(255, 247, 247, 0.94);
    box-shadow: 0 5px 14px rgba(120, 71, 64, 0.07);
  }

  .site-header .qa-header-avatar {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.88), 0 3px 10px rgba(100, 62, 48, 0.14);
  }
}

@media (max-width: 700px) {
  .portal-home-page,
  .portal-characters-page {
    background-attachment: scroll;
    background-position: center top;
  }

  .portal-home-page .portal-hero {
    background: linear-gradient(180deg, rgba(255,255,255,0.48), rgba(255,255,255,0.72));
  }
}

/* スマホヘッダー: アバターと省略ユーザー名を潰さず表示する */
@media (max-width: 700px), (orientation: portrait) and (min-width: 701px) and (max-width: 1439px) {
  .site-header .qa-account-menu {
    flex: 0 0 auto;
  }

  .site-header .qa-account-menu-button {
    width: auto;
    min-width: 96px;
    max-width: 112px;
    height: 40px;
    min-height: 40px;
    gap: 5px;
    margin-left: 0;
    padding: 3px 6px 3px 3px;
    flex: 0 0 auto;
  }

  .site-header .qa-header-avatar {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
  }

  .site-header .qa-topnav-user {
    display: block !important;
    min-width: 0;
    max-width: 56px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .site-header .qa-topnav-chevron {
    display: block !important;
    flex: 0 0 auto;
    margin-left: 0;
  }
}

@media (max-width: 360px) {
  body:is(.ai-game-mobile-menu-enabled, .workspace-mobile-minimal) .site-header .site-header-inner {
    gap: 4px;
    padding-inline: 7px;
  }

  body:is(.ai-game-mobile-menu-enabled, .workspace-mobile-minimal) .site-header .qa-topnav-logo {
    flex: 0 1 120px;
    min-width: 0;
  }

  body:is(.ai-game-mobile-menu-enabled, .workspace-mobile-minimal) .site-header .qa-topnav-logo .qa-brand-wordmark {
    width: 92px;
    max-width: none;
  }

  body:is(.ai-game-mobile-menu-enabled, .workspace-mobile-minimal) .site-header .qa-topnav-logo::after {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
  }

  body:is(.ai-game-mobile-menu-enabled, .workspace-mobile-minimal) .site-header .qa-topnav-right {
    min-width: 0;
    gap: 3px;
  }

  body:is(.ai-game-mobile-menu-enabled, .workspace-mobile-minimal) .site-header .qa-account-menu-button {
    width: 82px;
    min-width: 82px;
    max-width: 82px;
    gap: 3px;
    padding-right: 3px;
  }

  body:is(.ai-game-mobile-menu-enabled, .workspace-mobile-minimal) .site-header .qa-topnav-user {
    max-width: 28px;
  }

  body:is(.ai-game-mobile-menu-enabled, .workspace-mobile-minimal) .site-header .site-header-menu-button {
    display: flex !important;
    width: 40px;
    min-width: 40px;
    flex: 0 0 40px;
  }

}

/* Pulled-back scenery and generated spring-Go logo emblem v20260810. */
.portal-home-page,
.portal-characters-page {
  background-size: cover, contain;
  background-position: center, center 78px;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.site-header .qa-topnav-logo {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.site-header .qa-topnav-logo::after {
  display: block;
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  margin-left: -18px;
  background: url("/assets/site-logo-emblem-spring-v1-256.png") center / contain no-repeat;
  filter: drop-shadow(0 3px 5px rgba(93, 54, 45, 0.1));
  content: "";
}

@media (min-width: 1201px) {
  .site-header .qa-topnav-logo {
    width: 242px;
  }

  .site-header .qa-topnav-logo .qa-brand-wordmark {
    width: 184px;
    height: auto;
  }
}

@media (max-width: 1200px) and (min-width: 761px) {
  .site-header .qa-topnav-logo {
    width: 182px;
    gap: 0;
  }

  .site-header .qa-topnav-logo .qa-brand-wordmark {
    width: 140px;
    height: auto;
  }

  .site-header .qa-topnav-logo::after {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
    margin-left: -12px;
  }
}

@media (max-width: 760px) {
  .portal-home-page,
  .portal-characters-page {
    background-size: cover, contain;
    background-position: center, center 48px;
    background-attachment: scroll;
  }

  .site-header .qa-topnav-logo {
    width: auto;
    gap: 0;
  }

  .site-header .qa-topnav-logo .qa-brand-wordmark {
    width: 132px;
    max-width: 36vw;
    height: auto;
  }

  .site-header .qa-topnav-logo::after {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    margin-left: -10px;
  }
}

/* Open hero scenery, bust-up guide character, and softly fading footer town v20260810. */
.portal-home-page,
.portal-characters-page {
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 8% 14%, rgba(255, 210, 220, 0.3), transparent 25%),
    radial-gradient(circle at 91% 17%, rgba(190, 231, 249, 0.34), transparent 27%),
    linear-gradient(180deg, #fffdfb 0%, #fffaf7 52%, #f5fbed 100%);
  background-size: auto;
  background-position: initial;
  background-repeat: no-repeat;
  background-attachment: scroll;
}

.portal-page .portal-shell,
.portal-page .portal-error {
  position: relative;
  z-index: 2;
}

.portal-home-page .portal-hero {
  isolation: isolate;
  min-height: 302px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.portal-home-page .portal-hero::before {
  position: absolute;
  z-index: 0;
  inset: -10px -18px -30px;
  background:
    linear-gradient(90deg, rgba(255, 253, 251, 0) 0%, rgba(255, 253, 251, 0.04) 46%, rgba(255, 253, 251, 0.42) 72%, rgba(255, 253, 251, 0.9) 100%),
    linear-gradient(180deg, rgba(255, 250, 247, 0) 0%, rgba(255, 250, 247, 0.05) 55%, rgba(255, 250, 247, 0.72) 86%, #fffaf7 100%),
    image-set(url("/assets/portal-spring-landscape-v1.avif") type("image/avif"), url("/assets/portal-spring-landscape-v1.webp") type("image/webp"), url("/assets/portal-spring-landscape-v1.png") type("image/png")) center 58% / cover no-repeat;
  content: "";
  pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 64%, rgba(0, 0, 0, 0.82) 78%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 64%, rgba(0, 0, 0, 0.82) 78%, transparent 100%);
}

.portal-home-page .portal-hero::after {
  display: none;
}

.portal-home-page .portal-hero-character {
  align-self: end;
  width: min(100%, 260px);
  height: 240px;
  aspect-ratio: auto;
  margin: 0 auto -18px;
  border-radius: 0;
  background: url("/assets/portal-mina-guide-v1-768.png") center top / 342px auto no-repeat;
  box-shadow: none;
  filter: drop-shadow(0 12px 12px rgba(92, 61, 50, 0.15));
}

.portal-home-page .portal-hero-character::before,
.portal-home-page .portal-hero-character::after {
  position: absolute;
  z-index: 2;
  color: #f6a8b5;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1;
  pointer-events: none;
  content: "✿";
  filter: drop-shadow(0 2px 3px rgba(173, 100, 111, 0.12));
}

.portal-home-page .portal-hero-character::before {
  top: 22px;
  left: 7px;
  font-size: 27px;
  text-shadow: 35px -10px 0 #ffd7df, -2px 55px 0 #f9c1cb;
  transform: rotate(-12deg);
}

.portal-home-page .portal-hero-character::after {
  top: 58px;
  right: 3px;
  color: #ffd0d8;
  font-size: 22px;
  text-shadow: -5px 57px 0 #f3a9b8, 23px 31px 0 #ffe0e5;
  transform: rotate(14deg);
}

.portal-home-page .portal-hero-copy {
  align-self: center;
  padding: 19px 21px 18px;
  border: 2px solid rgba(234, 205, 198, 0.94);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 24px rgba(93, 65, 57, 0.1);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.portal-home-page .portal-hero-copy::before,
.portal-home-page .portal-hero-copy::after {
  position: absolute;
  top: 50%;
  width: 0;
  height: 0;
  border-top: 14px solid transparent;
  border-bottom: 14px solid transparent;
  content: "";
  transform: translateY(-50%);
}

.portal-home-page .portal-hero-copy::before {
  left: -20px;
  border-right: 20px solid rgba(234, 205, 198, 0.94);
}

.portal-home-page .portal-hero-copy::after {
  left: -16px;
  border-top-width: 12px;
  border-right: 18px solid rgba(255, 255, 255, 0.95);
  border-bottom-width: 12px;
}

.portal-home-page .portal-hero-copy h1 {
  font-size: clamp(24px, 2vw, 32px);
  line-height: 1.46;
}

.portal-home-page .portal-hero-copy p {
  margin-top: 10px;
  font-size: 14px;
}

.portal-home-page .portal-hero-actions {
  perspective: 900px;
  transform: translateY(7px);
}

.portal-home-page .portal-action-card {
  position: relative;
  border-color: rgba(255, 255, 255, 0.82);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.38),
    inset 0 2px 0 rgba(255, 255, 255, 0.56),
    0 7px 0 rgba(112, 77, 65, 0.16),
    0 16px 26px rgba(82, 61, 55, 0.2);
  transform: translateY(-5px) rotateX(1.5deg);
}

.portal-home-page .portal-action-card:hover {
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.46),
    inset 0 2px 0 rgba(255, 255, 255, 0.66),
    0 8px 0 rgba(112, 77, 65, 0.14),
    0 20px 30px rgba(82, 61, 55, 0.22);
  transform: translateY(-10px) rotateX(1.5deg);
}

.portal-bottom-scenery {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 250px;
  margin-top: -92px;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(245, 251, 237, 0) 0%, rgba(233, 249, 255, 0.15) 38%, rgba(230, 248, 217, 0.2) 100%),
    url("/assets/portal-footer-spring-town-v1.webp") center bottom / 100% auto no-repeat;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.12) 16%, rgba(0, 0, 0, 0.68) 43%, #000 70%);
  mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.12) 16%, rgba(0, 0, 0, 0.68) 43%, #000 70%);
}

@media (max-width: 1180px) {
  .portal-home-page .portal-hero {
    grid-template-columns: 190px minmax(210px, 0.72fr) minmax(0, 1.55fr);
    min-height: 282px;
  }

  .portal-home-page .portal-hero-character {
    width: 218px;
    height: 226px;
    background-size: 300px auto;
  }

  .portal-home-page .portal-hero-copy {
    padding: 16px 18px;
  }
}

@media (max-width: 900px) {
  .portal-home-page .portal-hero {
    grid-template-columns: 170px 1fr;
    min-height: 0;
  }

  .portal-home-page .portal-hero-character {
    width: 180px;
    height: 196px;
    background-size: 265px auto;
  }

  .portal-bottom-scenery {
    height: 210px;
    margin-top: -72px;
  }
}

/* Mobile kifu editor final accent lock r18 20260814. */
@media (orientation: portrait) and (max-width: 1439px) {
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-question-host #askQaWithPositionBtn.analysis-qa-action:not(:disabled) {
    display: flex !important;
    min-height: 54px !important;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 9px 12px !important;
    color: #fff !important;
    border: 2px solid #ef6673 !important;
    border-radius: 11px !important;
    background: linear-gradient(135deg, #f47782, #e85f6d) !important;
    box-shadow: 0 6px 15px rgba(203, 73, 89, 0.18) !important;
    font-family: "Noto Serif JP", serif;
    font-size: 16px !important;
    font-weight: 500 !important;
  }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-question-host #askQaWithPositionBtn.analysis-qa-action svg {
    width: 42px !important;
    height: 32px !important;
    color: #fff !important;
    fill: rgba(255, 255, 255, 0.97) !important;
  }
}

/* PC home: single-row character carousel matched to the approved spring mockup. */
.portal-character-carousel {
  min-width: 0;
}

.portal-character-viewport {
  min-width: 0;
}

.portal-home-page img.portal-character-art {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center;
  image-rendering: auto;
}

.portal-character-carousel-button,
.portal-character-progress,
.portal-character-swipe-hint {
  display: none;
}

@media (min-width: 1201px) {
  .portal-home-page .portal-character-showcase {
    margin-top: -3px;
    padding: 16px 24px 19px;
    overflow: visible;
    border: 1px solid rgba(235, 209, 202, 0.92);
    border-radius: 22px;
    background:
      radial-gradient(circle at 48% 0%, rgba(255, 238, 222, 0.42), transparent 34%),
      linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(255, 251, 247, 0.9));
    box-shadow: 0 15px 36px rgba(91, 62, 51, 0.09);
    backdrop-filter: blur(14px) saturate(1.08);
    -webkit-backdrop-filter: blur(14px) saturate(1.08);
  }

  .portal-home-page .portal-character-showcase::before {
    position: absolute;
    top: 14px;
    left: 18px;
    width: 42px;
    height: 12px;
    opacity: 0.34;
    background:
      radial-gradient(circle at 6px 6px, #e98f9c 0 3px, transparent 3.5px),
      radial-gradient(circle at 20px 4px, #f0b5bd 0 2px, transparent 2.5px),
      radial-gradient(circle at 34px 8px, #eac8a1 0 2.5px, transparent 3px);
    content: "";
    pointer-events: none;
  }

  .portal-home-page .portal-character-showcase .portal-section-heading {
    padding: 0 2px 0 0;
  }

  .portal-home-page .portal-character-showcase .portal-section-heading > div {
    padding-left: 0;
  }

  .portal-home-page .portal-character-showcase .portal-section-heading h2 {
    color: #53372d;
    font-size: 20px;
    letter-spacing: 0.045em;
  }

  .portal-home-page .portal-character-showcase .portal-section-heading > a {
    color: #2789bd;
    font-size: 11px;
    letter-spacing: 0.025em;
  }

  .portal-home-page .portal-character-carousel {
    position: relative;
    margin-top: 7px;
  }

  .portal-home-page .portal-character-viewport {
    position: relative;
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    padding: 10px 20px 11px;
    cursor: grab;
    outline: none;
    scroll-behavior: smooth;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 calc(100% - 46px), transparent 100%);
    mask-image: linear-gradient(90deg, #000 0%, #000 calc(100% - 46px), transparent 100%);
  }

  .portal-home-page .portal-character-viewport::-webkit-scrollbar {
    display: none;
  }

  .portal-home-page .portal-character-viewport:focus-visible {
    border-radius: 16px;
    box-shadow: 0 0 0 3px rgba(217, 105, 119, 0.17);
  }

  .portal-home-page .portal-character-viewport.is-dragging {
    cursor: grabbing;
    scroll-behavior: auto;
    scroll-snap-type: none;
    user-select: none;
  }

  .portal-home-page .portal-character-grid--home {
    display: flex;
    width: max-content;
    gap: 12px;
    margin-top: 0;
  }

  .portal-home-page .portal-character-card {
    display: flex;
    width: clamp(172px, 11.5vw, 176px);
    min-width: clamp(172px, 11.5vw, 176px);
    min-height: 332px;
    flex: 0 0 clamp(172px, 11.5vw, 176px);
    flex-direction: column;
    overflow: hidden;
    border-width: 1px;
    border-radius: 14px;
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--character-soft) 92%, white) 0%, rgba(255, 255, 255, 0.95) 100%);
    box-shadow: 0 7px 17px rgba(88, 58, 48, 0.085);
    scroll-snap-align: start;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  }

  .portal-home-page .portal-character-card:hover,
  .portal-home-page .portal-character-card:focus-within {
    z-index: 2;
    transform: translateY(-7px);
    border-color: color-mix(in srgb, var(--character) 72%, white);
    box-shadow: 0 16px 28px rgba(88, 58, 48, 0.15);
  }

  .portal-home-page .portal-character-art {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    flex: 0 0 auto;
    object-fit: cover;
    object-position: center;
    image-rendering: auto;
  }

  .portal-home-page .portal-character-body {
    display: flex;
    min-height: 156px;
    padding: 10px 11px 11px;
    flex: 1 1 auto;
    flex-direction: column;
  }

  .portal-home-page .portal-character-body h3 {
    font-family: "Noto Serif JP", serif;
    font-size: 18px;
    letter-spacing: 0.045em;
  }

  .portal-home-page .portal-character-body header span {
    max-width: 76px;
    font-size: 9px;
  }

  .portal-home-page .portal-character-meta {
    min-height: 0;
    margin-top: 4px;
    font-size: 9px;
    line-height: 1.45;
  }

  .portal-home-page .portal-character-description {
    min-height: 28px;
    margin: 6px 0 8px;
    color: #76635c;
    font-size: 9px;
    line-height: 1.55;
  }

  .portal-home-page .portal-character-body > a {
    min-height: 30px;
    margin-top: auto;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 7px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 4px 8px color-mix(in srgb, var(--character) 18%, transparent);
    font-size: 11px;
    letter-spacing: 0.04em;
  }

  .portal-home-page .portal-character-carousel-button {
    position: absolute;
    z-index: 5;
    top: 48%;
    display: grid;
    width: 48px;
    height: 48px;
    padding: 0;
    place-items: center;
    border: 1px solid rgba(229, 205, 195, 0.92);
    border-radius: 50%;
    background: rgba(255, 253, 249, 0.97);
    color: #7b4938;
    box-shadow: 0 7px 18px rgba(92, 61, 50, 0.14), inset 0 1px 0 #fff;
    cursor: pointer;
    transform: translateY(-50%);
    transition: color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
  }

  .portal-home-page .portal-character-carousel-button span {
    display: block;
    margin-top: -4px;
    font-family: Georgia, serif;
    font-size: 42px;
    font-weight: 400;
    line-height: 1;
  }

  .portal-home-page .portal-character-carousel-button--prev {
    left: -25px;
  }

  .portal-home-page .portal-character-carousel-button--next {
    right: -25px;
  }

  .portal-home-page .portal-character-carousel-button:hover:not(:disabled) {
    color: #c45463;
    background: #fff;
    box-shadow: 0 10px 22px rgba(92, 61, 50, 0.19), 0 0 0 5px rgba(243, 188, 195, 0.14);
    transform: translateY(-50%) scale(1.04);
  }

  .portal-home-page .portal-character-carousel-button:disabled {
    opacity: 0.62;
    cursor: default;
    box-shadow: 0 4px 11px rgba(92, 61, 50, 0.08);
  }

  .portal-home-page .portal-character-progress {
    display: flex;
    min-height: 12px;
    margin-top: 2px;
    align-items: center;
    justify-content: center;
    gap: 7px;
  }

  .portal-home-page .portal-character-progress button {
    width: 28px;
    height: 6px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: #f6dadd;
    cursor: pointer;
    transition: width 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  }

  .portal-home-page .portal-character-progress button.is-active {
    width: 42px;
    background: linear-gradient(90deg, #e65c6e, #ef8792);
    box-shadow: 0 2px 6px rgba(214, 78, 96, 0.2);
  }

  .portal-home-page .portal-character-progress button:focus-visible {
    outline: 2px solid #cb6470;
    outline-offset: 3px;
  }

  .portal-home-page .portal-character-swipe-hint {
    display: flex;
    margin: 8px 0 0;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #8b6f65;
    font-family: "Noto Serif JP", serif;
    font-size: 12px;
    letter-spacing: 0.08em;
  }

  .portal-home-page .portal-character-swipe-hint span {
    display: inline-block;
    color: #96766b;
    font-size: 18px;
    transform: rotate(-18deg);
  }

  .portal-home-page .portal-character-swipe-hint b {
    color: #b48d80;
    font-family: "Noto Sans JP", sans-serif;
    font-size: 16px;
    font-weight: 500;
  }
}

@media (prefers-reduced-motion: reduce) {
  .portal-home-page .portal-character-viewport {
    scroll-behavior: auto;
  }

  .portal-home-page .portal-character-card,
  .portal-home-page .portal-character-carousel-button,
  .portal-home-page .portal-character-progress button {
    transition: none;
  }
}

/* Mobile kifu editor character page r15 20260814. */
.editor-mobile-intro,
.editor-mobile-board-status,
.editor-mobile-after-board {
  display: none;
}

@media (orientation: portrait) and (max-width: 1439px) {
  body[data-mode="editor"].workspace-mobile-minimal {
    --editor-mobile-pink: #ef6673;
    --editor-mobile-line: rgba(231, 111, 119, 0.3);
    --editor-mobile-paper: rgba(255, 253, 250, 0.94);
    --editor-mobile-ink: #352521;
    color: var(--editor-mobile-ink);
    background: radial-gradient(circle at 7% 14%, rgba(246, 185, 181, 0.16), transparent 19rem), linear-gradient(180deg, #fffaf7, #fffdfb);
  }

  body[data-mode="editor"].workspace-mobile-minimal .app-shell,
  body[data-mode="editor"].workspace-mobile-minimal .workspace,
  body[data-mode="editor"].workspace-mobile-minimal .main-grid,
  body[data-mode="editor"].workspace-mobile-minimal .board-workspace-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  body[data-mode="editor"].workspace-mobile-minimal .board-workspace-panel {
    display: flex !important;
    flex-direction: column;
    gap: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-intro,
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-board-status,
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-after-board {
    display: block;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-intro {
    padding: 8px 10px 6px;
  }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-hero {
    position: relative;
    height: 154px;
    overflow: hidden;
    border: 2px solid rgba(239, 102, 115, 0.34);
    border-radius: 17px;
    background: radial-gradient(circle at 83% 20%, rgba(244, 163, 169, 0.27) 0 32px, transparent 33px), linear-gradient(105deg, #fffdfb 5%, #fff8f6 50%, #fdeae7 100%);
    box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.66);
  }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-hero::before,
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-hero::after {
    position: absolute;
    z-index: 0;
    color: rgba(239, 102, 115, 0.3);
    content: "✿";
    font-size: 27px;
  }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-hero::before { top: 8px; left: 11px; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-hero::after { right: 10px; bottom: 4px; font-size: 39px; }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-hero-copy {
    position: relative;
    z-index: 2;
    width: 55%;
    padding: 43px 0 0 20px;
    box-sizing: border-box;
  }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-hero h1 {
    margin: 0 0 8px;
    color: #2e1d19;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: clamp(24px, 6.6vw, 27px);
    font-weight: 500;
    letter-spacing: 0.035em;
    line-height: 1.15;
    white-space: nowrap;
  }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-hero-copy p {
    max-width: 190px;
    margin: 0;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 10px;
    line-height: 1.65;
  }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-hero > img {
    position: absolute;
    z-index: 1;
    right: 7px;
    bottom: -61px;
    width: 214px;
    height: auto;
    max-width: none;
    filter: drop-shadow(0 7px 8px rgba(79, 44, 36, 0.13));
  }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-hero-balloon {
    position: absolute;
    z-index: 3;
    top: 18px;
    right: 7px;
    width: 76px;
    margin: 0;
    padding: 7px 8px;
    color: #473530;
    border: 1px solid rgba(225, 146, 142, 0.48);
    border-radius: 999px;
    background: rgba(255, 252, 249, 0.94);
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 9px;
    line-height: 1.45;
    text-align: center;
  }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-file-actions {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 7px;
    margin-top: 8px;
  }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-file-actions > button {
    display: grid !important;
    grid-column: span 2;
    grid-template-columns: minmax(0, 1fr) !important;
    min-width: 0 !important;
    min-height: 76px;
    align-items: center;
    justify-items: center;
    gap: 4px;
    padding: 8px 4px !important;
    color: #392925;
    border: 1px solid var(--editor-mobile-line) !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.8) !important;
    box-shadow: 0 4px 14px rgba(95, 58, 49, 0.035) !important;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 11.5px !important;
    font-weight: 500 !important;
    line-height: 1.3;
    text-align: center;
    box-sizing: border-box;
  }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-file-actions > button svg {
    width: 34px !important;
    height: 34px !important;
    overflow: visible;
    stroke-width: 1.5;
  }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-file-actions > button:nth-child(1),
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-file-actions > button:nth-child(5) { color: #ec5765 !important; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-file-actions > button:nth-child(2) { color: #6c984b !important; border-color: rgba(108, 152, 75, 0.34) !important; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-file-actions > button:nth-child(3) { color: #2e8bd2 !important; border-color: rgba(70, 145, 202, 0.3) !important; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-file-actions > button:nth-child(4) { color: #6c984b !important; border-color: rgba(108, 152, 75, 0.34) !important; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-file-actions > button:nth-child(n + 4) {
    grid-column: span 3;
    grid-template-columns: 36px minmax(0, 1fr) !important;
    min-height: 62px;
    justify-items: start;
    gap: 7px;
    padding: 8px 10px !important;
    font-size: 12px !important;
    text-align: left;
  }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-file-actions > button span { color: #392925; white-space: nowrap; }

  body[data-mode="editor"].workspace-mobile-minimal .workspace-mobile-editor-actions {
    width: calc(100% - 8px);
    max-width: calc(100% - 8px);
    gap: 5px !important;
    margin: 0 4px !important;
    padding: 8px 7px 5px !important;
    border: 1px solid var(--editor-mobile-line);
    border-bottom: 0;
    border-radius: 13px 13px 0 0;
    background: var(--editor-mobile-paper);
  }

  body[data-mode="editor"].workspace-mobile-minimal .workspace-mobile-editor-actions > button {
    min-height: 42px !important;
    gap: 4px !important;
    padding: 5px 3px !important;
    color: #3e2c27 !important;
    border-color: rgba(226, 130, 133, 0.35) !important;
    border-radius: 9px !important;
    background: #fffdfb !important;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 9px !important;
    font-weight: 500 !important;
  }

  body[data-mode="editor"].workspace-mobile-minimal .workspace-mobile-editor-actions svg { width: 18px !important; height: 18px !important; flex-basis: 18px !important; }
  body[data-mode="editor"].workspace-mobile-minimal .workspace-mobile-editor-actions #editorPassBtn::before { width: 17px; height: 17px; flex: 0 0 17px; border: 1.5px solid currentColor; border-radius: 50%; content: ""; box-sizing: border-box; }
  body[data-mode="editor"].workspace-mobile-minimal .workspace-mobile-editor-actions .editor-quick-action-copy strong { font-family: inherit; font-size: 9px !important; font-weight: 500; }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-board-status {
    width: calc(100% - 8px);
    max-width: calc(100% - 8px);
    margin: 0 4px;
    padding: 0 8px 6px;
    border-right: 1px solid var(--editor-mobile-line);
    border-bottom: 1px solid var(--editor-mobile-line);
    border-left: 1px solid var(--editor-mobile-line);
    border-radius: 0 0 11px 11px;
    background: var(--editor-mobile-paper);
  }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-board-status .board-workspace-header {
    display: grid !important;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: center;
    gap: 5px 12px;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-board-status .board-workspace-mode,
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-board-status #boardMeta { display: none !important; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-board-status .board-turn-status { display: flex; align-items: center; gap: 6px; color: #3a2925; font-family: "Noto Serif JP", serif; font-size: 12px; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-board-status .board-turn-status strong { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-board-status .board-turn-status strong::after { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #555 0 4%, #121212 54%, #000 100%); box-shadow: 0 1px 3px rgba(0,0,0,.28); content: ""; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-board-status .board-turn-status strong[data-color="white"]::after { border: 1px solid #cfc5c1; background: radial-gradient(circle at 35% 30%, #fff 0 18%, #f7f5f4 58%, #ded9d6 100%); box-sizing: border-box; }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-board-status .capture-table { display: grid; grid-template-columns: auto auto auto auto auto; align-items: center; justify-content: end; gap: 4px; margin: 0; color: #3a2925; font-family: "Noto Serif JP", serif; font-size: 11px; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-board-status .capture-table::before { content: "アゲハマ"; white-space: nowrap; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-board-status .capture-table tbody,
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-board-status .capture-table tr { display: contents; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-board-status .capture-table th,
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-board-status .capture-table td { display: inline-flex; align-items: center; min-width: 0; padding: 0; border: 0; background: transparent; font-size: 11px; font-weight: 500; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-board-status .capture-table th { gap: 3px; font-size: 0; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-board-status .capture-table th::before { width: 10px; height: 10px; border-radius: 50%; background: #161413; box-shadow: 0 1px 2px rgba(0,0,0,.22); content: ""; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-board-status .capture-table th:last-of-type::before { border: 1px solid #cfc5c1; background: #fff; box-sizing: border-box; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-board-status .capture-table th:first-of-type::after { content: "黒"; font-size: 11px; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-board-status .capture-table th:last-of-type::after { content: "白"; font-size: 11px; }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-board-status .board-view-toggles { display: flex !important; grid-column: 1 / -1; justify-content: flex-end; gap: 5px; margin-top: 1px; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-board-status .board-view-toggles button { min-height: 25px; padding: 3px 8px; color: #765d56; border: 1px solid rgba(226,130,133,.26); border-radius: 999px; background: rgba(255,255,255,.7); font-size: 9px; }

  body[data-mode="editor"].workspace-mobile-minimal .board-workspace-panel > .board-stage {
    width: 100% !important;
    max-width: 100% !important;
    margin: 4px 0 0 !important;
    padding: 2px !important;
    overflow: hidden;
    border: 1px solid var(--editor-mobile-line);
    border-radius: 7px !important;
    background: #edbc72 !important;
    box-sizing: border-box;
  }

  body[data-mode="editor"].workspace-mobile-minimal .board-workspace-panel > .board-stage #board {
    width: 100% !important;
    max-width: 100% !important;
  }

  body[data-mode="editor"].workspace-mobile-minimal .board-workspace-panel > .move-controls {
    width: calc(100% - 8px) !important;
    max-width: calc(100% - 8px) !important;
    grid-template-columns: repeat(3, 34px) minmax(58px, 1fr) repeat(3, 34px) !important;
    grid-template-rows: 37px 31px !important;
    gap: 4px !important;
    margin: 4px 4px 8px !important;
    padding: 7px 6px 5px !important;
    border: 1px solid var(--editor-mobile-line) !important;
    border-radius: 11px !important;
    background: var(--editor-mobile-paper) !important;
    box-shadow: none !important;
    box-sizing: border-box;
  }

  body[data-mode="editor"].workspace-mobile-minimal .board-workspace-panel > .move-controls > button { display: grid !important; width: 34px !important; min-width: 0 !important; max-width: 34px !important; height: 37px !important; min-height: 37px !important; padding: 0 !important; place-items: center; color: #5b403a !important; border: 1px solid rgba(224,124,118,.3) !important; border-radius: 8px !important; background: #fffaf7 !important; box-shadow: none !important; }
  body[data-mode="editor"].workspace-mobile-minimal .board-workspace-panel > .move-controls #firstMoveBtn { grid-column: 1; grid-row: 1; }
  body[data-mode="editor"].workspace-mobile-minimal .board-workspace-panel > .move-controls #backFiveMoveBtn { grid-column: 2; grid-row: 1; }
  body[data-mode="editor"].workspace-mobile-minimal .board-workspace-panel > .move-controls #prevMoveBtn { grid-column: 3; grid-row: 1; }
  body[data-mode="editor"].workspace-mobile-minimal .board-workspace-panel > .move-controls .move-number-jump { grid-column: 4 !important; grid-row: 1; }
  body[data-mode="editor"].workspace-mobile-minimal .board-workspace-panel > .move-controls #nextMoveBtn { grid-column: 5; grid-row: 1; }
  body[data-mode="editor"].workspace-mobile-minimal .board-workspace-panel > .move-controls #forwardFiveMoveBtn { grid-column: 6; grid-row: 1; }
  body[data-mode="editor"].workspace-mobile-minimal .board-workspace-panel > .move-controls #lastMoveBtn { grid-column: 7; grid-row: 1; }
  body[data-mode="editor"].workspace-mobile-minimal .board-workspace-panel > .move-controls .move-number-jump { width: 100% !important; min-width: 0 !important; max-width: 100% !important; overflow: hidden; color: #392925; font-family: "Noto Serif JP", serif; font-size: 11px; white-space: nowrap; }
  body[data-mode="editor"].workspace-mobile-minimal .board-workspace-panel > .move-controls .move-number-jump input { width: 27px !important; min-width: 0; color: inherit; font: inherit; text-align: right; }
  body[data-mode="editor"].workspace-mobile-minimal .board-workspace-panel > .move-controls .seek-wrapper { width: 100% !important; max-width: 100% !important; height: 31px !important; grid-column: 1 / -1 !important; grid-row: 2 !important; margin: 0 !important; padding: 0 2px !important; overflow: hidden; box-sizing: border-box; }
  body[data-mode="editor"].workspace-mobile-minimal .board-workspace-panel > .move-controls input[type="range"] { accent-color: var(--editor-mobile-pink); touch-action: pan-y; }
}

@media (orientation: portrait) and (max-width: 1439px) {
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-after-board { padding: 0 10px 8px; }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-card,
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-tree-host .board-tree-panel,
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-info-host .editor-game-card,
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-more-tools {
    width: 100%;
    min-width: 0;
    margin: 0 0 8px !important;
    padding: 10px !important;
    border: 1px solid var(--editor-mobile-line) !important;
    border-radius: 12px !important;
    background: var(--editor-mobile-paper) !important;
    box-shadow: 0 4px 15px rgba(95, 58, 49, 0.035) !important;
    box-sizing: border-box;
  }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-card > h2 { margin: 0 0 8px; color: #3a2925; font-family: "Noto Serif JP", "Yu Mincho", serif; font-size: 15px; font-weight: 500; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-card > h2 > span { margin-right: 6px; color: rgba(239,102,115,.56); }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-markup-host .editor-diagram-group { display: grid !important; gap: 7px; margin: 0 !important; padding: 0 !important; border: 0 !important; background: transparent !important; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-markup-host .editor-tool-label { display: none !important; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-markup-host .diagram-tool-marks { display: grid !important; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-markup-host .diagram-tool-marks > button { width: 100% !important; min-width: 0 !important; min-height: 39px; padding: 4px !important; color: #342622; border: 1px solid rgba(226,130,133,.32) !important; border-radius: 8px !important; background: #fffdfb !important; font-family: "Noto Serif JP", serif; font-size: 17px !important; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-markup-host .diagram-tool-marks > button.active { color: #df5260 !important; border-color: var(--editor-mobile-pink) !important; box-shadow: inset 0 0 0 1px rgba(239,102,115,.14) !important; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-markup-host .diagram-label-row { display: grid !important; grid-template-columns: auto 78px; justify-content: start; gap: 8px; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-markup-host .diagram-label-row input { min-width: 0; height: 31px; padding: 4px 10px; border: 1px solid rgba(226,130,133,.32); border-radius: 7px; background: #fffdfb; font-family: "Noto Serif JP", serif; text-align: center; }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-comment-host .editor-comment-card { display: block !important; margin: 0 !important; padding: 0 !important; border: 0 !important; background: transparent !important; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-comment-host .editor-comment-card > span { display: none !important; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-comment-host textarea { display: block; width: 100% !important; min-height: 70px; resize: vertical; padding: 9px 10px; color: #44312c; border: 1px solid rgba(226,130,133,.3) !important; border-radius: 8px !important; background: repeating-linear-gradient(180deg, transparent 0 23px, rgba(226,130,133,.15) 23px 24px), #fffdfb !important; font-size: 12px; line-height: 24px; box-sizing: border-box; }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-tree-host .board-tree-panel { display: block !important; overflow: hidden; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-tree-host .board-tree-heading-icon,
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-tree-host .board-tree-eyebrow,
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-tree-host .board-tree-heading small,
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-tree-host .board-tree-summary,
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-tree-host #gameTreeToggleBtn,
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-tree-host .board-tree-legend,
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-tree-host .board-tree-help { display: none !important; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-tree-host .board-tree-header { display: flex; align-items: center; justify-content: space-between; margin: 0 0 6px; padding: 0; border: 0; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-tree-host .board-tree-heading strong { color: #3a2925; font-family: "Noto Serif JP", serif; font-size: 15px; font-weight: 500; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-tree-host .board-tree-heading strong::before { margin-right: 6px; color: rgba(239,102,115,.56); content: "✿"; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-tree-host .board-tree-toolbar { display: flex !important; justify-content: flex-end; min-height: 0; margin: -30px 0 5px; padding: 0; border: 0; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-tree-host #gameTreeFocusBtn { min-height: 29px; padding: 4px 9px; color: #4b3732; border: 1px solid rgba(226,130,133,.32); border-radius: 8px; background: #fffdfb; font-family: "Noto Serif JP", serif; font-size: 10px; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-tree-host .game-tree { min-height: 78px; padding: 7px 2px 2px !important; overflow-x: auto !important; overflow-y: hidden !important; border: 0 !important; background: transparent !important; touch-action: pan-x pan-y; }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-info-host .editor-game-card { display: block !important; padding: 0 !important; overflow: hidden; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-info-host .editor-tool-card-head { display: grid; grid-template-columns: minmax(0, 1fr) 32px; align-items: center; gap: 6px; min-height: 42px; padding: 5px 8px 2px; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-info-host .editor-tool-card-head > div > span { display: none; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-info-host .editor-tool-card-head strong { color: #3a2925; font-family: "Noto Serif JP", serif; font-size: 15px; font-weight: 500; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-info-host .editor-tool-card-head strong::before { margin-right: 6px; color: rgba(239,102,115,.56); content: "✿"; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-info-host #editorInfoToggleBtn { width: 32px; min-width: 32px; height: 32px; padding: 0; overflow: hidden; color: transparent; border: 0; background: transparent; font-size: 0; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-info-host #editorInfoToggleBtn::after { display: block; color: #392925; content: "⌄"; font-family: sans-serif; font-size: 24px; line-height: 27px; transition: transform .18s ease; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-info-host #editorInfoToggleBtn[aria-expanded="true"]::after { transform: rotate(180deg); }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-info-host .editor-info-bar { display: block !important; padding: 0 12px 9px; border: 0; background: transparent; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-info-host .editor-info-bar > svg { display: none; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-info-host .editor-info-summary { margin: 0; overflow: hidden; color: #54413b; font-size: 10px; line-height: 1.6; text-overflow: ellipsis; white-space: nowrap; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-info-host .editor-info-panel { padding: 0 10px 9px; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-info-host .editor-info-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-info-host .editor-info-links,
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-info-host .editor-file-actions { display: none !important; }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-more-tools { padding: 0 !important; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-more-tools > summary { min-height: 43px; padding: 11px 13px; color: #5a4540; cursor: pointer; font-family: "Noto Serif JP", serif; font-size: 12px; list-style: none; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-more-tools > summary::-webkit-details-marker { display: none; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-more-tools > summary::after { float: right; content: "⌄"; font-family: sans-serif; font-size: 19px; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-more-tools[open] > summary::after { transform: rotate(180deg); }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-more-tools-host > .workspace-mobile-tools-below { display: grid !important; width: 100% !important; max-width: 100% !important; height: auto !important; margin: 0 !important; padding: 8px !important; overflow: visible !important; border-top: 1px solid var(--editor-mobile-line); box-sizing: border-box; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-more-tools-host .editor-game-card,
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-more-tools-host .editor-diagram-group,
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-more-tools-host .editor-comment-card,
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-more-tools-host .analysis-qa-section { display: none !important; }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-question-host { margin: 4px 0 10px; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-question-host .analysis-qa-section { display: block !important; width: 100%; margin: 0 !important; padding: 0 !important; border: 0 !important; background: transparent !important; box-shadow: none !important; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-question-host .analysis-qa-action { display: flex !important; width: 100% !important; min-height: 54px; align-items: center; justify-content: center; gap: 10px; padding: 9px 12px !important; color: #df5260 !important; border: 2px solid var(--editor-mobile-pink) !important; border-radius: 11px !important; background: rgba(255,253,251,.96) !important; box-shadow: 0 4px 15px rgba(239,102,115,.06) !important; font-family: "Noto Serif JP", serif; font-size: 16px !important; font-weight: 500 !important; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-question-host .analysis-qa-action svg { width: 42px !important; height: 32px !important; color: #df5260; fill: #fff; stroke: currentColor; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-question-host .analysis-qa-action::before { width: 14px; height: 14px; margin-right: -35px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #555 0 4%, #151515 58%, #000 100%); box-shadow: 0 1px 2px rgba(0,0,0,.28); content: ""; pointer-events: none; }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-character-tip { position: relative; display: flex; min-height: 61px; align-items: center; margin: 0 0 8px; padding: 7px 12px 7px 105px; overflow: hidden; border: 1px solid var(--editor-mobile-line); border-radius: 11px; background: radial-gradient(circle at 92% 50%, rgba(239,102,115,.16) 0 23px, transparent 24px), linear-gradient(90deg, #fff8f6, #fffdfb); box-sizing: border-box; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-character-tip::after { position: absolute; right: 15px; color: rgba(239,102,115,.34); content: "✿"; font-size: 25px; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-character-tip img { position: absolute; left: 13px; bottom: -44px; width: 102px; max-width: none; filter: drop-shadow(0 3px 4px rgba(79,44,36,.1)); }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-character-tip p { position: relative; z-index: 1; width: 100%; margin: 0; padding: 7px 37px 7px 13px; color: #4b3732; border: 1px solid rgba(226,130,133,.3); border-radius: 999px; background: rgba(255,255,255,.72); font-family: "Noto Serif JP", serif; font-size: 11px; text-align: center; box-sizing: border-box; }

  body[data-mode="editor"].workspace-mobile-minimal .site-footer { margin-top: 3px; border-top-color: var(--editor-mobile-line); background: rgba(255,252,249,.9); }
  body[data-mode="editor"].workspace-mobile-minimal .site-footer-inner { padding-top: 14px; }
}

@media (max-width: 380px) {
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-hero { height: 146px; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-hero-copy { padding-left: 16px; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-hero > img { right: 10px; width: 184px; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-file-actions > button { padding-inline: 4px !important; font-size: 10.5px !important; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-file-actions > button:nth-child(n + 4) { grid-template-columns: 32px minmax(0, 1fr) !important; padding-inline: 7px !important; font-size: 11px !important; }
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-file-actions > button svg { width: 31px !important; height: 31px !important; }
  body[data-mode="editor"].workspace-mobile-minimal .board-workspace-panel > .move-controls { grid-template-columns: repeat(3, 31px) minmax(51px, 1fr) repeat(3, 31px) !important; }
  body[data-mode="editor"].workspace-mobile-minimal .board-workspace-panel > .move-controls > button { width: 31px !important; max-width: 31px !important; }
}

/* Shared site footer and AI-game VOICEVOX credit v20260814. */
.site-footer {
  position: relative;
  clear: both;
  width: 100%;
  margin-top: clamp(32px, 5vw, 68px);
  padding: 30px 18px calc(24px + env(safe-area-inset-bottom));
  overflow: hidden;
  border-top: 1px solid rgba(229, 154, 158, 0.46);
  background:
    radial-gradient(circle at 8% 100%, rgba(244, 176, 183, 0.2) 0 54px, transparent 55px),
    radial-gradient(circle at 93% 92%, rgba(245, 193, 183, 0.16) 0 62px, transparent 63px),
    linear-gradient(180deg, rgba(255, 252, 249, 0.98), rgba(255, 247, 243, 0.98));
  color: #5b4039;
  box-sizing: border-box;
}

.site-footer::before,
.site-footer::after {
  position: absolute;
  color: rgba(232, 117, 130, 0.34);
  font-size: 30px;
  line-height: 1;
  content: "✿";
  pointer-events: none;
}

.site-footer::before {
  bottom: 18px;
  left: 5%;
}

.site-footer::after {
  right: 5%;
  bottom: 26px;
  font-size: 21px;
}

.site-footer-inner {
  position: relative;
  z-index: 1;
  width: min(100%, 820px);
  margin: 0 auto;
}

.site-footer-credit {
  width: min(100%, 680px);
  margin: 0 auto 24px;
  overflow: hidden;
  border: 1px solid #efb5b8;
  border-radius: 18px;
  background: rgba(255, 253, 251, 0.96);
  box-shadow: 0 8px 22px rgba(116, 69, 59, 0.08);
}

.site-footer-credit > summary {
  display: flex;
  min-height: 58px;
  padding: 14px 18px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, rgba(255, 242, 242, 0.96), rgba(255, 250, 247, 0.96));
  color: #4d332d;
  font-family: "Noto Serif JP", "Yu Mincho", serif;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  box-sizing: border-box;
  touch-action: manipulation;
}

.site-footer-credit > summary::-webkit-details-marker {
  display: none;
}

.site-footer-credit-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.site-footer-credit-title > span {
  color: #ed7b88;
  font-size: 19px;
}

.site-footer-credit-chevron {
  color: #df6b78;
  font-family: sans-serif;
  font-size: 24px;
  transition: transform 160ms ease;
}

.site-footer-credit[open] .site-footer-credit-chevron {
  transform: rotate(180deg);
}

.site-footer-credit-body {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  padding: 18px 20px 20px;
  border-top: 1px solid rgba(239, 181, 184, 0.62);
}

.site-footer-credit-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: #fff0f1;
  color: #e76574;
}

.site-footer-credit-icon svg {
  width: 21px;
  height: 21px;
}

.site-footer-credit-body strong {
  display: block;
  margin: 1px 0 6px;
  color: #5b3a33;
  font-size: 14px;
}

.site-footer-credit-body p {
  margin: 0;
  color: #3f302c;
  font-size: 14px;
  line-height: 1.6;
}

.site-footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 28px;
}

.site-footer-links a {
  position: relative;
  min-height: 36px;
  padding: 8px 4px;
  color: #6b4c45;
  font-size: 13px;
  font-weight: 700;
  line-height: 20px;
  text-decoration: none;
  box-sizing: border-box;
}

.site-footer-links a:hover,
.site-footer-links a:focus-visible {
  color: #d55e6b;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.site-footer-copy {
  margin: 10px 0 0;
  color: #806861;
  font-family: "Noto Serif JP", "Yu Mincho", serif;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

@media (max-width: 700px) {
  .site-footer {
    margin-top: 28px;
    padding: 22px 14px calc(20px + env(safe-area-inset-bottom));
  }

  body.ai-game-page.ai-game-mobile-setup-open .site-footer {
    padding-bottom: calc(112px + env(safe-area-inset-bottom));
  }

  .site-footer-credit {
    margin-bottom: 18px;
    border-radius: 15px;
  }

  .site-footer-credit > summary {
    min-height: 54px;
    padding: 12px 14px;
    font-size: 16px;
  }

  .site-footer-credit-body {
    padding: 16px;
  }

  .site-footer-links {
    gap: 4px 18px;
  }

  .site-footer-links a {
    min-height: 42px;
    padding: 11px 2px;
    font-size: 12px;
  }
}

/* AI対局場: 完成イメージに合わせたスマホ対局開始UI。 */
@media (max-width: 1439px) and (orientation: portrait) {
  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open {
    color: #54372f;
    background:
      linear-gradient(180deg, rgba(255, 252, 250, 0.84), rgba(255, 248, 245, 0.95)),
      image-set(url("/assets/portal-spring-landscape-v1.avif") type("image/avif"), url("/assets/portal-spring-landscape-v1.webp") type("image/webp"), url("/assets/portal-spring-landscape-v1.png") type("image/png")) center 68px / auto 360px no-repeat,
      #fffaf7;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-character-chooser {
    margin: 0 0 12px;
    padding: 13px 11px 12px;
    border-color: rgba(236, 195, 190, 0.92);
    border-radius: 17px;
    background: rgba(255, 254, 252, 0.94);
    box-shadow: 0 7px 20px rgba(105, 63, 52, 0.07);
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-character-chooser-heading {
    align-items: center;
    margin: 0 1px 11px;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-character-chooser-heading > div {
    position: relative;
    padding-left: 27px;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-character-chooser-heading > div::before {
    position: absolute;
    top: 2px;
    left: 0;
    color: #ef8d9a;
    font-size: 22px;
    line-height: 1;
    content: "✿";
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-character-chooser-heading span {
    color: #d66672;
    font-size: 8px;
    letter-spacing: 0.11em;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-character-chooser-heading h2 {
    margin-top: 0;
    font-size: 18px;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-character-chooser-heading a {
    padding: 5px 8px;
    border: 1px solid #edc9c5;
    border-radius: 999px;
    color: #b65a64;
    background: #fffaf8;
    font-size: 8px;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-character-choices {
    display: flex;
    gap: 8px;
    margin: 0 -2px;
    padding: 2px 2px 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    scrollbar-color: #edb3b9 transparent;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-character-choice {
    position: relative;
    display: grid;
    flex: 0 0 104px;
    grid-template-columns: 1fr;
    grid-template-rows: 84px auto;
    gap: 5px;
    min-width: 104px;
    min-height: 126px;
    padding: 5px 5px 7px;
    overflow: hidden;
    border-color: #ead9d4;
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.96);
    scroll-snap-align: start;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-character-choice.is-selected::after {
    position: absolute;
    top: 5px;
    right: 5px;
    display: grid;
    width: 21px;
    height: 21px;
    place-items: center;
    border: 2px solid #fff;
    border-radius: 50%;
    color: #fff;
    background: #ed6374;
    font-size: 11px;
    font-weight: 900;
    content: "✓";
    box-shadow: 0 2px 6px rgba(163, 64, 77, 0.23);
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-character-choice-art {
    width: 100%;
    height: 84px;
    border: 0;
    border-radius: 10px;
    background-color: #faefed;
    background-position: center 22%;
    box-shadow: inset 0 0 0 1px rgba(226, 190, 182, 0.72);
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-character-choice-label {
    display: block;
    padding: 0 2px;
    text-align: center;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-character-choice-label strong {
    color: #59372f;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 13px;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-character-choice-label small {
    margin-top: 2px;
    color: #8a6e67;
    font-size: 7px;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-character-preset {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 10px;
    margin: 0 0 13px;
    padding: 9px;
    border-color: #efc4c6;
    border-radius: 15px;
    background: linear-gradient(135deg, #fff7f7, #fffdfb);
    box-shadow: 0 6px 18px rgba(111, 67, 58, 0.07);
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-character-preset-art {
    width: 82px;
    height: 88px;
    border: 1px solid #edcfca;
    border-radius: 12px;
    background-position: var(--ai-character-portrait-position, center 18%) !important;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-character-preset-copy > span {
    color: #df6977;
    font-size: 8px;
    letter-spacing: 0.08em;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-character-preset h2 {
    margin: 0 0 5px;
    font-size: 20px;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open #aiGameCharacterMeta,
  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-character-preset a {
    display: none;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-character-preset-details {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    margin: 0;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-character-preset-details > div {
    min-width: 0;
    padding: 4px 3px;
    border: 1px solid #eedbd6;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.82);
    text-align: center;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-character-preset-details dt {
    color: #c96872;
    font-size: 7px;
    font-weight: 800;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-character-preset-details dd {
    margin: 1px 0 0;
    overflow: hidden;
    color: #694940;
    font-size: 8px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-quick-mode {
    margin: 0 0 12px;
    padding: 12px 10px 10px;
    border: 1px solid rgba(236, 199, 192, 0.88);
    border-radius: 16px;
    background: rgba(255, 254, 252, 0.94);
    box-shadow: 0 6px 18px rgba(105, 63, 52, 0.06);
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-quick-mode legend {
    padding: 0 7px;
    color: #5f4037;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 16px;
    font-weight: 700;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-quick-mode legend::before {
    margin-right: 7px;
    color: #ef8e9a;
    content: "✿";
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-quick-mode .ai-game-mode-grid {
    gap: 8px;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-quick-mode .ai-game-mode-card {
    position: relative;
    min-height: 78px;
    padding: 11px 8px 9px 45px;
    border-color: #ead9d4;
    border-radius: 12px;
    color: #5d3d35;
    background: #fff;
    text-align: left;
    box-shadow: 0 3px 9px rgba(101, 62, 52, 0.05);
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-quick-mode .ai-game-mode-card.active {
    border-color: #ed6677;
    background: linear-gradient(145deg, #fff7f7, #ffecef);
    box-shadow: inset 0 0 0 1px #ed6677, 0 4px 11px rgba(202, 91, 105, 0.12);
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open #aiGameModeStudy.active {
    border-color: #70a9a0;
    background: linear-gradient(145deg, #f7fffc, #e8f5ef);
    box-shadow: inset 0 0 0 1px #70a9a0, 0 4px 11px rgba(83, 136, 125, 0.12);
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-quick-mode .ai-game-mode-card strong {
    color: #56382f;
    font-size: 13px;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-quick-mode .ai-game-mode-card span {
    color: #8b716a;
    font-size: 7px;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-quick-mode .ai-game-mode-card::before,
  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-quick-mode .ai-game-mode-card::after {
    position: absolute;
    border-radius: 50%;
    content: "";
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open #aiGameModeSerious::before {
    top: 19px;
    left: 12px;
    width: 25px;
    height: 25px;
    border: 1px solid #d7cec8;
    background: radial-gradient(circle at 35% 28%, #fff 0 44%, #e7dfda 76%, #c9beb6 100%);
    box-shadow: 0 2px 5px rgba(91, 56, 48, 0.2);
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open #aiGameModeSerious::after {
    top: 30px;
    left: 26px;
    width: 18px;
    height: 18px;
    background: radial-gradient(circle at 35% 28%, #595959 0 8%, #171717 54%, #000 100%);
    box-shadow: 0 2px 5px rgba(65, 38, 32, 0.3);
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open #aiGameModeStudy::before {
    top: 20px;
    left: 12px;
    width: 27px;
    height: 31px;
    border: 2px solid #70a99f;
    border-radius: 5px;
    background:
      linear-gradient(90deg, transparent 47%, #70a99f 48% 52%, transparent 53%),
      repeating-linear-gradient(180deg, transparent 0 6px, rgba(112, 169, 159, 0.42) 7px 8px);
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open #aiGameModeStudy::after {
    top: 41px;
    left: 31px;
    width: 13px;
    height: 3px;
    border-radius: 3px;
    background: #e37683;
    transform: rotate(45deg);
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-quick-time {
    position: relative;
    display: grid;
    grid-template-columns: 35px minmax(0, 1fr) auto;
    gap: 8px;
    min-height: 58px;
    margin: 0 0 12px;
    padding: 8px 10px;
    border: 1px solid rgba(236, 199, 192, 0.9);
    border-radius: 14px;
    background: rgba(255, 254, 252, 0.95);
    box-shadow: 0 5px 15px rgba(105, 63, 52, 0.055);
    box-sizing: border-box;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-quick-time::before {
    display: grid;
    width: 29px;
    height: 29px;
    place-items: center;
    border: 2px solid #e17380;
    border-radius: 50%;
    color: #d96371;
    font-size: 17px;
    font-weight: 900;
    line-height: 1;
    content: "◷";
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-quick-time > span {
    color: #604037;
    font-size: 11px;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-quick-time select {
    min-width: 92px;
    min-height: 38px;
    padding: 6px 28px 6px 10px;
    border-color: #e4cdc6;
    border-radius: 9px;
    color: #5f4037;
    background-color: #fff;
    font-size: 12px;
    font-weight: 800;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-custom-settings {
    margin: 0;
    border-color: rgba(231, 196, 188, 0.92);
    border-radius: 14px;
    background: rgba(255, 254, 252, 0.95);
    box-shadow: 0 5px 15px rgba(105, 63, 52, 0.055);
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-custom-settings > summary {
    min-height: 57px;
    padding: 9px 12px 9px 49px;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-custom-settings > summary::before {
    position: absolute;
    margin-left: -36px;
    color: #db6c79;
    font-size: 24px;
    line-height: 1;
    content: "⚙";
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-custom-settings > summary::after {
    color: #c55d69;
    font-size: 18px;
    content: "⌄";
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-custom-settings[open] > summary::after {
    content: "⌃";
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-custom-settings > summary span {
    font-size: 13px;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open .ai-game-custom-settings > summary small {
    font-size: 8px;
  }
}

/* AI対局場: 承認済み完成イメージに合わせたスマホ対局中UI。 */
.ai-game-page .ai-game-mobile-after-start {
  display: none;
}

.ai-game-page .ai-game-mobile-after-start[hidden] {
  display: none !important;
}

@media (max-width: 1439px) and (orientation: portrait) {
  body.ai-game-page {
    --ai-game-mobile-pink: #ef6671;
    --ai-game-mobile-pink-dark: #dc4d5d;
    --ai-game-mobile-pink-soft: #fff2f2;
    --ai-game-mobile-line: rgba(232, 157, 151, 0.5);
    --ai-game-mobile-ink: #3f2720;
    --ai-game-mobile-card: rgba(255, 253, 250, 0.96);
  }

  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] {
    display: flex !important;
    width: 100% !important;
    max-width: 920px !important;
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    margin: 0 auto !important;
    padding: 10px 8px 18px !important;
    box-sizing: border-box;
  }

  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-mobile-after-start:not([hidden]) {
    display: block;
  }

  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-mobile-match-hero { order: 1; }
  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-mobile-scoreboard { order: 2; }
  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-board-area { order: 3; }
  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-mobile-character-message { order: 4; }
  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-mobile-actions { order: 5; }
  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-mobile-match-info { order: 6; }
  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-left-panel { order: 7; }
  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-right-panel { order: 8; }
  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-mobile-farewell { order: 9; }

  .ai-game-mobile-match-hero,
  .ai-game-mobile-scoreboard,
  .ai-game-mobile-character-message,
  .ai-game-mobile-match-info,
  .ai-game-mobile-farewell {
    min-width: 0;
    border: 1px solid var(--ai-game-mobile-line);
    border-radius: 13px;
    background: var(--ai-game-mobile-card);
    box-shadow: 0 5px 14px rgba(135, 78, 65, 0.045);
    box-sizing: border-box;
  }

  .ai-game-mobile-match-hero {
    position: relative;
    min-height: 174px;
    overflow: hidden;
    background:
      radial-gradient(circle at 8% 74%, rgba(245, 165, 175, 0.18) 0 13px, transparent 14px),
      radial-gradient(circle at 93% 19%, rgba(245, 165, 175, 0.2) 0 10px, transparent 11px),
      linear-gradient(116deg, rgba(255, 253, 250, 0.99), rgba(255, 247, 246, 0.96));
  }

  .ai-game-mobile-match-hero::after {
    position: absolute;
    right: 12px;
    bottom: 8px;
    color: rgba(236, 122, 136, 0.24);
    font-size: 25px;
    letter-spacing: 7px;
    content: "✿ ❀";
  }

  .ai-game-mobile-hero-heading {
    position: absolute;
    z-index: 3;
    top: 18px;
    left: 17px;
  }

  .ai-game-mobile-hero-heading h1 {
    margin: 0;
    color: #38241e;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: clamp(25px, 7vw, 36px);
    font-weight: 500;
    letter-spacing: 0.04em;
    line-height: 1.1;
  }

  .ai-game-mobile-hero-heading > span {
    display: inline-flex;
    min-height: 31px;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
    padding: 4px 10px;
    border: 1px solid rgba(239, 102, 113, 0.45);
    border-radius: 999px;
    background: rgba(255, 252, 250, 0.86);
    color: #7b3e3b;
    font-size: 11px;
    font-weight: 800;
    box-sizing: border-box;
  }

  .ai-game-mobile-hero-heading > span i {
    color: var(--ai-game-mobile-pink);
    font-style: normal;
  }

  .ai-game-mobile-hero-art {
    position: absolute;
    z-index: 2;
    top: 2px;
    bottom: -25px;
    left: 22%;
    width: 47%;
    background-repeat: no-repeat;
    background-position: center top;
    background-size: contain;
    filter: drop-shadow(0 4px 7px rgba(93, 50, 42, 0.11));
    pointer-events: none;
  }

  .ai-game-mobile-hero-profile {
    position: absolute;
    z-index: 3;
    top: 17px;
    right: 15px;
    width: 36%;
    color: var(--ai-game-mobile-ink);
  }

  .ai-game-mobile-hero-name {
    display: flex;
    align-items: baseline;
    gap: 11px;
    margin: 0 0 5px;
    padding: 0 5px 5px;
    border-bottom: 1px solid #eadbd4;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
  }

  .ai-game-mobile-hero-name strong {
    font-size: 17px;
    font-weight: 600;
  }

  .ai-game-mobile-hero-name span {
    font-size: 13px;
  }

  .ai-game-mobile-hero-profile dl {
    margin: 0;
  }

  .ai-game-mobile-hero-profile dl > div {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 4px;
    padding: 4px 5px;
    border-bottom: 1px solid #eadbd4;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 11px;
  }

  .ai-game-mobile-hero-profile dt,
  .ai-game-mobile-hero-profile dd {
    margin: 0;
  }

  .ai-game-mobile-hero-profile dd {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ai-game-mobile-hero-bubble {
    position: relative;
    min-height: 36px;
    margin: 9px 0 0;
    padding: 9px 8px;
    border: 1px solid rgba(239, 102, 113, 0.48);
    border-radius: 20px;
    background: rgba(255, 253, 251, 0.94);
    color: #51312a;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 10px;
    text-align: center;
    box-sizing: border-box;
  }

  .ai-game-mobile-hero-bubble::before {
    position: absolute;
    top: 11px;
    left: -7px;
    width: 12px;
    height: 12px;
    border-bottom: 1px solid rgba(239, 102, 113, 0.48);
    border-left: 1px solid rgba(239, 102, 113, 0.48);
    background: inherit;
    content: "";
    transform: rotate(45deg);
  }

  .ai-game-mobile-match-hero[data-presentation="custom"] {
    min-height: 154px;
  }

  .ai-game-mobile-match-hero[data-presentation="custom"] .ai-game-mobile-hero-art {
    display: none;
  }

  .ai-game-mobile-match-hero[data-presentation="custom"] .ai-game-mobile-hero-profile {
    right: 18px;
    width: 55%;
  }

  .ai-game-mobile-scoreboard {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: stretch;
    min-height: 64px;
    overflow: hidden;
  }

  .ai-game-mobile-score-player {
    display: grid;
    align-content: center;
    gap: 7px;
    padding: 9px 12px;
  }

  .ai-game-mobile-score-player p {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 7px;
    margin: 0;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
  }

  .ai-game-mobile-score-player--opponent p {
    justify-content: flex-end;
  }

  .ai-game-mobile-score-player p:first-child {
    font-size: 12px;
  }

  .ai-game-mobile-score-player p:first-child strong {
    overflow: hidden;
    max-width: 75px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ai-game-mobile-score-stone {
    display: block;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    border-radius: 50%;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
  }

  .ai-game-mobile-score-stone[data-color="B"] { background-image: url("./assets/go-stones/black-stone.svg"); }
  .ai-game-mobile-score-stone[data-color="W"] { background-image: url("./assets/go-stones/white-stone.svg"); }

  .ai-game-mobile-clock {
    padding-top: 5px;
    border-top: 1px solid #eadbd4;
    font-size: 10px;
  }

  .ai-game-mobile-clock strong {
    margin-left: auto;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
  }

  .ai-game-mobile-score-player--opponent .ai-game-mobile-clock strong {
    margin-right: 0;
    margin-left: 5px;
  }

  .ai-game-mobile-score-center {
    display: flex;
    min-width: 96px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    padding: 8px 5px;
    color: var(--ai-game-mobile-pink-dark);
    text-align: center;
  }

  .ai-game-mobile-score-center strong {
    min-width: 96px;
    padding: 5px 9px;
    border: 1px solid rgba(239, 102, 113, 0.45);
    border-radius: 12px;
    background: #fff8f8;
    font-size: 10px;
    box-sizing: border-box;
  }

  .ai-game-mobile-score-center span {
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 16px;
  }

  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-board-area {
    width: calc(100% + 16px) !important;
    margin-inline: -8px !important;
    padding: 0 2px !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-board-frame,
  :root[data-board-coordinates="on"] .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-board-frame {
    width: 100% !important;
    padding: 1px !important;
    border-radius: 10px !important;
    overflow: hidden !important;
  }

  .ai-game-mobile-character-message {
    display: grid !important;
    min-height: 49px;
    grid-template-columns: 44px minmax(0, 1fr) 38px;
    align-items: center;
    gap: 8px;
    padding: 7px 11px;
  }

  .ai-game-mobile-message-avatar,
  .ai-game-mobile-farewell > span {
    display: block;
    width: 40px;
    height: 40px;
    border: 2px solid #fff;
    border-radius: 50%;
    background-color: #fff0f1;
    background-position: center 15%;
    background-repeat: no-repeat;
    background-size: 145%;
    box-shadow: 0 0 0 1px rgba(230, 149, 148, 0.55);
  }

  .ai-game-mobile-character-message p {
    margin: 0;
    padding: 8px 10px;
    border: 1px solid #f1ded8;
    border-radius: 14px;
    background: rgba(255, 250, 248, 0.85);
    color: #55382f;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 10px;
    line-height: 1.45;
  }

  .ai-game-mobile-character-message > button {
    position: relative;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid rgba(239, 102, 113, 0.55);
    border-radius: 10px;
    background: #fffafa;
  }

  .ai-game-mobile-character-message > button > span::before {
    color: var(--ai-game-mobile-pink);
    font-size: 20px;
    content: "♪";
  }

  .ai-game-mobile-character-message[data-presentation="custom"] {
    grid-template-columns: minmax(0, 1fr);
  }

  .ai-game-mobile-character-message[data-presentation="custom"] .ai-game-mobile-message-avatar,
  .ai-game-mobile-character-message[data-presentation="custom"] button {
    display: none;
  }

  .ai-game-mobile-actions {
    display: grid !important;
    gap: 8px;
  }

  .ai-game-mobile-actions-primary,
  .ai-game-mobile-actions-secondary {
    display: grid;
    gap: 7px;
  }

  .ai-game-mobile-actions-primary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ai-game-mobile-actions-secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .ai-game-mobile-actions button {
    min-width: 0;
    min-height: 46px;
    padding: 8px 5px;
    border: 1px solid #d9b5aa;
    border-radius: 10px;
    background: rgba(255, 253, 251, 0.96);
    color: #4b3028;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 13px;
    cursor: pointer;
  }

  .ai-game-mobile-actions button.is-primary {
    border-color: var(--ai-game-mobile-pink);
    background: linear-gradient(135deg, #f47781, #e55564);
    color: #fff;
    box-shadow: 0 6px 13px rgba(215, 75, 92, 0.19);
  }

  .ai-game-mobile-actions-secondary button {
    min-height: 41px;
    border-color: var(--ai-game-mobile-pink);
    color: var(--ai-game-mobile-pink-dark);
    font-size: 12px;
  }

  .ai-game-mobile-actions button:disabled {
    cursor: not-allowed;
    filter: grayscale(0.3);
    opacity: 0.43;
  }

  .ai-game-mobile-action-icon {
    position: relative;
    display: inline-block;
    width: 15px;
    height: 16px;
    margin-right: 8px;
    vertical-align: -3px;
  }

  .ai-game-mobile-action-icon--flag {
    border-left: 2px solid currentColor;
  }

  .ai-game-mobile-action-icon--flag::before {
    position: absolute;
    top: 0;
    left: 1px;
    border-width: 5px 0 5px 10px;
    border-style: solid;
    border-color: transparent transparent transparent currentColor;
    content: "";
  }

  .ai-game-mobile-action-icon--pause::before,
  .ai-game-mobile-action-icon--pause::after {
    position: absolute;
    top: 1px;
    bottom: 1px;
    width: 4px;
    border-radius: 2px;
    background: currentColor;
    content: "";
  }

  .ai-game-mobile-action-icon--pause::before { left: 1px; }
  .ai-game-mobile-action-icon--pause::after { right: 1px; }

  .ai-game-mobile-match-info {
    padding: 10px 14px 8px;
  }

  .ai-game-mobile-match-info h2 {
    margin: 0 0 6px;
    color: var(--ai-game-mobile-ink);
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 15px;
    font-weight: 600;
  }

  .ai-game-mobile-match-info h2 span {
    margin-right: 7px;
    color: #efa0a8;
  }

  .ai-game-mobile-match-info dl {
    margin: 0;
  }

  .ai-game-mobile-match-info dl > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(120px, auto);
    gap: 12px;
    padding: 5px 8px;
    border-top: 1px solid #efddd7;
    color: #412b25;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 11px;
  }

  .ai-game-mobile-match-info dt,
  .ai-game-mobile-match-info dd {
    margin: 0;
  }

  .ai-game-mobile-match-info dd {
    text-align: right;
  }

  .ai-game-mobile-farewell {
    position: relative;
    display: grid !important;
    min-height: 53px;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    padding: 5px 11px;
    overflow: hidden;
    border-width: 2px;
  }

  .ai-game-mobile-farewell p {
    margin: 0;
    color: #4c3028;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 12px;
    text-align: center;
  }

  .ai-game-mobile-farewell i {
    color: rgba(238, 123, 137, 0.34);
    font-size: 17px;
    font-style: normal;
    white-space: nowrap;
  }

  .ai-game-mobile-farewell[data-presentation="custom"] {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .ai-game-mobile-farewell[data-presentation="custom"] > span {
    display: none;
  }

  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-left-notice,
  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-left-toolbar,
  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-status-panel,
  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-match-panel {
    display: none !important;
  }

  .ai-game-page .ai-game-shell[data-phase="playing"][data-match-type="human-ai"] .ai-game-left-panel {
    display: none !important;
  }

  .ai-game-page .ai-game-shell[data-phase="ended"] .ai-game-result-mode-row {
    display: none !important;
  }

  .ai-game-page .ai-game-shell:is([data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-left-panel {
    position: static !important;
    display: flex;
    width: 100%;
    max-height: none;
    padding: 0;
    overflow: visible;
  }

  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-right-panel {
    position: static !important;
    display: flex;
    width: 100%;
    max-height: none;
    padding: 0;
    overflow: visible;
  }

  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-right-panel > .ai-game-panel:not(.ai-game-match-panel) {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .ai-game-mobile-match-hero {
    min-height: 165px;
  }

  .ai-game-mobile-hero-heading {
    top: 15px;
    left: 13px;
  }

  .ai-game-mobile-hero-heading h1 {
    font-size: 25px;
  }

  .ai-game-mobile-hero-heading > span {
    min-height: 28px;
    padding-inline: 8px;
    font-size: 9px;
  }

  .ai-game-mobile-hero-art {
    left: 20%;
    width: 49%;
  }

  .ai-game-mobile-hero-profile {
    top: 14px;
    right: 10px;
    width: 37%;
  }

  .ai-game-mobile-hero-name {
    gap: 7px;
  }

  .ai-game-mobile-hero-name strong { font-size: 15px; }
  .ai-game-mobile-hero-name span { font-size: 11px; }
  .ai-game-mobile-hero-profile dl > div { grid-template-columns: 34px minmax(0, 1fr); padding-inline: 3px; font-size: 9px; }
  .ai-game-mobile-hero-bubble { margin-top: 7px; padding: 8px 4px; font-size: 8px; }
  .ai-game-mobile-score-player { padding-inline: 8px; }
  .ai-game-mobile-score-player p:first-child { font-size: 10px; }
  .ai-game-mobile-score-stone { width: 21px; height: 21px; flex-basis: 21px; }
  .ai-game-mobile-score-center { min-width: 86px; padding-inline: 3px; }
  .ai-game-mobile-score-center strong { min-width: 86px; padding-inline: 5px; font-size: 9px; }
  .ai-game-mobile-clock { font-size: 8px; }
  .ai-game-mobile-clock strong { font-size: 11px; }
  .ai-game-mobile-actions button { font-size: 11px; }
}

/* Mobile page-flow scrolling and edge-to-edge boards r1 (2026-08-13). */
@media (max-width: 700px) {
  html,
  body {
    overscroll-behavior-y: auto;
  }

  body.workspace-mobile-minimal .workspace,
  body.workspace-spring-page .workspace {
    padding-inline: 0 !important;
  }

  body.workspace-mobile-minimal .board-workspace-panel,
  body.workspace-spring-page .board-workspace-panel {
    width: 100vw !important;
    max-width: 100vw !important;
    margin-inline: calc(50% - 50vw) !important;
    padding: 2px !important;
    border-right-width: 0 !important;
    border-left-width: 0 !important;
    border-radius: 0 !important;
  }

  body.workspace-mobile-minimal .board-workspace-panel > .board-stage,
  body.workspace-spring-page .board-workspace-panel > .board-stage {
    width: 100% !important;
    padding: 1px !important;
    border-right-width: 0;
    border-left-width: 0;
    border-radius: 0 !important;
    box-sizing: border-box;
  }

  body.workspace-mobile-minimal .board-stage > #board.goban,
  body.workspace-spring-page .board-stage > #board.goban {
    width: 100% !important;
    max-width: 100% !important;
    touch-action: pan-y pinch-zoom;
  }

  body.workspace-mobile-minimal .workspace-mobile-tools-below,
  body.workspace-mobile-minimal .workspace-mobile-tools-below > *,
  body.workspace-mobile-minimal .workspace-mobile-tools-below :is(
    .workspace-right-rail,
    .workspace-right-panels,
    .workspace-right-tab-panel,
    .analysis-right-stack,
    .result-panel,
    .editor-panel,
    .left-nav-history-list
  ) {
    height: auto !important;
    max-height: none !important;
    overflow-y: visible !important;
    overscroll-behavior-y: auto !important;
    touch-action: pan-y;
  }

  body.workspace-mobile-minimal .workspace-mobile-tools-below .game-tree {
    height: auto !important;
    max-height: none !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    overscroll-behavior: auto !important;
    touch-action: pan-x pan-y;
  }

  .ai-game-page .ai-game-shell,
  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="suspended"], [data-phase="scoring"], [data-phase="ended"]) {
    width: 100vw !important;
    max-width: 100vw !important;
    margin-inline: 0 !important;
    padding-top: 0 !important;
    padding-bottom: calc(10px + env(safe-area-inset-bottom)) !important;
  }

  .ai-game-page .ai-game-board-area,
  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-board-area {
    position: static !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 1px !important;
    overflow: visible !important;
    border-right-width: 0;
    border-left-width: 0;
    border-radius: 0 !important;
    box-sizing: border-box;
  }

  .ai-game-page .ai-game-board-frame,
  :root[data-board-coordinates="on"] .ai-game-page .ai-game-board-frame {
    width: 100% !important;
    max-width: 100% !important;
    padding: 1px !important;
    border-radius: 0 !important;
    box-sizing: border-box;
  }

  :root[data-board-coordinates="on"] .ai-game-page .ai-game-board-frame {
    padding: 19px 1px 2px 19px !important;
  }

  .ai-game-page .ai-game-board.goban {
    width: 100% !important;
    max-width: 100% !important;
    touch-action: pan-y pinch-zoom;
  }

  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-left-toolbar {
    position: static !important;
    z-index: auto;
    width: 100% !important;
    margin: 0 !important;
    padding: 6px !important;
    border: 1px solid rgba(42, 76, 55, 0.18);
    border-radius: 10px !important;
    box-shadow: none;
    backdrop-filter: none;
    touch-action: pan-y;
  }

  .ai-game-page :is(.ai-game-left-panel, .ai-game-right-panel, .ai-game-panel),
  .qk-shell,
  .qk-form-panel,
  .qk-board-panel,
  .qa-ans-board-container {
    overscroll-behavior-y: auto !important;
    touch-action: pan-y;
  }

  .qk-board-panel {
    padding-inline: 0 !important;
    overflow-y: visible !important;
  }

  .qk-board-wrap,
  .qa-ans-board-container .qk-board-wrap {
    width: 100%;
    padding: 1px !important;
    border-radius: 0;
    box-sizing: border-box;
  }

  .qa-ans-board-container {
    padding-inline: 0;
  }

  .qa-ans-board-container .qa-board {
    width: 100%;
    max-width: 100%;
  }

  .qa-page-body .qa-page-content,
  .qa-page-body .qa-question-page,
  .qa-page-body .qd-layout,
  .qa-page-body .qd-main,
  .qa-page-body .qd-question-card,
  .qa-page-body .qd-question-detail-grid {
    width: 100% !important;
    max-width: 100% !important;
    margin-inline: 0 !important;
    box-sizing: border-box;
  }

  .qa-page-body .qa-question-page {
    padding-inline: 0 !important;
  }

  .qa-page-body .qd-question-board-col {
    padding-inline: 1px !important;
  }

  .qa-page-body :is(.qd-q-board-slot, .qd-ai-board-slot) .qa-board {
    max-width: 100% !important;
    touch-action: pan-y pinch-zoom;
  }
}

/* Mobile global navigation: one shared hamburger containing only the six main pages. */
@media (max-width: 700px), (orientation: portrait) and (min-width: 701px) and (max-width: 1439px) {
  :root {
    --mobile-top-nav-height: 0px;
  }

  body .site-header.site-header {
    position: fixed !important;
    top: 0;
    right: 0;
    left: 0;
    width: 100%;
    transform: translateY(0);
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
  }

  body.has-mobile-bottom-nav {
    padding-top: var(--mobile-header-height);
  }

  body .site-header.site-header.is-scroll-hidden:not(.is-menu-open) {
    transform: translateY(calc(-100% - 2px)) !important;
    pointer-events: none;
  }

  .mobile-bottom-nav {
    display: none !important;
  }

  body .site-header.site-header .site-header-menu-button {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    width: 40px;
    min-width: 40px;
    flex: 0 0 40px;
    order: 2;
  }

  .site-header .qa-topnav-nav {
    display: none !important;
  }

  body .site-header.site-header.is-menu-open .qa-topnav-nav {
    position: absolute;
    top: calc(100% + 1px);
    right: 8px;
    left: 8px;
    z-index: 230;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    padding: 10px;
    border: 1px solid rgba(226, 194, 185, 0.92);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 14px 30px rgba(82, 52, 42, 0.16);
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  @media (prefers-reduced-motion: reduce) {
    body .site-header.site-header {
      transition: none;
    }
  }

  .site-header.is-menu-open .qa-topnav-nav a {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    min-height: 48px;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 12px;
    text-align: left;
  }

  .workspace-mobile-tools-below {
    display: grid;
    width: 100%;
    max-width: 100%;
    gap: 10px;
    margin-top: 10px;
    padding: 0 4px 12px;
    box-sizing: border-box;
  }

  .workspace-mobile-tools-below > * {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    box-sizing: border-box;
  }

  body.workspace-mobile-minimal .side-panel[data-board-focus-ready="true"] {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
  }

  body.ai-game-page .workspace-mobile-menu,
  body.ai-game-page .workspace-mobile-menu-backdrop {
    display: none !important;
  }

  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="suspended"], [data-phase="scoring"], [data-phase="ended"]) .ai-game-board-area {
    order: 1;
  }

  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="suspended"], [data-phase="scoring"], [data-phase="ended"]) .ai-game-left-panel {
    order: 2;
  }

  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="suspended"], [data-phase="scoring"], [data-phase="ended"]) .ai-game-right-panel {
    order: 3;
  }
}

@media (max-width: 360px) {
  .site-header .site-header-inner {
    gap: 4px;
    padding-inline: 7px;
  }

  .site-header .qa-topnav-logo {
    flex: 0 1 120px;
    min-width: 0;
  }

  .site-header .qa-topnav-logo .qa-brand-wordmark {
    width: 92px;
    max-width: none;
  }

  .site-header .qa-topnav-logo::after {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
    margin-left: -8px;
  }
}

/* iPhone幅: ユーザー部分を圧縮し、ハンバーガーメニューが画面外へ切れないようにする v20260815 */
@media (max-width: 430px) {
  .site-header .qa-topnav-right {
    min-width: 0;
    gap: 4px;
  }

  body .site-header.site-header .qa-account-menu {
    box-sizing: border-box;
    width: 58px;
    min-width: 0 !important;
    max-width: 58px;
    flex: 0 0 58px;
  }

  body .site-header.site-header .qa-account-menu .qa-account-menu-button {
    box-sizing: border-box;
    width: 58px;
    min-width: 58px;
    max-width: 58px;
    gap: 3px;
    padding: 3px 5px 3px 3px;
    overflow: hidden;
  }

  .site-header .qa-header-avatar {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
  }

  body .site-header.site-header .qa-account-menu .qa-topnav-user {
    min-width: 0;
    max-width: 16px;
  }

  .site-header .qa-topnav-chevron {
    display: none !important;
  }
}

@media (max-width: 700px) {
  .portal-home-page .portal-hero {
    min-height: 0;
    padding-top: 18px;
  }

  .portal-home-page .portal-hero::before {
    inset: -8px -8px auto;
    height: 246px;
    background:
      linear-gradient(180deg, rgba(255, 250, 247, 0.02) 0%, rgba(255, 250, 247, 0.18) 50%, #fffaf7 100%),
      image-set(url("/assets/portal-spring-landscape-v1.avif") type("image/avif"), url("/assets/portal-spring-landscape-v1.webp") type("image/webp"), url("/assets/portal-spring-landscape-v1.png") type("image/png")) center / cover no-repeat;
    -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 48%, rgba(0, 0, 0, 0.68) 70%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 0%, #000 48%, rgba(0, 0, 0, 0.68) 70%, transparent 100%);
  }

  .portal-home-page .portal-hero-character {
    width: 116px;
    height: 144px;
    margin: 0 10px 8px -4px;
    background-size: 190px auto;
    background-position: center top;
  }

  .portal-home-page .portal-hero-character::before {
    top: 12px;
    left: -1px;
    font-size: 18px;
    text-shadow: 22px -5px 0 #ffd7df, 0 38px 0 #f9c1cb;
  }

  .portal-home-page .portal-hero-character::after {
    top: 40px;
    right: -1px;
    font-size: 15px;
    text-shadow: 0 35px 0 #f3a9b8, 13px 20px 0 #ffe0e5;
  }

  .portal-home-page .portal-hero-copy {
    min-height: 142px;
    margin: 0 0 14px 118px;
    padding: 12px 13px;
    border-width: 1px;
    border-radius: 18px;
  }

  .portal-home-page .portal-hero-copy::before {
    left: -13px;
    border-top-width: 10px;
    border-right-width: 13px;
    border-bottom-width: 10px;
  }

  .portal-home-page .portal-hero-copy::after {
    left: -11px;
    border-top-width: 9px;
    border-right-width: 12px;
    border-bottom-width: 9px;
  }

  .portal-home-page .portal-hero-copy h1 {
    font-size: 19px;
  }

  .portal-home-page .portal-hero-copy p {
    font-size: 12px;
  }

  .portal-bottom-scenery {
    height: 172px;
    margin-top: -50px;
    background-size: auto, auto 165%;
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.2) 22%, rgba(0, 0, 0, 0.82) 52%, #000 72%);
    mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.2) 22%, rgba(0, 0, 0, 0.82) 52%, #000 72%);
  }
}

/* Final 1536px composition tuning against the supplied home reference. */
@media (min-width: 1201px) {
  .portal-home-page .portal-shell {
    isolation: isolate;
  }

  .portal-home-page .portal-shell::before {
    position: absolute;
    z-index: 0;
    top: 0;
    left: 50%;
    width: 100vw;
    height: 292px;
    background:
      linear-gradient(180deg, rgba(243, 251, 250, 0) 0%, rgba(243, 251, 250, 0.03) 72%, rgba(243, 251, 250, 0.7) 94%, #f3fbfa 100%),
      image-set(url("/assets/portal-spring-landscape-v1.avif") type("image/avif"), url("/assets/portal-spring-landscape-v1.webp") type("image/webp"), url("/assets/portal-spring-landscape-v1.png") type("image/png")) center 58% / cover no-repeat;
    content: "";
    pointer-events: none;
    transform: translateX(-50%);
    -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 82%, rgba(0, 0, 0, 0.82) 91%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 0%, #000 82%, rgba(0, 0, 0, 0.82) 91%, transparent 100%);
  }

  .portal-home-page .portal-home-sidebar,
  .portal-home-page .portal-hero,
  .portal-home-page .portal-character-showcase,
  .portal-home-page .portal-home-columns {
    position: relative;
    z-index: 1;
  }

  .portal-home-page .portal-hero {
    grid-template-columns: 230px minmax(190px, 220px) minmax(0, 1fr);
    gap: 12px;
    min-height: 258px;
    padding: 4px 12px 3px;
  }

  .portal-home-page .portal-hero::before {
    display: none;
  }

  .portal-home-page .portal-hero-character {
    align-self: start;
    width: 282px;
    height: 251px;
    margin: -3px 0 0 -27px;
    background-size: 282px auto;
    background-position: center -14px;
  }

  .portal-home-page .portal-hero-copy {
    align-self: start;
    min-height: 0;
    margin-top: 30px;
    padding: 13px 16px;
  }

  .portal-home-page .portal-hero-copy h1 {
    font-size: 19px;
    line-height: 1.52;
    white-space: nowrap;
  }

  .portal-home-page .portal-hero-copy p {
    margin-top: 6px;
    font-size: 11px;
    white-space: nowrap;
  }

  .portal-home-page .portal-hero-actions {
    align-self: end;
    margin-bottom: 7px;
  }

  .portal-home-page .portal-action-card {
    min-height: 146px;
  }

  .portal-home-page .portal-character-showcase {
    margin-top: -8px;
    padding: 10px 12px 11px;
  }

  .portal-home-page .portal-character-art {
    aspect-ratio: 1;
  }

  .portal-home-page .portal-side-recent nav a {
    min-height: 56px;
  }

  .portal-home-page .portal-side-promo {
    min-height: 200px;
  }
}

/* Enlarge the complete home composition at 100% browser zoom on ultrawide displays. */
@media (min-width: 2200px) {
  .portal-home-page .portal-shell {
    zoom: 1.1;
  }

  .portal-home-page .portal-shell::before {
    width: 90.91vw;
  }

  .portal-home-page .portal-side-opponents li {
    grid-template-columns: 18px 40px minmax(0, 1fr);
    min-height: 58px;
  }

  .portal-home-page .portal-side-avatar {
    width: 40px;
    height: 40px;
  }

  .portal-home-page .portal-side-quote .portal-side-character,
  .portal-home-page .portal-side-favorite .portal-side-character {
    width: 80px;
    height: 80px;
  }
}

@media (min-width: 3000px) {
  .portal-home-page .portal-shell {
    zoom: 1.25;
  }

  .portal-home-page .portal-shell::before {
    width: 80vw;
  }
}

/* Spring character game and Q&A visual alignment r7 (2026-08-11). */
.ai-game-page,
.qa-page-body {
  min-height: 100dvh;
  overflow-x: hidden;
  color: #4c3028;
  background:
    linear-gradient(180deg, rgba(255, 252, 250, 0.38) 0%, rgba(255, 250, 247, 0.78) 54%, #f6fbed 100%),
    image-set(url("/assets/portal-spring-landscape-v1.avif") type("image/avif"), url("/assets/portal-spring-landscape-v1.webp") type("image/webp"), url("/assets/portal-spring-landscape-v1.png") type("image/png")) center 78px / 100% auto no-repeat fixed,
    #fffaf7;
}

.ai-game-page .ai-game-shell {
  width: min(1540px, calc(100% - 42px));
  margin: 22px auto 70px;
  grid-template-columns: 300px minmax(590px, 1fr) 350px;
  gap: 18px;
}

.ai-game-page .ai-game-panel,
.ai-game-page .ai-game-board-area {
  border-color: rgba(235, 204, 196, 0.94);
  border-radius: 18px;
  background: rgba(255, 254, 252, 0.93);
  box-shadow: 0 12px 32px rgba(97, 63, 52, 0.085);
  backdrop-filter: blur(12px) saturate(1.06);
  -webkit-backdrop-filter: blur(12px) saturate(1.06);
}

.ai-game-page .ai-game-panel > header span,
.ai-game-page .ai-game-match-header > span,
.ai-game-page .ai-game-section-header span {
  color: #d45c68;
}

.ai-game-page .ai-game-panel h1,
.ai-game-page .ai-game-panel h2,
.ai-game-page .ai-game-board-header strong {
  color: #4f3028;
  font-family: "Noto Serif JP", serif;
}

.ai-game-page .ai-game-character-chooser {
  margin: 10px 0 12px;
  padding: 11px;
  border: 1px solid #efd9d3;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(255, 249, 248, 0.97), rgba(255, 255, 253, 0.94));
}

.ai-game-page .ai-game-character-chooser[hidden] {
  display: none;
}

.ai-game-page .ai-game-character-chooser-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}

.ai-game-page .ai-game-character-chooser-heading span {
  display: block;
  color: #d45c68;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.09em;
}

.ai-game-page .ai-game-character-chooser-heading h2 {
  margin: 1px 0 0;
  font-size: 15px;
}

.ai-game-page .ai-game-character-chooser-heading a {
  color: #b85b63;
  font-size: 9px;
  font-weight: 800;
  text-decoration: none;
}

.ai-game-page .ai-game-character-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.ai-game-page .ai-game-character-choice {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  min-width: 0;
  padding: 5px;
  border: 1px solid #eadbd5;
  border-radius: 11px;
  color: #634139;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 3px 8px rgba(100, 65, 53, 0.05);
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.ai-game-page .ai-game-character-choice:hover {
  transform: translateY(-1px);
  border-color: #eba8b0;
  box-shadow: 0 5px 11px rgba(202, 91, 105, 0.12);
}

.ai-game-page .ai-game-character-choice.is-selected {
  border-color: #ed6677;
  background: linear-gradient(145deg, #fff5f6, #ffe9ed);
  box-shadow: 0 0 0 2px rgba(237, 102, 119, 0.14), 0 5px 11px rgba(202, 91, 105, 0.12);
}

.ai-game-page .ai-game-character-choice-art {
  width: 42px;
  height: 42px;
  border: 2px solid #fff;
  border-radius: 50%;
  background-color: #f9eeee;
  background-position: center;
  background-size: cover;
  box-shadow: 0 0 0 1px #ead5cf;
}

.ai-game-page .ai-game-character-choice-label {
  display: block;
  min-width: 0;
  padding-left: 5px;
  text-align: left;
}

.ai-game-page .ai-game-character-choice-label strong,
.ai-game-page .ai-game-character-choice-label small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-game-page .ai-game-character-choice-label strong {
  color: #63382f;
  font-size: 12px;
}

.ai-game-page .ai-game-character-choice-label small {
  margin-top: 2px;
  color: #8c7770;
  font-size: 8px;
}

.ai-game-page .ai-game-character-preset {
  border-color: #efc8c8;
  background: linear-gradient(140deg, #fff6f7, #fffdfb);
}

.ai-game-page .ai-game-setup-actions--quick-start {
  margin: 10px 0 12px;
}

.ai-game-page .ai-game-quick-mode {
  margin: 10px 0 0;
}

.ai-game-page .ai-game-quick-mode .ai-game-mode-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.ai-game-page .ai-game-quick-mode .ai-game-mode-card {
  min-height: 59px;
  align-content: center;
  padding: 8px 9px;
  text-align: center;
}

.ai-game-page .ai-game-quick-mode .ai-game-mode-card strong {
  font-size: 13px;
}

.ai-game-page .ai-game-quick-mode .ai-game-mode-card span {
  font-size: 8px;
  line-height: 1.35;
}

.ai-game-page .ai-game-quick-time {
  display: grid;
  grid-template-columns: auto minmax(118px, 1fr);
  gap: 9px;
  align-items: center;
  margin-top: 9px;
}

.ai-game-page .ai-game-quick-time > span {
  color: #70463d;
  font-size: 11px;
  font-weight: 800;
}

.ai-game-page .ai-game-quick-time select {
  min-height: 38px;
}

.ai-game-page .ai-game-setup-actions--quick-start .ai-game-primary {
  width: 100%;
  min-height: 46px;
  font-size: 14px;
  box-shadow: 0 8px 18px rgba(213, 83, 101, 0.2);
}

.ai-game-page .ai-game-custom-settings {
  margin-top: 3px;
  border: 1px solid #ead8d1;
  border-radius: 13px;
  background: rgba(255, 253, 251, 0.88);
  overflow: hidden;
}

.ai-game-page .ai-game-custom-settings > summary {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 43px;
  padding: 9px 12px;
  box-sizing: border-box;
  color: #70463d;
  cursor: pointer;
  list-style: none;
}

.ai-game-page .ai-game-custom-settings > summary::-webkit-details-marker {
  display: none;
}

.ai-game-page .ai-game-custom-settings > summary::after {
  margin-left: auto;
  color: #c45d69;
  font-size: 16px;
  content: "＋";
}

.ai-game-page .ai-game-custom-settings[open] > summary::after {
  content: "−";
}

.ai-game-page .ai-game-custom-settings > summary span {
  font-size: 13px;
  font-weight: 800;
}

.ai-game-page .ai-game-custom-settings > summary small {
  color: #9a7e76;
  font-size: 9px;
}

.ai-game-page .ai-game-custom-settings-body {
  padding: 2px 11px 12px;
  border-top: 1px solid #f0dfda;
}

.ai-game-page .ai-game-custom-settings-body > :first-child {
  margin-top: 10px;
}

.ai-game-page .ai-game-custom-settings-start {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #f0dfda;
}

.ai-game-page .ai-game-custom-settings-start .ai-game-primary {
  width: 100%;
  min-height: 44px;
}

.ai-game-page .ai-game-board-area {
  padding: 15px;
  background: rgba(255, 253, 248, 0.95);
}

.ai-game-page .ai-game-board-frame {
  overflow: visible;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.ai-game-page .ai-game-board-header {
  border-color: #ead9d1;
  background: rgba(255, 250, 247, 0.92);
}

.ai-game-page .ai-game-mode-badge {
  border-color: #efc3c5;
  color: #b84d59 !important;
  background: #fff0f2;
}

.ai-game-page .ai-game-mode-card,
.ai-game-page .ai-game-panel select,
.ai-game-page .ai-game-panel input {
  border-color: #ead8d1;
  border-radius: 11px;
  background: rgba(255, 253, 251, 0.96);
}

.ai-game-page .ai-game-mode-card.active {
  border-color: #ee7783;
  color: #8d3944;
  background: linear-gradient(145deg, #fff5f6, #ffecef);
  box-shadow: inset 0 0 0 1px rgba(225, 91, 106, 0.3);
}

.ai-game-page .ai-game-primary,
.ai-game-page #aiGameStartBtn {
  border-color: #e95566;
  background: linear-gradient(145deg, #f57a87, #df4055);
  color: #fff;
  box-shadow: 0 8px 16px rgba(210, 63, 81, 0.19);
}

.ai-game-page .ai-game-secondary,
.ai-game-page .ai-game-view-controls button,
.ai-game-page .ai-game-play-controls button {
  border-color: #e7cfc8;
  border-radius: 10px;
  color: #71483d;
  background: rgba(255, 253, 251, 0.96);
}

.ai-game-page .ai-game-play-controls #aiGameToolbarHintBtn,
.ai-game-page .ai-game-study-actions button:first-child {
  border-color: #a9c9ef;
  color: #3975bd;
  background: #f1f7ff;
}

.ai-game-page .ai-game-match-panel {
  background: linear-gradient(180deg, rgba(255, 250, 250, 0.98), rgba(255, 255, 253, 0.96));
}

.ai-game-page .ai-game-match-panel::before {
  right: 16px;
  left: 16px;
  height: 4px;
  background: linear-gradient(90deg, #f4a7b1, #dd6572, #f6bdc6);
}

.ai-game-character-presence {
  --ai-character-effect-primary: rgba(239, 130, 148, 0.34);
  --ai-character-effect-secondary: rgba(255, 214, 170, 0.3);
  --ai-character-effect-stone: rgba(255, 255, 255, 0.62);
  position: relative;
  isolation: isolate;
  min-height: 230px;
  margin: 0 0 13px;
  overflow: hidden;
  border: 1px solid #f1d6d2;
  border-radius: 16px;
  background:
    radial-gradient(circle at 16% 18%, rgba(255, 255, 255, 0.82), transparent 28%),
    linear-gradient(145deg, #fff6f7, #f9eef0 64%, #fffaf6);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.72),
    inset 0 0 28px var(--ai-character-effect-primary),
    0 10px 24px rgba(111, 63, 64, 0.12);
  animation: ai-game-character-frame-pulse 4.2s ease-in-out infinite;
}

.ai-game-character-presence[data-character="mina"] { --ai-character-effect-primary: rgba(239, 125, 148, 0.38); --ai-character-effect-secondary: rgba(255, 204, 183, 0.34); background: linear-gradient(120deg, #f9dfe5, #fff5f6 78%); }
.ai-game-character-presence[data-character="yuki"] { --ai-character-effect-primary: rgba(92, 181, 232, 0.34); --ai-character-effect-secondary: rgba(194, 231, 255, 0.42); background: linear-gradient(120deg, #e4f3fb, #f8fcff 78%); }
.ai-game-character-presence[data-character="akari"] { --ai-character-effect-primary: rgba(117, 176, 83, 0.33); --ai-character-effect-secondary: rgba(208, 232, 153, 0.4); background: linear-gradient(120deg, #e9f4df, #fbfdf7 78%); }
.ai-game-character-presence[data-character="riri"] { --ai-character-effect-primary: rgba(137, 91, 201, 0.34); --ai-character-effect-secondary: rgba(222, 183, 246, 0.4); background: linear-gradient(120deg, #e9def7, #faf6ff 78%); }
.ai-game-character-presence[data-character="haru"] { --ai-character-effect-primary: rgba(232, 171, 48, 0.35); --ai-character-effect-secondary: rgba(255, 223, 132, 0.43); background: linear-gradient(120deg, #faedc9, #fffaf0 78%); }
.ai-game-character-presence[data-character="sakura"] { --ai-character-effect-primary: rgba(185, 55, 75, 0.34); --ai-character-effect-secondary: rgba(247, 160, 174, 0.38); background: linear-gradient(120deg, #f4d9dd, #fff5f6 78%); }
.ai-game-character-presence[data-character="ren"] { --ai-character-effect-primary: rgba(51, 103, 166, 0.36); --ai-character-effect-secondary: rgba(140, 191, 236, 0.38); background: linear-gradient(120deg, #dce9f7, #f7fbff 78%); }
.ai-game-character-presence[data-character="sota"] { --ai-character-effect-primary: rgba(205, 84, 47, 0.34); --ai-character-effect-secondary: rgba(244, 171, 102, 0.4); background: linear-gradient(120deg, #f7ddd3, #fff8f2 78%); }

.ai-game-character-presence[hidden] {
  display: none;
}

.ai-game-character-presence-backdrop {
  position: absolute;
  z-index: 0;
  inset: 0;
  background-repeat: no-repeat;
  background-position: left 18%;
  background-size: cover;
  -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 58%, rgba(0, 0, 0, 0.78) 68%, rgba(0, 0, 0, 0.22) 80%, transparent 90%);
  mask-image: linear-gradient(90deg, #000 0%, #000 58%, rgba(0, 0, 0, 0.78) 68%, rgba(0, 0, 0, 0.22) 80%, transparent 90%);
  filter: saturate(0.94) brightness(1.035) blur(0.35px);
  transform: scale(1.006);
  transform-origin: center;
  pointer-events: none;
}

.ai-game-character-presence::before {
  position: absolute;
  z-index: 1;
  inset: -42%;
  background:
    radial-gradient(circle at 18% 26%, var(--ai-character-effect-stone) 0 4px, transparent 5px),
    radial-gradient(circle at 72% 18%, var(--ai-character-effect-stone) 0 3px, transparent 4px),
    radial-gradient(circle at 48% 78%, var(--ai-character-effect-stone) 0 4px, transparent 5px),
    radial-gradient(circle at 82% 68%, rgba(255, 255, 255, 0.78) 0 2px, transparent 4px),
    radial-gradient(circle at 30% 48%, var(--ai-character-effect-primary) 0 15%, transparent 36%),
    radial-gradient(circle at 73% 55%, var(--ai-character-effect-secondary) 0 18%, transparent 40%),
    conic-gradient(from 20deg at 54% 48%, transparent 0 18%, var(--ai-character-effect-primary) 31%, rgba(255, 255, 255, 0.6) 37%, transparent 47% 68%, var(--ai-character-effect-secondary) 80%, transparent 95%);
  background-size: 72px 72px, 104px 104px, 138px 138px, 86px 86px, auto, auto, auto;
  padding: 22px 28px;
  box-sizing: border-box;
  color: rgba(255, 255, 255, 0.8);
  font-size: 19px;
  font-weight: 700;
  line-height: 2.55;
  letter-spacing: 17px;
  white-space: pre;
  opacity: 0.82;
  transform: translate3d(-2%, 1%, 0) rotate(0deg);
  transform-origin: center;
  animation: ai-game-character-background-drift 14s linear infinite;
  pointer-events: none;
  content: "";
}

.ai-game-character-presence[data-character="mina"]::before {
  color: rgba(238, 105, 139, 0.78);
  content: "❀　✿　❀　✿\A　✿　❀　✿　❀\A❀　✿　❀　✿\A　✿　❀　✿　❀";
  animation-name: ai-game-mina-blossoms;
}

.ai-game-character-presence[data-character="yuki"]::before {
  color: rgba(255, 255, 255, 0.96);
  font-size: 21px;
  text-shadow: 0 0 7px rgba(73, 158, 217, 0.62);
  content: "❄　❅　❆　❄\A　❆　❄　❅　❆\A❅　❄　❆　❅\A　❄　❆　❄　❅";
  animation-name: ai-game-yuki-snowfall;
  animation-duration: 18s;
}

.ai-game-character-presence[data-character="akari"]::before {
  color: rgba(76, 143, 63, 0.72);
  font-size: 23px;
  content: "❧　◆　❧　◆\A　◆　❧　◆　❧\A❧　◆　❧　◆\A　◆　❧　◆　❧";
  animation-name: ai-game-akari-leaves;
  animation-duration: 16s;
}

.ai-game-character-presence[data-character="riri"]::before {
  color: rgba(129, 72, 198, 0.82);
  font-size: 22px;
  text-shadow: 0 0 9px rgba(221, 179, 255, 0.9);
  content: "✦　✧　⋆　✦\A　⋆　✦　✧　⋆\A✧　⋆　✦　✧\A　✦　✧　⋆　✦";
  animation-name: ai-game-riri-magic-orbit;
  animation-duration: 13s;
}

.ai-game-character-presence[data-character="haru"]::before {
  color: rgba(237, 175, 42, 0.86);
  font-size: 22px;
  text-shadow: 0 0 10px rgba(255, 239, 164, 0.98);
  content: "✦　✧　✦　✧\A　✧　✦　✧　✦\A✦　✧　✦　✧\A　✧　✦　✧　✦";
  animation-name: ai-game-haru-sun-sparkle;
  animation-duration: 7s;
}

.ai-game-character-presence[data-character="sakura"]::before {
  color: rgba(156, 35, 61, 0.8);
  font-size: 21px;
  text-shadow: 0 0 8px rgba(248, 136, 155, 0.72);
  content: "✿　❀　✿　❀\A　❀　✿　❀　✿\A✿　❀　✿　❀\A　❀　✿　❀　✿";
  animation-name: ai-game-sakura-crimson-petals;
  animation-duration: 14s;
}

.ai-game-character-presence[data-character="ren"]::before {
  color: rgba(50, 94, 157, 0.62);
  font-family: Georgia, serif;
  font-size: 19px;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.92);
  content: "●　○　●　○\A　○　●　○　●\A●　○　●　○\A　○　●　○　●";
  animation-name: ai-game-ren-go-ripples;
  animation-duration: 17s;
}

.ai-game-character-presence[data-character="sota"]::before {
  color: rgba(198, 61, 31, 0.84);
  font-size: 22px;
  text-shadow: 0 0 9px rgba(255, 184, 77, 0.94);
  content: "✦　⋆　◆　✦\A　◆　✦　⋆　◆\A⋆　◆　✦　⋆\A　✦　⋆　◆　✦";
  animation-name: ai-game-sota-rising-embers;
  animation-duration: 10s;
}

.ai-game-shell[data-phase="playing"] .ai-game-character-presence::before {
  opacity: 0.96;
  animation-duration: 9s;
}

.ai-game-character-presence-art {
  position: absolute;
  z-index: 3;
  inset: 0;
  background-repeat: no-repeat;
  background-position: var(--ai-character-portrait-position, left 18%) !important;
  background-size: var(--ai-character-portrait-size, cover) !important;
  filter: drop-shadow(0 8px 13px rgba(94, 58, 49, 0.12));
}

@keyframes ai-game-character-background-drift {
  0% {
    transform: translate3d(-2%, 1%, 0) rotate(0deg) scale(1);
  }
  50% {
    transform: translate3d(3%, -2%, 0) rotate(180deg) scale(1.035);
  }
  100% {
    transform: translate3d(-2%, 1%, 0) rotate(360deg) scale(1);
  }
}

@keyframes ai-game-mina-blossoms {
  0% { transform: translate3d(-5%, -7%, 0) rotate(-8deg) scale(1.02); }
  50% { transform: translate3d(4%, 3%, 0) rotate(7deg) scale(1.06); }
  100% { transform: translate3d(-5%, -7%, 0) rotate(-8deg) scale(1.02); }
}

@keyframes ai-game-yuki-snowfall {
  0% { transform: translate3d(-2%, -13%, 0) rotate(0deg); }
  50% { transform: translate3d(3%, 1%, 0) rotate(4deg); }
  100% { transform: translate3d(-1%, 15%, 0) rotate(-3deg); }
}

@keyframes ai-game-akari-leaves {
  0% { transform: translate3d(-7%, -6%, 0) rotate(-13deg); }
  50% { transform: translate3d(5%, 2%, 0) rotate(10deg); }
  100% { transform: translate3d(-4%, 10%, 0) rotate(-7deg); }
}

@keyframes ai-game-riri-magic-orbit {
  0% { transform: rotate(0deg) scale(0.96); opacity: 0.68; }
  50% { transform: rotate(180deg) scale(1.09); opacity: 1; }
  100% { transform: rotate(360deg) scale(0.96); opacity: 0.68; }
}

@keyframes ai-game-haru-sun-sparkle {
  0%, 100% { transform: scale(0.96) rotate(-2deg); opacity: 0.56; }
  45% { transform: scale(1.08) rotate(3deg); opacity: 1; }
  65% { transform: scale(1.01) rotate(-1deg); opacity: 0.74; }
}

@keyframes ai-game-sakura-crimson-petals {
  0% { transform: translate3d(5%, -11%, 0) rotate(14deg); }
  50% { transform: translate3d(-3%, 1%, 0) rotate(-9deg); }
  100% { transform: translate3d(4%, 13%, 0) rotate(12deg); }
}

@keyframes ai-game-ren-go-ripples {
  0%, 100% { transform: translate3d(-2%, 0, 0) scale(0.98); opacity: 0.6; }
  50% { transform: translate3d(3%, -1%, 0) scale(1.08); opacity: 0.9; }
}

@keyframes ai-game-sota-rising-embers {
  0% { transform: translate3d(-2%, 15%, 0) rotate(-4deg) scale(0.96); opacity: 0.55; }
  55% { transform: translate3d(3%, 0, 0) rotate(5deg) scale(1.05); opacity: 1; }
  100% { transform: translate3d(-1%, -16%, 0) rotate(-3deg) scale(0.98); opacity: 0.58; }
}

@keyframes ai-game-character-frame-pulse {
  0%, 100% {
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.72),
      inset 0 0 22px var(--ai-character-effect-primary),
      0 10px 24px rgba(111, 63, 64, 0.12);
  }
  50% {
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.96),
      inset 0 0 42px var(--ai-character-effect-secondary),
      0 12px 30px var(--ai-character-effect-primary);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-game-character-presence,
  .ai-game-character-presence::before {
    animation: none !important;
    transform: translate3d(0, 0, 0);
  }

}

.ai-game-character-presence-flower {
  position: absolute;
  z-index: 4;
  top: 18px;
  left: 16px;
  color: transparent;
  font-size: 0;
  text-shadow: none;
  transform: rotate(-12deg);
}

.ai-game-character-presence-flower::before {
  color: #f0a0ad;
  font-size: 25px;
  text-shadow: 34px -8px 0 #ffd1d8, 10px 46px 0 #f7bdc7;
  content: "✿";
}

.ai-game-character-presence[data-character="yuki"] .ai-game-character-presence-flower::before { color: #78bce8; text-shadow: 31px -7px 0 #d7f2ff, 8px 45px 0 #a8daf4; content: "❄"; }
.ai-game-character-presence[data-character="akari"] .ai-game-character-presence-flower::before { color: #74a95b; text-shadow: 31px -7px 0 #d9efbd, 8px 45px 0 #acd184; content: "❧"; }
.ai-game-character-presence[data-character="riri"] .ai-game-character-presence-flower::before { color: #8f63c8; text-shadow: 31px -7px 0 #e1c4f6, 8px 45px 0 #b98cdd; content: "✦"; }
.ai-game-character-presence[data-character="haru"] .ai-game-character-presence-flower::before { color: #dda82d; text-shadow: 31px -7px 0 #fff0aa, 8px 45px 0 #f3cd64; content: "✧"; }
.ai-game-character-presence[data-character="sakura"] .ai-game-character-presence-flower::before { color: #9e2c46; text-shadow: 31px -7px 0 #f3a4b2, 8px 45px 0 #c95f74; content: "❀"; }
.ai-game-character-presence[data-character="ren"] .ai-game-character-presence-flower::before { color: #3e6fa8; text-shadow: 31px -7px 0 #d6e8fa, 8px 45px 0 #86b1dd; content: "●"; }
.ai-game-character-presence[data-character="sota"] .ai-game-character-presence-flower::before { color: #c9512c; text-shadow: 31px -7px 0 #ffd69a, 8px 45px 0 #ef9149; content: "✦"; }

.ai-game-character-prompt {
  position: absolute;
  z-index: 5;
  top: 8px;
  right: 7px;
  width: clamp(86px, 29%, 96px);
  margin: 0 !important;
  padding: 7px 8px;
  box-sizing: border-box;
  border: 1.5px solid #ead0cb;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.95);
  color: #5a362e !important;
  font-size: 9px !important;
  font-weight: 800;
  line-height: 1.4 !important;
  box-shadow: 0 5px 12px rgba(89, 57, 49, 0.09);
}

.ai-game-character-prompt::before,
.ai-game-character-prompt::after {
  position: absolute;
  top: 17px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  content: "";
}

.ai-game-character-prompt::before {
  left: -10px;
  border-right: 10px solid #ead0cb;
}

.ai-game-character-prompt::after {
  left: -8px;
  border-right: 9px solid #fff;
}

.ai-game-page .ai-game-voice-control {
  border-color: #f0d5cf;
  border-radius: 13px;
  background: linear-gradient(135deg, #fffaf8, #fff);
}

.ai-game-page .ai-game-voice-mark {
  width: 42px;
  height: 42px;
  border: 2px solid #fff;
  border-radius: 50%;
  background-color: #f8e8e6;
  background-position: center;
  background-size: cover;
  box-shadow: 0 0 0 1px #eccdc8, 0 4px 9px rgba(91, 57, 49, 0.12);
}

.ai-game-page .ai-game-voice-mark[data-character] i {
  display: none;
}

.ai-game-page .ai-game-voice-identity strong {
  color: #6b3d34;
}

.ai-game-page #aiGameVoiceToggleBtn[aria-pressed="true"] {
  border-color: #6b9dd8;
  background: #edf6ff;
  color: #3472ba;
}

.ai-game-page .ai-game-voice-caption {
  border: 1px solid #f0d7c6;
  border-radius: 12px;
  background: #fff8ec;
  color: #614b39;
}

.ai-game-page .ai-game-right-panel .ai-game-player-strip {
  border-color: #ecdcd6;
  background: rgba(255, 255, 255, 0.94);
}

.qa-page-body .qa-page-content {
  width: min(1500px, calc(100% - 48px));
  max-width: none;
  padding: 30px 0 76px;
}

.qa-page-body .qa-entry-panel {
  grid-template-columns: 235px minmax(300px, 0.82fr) minmax(500px, 1.18fr);
  gap: 22px;
  min-height: 204px;
  padding: 0 26px;
  overflow: hidden;
  border-color: #efc8ca;
  border-radius: 19px;
  background:
    radial-gradient(circle at 94% 18%, rgba(255, 214, 222, 0.38), transparent 24%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 247, 248, 0.95));
  box-shadow: 0 12px 30px rgba(108, 69, 57, 0.08);
}

.qa-page-body .qa-entry-panel::before {
  display: none;
}

.qa-entry-character {
  align-self: end;
  width: 235px;
  height: 196px;
  margin-bottom: -18px;
  background: url("/assets/portal-mina-guide-v1-768.png") center top / 292px auto no-repeat;
  filter: drop-shadow(0 10px 12px rgba(91, 57, 48, 0.12));
}

.qa-page-body .qa-entry-intro {
  padding: 8px 18px 8px 0;
  border-right-color: #efdcd7;
}

.qa-page-body .qa-entry-label,
.qa-page-body .qa-section-kicker,
.qa-page-body .qa-sidebar-kicker {
  color: #ce5663;
}

.qa-page-body .qa-entry-intro h1,
.qa-page-body .qa-section-title,
.qa-page-body .qa-sidebar-title {
  color: #4b2c25;
}

.qa-page-body .qa-entry-search {
  border-color: #e4d4cd;
  background: rgba(255, 255, 255, 0.9);
}

.qa-page-body .qa-entry-search:focus-within {
  border-color: #e16a77;
  box-shadow: 0 0 0 3px rgba(225, 106, 119, 0.12);
}

.qa-page-body .qa-entry-action {
  min-height: 76px;
  border-width: 2px;
  border-radius: 14px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.42), 0 7px 0 rgba(91, 63, 55, 0.1);
}

.qa-page-body .qa-entry-action--ask {
  border-color: #ed5c70;
  background: linear-gradient(145deg, #fa7f8d, #ed4e65);
  color: #fff;
}

.qa-page-body .qa-entry-action--answer {
  border-color: #5ca5e4;
  background: linear-gradient(145deg, #69b7ee, #4698dc);
  color: #fff;
}

.qa-page-body .qa-entry-action--ask:hover {
  background: linear-gradient(145deg, #fb8a96, #e9435b);
}

.qa-page-body .qa-entry-action--answer:hover {
  border-color: #4c98d9;
  background: linear-gradient(145deg, #77c0f0, #3f8ed1);
}

.qa-page-body .qa-entry-action--answer .qa-entry-action-icon {
  background: rgba(255, 255, 255, 0.18);
}

.qa-page-body .qa-categories-section,
.qa-page-body .qa-home-section,
.qa-page-body .qa-sidebar-box {
  border-color: #ead8d1;
  background: rgba(255, 254, 252, 0.93);
  box-shadow: 0 10px 26px rgba(96, 65, 54, 0.065);
  backdrop-filter: blur(11px);
  -webkit-backdrop-filter: blur(11px);
}

.qa-page-body .qa-category-item {
  border-color: #e8ddd6;
  border-radius: 13px;
  background: #fffdfa;
}

.qa-page-body .qa-category-item[data-category="布石"] { background: #f3f9ee; border-color: #d3e5c6; }
.qa-page-body .qa-category-item[data-category="定石"] { background: #f2f7ff; border-color: #cfdff2; }
.qa-page-body .qa-category-item[data-category="中盤"] { background: #f1faf5; border-color: #cce6d6; }
.qa-page-body .qa-category-item[data-category="死活"] { background: #f8f2ff; border-color: #ded0ee; }
.qa-page-body .qa-category-item[data-category="攻め合い"] { background: #fff3f4; border-color: #efced1; }
.qa-page-body .qa-category-item[data-category="ヨセ"] { background: #fff8ed; border-color: #efddbd; }
.qa-page-body .qa-category-item[data-category="手筋"] { background: #f2f7ff; border-color: #cfdef0; }
.qa-page-body .qa-category-item[data-category="ルール"] { background: #fff7ed; border-color: #edd8b9; }

.qa-page-body .qa-home-layout {
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  margin-top: 18px;
}

.portal-characters-page .portal-characters-shell {
  width: min(1500px, calc(100% - 48px));
  padding-top: 28px;
}

.portal-characters-page .portal-page-heading {
  padding: 18px 20px;
  border: 1px solid rgba(236, 207, 199, 0.9);
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(93, 62, 52, 0.07);
}

.portal-characters-page .portal-character-layout {
  grid-template-columns: minmax(0, 1fr) 410px;
  gap: 24px;
}

.portal-characters-page .portal-character-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.portal-characters-page .portal-character-art {
  aspect-ratio: 1.18;
  background-position: var(--portal-character-position, center 20%) !important;
  background-size: var(--portal-character-size, cover) !important;
}

.portal-characters-page .portal-character-card,
.portal-characters-page .portal-coming-soon article {
  border-radius: 16px;
  background-color: rgba(255, 255, 255, 0.94);
}

.portal-characters-page .portal-character-detail {
  border-color: #efc9c7;
  background: rgba(255, 252, 251, 0.95);
}

@media (max-width: 1320px) {
  .ai-game-page .ai-game-shell {
    grid-template-columns: 270px minmax(520px, 1fr) 320px;
  }

  .qa-page-body .qa-entry-panel {
    grid-template-columns: 190px minmax(260px, 0.8fr) minmax(430px, 1.2fr);
  }

  .qa-entry-character {
    width: 190px;
    background-size: 250px auto;
  }

  .portal-characters-page .portal-character-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .ai-game-page .ai-game-shell {
    grid-template-columns: 1fr;
  }

  .ai-game-page .ai-game-board-area,
  .ai-game-page .ai-game-right-panel {
    position: static;
    max-height: none;
  }

  .ai-game-page .ai-game-character-choices {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .qa-page-body .qa-entry-panel {
    grid-template-columns: 170px minmax(0, 1fr);
    padding-right: 20px;
  }

  .qa-page-body .qa-entry-tools {
    grid-column: 1 / -1;
    margin-bottom: 20px;
  }

  .qa-entry-character {
    width: 170px;
    height: 170px;
    background-size: 225px auto;
  }

  .qa-page-body .qa-home-layout {
    grid-template-columns: 1fr;
  }

  .portal-characters-page .portal-character-layout {
    grid-template-columns: 1fr;
  }

  .portal-characters-page .portal-character-detail {
    position: static;
  }
}

@media (max-width: 700px) {
  .ai-game-page,
  .qa-page-body {
    background-attachment: scroll;
    background-size: auto, auto 420px, auto;
  }

  .ai-game-page .ai-game-shell,
  .qa-page-body .qa-page-content,
  .portal-characters-page .portal-characters-shell {
    width: min(100% - 20px, 680px);
  }

  .ai-game-character-presence {
    min-height: 210px;
  }

  .ai-game-character-presence-art {
    inset: 0;
  }

  .ai-game-page .ai-game-character-choices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .qa-page-body .qa-entry-panel {
    display: block;
    padding: 14px;
  }

  .qa-entry-character {
    float: left;
    width: 112px;
    height: 128px;
    margin: -4px 8px -8px -8px;
    background-size: 172px auto;
  }

  .qa-page-body .qa-entry-intro {
    min-height: 124px;
    padding: 12px 4px;
    border: 0;
  }

  .qa-page-body .qa-entry-tools {
    clear: both;
    margin: 8px 0 0;
  }

  .qa-page-body .qa-entry-actions {
    grid-template-columns: 1fr;
  }

  .portal-characters-page .portal-character-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

/* Spring workspace visual alignment r11 (2026-08-11). */
body.workspace-spring-page {
  --workspace-accent: #d85d6b;
  --workspace-accent-dark: #b84655;
  --workspace-accent-soft: #fff0f2;
  --workspace-card-wash: rgba(255, 239, 241, 0.82);
  min-height: 100dvh;
  overflow-x: hidden;
  color: #4c3028;
  background:
    linear-gradient(180deg, rgba(255, 252, 250, 0.42) 0%, rgba(255, 250, 247, 0.78) 54%, rgba(246, 251, 237, 0.96) 100%),
    image-set(url("/assets/portal-spring-landscape-v1.avif") type("image/avif"), url("/assets/portal-spring-landscape-v1.webp") type("image/webp"), url("/assets/portal-spring-landscape-v1.png") type("image/png")) center 78px / 100% auto no-repeat fixed,
    #fffaf7;
}

body.workspace-spring-page[data-mode="study"] {
  --workspace-accent: #4d9fc7;
  --workspace-accent-dark: #347da1;
  --workspace-accent-soft: #edf8fc;
  --workspace-card-wash: rgba(232, 247, 252, 0.84);
}

body.workspace-spring-page[data-page="kifu-editor"] {
  --workspace-accent: #c76b78;
  --workspace-accent-dark: #a84f5d;
  --workspace-accent-soft: #fff2f4;
  --workspace-card-wash: rgba(255, 239, 242, 0.82);
}

body.workspace-spring-page .app-shell {
  position: relative;
  z-index: 1;
  background: transparent !important;
}

body.workspace-spring-page .workspace {
  gap: 18px 20px;
  padding-top: 18px;
}

body.workspace-spring-page .analysis-workspace-nav,
body.workspace-spring-page .editor-workspace-nav,
body.workspace-spring-page .board-panel,
body.workspace-spring-page .side-panel {
  box-sizing: border-box;
  border: 1px solid rgba(222, 174, 165, 0.72) !important;
  border-radius: 18px !important;
  background: rgba(255, 254, 252, 0.9) !important;
  box-shadow: 0 12px 34px rgba(112, 77, 62, 0.13), 0 2px 8px rgba(112, 77, 62, 0.07) !important;
  backdrop-filter: blur(10px);
}

body.workspace-spring-page .analysis-workspace-nav,
body.workspace-spring-page .editor-workspace-nav {
  padding: 17px 14px 16px;
}

body.workspace-spring-page .board-panel,
body.workspace-spring-page .side-panel {
  padding: 10px;
}

body.workspace-spring-page .analysis-workspace-nav > .nav-head,
body.workspace-spring-page .editor-workspace-nav > .nav-head {
  position: relative;
  margin: -2px 0 13px;
  padding: 2px 28px 12px 2px;
  border-bottom: 1px solid rgba(222, 174, 165, 0.46);
}

body.workspace-spring-page .analysis-workspace-nav > .nav-head::after,
body.workspace-spring-page .editor-workspace-nav > .nav-head::after {
  position: absolute;
  top: -5px;
  right: 2px;
  content: "✿";
  color: #f29baa;
  font-size: 25px;
  line-height: 1;
  text-shadow: 11px 8px 0 rgba(242, 155, 170, 0.36);
}

body.workspace-spring-page .nav-eyebrow {
  color: var(--workspace-accent-dark) !important;
  font-weight: 800;
  letter-spacing: 0.12em;
}

body.workspace-spring-page .nav-head strong,
body.workspace-spring-page .side-panel h2,
body.workspace-spring-page .side-panel h3 {
  color: #543329;
  font-family: "Noto Serif JP", "Yu Mincho", serif;
}

body.workspace-spring-page .analysis-workspace-nav a,
body.workspace-spring-page .editor-workspace-nav a {
  color: var(--workspace-accent-dark);
}

body.workspace-spring-page .analysis-current-kifu,
body.workspace-spring-page .study-left-command,
body.workspace-spring-page .study-start-section,
body.workspace-spring-page .editor-current-kifu,
body.workspace-spring-page .editor-left-tools,
body.workspace-spring-page .editor-left-autosave,
body.workspace-spring-page .board-header,
body.workspace-spring-page .move-controls,
body.workspace-spring-page .workspace-right-tabs,
body.workspace-spring-page .workspace-right-tab-panel {
  border: 1px solid rgba(226, 194, 185, 0.72) !important;
  border-radius: 14px !important;
  background: rgba(255, 255, 255, 0.82) !important;
  box-shadow: 0 4px 13px rgba(104, 72, 58, 0.06);
}

body.workspace-spring-page .analysis-current-kifu,
body.workspace-spring-page .study-left-command,
body.workspace-spring-page .study-start-section,
body.workspace-spring-page .editor-current-kifu,
body.workspace-spring-page .editor-left-tools,
body.workspace-spring-page .editor-left-autosave {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.94), var(--workspace-card-wash)) !important;
}

body.workspace-spring-page .board-header {
  margin-bottom: 9px;
  padding: 10px 13px;
}

body.workspace-spring-page .board-stage {
  overflow: hidden;
  border: 1px solid rgba(190, 145, 111, 0.44);
  border-radius: 14px;
  background: rgba(255, 249, 237, 0.7);
  box-shadow: 0 7px 20px rgba(91, 61, 42, 0.1);
}

body.workspace-spring-page .goban-wrap {
  box-shadow: inset 0 0 0 1px rgba(123, 78, 43, 0.13), 0 5px 14px rgba(83, 56, 39, 0.09);
}

body.workspace-spring-page .move-controls {
  margin-top: 10px;
  padding: 9px;
}

body.workspace-spring-page :is(.analysis-left-secondary, .editor-left-secondary, .analysis-action-button, .study-action-button, .editor-action-button, .move-controls button) {
  border-color: rgba(203, 134, 137, 0.62) !important;
  border-radius: 10px !important;
  color: var(--workspace-accent-dark) !important;
  background: rgba(255, 253, 251, 0.92) !important;
  box-shadow: 0 2px 7px rgba(105, 67, 53, 0.06);
}

body.workspace-spring-page :is(.analysis-left-secondary, .editor-left-secondary, .analysis-action-button, .study-action-button, .editor-action-button, .move-controls button):hover:not(:disabled) {
  border-color: var(--workspace-accent) !important;
  background: var(--workspace-accent-soft) !important;
  transform: translateY(-1px);
}

body.workspace-spring-page :is(.analysis-left-primary, .editor-left-primary, .analysis-qa-action, .study-btn-primary):not(:disabled) {
  border-color: var(--workspace-accent) !important;
  color: #fff !important;
  background: linear-gradient(135deg, var(--workspace-accent), var(--workspace-accent-dark)) !important;
  box-shadow: 0 6px 15px rgba(177, 76, 91, 0.2) !important;
}

body.workspace-spring-page .workspace-right-tabs {
  gap: 6px;
  padding: 6px;
}

body.workspace-spring-page .workspace-right-tabs button {
  border: 1px solid transparent;
  border-radius: 10px;
  color: #72574d;
}

body.workspace-spring-page .workspace-right-tabs button.active,
body.workspace-spring-page .workspace-right-tabs button[aria-selected="true"] {
  border-color: rgba(210, 139, 145, 0.48);
  color: var(--workspace-accent-dark);
  background: var(--workspace-accent-soft);
  box-shadow: 0 2px 8px rgba(131, 82, 68, 0.08);
}

body.workspace-spring-page .side-panel section,
body.workspace-spring-page .side-panel .panel-card {
  border-color: rgba(226, 194, 185, 0.68) !important;
  border-radius: 13px !important;
  background: rgba(255, 255, 255, 0.8) !important;
}

body.workspace-spring-page input[type="range"] {
  accent-color: var(--workspace-accent);
}

body.workspace-spring-page :is(.badge, .status-badge, .pill).active {
  color: var(--workspace-accent-dark) !important;
  background: var(--workspace-accent-soft) !important;
}

/* Shared home guest mode: the public entrance uses the logged-in home design. */
.portal-home-guest .site-header[data-site-context="guest"] .qa-topnav-right {
  gap: 8px;
}

.portal-home-guest.portal-page .site-header[data-site-context="guest"] .qa-topnav-ask-btn {
  display: inline-flex;
}

.portal-home-guest .site-header[data-site-context="guest"] .guest-login-link {
  border: 1px solid rgba(228, 129, 151, 0.62);
  color: #a84f68;
  background: rgba(255, 255, 255, 0.88);
}

.portal-home-guest .site-header[data-site-context="guest"] .guest-register-link {
  border-color: #ef829b;
  color: #fff;
  background: linear-gradient(135deg, #f49ab0, #ee7692);
  box-shadow: 0 5px 14px rgba(216, 102, 132, 0.2);
}

.portal-home-guest .portal-hero-copy {
  display: flex;
  flex-direction: column;
}

.portal-guest-auth-actions {
  display: grid;
  gap: 7px;
  margin-top: 13px;
}

.portal-guest-auth-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 35px;
  border: 1px solid rgba(231, 127, 150, 0.56);
  border-radius: 11px;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.portal-guest-register {
  color: #fff;
  background: linear-gradient(135deg, #f49eb2, #ef7793);
  box-shadow: 0 5px 13px rgba(219, 102, 132, 0.18);
}

.portal-guest-login {
  color: #a44f66;
  background: rgba(255, 255, 255, 0.82);
}

.portal-home-guest .portal-side-notices nav a span {
  display: grid;
  gap: 2px;
}

.portal-home-guest .portal-side-notices nav strong {
  font-size: 11px;
}

.portal-home-guest .portal-side-notices nav small {
  color: #766f6a;
  font-size: 8px;
  line-height: 1.45;
}

.portal-guest-benefits,
.portal-guest-steps,
.portal-guest-account-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.portal-guest-benefits li,
.portal-guest-account-list li {
  position: relative;
  padding-left: 19px;
  color: #52635c;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.5;
}

.portal-guest-benefits li::before,
.portal-guest-account-list li::before {
  position: absolute;
  top: 0;
  left: 0;
  color: #5daf86;
  content: "✓";
}

.portal-guest-steps li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  color: #5b6661;
  font-size: 10px;
  font-weight: 700;
}

.portal-guest-steps b {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #82bda4;
}

.portal-home-guest .portal-side-quote .portal-side-card-button {
  margin-top: 8px;
}

.portal-home-guest .portal-side-quote > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  min-height: 82px;
  padding: 5px 0 5px 9px;
}

.portal-home-guest .portal-side-quote p {
  width: auto;
  min-width: 0;
  padding-left: 0;
  font-size: 10px;
  line-height: 1.55;
}

.portal-home-guest .portal-side-quote .portal-side-character {
  position: relative;
  right: auto;
  bottom: auto;
  width: 72px;
  height: 72px;
  align-self: end;
  margin-right: -3px;
}

.portal-home-guest .portal-mypage-card .portal-guest-account-list {
  margin: 12px 0;
}

@media (min-width: 1201px) {
  .portal-home-guest .portal-hero-copy {
    padding: 13px 15px;
  }

  .portal-home-guest .portal-hero-copy h1 {
    font-size: clamp(20px, 1.25vw, 22px);
    line-height: 1.45;
    letter-spacing: -0.035em;
    white-space: nowrap;
  }

  .portal-home-guest .portal-hero-copy p {
    font-size: 11px;
  }
}

@media (max-width: 700px) {
  .portal-home-guest .site-header[data-site-context="guest"] .guest-register-link,
  .portal-home-guest .site-header[data-site-context="guest"] .guest-login-link {
    display: inline-flex !important;
    min-width: 0;
    min-height: 34px;
    padding: 0 10px;
    font-size: 11px;
    white-space: nowrap;
  }

  .portal-home-guest .portal-hero-copy {
    padding-bottom: 18px;
  }
}

/* Home guide prototype: breathing, full-image blinking, and motion control. */
.portal-home-page .portal-hero-guide {
  --portal-guide-image: image-set(url("/assets/portal-mina-guide-v1-768.avif") type("image/avif"), url("/assets/portal-mina-guide-v1-768.webp") type("image/webp"), url("/assets/portal-mina-guide-v1-768.png") type("image/png"));
  --portal-guide-layer-size: 342px auto;
  --portal-guide-layer-position: center top;
  isolation: isolate;
  background: none;
}

.portal-guide-motion-stage {
  position: absolute;
  z-index: 1;
  inset: 0;
  background-image: var(--portal-guide-image);
  background-repeat: no-repeat;
  background-position: var(--portal-guide-layer-position);
  background-size: var(--portal-guide-layer-size);
  pointer-events: none;
  transform-origin: 50% 100%;
  animation: portal-guide-breathe 6.2s ease-in-out infinite;
}

.portal-guide-hair-layer {
  display: none;
}

.portal-guide-blink-frame {
  position: absolute;
  z-index: 2;
  inset: 0;
  background-image: none;
  background-repeat: no-repeat;
  background-position: var(--portal-guide-layer-position);
  background-size: var(--portal-guide-layer-size);
  opacity: 0;
  pointer-events: none;
}

.portal-hero-guide.is-blinking .portal-guide-motion-stage {
  background-image: none;
}

.portal-hero-guide.is-blinking .portal-guide-blink-frame {
  background-image: image-set(url("/assets/portal-mina-guide-blink-composite-v1.avif") type("image/avif"), url("/assets/portal-mina-guide-blink-composite-v1.webp") type("image/webp"), url("/assets/portal-mina-guide-blink-composite-v1.png") type("image/png"));
  opacity: 1;
}

.portal-guide-motion-toggle {
  position: absolute;
  z-index: 4;
  right: 4px;
  bottom: 7px;
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  border: 1px solid rgba(211, 135, 150, 0.48);
  border-radius: 999px;
  color: #8e5260;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 3px 9px rgba(105, 68, 58, 0.1);
  font: 700 9px/1 "Noto Sans JP", sans-serif;
  cursor: pointer;
  backdrop-filter: blur(5px);
}

.portal-guide-motion-toggle:hover,
.portal-guide-motion-toggle:focus-visible {
  border-color: #db8298;
  background: #fff;
  outline: none;
}

.portal-hero-guide.is-motion-paused .portal-guide-motion-stage,
.portal-hero-guide.is-tab-hidden .portal-guide-motion-stage {
  animation: none;
  transform: none;
}

.portal-hero-guide.is-motion-paused .portal-guide-hair-layer,
.portal-hero-guide.is-tab-hidden .portal-guide-hair-layer {
  animation: none;
  transform: none;
}

.portal-hero-guide.is-motion-paused .portal-guide-blink-frame,
.portal-hero-guide.is-tab-hidden .portal-guide-blink-frame {
  opacity: 0;
}

@keyframes portal-guide-breathe {
  0%, 100% { transform: translate(0, 0) rotate(0deg) scaleY(1); }
  18% { transform: translate(0, -2px) rotate(0deg) scaleY(1.01); }
  34% { transform: translate(2px, -3px) rotate(0.22deg) scaleY(1.014); }
  50% { transform: translate(1px, -1px) rotate(0.08deg) scaleY(1.006); }
  66% { transform: translate(3px, -3px) rotate(0.36deg) scaleY(1.014); }
  82% { transform: translate(0, -1px) rotate(0deg) scaleY(1.006); }
}

@media (max-width: 1180px) {
  .portal-home-page .portal-hero-guide {
    --portal-guide-layer-size: 300px auto;
  }
}

@media (max-width: 900px) {
  .portal-home-page .portal-hero-guide {
    --portal-guide-layer-size: 265px auto;
  }
}

@media (max-width: 700px) {
  .portal-home-page .portal-hero-guide {
    --portal-guide-layer-size: 190px auto;
  }

  .portal-guide-motion-toggle {
    right: -2px;
    bottom: 5px;
    min-height: 22px;
    padding: 0 7px;
    font-size: 8px;
  }
}

@media (min-width: 1201px) {
  .portal-home-page .portal-hero-guide {
    --portal-guide-layer-size: 282px auto;
    --portal-guide-layer-position: center -14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .portal-home-page .portal-guide-motion-stage,
  .portal-home-page .portal-guide-hair-layer {
    animation: none;
    transform: none;
  }
}

@media (max-width: 900px) {
  body.workspace-spring-page {
    background-attachment: scroll;
    background-size: auto, auto 520px, auto;
  }

  body.workspace-spring-page .analysis-workspace-nav,
  body.workspace-spring-page .editor-workspace-nav,
  body.workspace-spring-page .board-panel,
  body.workspace-spring-page .side-panel {
    border-radius: 14px !important;
  }
}

/* Mobile kifu editor final accent cascade r18 20260814. */
@media (orientation: portrait) and (max-width: 1439px) {
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-question-host #askQaWithPositionBtn.analysis-qa-action:not(:disabled) {
    display: flex !important;
    min-height: 54px !important;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 9px 12px !important;
    color: #fff !important;
    border: 2px solid #ef6673 !important;
    border-radius: 11px !important;
    background: linear-gradient(135deg, #f47782, #e85f6d) !important;
    box-shadow: 0 6px 15px rgba(203, 73, 89, 0.18) !important;
    font-family: "Noto Serif JP", serif;
    font-size: 16px !important;
    font-weight: 500 !important;
  }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-question-host #askQaWithPositionBtn.analysis-qa-action svg {
    width: 42px !important;
    height: 32px !important;
    color: #fff !important;
    fill: rgba(255, 255, 255, 0.97) !important;
  }
}

/* Final PC home carousel spacing after the 1536px composition rules. */
@media (min-width: 1201px) {
  .portal-home-page .portal-character-showcase {
    margin-top: -3px;
    padding: 16px 24px 19px;
  }
}

/* Mobile kifu analysis refresh r1 (2026-08-17).
   PC版で整理した解析内容を維持し、スマホでは開始・盤面・結果を一続きの春色UIにする。 */
.analysis-mobile-intro,
.analysis-mobile-after-board {
  display: none;
}

@media (orientation: portrait) and (max-width: 1439px) {
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal {
    --analysis-mobile-pink: #ed6876;
    --analysis-mobile-pink-dark: #c94f5d;
    --analysis-mobile-line: rgba(232, 142, 143, 0.46);
    --analysis-mobile-ink: #3f2d2a;
    background:
      radial-gradient(circle at 7% 12%, rgba(246, 185, 181, 0.17), transparent 18rem),
      linear-gradient(180deg, #fff9f7 0%, #fffdfb 100%);
    color: var(--analysis-mobile-ink);
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-intro,
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-after-board {
    display: block;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .study-mobile-intro,
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .study-mobile-after-board,
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .workspace-mobile-tools-below {
    display: none !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-intro {
    padding: 8px 8px 7px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-hero {
    position: relative;
    height: 166px;
    overflow: hidden;
    border: 2px solid rgba(239, 104, 114, 0.34);
    border-radius: 18px;
    background:
      radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.96) 0 4px, transparent 5px),
      radial-gradient(circle at 88% 18%, rgba(244, 163, 169, 0.3) 0 38px, transparent 39px),
      linear-gradient(105deg, #fffdfb 4%, #fff8f6 48%, #fdeae7 100%);
    box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.66), 0 7px 18px rgba(118, 72, 61, 0.06);
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-hero::before,
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-hero::after {
    position: absolute;
    z-index: 0;
    color: rgba(239, 104, 114, 0.34);
    content: "✿";
    font-family: serif;
    line-height: 1;
    pointer-events: none;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-hero::before {
    top: 9px;
    left: 11px;
    font-size: 30px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-hero::after {
    right: 10px;
    bottom: 7px;
    font-size: 40px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-hero-copy {
    position: relative;
    z-index: 3;
    width: 50%;
    padding: 38px 0 0 18px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-hero-copy > span {
    color: #d85b68;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.1em;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-hero-copy h1 {
    margin: 3px 0 7px;
    color: #362522;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: clamp(27px, 8vw, 33px);
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1.18;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-hero-copy p {
    margin: 0;
    color: #725a54;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 10px;
    line-height: 1.65;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-hero > img {
    position: absolute;
    z-index: 2;
    right: 18px;
    bottom: -66px;
    width: 214px;
    max-width: none;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 8px 8px rgba(79, 44, 36, 0.13));
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-hero-balloon {
    position: absolute;
    z-index: 4;
    top: 20px;
    right: 7px;
    width: 76px;
    margin: 0;
    padding: 7px 8px;
    border: 1px solid rgba(225, 146, 142, 0.48);
    border-radius: 999px;
    background: rgba(255, 252, 249, 0.94);
    color: #4c3934;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 9px;
    line-height: 1.5;
    text-align: center;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-load-host {
    margin-top: 8px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-load-host .analysis-desktop-load-actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-load-host button,
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-current-host .analysis-file-actions button {
    display: flex !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 54px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 6px !important;
    border: 1px solid var(--analysis-mobile-line) !important;
    border-radius: 12px !important;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 249, 247, 0.96)) !important;
    box-shadow: 0 4px 12px rgba(105, 63, 54, 0.05) !important;
    color: #5c4641 !important;
    font-family: "Noto Sans JP", "Yu Gothic", sans-serif;
    font-size: 12px !important;
    font-weight: 800;
    line-height: 1.35;
    box-sizing: border-box;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-load-host button svg,
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-current-host .analysis-file-actions button svg {
    width: 24px !important;
    height: 24px !important;
    flex: 0 0 24px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-load-host #leftNavSgfLoadBtn { color: #378bc4 !important; }
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-load-host #analysisOpenAiGamesBtn { color: #70944f !important; }
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-current-host #exportSgfBtn { color: #658f4c !important; }
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-current-host #saveHistoryBtn { color: #db5b69 !important; }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-current-host {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
    margin-top: 7px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-current-host .analysis-current-kifu {
    display: grid !important;
    gap: 4px;
    width: 100%;
    min-width: 0;
    margin: 0 !important;
    padding: 10px 12px !important;
    border: 1px solid var(--analysis-mobile-line) !important;
    border-radius: 12px !important;
    background: rgba(255, 253, 251, 0.9) !important;
    box-shadow: 0 4px 12px rgba(105, 63, 54, 0.04) !important;
    box-sizing: border-box;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-current-host .analysis-current-kifu-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
    color: #806b66;
    font-size: 10px;
    font-weight: 700;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-current-host .analysis-current-kifu > strong {
    overflow: hidden;
    color: #45332f;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-current-host .analysis-current-kifu > span:last-child {
    color: #84716c;
    font-size: 10px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-current-host .analysis-file-actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-status-host {
    margin-top: 7px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-status-host .board-workspace-header {
    display: grid !important;
    width: 100%;
    min-width: 0;
    margin: 0 !important;
    padding: 9px 10px !important;
    border: 1px solid var(--analysis-mobile-line) !important;
    border-radius: 12px !important;
    background: rgba(255, 253, 251, 0.9) !important;
    box-shadow: 0 4px 12px rgba(105, 63, 54, 0.04) !important;
    box-sizing: border-box;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-status-host .board-workspace-mode,
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-status-host .board-view-toggles {
    display: none !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-status-host .board-workspace-context {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-status-host .board-turn-status {
    min-width: 0;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-status-host .capture-table {
    font-size: 10px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-evaluation-host {
    margin-top: 7px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-evaluation-host .workspace-mobile-evaluation {
    display: block;
    width: 100%;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-evaluation-host .winrate-bar-panel.analysis-study-section {
    display: grid !important;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    margin: 0 !important;
    padding: 11px 12px !important;
    border: 1px solid var(--analysis-mobile-line) !important;
    border-radius: 12px !important;
    background: rgba(255, 253, 251, 0.92) !important;
    box-shadow: 0 4px 12px rgba(105, 63, 54, 0.04) !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-evaluation-host .study-result-heading,
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-evaluation-host .winrate-complexity-row,
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-evaluation-host .winrate-stone {
    display: none !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-evaluation-host .bar-score {
    grid-column: 1;
    margin: 0 !important;
    color: #176e4a;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 18px;
    white-space: nowrap;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-evaluation-host .winrate-bar-row {
    display: grid !important;
    min-width: 0;
    grid-column: 2;
    grid-template-columns: auto minmax(34px, 1fr) auto !important;
    align-items: center;
    gap: 5px !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-evaluation-host .winrate-stone-label {
    font-size: 11px !important;
    font-weight: 700;
    white-space: nowrap;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-evaluation-host .winrate-bar {
    height: 8px !important;
    overflow: hidden;
    border: 0 !important;
    border-radius: 999px !important;
    background: #b9d9f5 !important;
    box-shadow: none !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-evaluation-host .winrate-fill.black-side {
    height: 100% !important;
    border-radius: 999px 0 0 999px !important;
    background: #505254 !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-evaluation-host .winrate-fill.black-side::after {
    display: none !important;
    content: none !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .board-workspace-panel {
    display: flex !important;
    width: 100% !important;
    min-width: 0;
    flex-direction: column;
    gap: 0 !important;
    overflow: hidden !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .board-workspace-panel > .board-stage {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border-right: 0 !important;
    border-left: 0 !important;
    border-radius: 0 !important;
    box-sizing: border-box;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-after-board {
    padding: 9px 8px 12px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-after-board > div,
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-after-board > aside {
    margin-bottom: 9px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-feedback-host .board-workspace-feedback {
    display: block !important;
    margin: 0 !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-feedback-host .board-workspace-feedback > :empty {
    display: none !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host {
    display: grid;
    width: 100%;
    min-width: 0;
    gap: 9px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .analysis-desktop-analysis-card,
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .analysis-review-card {
    width: 100% !important;
    min-width: 0;
    margin: 0 !important;
    overflow: hidden;
    border: 1px solid var(--analysis-mobile-line) !important;
    border-radius: 15px !important;
    background: linear-gradient(180deg, rgba(255, 254, 252, 0.99), rgba(255, 249, 247, 0.98)) !important;
    box-shadow: 0 7px 18px rgba(118, 72, 61, 0.065) !important;
    box-sizing: border-box;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .analysis-desktop-analysis-card > header {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    padding: 12px 13px 10px;
    border-bottom: 1px solid rgba(238, 121, 132, 0.32);
    background: linear-gradient(90deg, rgba(255, 241, 243, 0.72), rgba(255, 253, 250, 0.28));
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .analysis-desktop-analysis-card > header > span {
    color: rgba(237, 103, 121, 0.75);
    font-size: 20px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .analysis-desktop-analysis-card > header h2 {
    margin: 0;
    color: #3d2c2a;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 17px;
    letter-spacing: 0.04em;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .analysis-desktop-analysis-card > header p {
    margin: 3px 0 0;
    color: #816b66;
    font-size: 9px;
    line-height: 1.5;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .analysis-desktop-analysis-card > header small {
    padding: 4px 7px;
    border: 1px solid rgba(225, 129, 136, 0.42);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    color: #ad4e58;
    font-size: 9px;
    font-weight: 800;
    white-space: nowrap;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .analysis-desktop-analysis-card .kap-pre-section {
    padding: 5px 10px 10px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .analysis-desktop-analysis-card .kap-header,
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .analysis-desktop-analysis-card .kap-desc,
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .analysis-desktop-analysis-card .kap-group:has(.kap-display-list),
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .analysis-desktop-analysis-card .kap-empty {
    display: none !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .analysis-desktop-analysis-card .kap-divider {
    margin: 0 5px !important;
    background: rgba(232, 151, 147, 0.22);
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .analysis-desktop-analysis-card .kap-group {
    padding: 8px 5px !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .analysis-desktop-analysis-card .kap-target-card {
    display: flex !important;
    min-height: 44px !important;
    align-items: center;
    gap: 8px;
    padding: 9px 10px !important;
    box-sizing: border-box;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .analysis-desktop-analysis-card .kap-target-card svg {
    width: 20px !important;
    height: 20px !important;
    max-width: 20px !important;
    max-height: 20px !important;
    flex: 0 0 20px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .analysis-desktop-analysis-card .kap-group-label {
    margin-bottom: 7px !important;
    color: #4a3734;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 12px !important;
    font-weight: 700;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .kap-analyze-btn {
    display: flex !important;
    width: 100% !important;
    min-height: 54px !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 0 14px !important;
    border: 0 !important;
    border-radius: 12px !important;
    background: linear-gradient(135deg, #ef7480, #df5968) !important;
    box-shadow: 0 7px 16px rgba(200, 72, 89, 0.19) !important;
    color: #fff !important;
    font-size: 15px !important;
    font-weight: 800 !important;
    box-sizing: border-box;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .kap-analyze-btn svg {
    width: 21px !important;
    height: 21px !important;
    max-width: 21px !important;
    max-height: 21px !important;
    flex: 0 0 21px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .kap-range-btns,
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .kap-result-range-btns {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .kap-range-btn,
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .kap-result-range-btn {
    min-width: 0 !important;
    min-height: 40px !important;
    padding: 5px 3px !important;
    font-size: 10px !important;
    white-space: normal;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .analysis-review-card:has(#kapPostSection.hidden) {
    display: none !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host:has(#kapPostSection:not(.hidden)) > .analysis-desktop-analysis-card {
    display: none !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .kap-post-section {
    padding: 0 0 4px !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .kap-post-section > .kap-group:not(.kap-trend-group) {
    margin: 8px !important;
    padding: 11px 10px !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .kap-result-badge-row {
    padding: 9px 11px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .kap-budget-phase-row {
    grid-template-columns: minmax(0, 1.2fr) auto auto;
    gap: 5px;
    padding: 10px 7px;
    font-size: 10px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .kap-rank-tabs {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .kap-rank-tab {
    min-height: 40px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-result-host .kap-rank-row {
    min-width: 0;
    gap: 5px;
    padding: 9px 7px;
    font-size: 10px;
  }

  /* PC版で廃止した診断・比較カードは、互換データが残っていてもスマホに表示しない。 */
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal :is(
    .kap-style-grid,
    .kap-style-phase-details,
    .kap-style-phase-heatmaps,
    .kap-comparison-row,
    .kap-continuation-row,
    .kap-endgame-card,
    .kap-metric-grid,
    .kap-band-grid,
    .kap-move-quality-table
  ) {
    display: none !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-tree-host .board-tree-panel {
    display: block !important;
    width: 100% !important;
    min-width: 0;
    margin: 0 !important;
    padding: 10px 9px 9px !important;
    overflow: hidden !important;
    border: 1px solid var(--analysis-mobile-line) !important;
    border-radius: 15px !important;
    background: linear-gradient(180deg, rgba(255, 254, 252, 0.99), rgba(255, 249, 247, 0.98)) !important;
    box-shadow: 0 7px 18px rgba(118, 72, 61, 0.065) !important;
    box-sizing: border-box;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-tree-host .board-tree-heading-icon,
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-tree-host .board-tree-eyebrow,
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-tree-host .board-tree-heading small,
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-tree-host #gameTreeBranchBadge,
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-tree-host #gameTreeToggleBtn,
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-tree-host .board-tree-legend,
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-tree-host .board-tree-help {
    display: none !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-tree-host .board-tree-header {
    min-height: 38px;
    margin: 0 0 5px;
    padding: 0 2px 7px 28px;
    border-bottom: 1px solid rgba(238, 121, 132, 0.34);
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-tree-host .board-tree-heading {
    padding: 0;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-tree-host .board-tree-heading strong {
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 19px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-tree-host .board-tree-toolbar {
    display: flex !important;
    min-height: 34px;
    justify-content: flex-end;
    margin: 0 1px 5px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-tree-host .game-tree {
    width: 100%;
    height: clamp(112px, 19dvh, 148px) !important;
    min-height: 112px !important;
    max-height: 148px !important;
    padding: 5px 3px 3px !important;
    overflow: auto !important;
    touch-action: pan-x pan-y;
    border-radius: 10px;
    box-sizing: border-box;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-question-host .analysis-qa-section {
    display: block !important;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-question-host .analysis-qa-action {
    display: flex !important;
    width: 100% !important;
    min-height: 58px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 9px 12px !important;
    border: 3px double rgba(255, 255, 255, 0.88) !important;
    border-radius: 13px !important;
    background: linear-gradient(135deg, #ef6670, #df5964) !important;
    box-shadow: 0 7px 16px rgba(215, 83, 94, 0.18) !important;
    color: #fff !important;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 16px !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-question-host .analysis-qa-action svg {
    width: 31px !important;
    height: 31px !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-character-tip {
    position: relative;
    display: flex;
    min-height: 78px;
    align-items: center;
    justify-content: flex-end;
    overflow: hidden;
    padding: 8px 12px;
    border: 1px solid var(--analysis-mobile-line);
    border-radius: 14px;
    background: linear-gradient(90deg, #fff5f2, #fffdfa);
    box-sizing: border-box;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-character-tip img {
    position: absolute;
    left: -4px;
    bottom: -62px;
    width: 150px;
    max-width: none;
    height: auto;
    object-fit: contain;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-character-tip p {
    position: relative;
    width: calc(100% - 103px);
    margin: 0;
    padding: 10px 8px;
    border: 1px solid rgba(229, 143, 139, 0.45);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
  }
}

@media (max-width: 390px) {
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-hero {
    height: 154px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-hero-copy {
    padding-top: 34px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-hero > img {
    right: 6px;
    bottom: -62px;
    width: 200px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-evaluation-host .bar-score {
    font-size: 16px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"].workspace-mobile-minimal .analysis-mobile-evaluation-host .winrate-stone-label {
    font-size: 10px !important;
  }
}

/* Free study: PC three-column character workspace r1 (2026-08-17).
   Keep the center board-only and reuse the AI-game evaluation/tree visual language. */
@media (min-width: 1440px), (orientation: landscape) {
  body.study-desktop-redesign[data-mode="study"] {
    --study-pc-pink: #ef6673;
    --study-pc-pink-soft: #fff3f3;
    --study-pc-line: rgba(229, 142, 142, 0.46);
    --study-pc-ink: #3d2d2a;
  }

  body.study-desktop-redesign[data-mode="study"] .workspace {
    max-width: none !important;
    padding: 12px 18px 22px !important;
    grid-template-columns: 300px minmax(0, var(--workspace-primary-board-stage-size, 646px)) 350px !important;
    gap: 14px !important;
    justify-content: center;
  }

  body.study-desktop-redesign[data-mode="study"] .main-grid,
  body.study-desktop-redesign[data-mode="study"].workspace-board-focus .main-grid {
    width: 100% !important;
    grid-template-columns: 300px minmax(0, var(--workspace-primary-board-stage-size, 646px)) 350px !important;
    gap: 14px !important;
    align-items: start;
    justify-content: center;
  }

  body.study-desktop-redesign[data-mode="study"] #leftNav.analysis-workspace-nav {
    position: sticky;
    top: 76px;
    display: block !important;
    width: 300px !important;
    max-height: calc(100dvh - 92px);
    padding: 0 !important;
    overflow-x: hidden;
    overflow-y: auto;
    border: 0 !important;
    border-radius: 15px !important;
    background: transparent !important;
    box-shadow: none !important;
    scrollbar-width: thin;
    scrollbar-color: #e9a2a5 transparent;
  }

  body.study-desktop-redesign[data-mode="study"] #leftNav.analysis-workspace-nav > :not(.study-desktop-left-stack) {
    display: none !important;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack {
    display: grid;
    gap: 10px;
    width: 100%;
    min-width: 0;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-hero {
    position: relative;
    height: 162px;
    overflow: hidden;
    border: 1px solid var(--study-pc-line);
    border-radius: 15px;
    background:
      radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.96) 0 4px, transparent 5px),
      radial-gradient(circle at 92% 18%, rgba(244, 163, 169, 0.28) 0 43px, transparent 44px),
      linear-gradient(105deg, #fffdfb 4%, #fff8f6 48%, #fdeae7 100%);
    box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.62), 0 8px 20px rgba(116, 70, 60, 0.07);
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-hero::before,
  body.study-desktop-redesign[data-mode="study"] .study-desktop-hero::after {
    position: absolute;
    z-index: 1;
    color: rgba(239, 104, 114, 0.33);
    content: "✿";
    font-family: serif;
    pointer-events: none;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-hero::before {
    top: 10px;
    left: 12px;
    font-size: 26px;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-hero::after {
    right: 12px;
    bottom: 8px;
    font-size: 30px;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-hero-copy {
    position: absolute;
    z-index: 3;
    top: 43px;
    left: 14px;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-hero-copy h1 {
    margin: 0 0 8px;
    color: #3f2925;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.2;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-hero-copy p {
    margin: 0;
    color: #71504a;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 12px;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-hero > img {
    position: absolute;
    z-index: 2;
    right: 20px;
    bottom: -42px;
    width: 184px;
    max-width: none;
    height: auto;
    pointer-events: none;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-hero-balloon {
    position: absolute;
    z-index: 4;
    top: 22px;
    right: 10px;
    width: 76px;
    margin: 0;
    padding: 9px 5px;
    border: 1px solid rgba(231, 157, 152, 0.55);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.92);
    color: #61443e;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 9px;
    line-height: 1.55;
    text-align: center;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack > .board-workspace-header {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 7px 10px !important;
    width: 100% !important;
    min-height: 0;
    margin: 0 !important;
    padding: 12px 14px !important;
    border: 1px solid var(--study-pc-line) !important;
    border-radius: 13px !important;
    background: rgba(255, 253, 251, 0.96) !important;
    box-shadow: 0 6px 16px rgba(116, 70, 60, 0.055) !important;
    box-sizing: border-box;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack .board-workspace-context {
    display: flex;
    align-items: baseline;
    gap: 8px;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack .board-workspace-mode,
  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack .board-view-toggles {
    display: none !important;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack .board-turn-status {
    display: flex;
    align-items: baseline;
    gap: 7px;
    color: #5e4944;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 13px;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack .board-turn-status strong {
    color: #251d1b;
    font-size: 17px;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack .capture-table {
    justify-self: end;
    color: #5c4843;
    font-size: 11px;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack .capture-table th {
    padding-left: 8px;
    font-weight: 600;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack .capture-table td {
    padding-left: 4px;
    color: #231c1a;
    font-size: 14px;
    font-weight: 800;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack .study-start-section {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack .study-section-title,
  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack #studyStartCurrentBtn,
  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack #studyOpenAiGamesBtn {
    display: none !important;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack .study-start-actions {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack .study-start-actions > button {
    display: grid !important;
    min-width: 0 !important;
    min-height: 86px;
    grid-template-columns: 1fr !important;
    grid-template-rows: 46px auto !important;
    place-items: center;
    gap: 5px !important;
    padding: 8px 4px !important;
    border: 1px solid var(--study-pc-line) !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.86) !important;
    box-shadow: 0 5px 14px rgba(105, 68, 58, 0.045);
    color: var(--study-pc-ink);
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 12px !important;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack .study-start-actions > button:hover {
    border-color: #ef8e96 !important;
    background: #fff9f8 !important;
    transform: translateY(-1px);
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack .study-start-actions > button > svg:first-child {
    display: none !important;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack .study-mobile-entry-icon,
  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack .study-mobile-entry-icon > svg {
    display: block;
    width: 46px !important;
    height: 46px !important;
    overflow: visible;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack #studyStartEmptyBtn { color: #df5966; }
  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack #studyOpenSavedBtn { color: #73984e; }
  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack #studyOpenSgfBtn { color: #397fba; }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack #studyOpenSavedBtn > span:not(.study-mobile-entry-icon) {
    display: none;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack #studyOpenSavedBtn::after {
    color: var(--study-pc-ink);
    content: "保存対局";
  }

  body.study-desktop-redesign[data-mode="study"] #leftNav .study-desktop-left-stack .study-save-actions,
  body.study-desktop-redesign[data-mode="study"] #leftNav .study-desktop-left-stack .study-edit-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0 !important;
  }

  body.study-desktop-redesign[data-mode="study"] #leftNav .study-desktop-left-stack .study-save-actions .study-btn-secondary,
  body.study-desktop-redesign[data-mode="study"] #leftNav .study-desktop-left-stack .study-edit-actions .study-btn-secondary {
    min-width: 0;
    min-height: 56px;
    justify-content: center;
    gap: 9px;
    padding: 11px 8px;
    border: 1px solid rgba(228, 159, 153, 0.48);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.88);
    color: #5b403a;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
  }

  body.study-desktop-redesign[data-mode="study"] #leftNav .study-desktop-left-stack .study-save-actions svg,
  body.study-desktop-redesign[data-mode="study"] #leftNav .study-desktop-left-stack .study-edit-actions svg {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack #studySaveServerBtn {
    color: #e65d68;
    border-color: rgba(230, 93, 104, 0.55);
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack #studyExportSgfBtn {
    color: #658f46;
    border-color: rgba(101, 143, 70, 0.55);
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack #studySaveLocalBtn {
    display: none !important;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack > .move-controls {
    display: grid !important;
    width: 100% !important;
    grid-template-columns: 42px 42px minmax(82px, 1fr) 42px 42px !important;
    grid-template-rows: 42px 30px;
    gap: 5px 6px !important;
    margin: 0 !important;
    padding: 10px !important;
    border: 1px solid var(--study-pc-line) !important;
    border-radius: 12px !important;
    background: rgba(255, 253, 251, 0.96) !important;
    box-shadow: 0 6px 16px rgba(116, 70, 60, 0.05);
    box-sizing: border-box;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack > .move-controls #backFiveMoveBtn,
  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack > .move-controls #forwardFiveMoveBtn {
    display: none !important;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack > .move-controls > button {
    display: grid !important;
    width: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    place-items: center;
    padding: 0 !important;
    border: 1px solid rgba(229, 142, 142, 0.46) !important;
    border-radius: 9px !important;
    background: #fff !important;
    color: #75443f !important;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack > .move-controls #firstMoveBtn { grid-column: 1; grid-row: 1; }
  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack > .move-controls #prevMoveBtn { grid-column: 2; grid-row: 1; }
  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack > .move-controls #nextMoveBtn { grid-column: 4; grid-row: 1; }
  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack > .move-controls #lastMoveBtn { grid-column: 5; grid-row: 1; }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack > .move-controls .move-number-jump {
    display: flex !important;
    width: 100% !important;
    min-width: 0 !important;
    grid-column: 3 !important;
    grid-row: 1;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(229, 142, 142, 0.28);
    border-radius: 9px;
    background: #fff;
    color: #3f302d;
    font-size: 12px;
    white-space: nowrap;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack > .move-controls .move-number-jump input {
    width: 36px !important;
    min-width: 36px !important;
    padding-inline: 2px;
    text-align: right;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack > .move-controls .seek-wrapper {
    width: calc(100% - 8px) !important;
    min-width: 0;
    height: 30px !important;
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    justify-self: center;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack > .board-workspace-feedback {
    display: grid;
    gap: 4px;
    margin: 0;
    color: #57705f;
    font-size: 10px;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack > .board-workspace-feedback > :empty {
    display: none;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack > .study-candidate-row {
    margin: 0 !important;
    padding: 10px 12px !important;
    border: 1px solid rgba(229, 142, 142, 0.36) !important;
    border-radius: 11px !important;
    background: rgba(255, 253, 251, 0.92) !important;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-left-stack > .study-candidate-row > summary {
    display: flex !important;
    cursor: pointer;
  }

  body.study-desktop-redesign[data-mode="study"] .workspace-board-only {
    position: sticky;
    top: 76px;
    max-height: calc(100dvh - 92px) !important;
    align-self: start;
    overflow: hidden;
  }

  body.study-desktop-redesign[data-mode="study"] .workspace-board-only > .board-stage {
    width: min(100%, var(--workspace-primary-board-stage-size, calc(100dvh - 130px))) !important;
    margin: 0 !important;
    padding: 10px !important;
    border: 1px solid rgba(218, 187, 166, 0.7) !important;
    border-radius: 14px !important;
    background: rgba(255, 252, 246, 0.96) !important;
    box-shadow: 0 12px 30px rgba(93, 64, 48, 0.1) !important;
    box-sizing: border-box;
  }

  body.study-desktop-redesign[data-mode="study"] .workspace-board-only > .board-stage > #board.goban {
    width: 100% !important;
    max-width: none !important;
  }

  body.study-desktop-redesign[data-mode="study"] .side-panel[data-board-focus-ready="true"] {
    position: sticky;
    top: 76px;
    display: flex !important;
    width: 350px;
    height: fit-content !important;
    min-height: 0 !important;
    max-height: calc(100dvh - 92px);
    align-self: start;
    flex-direction: column;
    gap: 10px;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    scrollbar-width: thin;
    scrollbar-color: #e9a2a5 transparent;
  }

  body.study-desktop-redesign[data-mode="study"] .workspace-right-fixed {
    display: block;
    order: 1;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body.study-desktop-redesign[data-mode="study"] .workspace-right-fixed .study-primary-action {
    display: none !important;
  }

  body.study-desktop-redesign[data-mode="study"] #studyPanel.study-panel {
    display: block !important;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  body.study-desktop-redesign[data-mode="study"] #studyPanel .winrate-bar-panel {
    position: relative;
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 8px;
    margin: 0;
    padding: 13px 14px 15px;
    overflow: hidden;
    border: 1px solid var(--study-pc-line);
    border-radius: 14px;
    background:
      radial-gradient(circle at 94% 12%, rgba(244, 172, 182, 0.12), transparent 24%),
      linear-gradient(180deg, rgba(255, 254, 252, 0.99), rgba(255, 250, 248, 0.98));
    box-shadow: 0 8px 22px rgba(121, 75, 62, 0.07);
  }

  body.study-desktop-redesign[data-mode="study"] #studyPanel .winrate-bar-panel::before {
    position: absolute;
    top: 12px;
    left: 13px;
    color: rgba(240, 112, 130, 0.42);
    content: "✿";
    font-family: serif;
    font-size: 20px;
  }

  body.study-desktop-redesign[data-mode="study"] #studyPanel .study-result-heading {
    display: flex;
    min-height: 36px;
    grid-column: 1 / -1;
    align-items: center;
    margin: 0;
    padding: 0 2px 8px 28px;
    border-bottom: 1px solid rgba(238, 121, 132, 0.32);
  }

  body.study-desktop-redesign[data-mode="study"] #studyPanel .study-result-heading span,
  body.study-desktop-redesign[data-mode="study"] #studyPanel .study-result-heading small {
    display: none !important;
  }

  body.study-desktop-redesign[data-mode="study"] #studyPanel .study-result-heading strong {
    color: #382b2a;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.06em;
  }

  body.study-desktop-redesign[data-mode="study"] #studyPanel .bar-score {
    display: flex;
    min-height: 32px;
    align-items: center;
    justify-content: flex-start;
    margin: 0;
    padding: 0 2px 0 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #15724d;
    font-family: "Noto Sans JP", "Yu Gothic", sans-serif;
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
  }

  body.study-desktop-redesign[data-mode="study"] #studyPanel .winrate-bar-row {
    display: grid;
    min-width: 0;
    width: 100%;
    grid-template-columns: max-content minmax(30px, 1fr) max-content !important;
    align-items: center;
    gap: 4px !important;
    margin: 0;
    overflow: visible;
  }

  body.study-desktop-redesign[data-mode="study"] #studyPanel .winrate-stone-label {
    min-width: 0;
    gap: 3px;
    color: #332d2d;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
  }

  body.study-desktop-redesign[data-mode="study"] #studyPanel .winrate-stone {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
  }

  body.study-desktop-redesign[data-mode="study"] #studyPanel .winrate-bar {
    min-width: 0;
    height: 13px;
    border: 1px solid rgba(113, 123, 132, 0.23);
    border-radius: 999px;
    background: #a9d3f1;
    box-shadow: inset 0 1px 2px rgba(53, 67, 77, 0.12), 0 0 0 2px rgba(255, 255, 255, 0.78);
  }

  body.study-desktop-redesign[data-mode="study"] #studyPanel .winrate-fill.black-side {
    background: linear-gradient(90deg, #34383d, #55595e);
  }

  body.study-desktop-redesign[data-mode="study"] #studyPanel .winrate-fill.white-side {
    background: linear-gradient(90deg, #b9dcf5, #91c7ec);
  }

  body.study-desktop-redesign[data-mode="study"] #studyPanel .winrate-complexity-row {
    display: none !important;
  }

  body.study-desktop-redesign[data-mode="study"] .workspace-right-rail {
    order: 2;
    min-height: 0;
    overflow: visible;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body.study-desktop-redesign[data-mode="study"] .workspace-right-panels,
  body.study-desktop-redesign[data-mode="study"] .workspace-right-tab-panel[data-workspace-right-panel="moves"] {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body.study-desktop-redesign[data-mode="study"] .board-tree-panel {
    position: relative;
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 11px 10px 10px !important;
    overflow: hidden;
    border: 1px solid var(--study-pc-line) !important;
    border-radius: 14px !important;
    background:
      radial-gradient(circle at 94% 10%, rgba(244, 172, 182, 0.11), transparent 22%),
      linear-gradient(180deg, rgba(255, 254, 251, 0.99), rgba(255, 249, 247, 0.98)) !important;
    box-shadow: 0 8px 22px rgba(121, 75, 62, 0.07) !important;
    box-sizing: border-box;
  }

  body.study-desktop-redesign[data-mode="study"] .board-tree-panel::before {
    top: 12px;
    left: 13px;
    color: rgba(240, 112, 130, 0.42);
    font-size: 20px;
  }

  body.study-desktop-redesign[data-mode="study"] .board-tree-panel .board-tree-header {
    min-height: 38px;
    margin: 0 0 6px;
    padding: 0 2px 7px 28px;
    border: 0;
    border-bottom: 1px solid rgba(238, 121, 132, 0.34);
    background: transparent;
  }

  body.study-desktop-redesign[data-mode="study"] .board-tree-panel .board-tree-heading {
    padding: 0;
  }

  body.study-desktop-redesign[data-mode="study"] .board-tree-panel .board-tree-heading-icon,
  body.study-desktop-redesign[data-mode="study"] .board-tree-panel .board-tree-eyebrow,
  body.study-desktop-redesign[data-mode="study"] .board-tree-panel .board-tree-heading small,
  body.study-desktop-redesign[data-mode="study"] .board-tree-panel .board-tree-legend,
  body.study-desktop-redesign[data-mode="study"] .board-tree-panel #gameTreeBranchBadge,
  body.study-desktop-redesign[data-mode="study"] .board-tree-panel #gameTreeToggleBtn,
  body.study-desktop-redesign[data-mode="study"] .board-tree-panel .board-tree-help {
    display: none !important;
  }

  body.study-desktop-redesign[data-mode="study"] .board-tree-panel .board-tree-heading strong {
    color: #382b2a;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.06em;
  }

  body.study-desktop-redesign[data-mode="study"] .board-tree-panel .board-tree-header-actions {
    margin-left: auto;
  }

  body.study-desktop-redesign[data-mode="study"] .board-tree-panel #gameTreeMoveBadge {
    display: inline-flex;
    min-width: 74px;
    min-height: 29px;
    align-items: center;
    justify-content: center;
    padding: 4px 9px;
    border: 1px solid rgba(238, 126, 133, 0.5);
    border-radius: 999px;
    background: #fff;
    color: #493536;
    font-family: "Noto Sans JP", "Yu Gothic", sans-serif;
    font-size: 11px;
    font-weight: 800;
  }

  body.study-desktop-redesign[data-mode="study"] .board-tree-panel .board-tree-toolbar {
    display: flex !important;
    min-height: 32px;
    align-items: center;
    justify-content: flex-end;
    margin: 0 1px 5px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  body.study-desktop-redesign[data-mode="study"] .board-tree-panel #gameTreeFocusBtn {
    min-height: 30px;
    padding: 4px 10px;
    border: 1px solid #e9a5a5;
    border-radius: 8px;
    background: #fff;
    color: #65433d;
    font-size: 10px;
    font-weight: 800;
  }

  body.study-desktop-redesign[data-mode="study"] .board-tree-panel .game-tree {
    width: 100%;
    height: clamp(160px, 24dvh, 245px) !important;
    min-height: 160px !important;
    max-height: 245px !important;
    padding: 5px 3px 3px !important;
    overflow: auto !important;
    overscroll-behavior: contain;
    touch-action: pan-x pan-y;
    border: 1px solid rgba(235, 157, 151, 0.42) !important;
    border-radius: 10px;
    background: rgba(255, 253, 251, 0.9) !important;
    scrollbar-width: thin;
    scrollbar-color: #e9a2a5 #fff2f1;
    box-sizing: border-box;
  }

  body.study-desktop-redesign[data-mode="study"] .board-tree-panel .game-tree-canvas {
    min-height: 142px;
  }

  body.study-desktop-redesign[data-mode="study"] .board-tree-panel .tree-node,
  body.study-desktop-redesign[data-mode="study"] .board-tree-panel .root-node {
    display: flex;
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    border-radius: 50%;
    font-size: 10px;
  }

  body.study-desktop-redesign[data-mode="study"] .analysis-qa-section {
    order: 3;
    width: 100%;
    margin: 0;
  }

  body.study-desktop-redesign[data-mode="study"] .analysis-qa-action {
    display: flex !important;
    width: 100%;
    min-height: 58px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 14px !important;
    border: 1px solid #a8c7b0 !important;
    border-radius: 12px !important;
    background: linear-gradient(135deg, #16804a, #0d6b3b) !important;
    box-shadow: 0 7px 17px rgba(26, 104, 62, 0.15) !important;
    color: #fff !important;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 16px !important;
    font-weight: 700;
  }

  body.study-desktop-redesign[data-mode="study"] .analysis-qa-action svg {
    width: 28px !important;
    height: 28px !important;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-character-tip {
    position: relative;
    order: 4;
    display: flex;
    min-height: 92px;
    align-items: center;
    overflow: hidden;
    border: 1px solid var(--study-pc-line);
    border-radius: 13px;
    background: linear-gradient(105deg, #fff7f6, #fffdfb);
    box-shadow: 0 6px 16px rgba(116, 70, 60, 0.055);
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-character-tip::after {
    position: absolute;
    right: 12px;
    color: rgba(240, 112, 130, 0.28);
    content: "✿";
    font-size: 24px;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-character-tip img {
    align-self: flex-end;
    width: 118px;
    height: 96px;
    object-fit: contain;
    object-position: center bottom;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-character-tip p {
    position: relative;
    z-index: 1;
    flex: 1;
    margin: 0 14px 0 -2px;
    padding: 11px 16px;
    border: 1px solid rgba(229, 142, 142, 0.42);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: #51403c;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 12px;
    text-align: center;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-tools-empty,
  body.study-desktop-redesign[data-mode="study"] .study-left-command,
  body.study-desktop-redesign[data-mode="study"] .study-left-tools,
  body.study-desktop-redesign[data-mode="study"] .left-nav-history {
    display: none !important;
  }
}

@media (max-width: 1180px) and (orientation: portrait) {
  .study-desktop-hero,
  .study-desktop-character-tip {
    display: none !important;
  }
}

/* Kifu analysis spring result card r2 (2026-08-17). */
.analysis-review-card.result-panel.kap-panel {
  overflow: hidden;
  border: 1px solid rgba(235, 153, 151, 0.62);
  border-radius: 16px;
  background:
    radial-gradient(circle at 95% 3%, rgba(244, 156, 170, 0.12) 0 42px, transparent 43px),
    linear-gradient(180deg, rgba(255, 254, 252, 0.995), rgba(255, 249, 247, 0.985));
  box-shadow: 0 9px 24px rgba(118, 72, 61, 0.085);
  color: #493936;
  font-family: "Noto Sans JP", "Yu Gothic", sans-serif;
}

.analysis-review-card .kap-header {
  gap: 10px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(238, 121, 132, 0.32);
  background: linear-gradient(90deg, rgba(255, 241, 243, 0.7), rgba(255, 253, 250, 0.2));
}

.analysis-review-card .kap-header-icon svg {
  width: 30px;
  height: 30px;
  filter: drop-shadow(0 3px 5px rgba(190, 75, 91, 0.14));
}

.analysis-review-card .kap-header-icon svg rect {
  fill: #ed7180;
}

.analysis-review-card .kap-title {
  color: #3f2f2d;
  font-family: "Noto Serif JP", "Yu Mincho", serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.055em;
}

.analysis-review-card .kap-desc {
  padding: 12px 16px 14px;
  color: #796663;
  font-size: 12.5px;
  line-height: 1.75;
}

.analysis-review-card .kap-divider {
  width: auto;
  margin: 0 14px;
  background: rgba(232, 151, 147, 0.27);
}

.analysis-review-card .kap-group {
  padding: 13px 14px;
}

.analysis-review-card .kap-group:not(.kap-trend-group) > .kap-group-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 9px;
  color: #4a3734;
  font-family: "Noto Serif JP", "Yu Mincho", serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.025em;
}

.analysis-review-card .kap-group:not(.kap-trend-group) > .kap-group-label::before {
  color: rgba(236, 101, 119, 0.72);
  content: "✿";
  font-family: serif;
  font-size: 14px;
  line-height: 1;
}

.analysis-review-card .kap-analyze-btn {
  min-height: 52px !important;
  border: 1px solid rgba(221, 87, 105, 0.38) !important;
  border-radius: 12px !important;
  background: linear-gradient(135deg, #ef7480, #df5968) !important;
  box-shadow: 0 7px 16px rgba(200, 72, 89, 0.19), inset 0 1px 0 rgba(255, 255, 255, 0.35) !important;
  color: #fff !important;
  font-family: "Noto Sans JP", "Yu Gothic", sans-serif;
  font-size: 15px !important;
  font-weight: 800 !important;
  letter-spacing: 0.025em;
}

.analysis-review-card .kap-analyze-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #f07c87, #d94e5f) !important;
}

.analysis-review-card .kap-analyze-btn:disabled {
  border-color: rgba(177, 173, 170, 0.36) !important;
  background: linear-gradient(135deg, #d8d8d6, #c7cbc8) !important;
  box-shadow: none !important;
}

.analysis-review-card .kap-cancel-btn {
  border-color: rgba(217, 128, 132, 0.45) !important;
  background: rgba(255, 253, 251, 0.96) !important;
  color: #9a5559 !important;
}

.analysis-review-card .kap-target-card {
  min-height: 42px;
  border-color: rgba(228, 143, 142, 0.48);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(255, 246, 245, 0.95), rgba(255, 252, 248, 0.96));
  color: #54413d;
  font-size: 12.5px;
}

.analysis-review-card .kap-target-card svg {
  color: #df6070;
}

.analysis-review-card .kap-range-btn,
.analysis-review-card .kap-result-range-btn {
  border-color: rgba(220, 154, 147, 0.52) !important;
  border-radius: 9px !important;
  background: rgba(255, 255, 255, 0.9) !important;
  color: #745650 !important;
}

.analysis-review-card .kap-range-btn.active,
.analysis-review-card .kap-result-range-btn.active {
  border-color: #e26874 !important;
  background: linear-gradient(135deg, #fff0f1, #ffe5e8) !important;
  color: #bd4856 !important;
  box-shadow: inset 0 0 0 1px rgba(226, 104, 116, 0.1) !important;
}

.analysis-review-card .kap-display-list {
  border-color: rgba(228, 156, 151, 0.42);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.8);
}

.analysis-review-card .kap-display-item {
  min-height: 45px;
  border-bottom-color: rgba(228, 156, 151, 0.24);
}

.analysis-review-card .kap-display-item:hover {
  background: rgba(255, 239, 241, 0.55);
}

.analysis-review-card .kap-display-item svg,
.analysis-review-card .kap-empty-icon svg {
  color: #df6070;
}

.analysis-review-card .kap-display-item small {
  background: #fff0f1;
  color: #bd5260;
}

.analysis-review-card .kap-empty {
  margin: 12px;
  padding: 20px 14px;
  border: 1px dashed rgba(228, 143, 142, 0.48);
  border-radius: 12px;
  background: rgba(255, 250, 248, 0.72);
}

.analysis-review-card .kap-empty-icon {
  background: #fff0f1;
}

.analysis-review-card .kap-empty-title {
  color: #4a3734;
  font-family: "Noto Serif JP", "Yu Mincho", serif;
}

.analysis-review-card .kap-empty-body {
  color: #806d68;
}

.analysis-review-card .kap-result-badge-row {
  padding: 11px 14px;
  border-bottom-color: rgba(238, 121, 132, 0.3);
  background: linear-gradient(90deg, rgba(255, 240, 242, 0.72), rgba(255, 252, 249, 0.35));
}

.analysis-review-card .kap-result-badge {
  min-height: 28px;
  padding: 0 11px;
  border-color: #e26874;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: #bd4856;
  font-weight: 800;
}

.analysis-review-card .kap-reanalyze-btn {
  min-height: 32px !important;
  border-color: rgba(218, 116, 126, 0.48) !important;
  border-radius: 9px !important;
  background: rgba(255, 255, 255, 0.88) !important;
  color: #a64a56 !important;
}

.analysis-review-card .kap-reanalyze-btn:hover {
  border-color: #e26874 !important;
  background: #fff0f1 !important;
  color: #bd4856 !important;
}

.analysis-review-card .kap-post-section > .kap-divider {
  display: none;
}

.analysis-review-card .kap-post-section > .kap-group:not(.kap-trend-group) {
  margin: 10px 12px !important;
  padding: 13px !important;
  border: 1px solid rgba(231, 159, 153, 0.43);
  border-radius: 13px;
  background: rgba(255, 253, 251, 0.88);
  box-shadow: 0 4px 12px rgba(115, 72, 61, 0.045);
}

.analysis-review-card .kap-budget-table,
.analysis-review-card .kap-rank-list {
  overflow: hidden;
  border-color: rgba(226, 158, 151, 0.4);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
}

.analysis-review-card .kap-budget-phase-row,
.analysis-review-card .kap-rank-row {
  border-bottom-color: rgba(230, 164, 158, 0.25);
  background: transparent;
}

.analysis-review-card .kap-budget-phase-row:nth-child(even),
.analysis-review-card .kap-rank-row:nth-child(even) {
  background: rgba(255, 244, 244, 0.42);
}

.analysis-review-card .kap-rank-tabs {
  border-color: rgba(226, 149, 147, 0.48);
  border-radius: 10px;
}

.analysis-review-card .kap-rank-tab {
  background: rgba(255, 247, 246, 0.92) !important;
  color: #755650 !important;
}

.analysis-review-card .kap-rank-tab.active {
  background: linear-gradient(135deg, #ef7480, #df5968) !important;
  color: #fff !important;
}

.analysis-review-card .kap-rank-tab:hover:not(.active) {
  background: #fff0f1 !important;
  color: #bd4856 !important;
}

.analysis-review-card .kap-rank-standard {
  border: 1px solid rgba(191, 112, 117, 0.35);
  background: linear-gradient(135deg, #b87980, #9c6169);
}

.analysis-review-card .kap-open-move-btn {
  border-color: rgba(218, 128, 134, 0.46) !important;
  border-radius: 8px !important;
  background: #fffaf9 !important;
  color: #a8535a !important;
}

.analysis-review-card .kap-section-note,
.analysis-review-card .kap-section-empty {
  color: #806d68;
}

.analysis-review-card .kap-analysis-warning {
  margin: 10px 12px 0;
  border-color: rgba(224, 162, 112, 0.48);
  border-radius: 11px;
  background: #fff8ec;
}

@media (orientation: portrait) and (max-width: 1439px) {
  body[data-mode="analysis"] .analysis-review-card.result-panel.kap-panel {
    width: calc(100% - 20px);
    margin-right: 10px;
    margin-left: 10px;
    border-radius: 15px;
    box-sizing: border-box;
  }

  body[data-mode="analysis"] .analysis-review-card .kap-header {
    padding: 13px 14px 11px;
  }

  body[data-mode="analysis"] .analysis-review-card .kap-title {
    font-size: 19px;
  }

  body[data-mode="analysis"] .analysis-review-card .kap-group:not(.kap-trend-group) > .kap-group-label {
    font-size: 14px;
  }

  body[data-mode="analysis"] .analysis-review-card .kap-budget-phase-row {
    grid-template-columns: minmax(0, 1.35fr) auto auto;
    gap: 5px;
    padding: 9px 8px;
    font-size: 10.5px;
  }
}

/* AI対局場: PC対局中UI仕上げ r2 (2026-08-17). */
@media (min-width: 1440px), (orientation: landscape) {
  .ai-game-page .ai-game-shell[data-phase="playing"] {
    --ai-game-playing-board-size: min(calc(100dvh - 108px), calc(100vw - 700px));
    width: min(calc(100vw - 24px), calc(var(--ai-game-playing-board-size) + 664px)) !important;
    min-height: calc(100dvh - 76px);
    grid-template-columns: 280px minmax(0, var(--ai-game-playing-board-size)) 360px !important;
    align-content: start;
    margin-bottom: 0;
  }

  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-board-frame {
    width: var(--ai-game-playing-board-size) !important;
    max-width: 100% !important;
  }

  .ai-game-page .ai-game-shell[data-phase="playing"][data-mode="study"] .ai-game-left-toolbar .ai-game-play-controls,
  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-left-toolbar .ai-game-play-controls {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-auto-flow: row !important;
  }

  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-left-toolbar .ai-game-play-controls button {
    position: relative;
    min-width: 0;
    min-height: 62px;
    padding: 29px 5px 7px;
    overflow: hidden;
  }

  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-left-toolbar .ai-game-play-controls button::before {
    position: absolute;
    top: 7px;
    left: 50%;
    font-family: "Segoe UI Symbol", "Noto Sans Symbols", sans-serif;
    font-size: 19px;
    font-weight: 500;
    line-height: 1;
    transform: translateX(-50%);
  }

  .ai-game-page #aiGamePassBtn::before { color: #299152; content: "♧"; }
  .ai-game-page #aiGameUndoBtn::before { color: #c58170; content: "↶"; }
  .ai-game-page #aiGameToolbarHintBtn::before { color: #257bd5; content: "◉"; }
  .ai-game-page #aiGameFinishBtn::before { color: #ed4051; content: "⚑"; }

  /* 背景画像と切り抜き画像の二重描画を止める。 */
  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-character-presence-backdrop {
    display: none !important;
    background-image: none !important;
  }

  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-character-presence-art {
    background-size: var(--ai-character-portrait-size, 74% auto) !important;
    background-position: var(--ai-character-portrait-position, center 22%) !important;
  }

  /* スマホ版の形勢推移と同じ余白・比率・描画部品をPCにも適用する。 */
  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-trend-mobile-surface {
    position: relative;
    z-index: 1;
    min-width: 0;
  }

  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-trend-summary {
    display: grid;
    min-width: 0;
    grid-template-columns: auto auto minmax(42px, 1fr) auto;
    align-items: center;
    gap: 6px;
    margin: 0 0 9px;
    padding: 8px;
    border: 1px solid rgba(235, 157, 151, 0.42);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 3px 9px rgba(116, 70, 60, 0.045);
    box-sizing: border-box;
  }

  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-trend-lead {
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    justify-content: center;
    padding: 4px 9px;
    border: 1px solid rgba(222, 123, 132, 0.62);
    border-radius: 999px;
    background: linear-gradient(135deg, #fffaf9, #fff0f2);
    box-shadow: 0 2px 6px rgba(125, 53, 60, 0.08);
    color: #7d353c;
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
  }

  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-trend-rate {
    font-size: 10px;
    font-weight: 800;
  }

  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-trend-winrate-bar {
    height: 9px;
    box-shadow: inset 0 1px 2px rgba(53, 67, 77, 0.12), 0 0 0 2px rgba(255, 255, 255, 0.78);
  }

  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-trend-graph-wrap {
    position: relative;
    min-width: 0;
    padding: 4px 3px 1px;
    overflow: hidden;
    border-radius: 12px;
    box-sizing: border-box;
  }

  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-trend-mobile-surface .ai-game-trend-graph {
    display: block;
    width: 100%;
    height: auto !important;
    aspect-ratio: 320 / 150;
    margin: 0 !important;
    overflow: visible;
  }

  .ai-game-page .ai-game-trend-graph .trend-grid {
    stroke: rgba(92, 92, 92, 0.14);
    stroke-width: 0.8;
    stroke-dasharray: 2 2;
  }

  .ai-game-page .ai-game-trend-graph .trend-grid--vertical { stroke: rgba(126, 103, 98, 0.11); }
  .ai-game-page .ai-game-trend-graph .trend-grid--even { stroke: rgba(101, 83, 79, 0.5); stroke-width: 1; stroke-dasharray: none; }

  .ai-game-page .ai-game-trend-graph .trend-tick-label,
  .ai-game-page .ai-game-trend-graph .trend-move-label,
  .ai-game-page .ai-game-trend-graph .trend-side-label,
  .ai-game-page .ai-game-trend-graph .trend-callout-text {
    fill: #66595a;
    font-family: "Noto Sans JP", sans-serif;
    font-size: 7px;
    font-weight: 700;
  }

  .ai-game-page .ai-game-trend-graph .trend-side-label { fill: #4e4243; font-size: 7.5px; }
  .ai-game-page .ai-game-trend-graph .trend-area { stroke: none; }
  .ai-game-page .ai-game-trend-graph .trend-series { fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
  .ai-game-page .ai-game-trend-graph .trend-guide { stroke: rgba(112, 151, 180, 0.55); stroke-width: 0.8; stroke-dasharray: 3 2; }
  .ai-game-page .ai-game-trend-graph .trend-guide.is-current { stroke: #ef6570; stroke-width: 1.4; stroke-dasharray: none; }
  .ai-game-page .ai-game-trend-graph .trend-callout { fill: #eaf6fe; stroke: rgba(91, 160, 207, 0.25); stroke-width: 0.6; }
  .ai-game-page .ai-game-trend-graph .trend-callout.is-current { fill: #ef6570; stroke: #ef6570; }
  .ai-game-page .ai-game-trend-graph .trend-callout-text.is-current { fill: #fff; }
  .ai-game-page .ai-game-trend-graph .trend-point { fill: #4395cd; stroke: #fff; stroke-width: 1.5; }
  .ai-game-page .ai-game-trend-graph .trend-point.is-current { fill: #ef6570; stroke-width: 2; }
}

/* AI対局場: PC対局中サイドバー再設計 r1 (2026-08-16).
   中央の碁盤とスマホ版の形勢推移・棋譜ツリー描画は共通のまま使用する。 */
@media (min-width: 1440px), (orientation: landscape) {
  .ai-game-page .ai-game-shell[data-phase="playing"] {
    width: min(1540px, calc(100vw - 34px)) !important;
    grid-template-areas: "left board right" !important;
    grid-template-columns: 280px minmax(610px, 1fr) 360px !important;
    align-items: start;
    gap: 12px !important;
    margin-top: 10px;
  }

  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-left-panel,
  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-right-panel {
    position: sticky;
    top: 76px;
    max-height: calc(100dvh - 90px);
    padding: 0 4px 8px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #e8a7a5 transparent;
  }

  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-left-panel { grid-area: left; }
  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-board-area { grid-area: board; }
  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-right-panel { grid-area: right; }

  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-board-area {
    padding: 10px;
    border-color: rgba(221, 198, 186, 0.66);
    border-radius: 14px;
    background: rgba(255, 254, 251, 0.96);
    box-shadow: 0 10px 28px rgba(102, 66, 54, 0.09);
  }

  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-board-frame {
    width: 100%;
    max-width: calc(100dvh - 112px) !important;
    padding: 8px;
    border-color: rgba(215, 184, 160, 0.7);
    border-radius: 8px;
    background: #fff6e8;
  }

  .ai-game-page .ai-game-status-panel {
    position: relative;
    padding: 15px 12px 12px !important;
    overflow: hidden;
    border-color: rgba(235, 166, 159, 0.56) !important;
    border-radius: 13px !important;
    background:
      radial-gradient(circle at 92% 8%, rgba(247, 177, 185, 0.16), transparent 20%),
      linear-gradient(180deg, rgba(255, 254, 252, 0.99), rgba(255, 250, 247, 0.98)) !important;
    box-shadow: 0 8px 22px rgba(121, 75, 62, 0.08) !important;
  }

  .ai-game-page .ai-game-status-panel::after {
    position: absolute;
    top: 28px;
    right: 17px;
    color: rgba(238, 132, 142, 0.35);
    content: "✿";
    font-family: serif;
    font-size: 30px;
    pointer-events: none;
  }

  .ai-game-page .ai-game-status-panel > header {
    margin-bottom: 8px !important;
    padding: 0 2px 7px;
    border-bottom: 1px solid rgba(238, 146, 145, 0.3);
  }

  .ai-game-page .ai-game-status-panel > header span {
    display: inline-flex;
    min-height: 20px;
    align-items: center;
    padding: 1px 11px;
    border-radius: 999px;
    background: linear-gradient(135deg, #f47781, #e65c68);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
  }

  .ai-game-page .ai-game-status-panel > header h1 {
    margin: 7px 0 0;
    color: #512d29;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 23px;
    letter-spacing: 0.06em;
  }

  .ai-game-page .ai-game-desktop-turn-summary {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 3px;
    margin: 2px 0 8px;
  }

  .ai-game-page .ai-game-desktop-turn-summary strong {
    min-width: 132px;
    padding: 5px 14px;
    border: 1px solid #f1a4aa;
    border-radius: 999px;
    background: #fff8f8;
    color: #e84f5f;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 15px;
    text-align: center;
  }

  .ai-game-page .ai-game-desktop-turn-summary span {
    color: #4f3b37;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 16px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
  }

  .ai-game-page .ai-game-desktop-scoreboard {
    overflow: hidden;
    margin-bottom: 9px;
    border: 1px solid rgba(224, 195, 185, 0.64);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.84);
  }

  .ai-game-page .ai-game-desktop-scoreboard > div {
    display: grid;
    grid-template-columns: 25px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 6px;
    min-height: 39px;
    padding: 4px 8px;
    border-top: 1px solid rgba(225, 201, 192, 0.5);
  }

  .ai-game-page .ai-game-desktop-scoreboard > div:first-child { border-top: 0; }
  .ai-game-page .ai-game-desktop-scoreboard .ai-game-player-stone { width: 24px; height: 24px; }
  .ai-game-page .ai-game-desktop-scoreboard strong { overflow: hidden; color: #382a27; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
  .ai-game-page .ai-game-desktop-scoreboard small { color: #b17668; font-size: 8px; font-weight: 700; }
  .ai-game-page .ai-game-desktop-scoreboard b { min-width: 53px; color: #352b29; font-size: 10px; text-align: right; font-variant-numeric: tabular-nums; }

  .ai-game-page .ai-game-status-panel .ai-game-status-list { margin: 0; }
  .ai-game-page .ai-game-status-panel .ai-game-status-list > div {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    min-height: 30px;
    padding: 5px 3px;
    border-top: 1px solid rgba(224, 204, 196, 0.55);
  }
  .ai-game-page .ai-game-status-panel .ai-game-status-list dt { color: #a3685c; font-size: 10px; }
  .ai-game-page .ai-game-status-panel .ai-game-status-list dd { margin: 0; color: #332b29; font-size: 11px; font-weight: 800; text-align: right; }
  .ai-game-page .ai-game-status-panel .ai-game-status-detail-row { display: none !important; }
  .ai-game-page .ai-game-status-panel .ai-game-status-legacy-resign { display: none !important; }

  .ai-game-page .ai-game-left-notice {
    width: 100%;
    min-height: 34px;
    padding: 8px 10px;
    border-color: #c5dfcc;
    background: #f0f8f2;
    color: #32704a !important;
    font-size: 9px;
  }

  .ai-game-page .ai-game-left-toolbar {
    display: flex;
    width: 100%;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 10px;
    border: 1px solid rgba(235, 166, 159, 0.56);
    border-radius: 12px;
    background: rgba(255, 253, 251, 0.96);
    box-shadow: 0 7px 18px rgba(121, 75, 62, 0.06);
  }

  .ai-game-page .ai-game-left-toolbar .ai-game-view-controls {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  .ai-game-page .ai-game-left-toolbar .ai-game-view-controls output { display: none; }
  .ai-game-page .ai-game-left-toolbar .ai-game-view-controls button { min-height: 48px; padding: 6px 3px; flex-direction: column; border-color: #eed6d0; color: #9b4e43; font-size: 10px; }
  .ai-game-page .ai-game-left-toolbar .ai-game-view-controls button > span[aria-hidden="true"] { color: #c75449; font-size: 19px; }

  .ai-game-page .ai-game-left-toolbar .ai-game-play-controls {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  .ai-game-page .ai-game-left-toolbar .ai-game-play-controls button { min-height: 58px; padding: 22px 4px 7px; border-color: #ead8d2; background: #fff; color: #8c5148; font-family: "Noto Serif JP", "Yu Mincho", serif; font-size: 12px; }
  .ai-game-page .ai-game-left-toolbar .ai-game-play-controls #aiGamePassBtn { border-color: #cbe3d2; background: #f8fffa; color: #188441; }
  .ai-game-page .ai-game-left-toolbar .ai-game-play-controls #aiGameToolbarHintBtn { border-color: #c7dafa; background: #f8fbff; color: #176fda; }
  .ai-game-page .ai-game-left-toolbar .ai-game-play-controls #aiGameFinishBtn { border-color: #ffd2d5; background: #fffafa; color: #ed263d; }
  .ai-game-page .ai-game-desktop-abort { width: 100%; min-height: 43px; border: 1px solid #f3a9ae; border-radius: 9px; background: #fff; color: #a4413d; font: inherit; font-size: 12px; font-weight: 800; }

  .ai-game-page .ai-game-right-panel { gap: 8px; }
  .ai-game-page .ai-game-right-panel > .ai-game-panel { padding: 10px !important; border-color: rgba(235, 166, 159, 0.56); border-radius: 12px; }
  .ai-game-page .ai-game-match-panel { padding-top: 9px !important; background: linear-gradient(180deg, #fffafa, #fffdfb) !important; }
  .ai-game-page .ai-game-match-panel::before,
  .ai-game-page .ai-game-match-header,
  .ai-game-page .ai-game-match-summary,
  .ai-game-page .ai-game-match-players { display: none !important; }

  .ai-game-page .ai-game-character-presence {
    width: calc(100% + 2px);
    min-height: 178px;
    margin: -1px -1px 8px;
    overflow: hidden;
    border: 1px solid rgba(239, 166, 164, 0.56);
    border-radius: 10px;
    background: #fff1f3;
  }
  .ai-game-page .ai-game-character-presence-art { inset: 0; width: 100%; height: 100%; background-position: var(--ai-character-portrait-position, center 22%) !important; background-size: var(--ai-character-portrait-size, 74% auto) !important; }
  .ai-game-page .ai-game-character-presence-backdrop { inset: 0; opacity: 0.46; background-size: cover; }
  .ai-game-page .ai-game-character-prompt { top: 23px; right: 17px; max-width: 98px; padding: 12px 11px; border: 1px solid #efd0ca; border-radius: 20px; background: rgba(255,255,255,.94); color: #6c463d; font-family: "Noto Serif JP", "Yu Mincho", serif; font-size: 10px; line-height: 1.6; }

  .ai-game-page .ai-game-desktop-character-profile { margin: 0 3px 8px; }
  .ai-game-page .ai-game-desktop-character-profile > strong { display: block; margin-bottom: 3px; color: #74372d; font-family: "Noto Serif JP", "Yu Mincho", serif; font-size: 16px; }
  .ai-game-page .ai-game-desktop-character-profile dl { margin: 0; }
  .ai-game-page .ai-game-desktop-character-profile dl > div { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 6px; padding: 2px 0; color: #4e3d38; font-size: 9px; }
  .ai-game-page .ai-game-desktop-character-profile dt { color: #9d675d; }
  .ai-game-page .ai-game-desktop-character-profile dd { margin: 0; font-weight: 700; }
  .ai-game-page .ai-game-voice-control { margin-top: 7px; padding: 7px 8px; border-color: #ead5cf; border-radius: 9px; }
  .ai-game-page .ai-game-voice-credit { display: none; }

  /* PCでもスマホ版と同一の形勢推移面を表示する。 */
  .ai-game-page .ai-game-trend-panel { padding: 10px 9px 9px !important; overflow: hidden; }
  .ai-game-page .ai-game-trend-panel > .ai-game-trend-header { display: flex !important; min-height: 34px; align-items: center; justify-content: space-between; margin: 0 0 6px !important; padding: 0 2px 6px 25px !important; border-bottom: 1px solid rgba(238, 121, 132, 0.36); }
  .ai-game-page .ai-game-trend-panel > .ai-game-trend-header::before { position: absolute; left: 12px; color: rgba(240,112,130,.42); content: "✿"; font-size: 17px; }
  .ai-game-page .ai-game-trend-panel .ai-game-trend-kicker,
  .ai-game-page .ai-game-trend-panel .ai-game-trend-desktop-title,
  .ai-game-page .ai-game-trend-panel .ai-game-eval-desktop-legacy,
  .ai-game-page .ai-game-study-panel .ai-game-candidate-list,
  .ai-game-page .ai-game-study-panel .ai-game-study-actions { display: none !important; }
  .ai-game-page .ai-game-trend-panel .ai-game-trend-mobile-title,
  .ai-game-page .ai-game-study-panel .ai-game-trend-move,
  .ai-game-page .ai-game-trend-mobile-surface { display: block; }
  .ai-game-page .ai-game-trend-panel .ai-game-trend-header h2 { margin: 0 !important; color: #422e2e; font-family: "Noto Serif JP", "Yu Mincho", serif; font-size: 16px !important; }
  .ai-game-page .ai-game-trend-panel .ai-game-panel-count { min-width: 54px; padding: 4px 8px; border: 1px solid #efb0b2; border-radius: 999px; background: #fff; color: #493536; font-size: 10px; text-align: center; }
  .ai-game-page .ai-game-trend-summary { display: grid; grid-template-columns: auto auto minmax(45px, 1fr) auto; align-items: center; gap: 5px; margin-bottom: 6px; padding: 6px; border: 1px solid rgba(235,157,151,.42); border-radius: 10px; background: rgba(255,255,255,.87); }
  .ai-game-page .ai-game-trend-lead { padding: 4px 7px; border: 1px solid #e58c92; border-radius: 999px; background: #fff4f5; color: #ba4651; font-size: 12px; font-weight: 800; white-space: nowrap; }
  .ai-game-page .ai-game-trend-rate { font-size: 9px; font-weight: 800; white-space: nowrap; }
  .ai-game-page .ai-game-trend-rate--black { color: #292d31; }
  .ai-game-page .ai-game-trend-rate--white { color: #2f87c7; }
  .ai-game-page .ai-game-trend-winrate-bar { position: relative; display: block; height: 8px; overflow: hidden; border: 1px solid rgba(113,123,132,.23); border-radius: 999px; background: #a9d3f1; }
  .ai-game-page .ai-game-trend-winrate-bar > i { position: absolute; inset: 0 auto 0 0; width: 50%; border-right: 1px solid #fff; background: #3f4347; }
  .ai-game-page .ai-game-trend-graph-wrap { padding: 2px; overflow: hidden; border: 1px solid rgba(231,161,154,.42); border-radius: 9px; background: linear-gradient(180deg,rgba(255,242,243,.56),rgba(255,255,255,.8) 49%,rgba(235,247,255,.7) 51%,rgba(244,250,255,.82)); }
  .ai-game-page .ai-game-trend-mobile-surface .ai-game-trend-graph { display: block; width: 100%; height: 105px !important; margin: 0 !important; border: 0 !important; background: transparent !important; }

  .ai-game-page .ai-game-study-question-outside:not([hidden]) { display: block; order: 4; width: 100%; }
  .ai-game-page .ai-game-study-question-outside #aiGameMobileQuestionBtn { width: 100%; min-height: 43px; border: 1px solid #b9d6c1; border-radius: 10px; background: #fff; color: #287144; font-family: "Noto Serif JP", "Yu Mincho", serif; font-size: 12px; font-weight: 800; }

  /* PCでもスマホ版と同一の棋譜ツリー面を表示する。 */
  .ai-game-page .ai-game-kifu-panel { order: 3; padding: 9px 8px 8px !important; overflow: hidden; }
  .ai-game-page .ai-game-kifu-panel > .ai-game-kifu-header { display: flex !important; min-height: 34px; align-items: center; justify-content: space-between; margin: 0 0 4px !important; padding: 0 2px 5px 25px !important; border-bottom: 1px solid rgba(238,121,132,.36); }
  .ai-game-page .ai-game-kifu-panel > .ai-game-kifu-header::before { position: absolute; left: 12px; color: rgba(240,112,130,.42); content: "✿"; font-size: 17px; }
  .ai-game-page .ai-game-kifu-panel .ai-game-kifu-desktop-kicker,
  .ai-game-page .ai-game-kifu-panel .ai-game-kifu-desktop-title,
  .ai-game-page .ai-game-kifu-panel .ai-game-record-help { display: none !important; }
  .ai-game-page .ai-game-kifu-panel .ai-game-kifu-mobile-title { display: inline; }
  .ai-game-page .ai-game-kifu-panel .ai-game-kifu-header h2 { margin: 0 !important; color: #422e2e; font-family: "Noto Serif JP", "Yu Mincho", serif; font-size: 16px !important; }
  .ai-game-page .ai-game-kifu-panel .ai-game-panel-count { min-width: 54px; padding: 4px 8px; border: 1px solid #efb0b2; border-radius: 999px; background: #fff; color: #493536; font-size: 10px; text-align: center; }
  .ai-game-page .ai-game-kifu-toolbar { display: flex; min-height: 30px; align-items: center; justify-content: flex-end; margin-bottom: 3px; }
  .ai-game-page .ai-game-kifu-toolbar #aiGameMoveCurrentBtn { display: inline-flex; min-height: 29px; align-items: center; gap: 4px; padding: 4px 8px; border: 1px solid #e9a5a5; border-radius: 8px; background: #fff; color: #65433d; font-size: 9px; font-weight: 800; }
  .ai-game-page .ai-game-kifu-toolbar #aiGameMoveCurrentBtn svg { width: 12px; height: 12px; fill: #ed6671; }
  .ai-game-page .ai-game-kifu-tree { width: 100%; height: 125px; min-height: 125px; padding: 4px 2px; overflow: auto; overscroll-behavior: contain; touch-action: pan-x pan-y; border: 1px solid rgba(235,157,151,.42); border-radius: 9px; background: rgba(255,253,251,.9); scrollbar-width: thin; scrollbar-color: #e9a2a5 #fff2f1; }
  .ai-game-page .ai-game-kifu-tree-canvas { min-width: 100%; min-height: 108px; }
  .ai-game-page .ai-game-kifu-tree-node,
  .ai-game-page .ai-game-kifu-tree-node.root-node { display: flex; width: 30px; min-width: 30px; height: 30px; min-height: 30px; align-items: center; justify-content: center; padding: 0 !important; border-radius: 50%; font-family: "Noto Serif JP", "Yu Mincho", serif; font-size: 10px; }
  .ai-game-page .ai-game-kifu-tree-node.black-node { background: radial-gradient(circle at 34% 26%,#656668 0 6%,#303133 34%,#101112 76%,#050505 100%); color: #fff; }
  .ai-game-page .ai-game-kifu-tree-node.white-node { background: radial-gradient(circle at 34% 26%,#fff 0 9%,#f6f4f1 40%,#e8e5e1 76%,#d5d0ca 100%); color: #4b2928; }
  .ai-game-page .ai-game-kifu-tree-node.current { outline: 2px solid #ef6570; outline-offset: 2px; }
}

/* Free-study mobile playback endpoints and complete move count r43 20260816. */
@media (orientation: portrait) and (max-width: 1439px) {
  body[data-mode="study"].workspace-mobile-minimal .board-workspace-panel > .move-controls {
    grid-template-columns: 38px 38px minmax(92px, 1fr) 38px 38px !important;
    grid-template-rows: 38px 30px !important;
    gap: 2px 4px !important;
  }

  body[data-mode="study"].workspace-mobile-minimal .board-workspace-panel > .move-controls #firstMoveBtn,
  body[data-mode="study"].workspace-mobile-minimal .board-workspace-panel > .move-controls #lastMoveBtn {
    display: grid !important;
    width: 38px !important;
    max-width: 38px !important;
    min-width: 0 !important;
    min-height: 38px !important;
    place-items: center;
  }

  body[data-mode="study"].workspace-mobile-minimal .board-workspace-panel > .move-controls #firstMoveBtn {
    grid-column: 1;
    grid-row: 1;
  }

  body[data-mode="study"].workspace-mobile-minimal .board-workspace-panel > .move-controls #prevMoveBtn {
    grid-column: 2;
    grid-row: 1;
  }

  body[data-mode="study"].workspace-mobile-minimal .board-workspace-panel > .move-controls .move-number-jump,
  body[data-mode="study"].workspace-mobile-minimal .board-workspace-panel > .move-controls #moveNumberLabel {
    display: flex !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    grid-column: 3 !important;
    grid-row: 1;
    overflow: visible;
    white-space: nowrap;
  }

  body[data-mode="study"].workspace-mobile-minimal .board-workspace-panel > .move-controls .move-number-jump input {
    width: 38px !important;
    max-width: 38px !important;
    min-width: 38px !important;
    flex: 0 0 38px;
    padding-inline: 2px;
  }

  body[data-mode="study"].workspace-mobile-minimal .board-workspace-panel > .move-controls #moveNumberMaxLabel {
    flex: 0 0 auto;
  }

  body[data-mode="study"].workspace-mobile-minimal .board-workspace-panel > .move-controls #nextMoveBtn {
    grid-column: 4;
    grid-row: 1;
  }

  body[data-mode="study"].workspace-mobile-minimal .board-workspace-panel > .move-controls #lastMoveBtn {
    grid-column: 5;
    grid-row: 1;
  }

  body[data-mode="study"].workspace-mobile-minimal .board-workspace-panel > .move-controls .seek-wrapper {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
  }
}

/* AI対局場: スマホ形勢推移カード r1 20260816. */
.ai-game-trend-mobile-surface,
.ai-game-trend-mobile-title,
.ai-game-study-question-outside,
.ai-game-kifu-mobile-title,
.ai-game-kifu-toolbar,
.ai-game-kifu-current-label,
.ai-game-page .ai-game-study-panel .ai-game-trend-move {
  display: none;
}

@media (max-width: 1439px) and (orientation: portrait) {
  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-right-panel {
    align-items: stretch !important;
    flex-direction: column !important;
    gap: 10px !important;
  }

  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-right-panel > .ai-game-panel {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 auto !important;
  }

  .ai-game-page .ai-game-trend-panel {
    position: relative;
    padding: 12px 10px 11px !important;
    overflow: hidden;
    border: 1px solid rgba(239, 153, 151, 0.58) !important;
    border-radius: 15px !important;
    background:
      radial-gradient(circle at 6% 8%, rgba(245, 157, 170, 0.12) 0 18px, transparent 19px),
      radial-gradient(circle at 96% 94%, rgba(245, 157, 170, 0.1) 0 24px, transparent 25px),
      linear-gradient(180deg, rgba(255, 254, 251, 0.99), rgba(255, 249, 247, 0.98)) !important;
    box-shadow: 0 7px 18px rgba(126, 72, 61, 0.07) !important;
    box-sizing: border-box;
  }

  .ai-game-page .ai-game-trend-panel::before,
  .ai-game-page .ai-game-trend-panel::after {
    position: absolute;
    z-index: 0;
    color: rgba(240, 112, 130, 0.27);
    font-family: serif;
    line-height: 1;
    pointer-events: none;
  }

  .ai-game-page .ai-game-trend-panel::before {
    top: 12px;
    left: 12px;
    font-size: 20px;
    content: "✿";
  }

  .ai-game-page .ai-game-trend-panel::after {
    right: 11px;
    bottom: 8px;
    font-size: 17px;
    letter-spacing: 4px;
    content: "❀ ✿";
  }

  .ai-game-page .ai-game-trend-panel > .ai-game-trend-header {
    position: relative;
    z-index: 2;
    display: flex !important;
    min-height: 38px;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 9px !important;
    padding: 0 2px 8px 27px !important;
    border-bottom: 1px solid rgba(238, 121, 132, 0.36);
    cursor: default;
  }

  .ai-game-page .ai-game-trend-panel > .ai-game-trend-header > div {
    min-width: 0;
  }

  .ai-game-page .ai-game-trend-panel > .ai-game-trend-header h2 {
    margin: 0 !important;
    color: #35282a;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 20px !important;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1.25;
  }

  .ai-game-page .ai-game-trend-panel .ai-game-trend-kicker,
  .ai-game-page .ai-game-trend-panel .ai-game-trend-desktop-title,
  .ai-game-page .ai-game-trend-panel .ai-game-eval-desktop-legacy {
    display: none !important;
  }

  .ai-game-page .ai-game-trend-panel .ai-game-trend-mobile-title,
  .ai-game-page .ai-game-study-panel .ai-game-trend-move,
  .ai-game-page .ai-game-trend-mobile-surface {
    display: block;
  }

  .ai-game-page .ai-game-trend-panel .ai-game-panel-count,
  .ai-game-page .ai-game-trend-panel .ai-game-trend-move {
    min-width: 58px;
    min-height: 29px;
    padding: 5px 10px;
    border: 1px solid rgba(238, 126, 133, 0.5);
    border-radius: 999px;
    background: rgba(255, 253, 251, 0.92);
    color: #3b3032;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    box-sizing: border-box;
  }

  .ai-game-page .ai-game-trend-panel .ai-game-mobile-accordion-toggle {
    display: none !important;
  }

  .ai-game-page .ai-game-trend-mobile-surface {
    position: relative;
    z-index: 1;
    min-width: 0;
  }

  .ai-game-page .ai-game-trend-summary {
    display: grid;
    min-width: 0;
    grid-template-columns: auto auto minmax(42px, 1fr) auto;
    align-items: center;
    gap: 6px;
    margin: 0 0 9px;
    padding: 8px;
    border: 1px solid rgba(235, 157, 151, 0.42);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 3px 9px rgba(116, 70, 60, 0.045);
    color: #302a2b;
    font-variant-numeric: tabular-nums;
    box-sizing: border-box;
  }

  .ai-game-page .ai-game-trend-lead {
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    justify-content: center;
    padding: 4px 9px;
    border: 1px solid rgba(222, 123, 132, 0.62);
    border-radius: 999px;
    background: linear-gradient(135deg, #fffaf9 0%, #fff0f2 100%);
    box-shadow: 0 2px 6px rgba(125, 53, 60, 0.08);
    color: #7d353c;
    font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", sans-serif;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.01em;
    line-height: 1;
    white-space: nowrap;
    box-sizing: border-box;
  }

  .ai-game-page .ai-game-trend-rate {
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
  }

  .ai-game-page .ai-game-trend-rate--black { color: #292d31; }
  .ai-game-page .ai-game-trend-rate--white { color: #2f87c7; }

  .ai-game-page .ai-game-trend-winrate-bar {
    position: relative;
    display: block;
    min-width: 0;
    height: 9px;
    overflow: hidden;
    border: 1px solid rgba(113, 123, 132, 0.23);
    border-radius: 999px;
    background: linear-gradient(90deg, #b9dcf5, #91c7ec);
    box-shadow: inset 0 1px 2px rgba(53, 67, 77, 0.12), 0 0 0 2px rgba(255, 255, 255, 0.78);
  }

  .ai-game-page .ai-game-trend-winrate-bar > i {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 50%;
    border-right: 1px solid rgba(255, 255, 255, 0.75);
    background: linear-gradient(90deg, #34383d, #55595e);
    transition: width 180ms ease;
  }

  .ai-game-page .ai-game-trend-graph-wrap {
    position: relative;
    min-width: 0;
    padding: 4px 3px 1px;
    overflow: hidden;
    border: 1px solid rgba(231, 161, 154, 0.42);
    border-radius: 12px;
    background:
      radial-gradient(circle at 12% 12%, rgba(244, 172, 182, 0.13), transparent 26%),
      linear-gradient(180deg, rgba(255, 242, 243, 0.56) 0%, rgba(255, 255, 255, 0.8) 49%, rgba(235, 247, 255, 0.7) 51%, rgba(244, 250, 255, 0.82) 100%);
    box-sizing: border-box;
  }

  .ai-game-page .ai-game-trend-mobile-surface .ai-game-trend-graph {
    display: block;
    width: 100%;
    height: auto !important;
    aspect-ratio: 320 / 150;
    margin: 0 !important;
    overflow: visible;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
  }

  .ai-game-page .ai-game-trend-graph .trend-grid {
    stroke: rgba(92, 92, 92, 0.14);
    stroke-width: 0.8;
    stroke-dasharray: 2 2;
  }

  .ai-game-page .ai-game-trend-graph .trend-grid--vertical {
    stroke: rgba(126, 103, 98, 0.11);
  }

  .ai-game-page .ai-game-trend-graph .trend-grid--even {
    stroke: rgba(101, 83, 79, 0.5);
    stroke-width: 1;
    stroke-dasharray: none;
  }

  .ai-game-page .ai-game-trend-graph .trend-tick-label,
  .ai-game-page .ai-game-trend-graph .trend-move-label,
  .ai-game-page .ai-game-trend-graph .trend-side-label,
  .ai-game-page .ai-game-trend-graph .trend-callout-text {
    fill: #66595a;
    font-family: "Noto Sans JP", sans-serif;
    font-size: 7px;
    font-weight: 700;
  }

  .ai-game-page .ai-game-trend-graph .trend-side-label {
    fill: #4e4243;
    font-size: 7.5px;
  }

  .ai-game-page .ai-game-trend-graph .trend-area {
    stroke: none;
  }

  .ai-game-page .ai-game-trend-graph .trend-series {
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .ai-game-page .ai-game-trend-graph .trend-guide {
    stroke: rgba(112, 151, 180, 0.55);
    stroke-width: 0.8;
    stroke-dasharray: 3 2;
  }

  .ai-game-page .ai-game-trend-graph .trend-guide.is-current {
    stroke: #ef6570;
    stroke-width: 1.4;
    stroke-dasharray: none;
  }

  .ai-game-page .ai-game-trend-graph .trend-callout {
    fill: #eaf6fe;
    stroke: rgba(91, 160, 207, 0.25);
    stroke-width: 0.6;
  }

  .ai-game-page .ai-game-trend-graph .trend-callout.is-current {
    fill: #ef6570;
    stroke: #ef6570;
  }

  .ai-game-page .ai-game-trend-graph .trend-callout-text.is-current {
    fill: #fff;
  }

  .ai-game-page .ai-game-trend-graph .trend-point {
    fill: #4395cd;
    stroke: #fff;
    stroke-width: 1.5;
  }

  .ai-game-page .ai-game-trend-graph .trend-point.is-current {
    fill: #ef6570;
    stroke-width: 2;
  }

  .ai-game-page .ai-game-study-panel .ai-game-candidate-list {
    display: none !important;
  }

  .ai-game-page .ai-game-study-panel .ai-game-study-actions {
    display: none !important;
  }

  .ai-game-page .ai-game-study-question-outside:not([hidden]) {
    display: block;
    position: relative;
    z-index: 1;
    order: 2;
    width: 100%;
    max-width: 100%;
    margin: 0;
  }

  .ai-game-page .ai-game-study-question-outside #aiGameMobileQuestionBtn {
    width: 100%;
    min-height: 52px;
    border: 2px solid #f06f79;
    border-radius: 15px;
    background: linear-gradient(135deg, #f47781 0%, #e65b68 100%);
    box-shadow: 0 7px 16px rgba(221, 88, 101, 0.2);
    color: #fff;
    font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.04em;
  }
}

/* AI対局場: スマホ棋譜ツリーカード r1 20260816. */
@media (max-width: 1439px) and (orientation: portrait) {
  .ai-game-page .ai-game-kifu-panel {
    position: relative;
    padding: 10px 9px 9px !important;
    overflow: hidden;
    border: 1px solid rgba(239, 153, 151, 0.58) !important;
    border-radius: 15px !important;
    background:
      radial-gradient(circle at 5% 8%, rgba(245, 157, 170, 0.11) 0 18px, transparent 19px),
      linear-gradient(180deg, rgba(255, 254, 251, 0.99), rgba(255, 249, 247, 0.98)) !important;
    box-shadow: 0 7px 18px rgba(126, 72, 61, 0.07) !important;
    box-sizing: border-box;
  }

  .ai-game-page .ai-game-kifu-panel::before {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 0;
    color: rgba(240, 112, 130, 0.3);
    content: "✿";
    font-family: serif;
    font-size: 20px;
    line-height: 1;
    pointer-events: none;
  }

  .ai-game-page .ai-game-kifu-panel > .ai-game-kifu-header {
    position: relative;
    z-index: 2;
    display: flex !important;
    min-height: 38px;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 6px !important;
    padding: 0 2px 7px 28px !important;
    border-bottom: 1px solid rgba(238, 121, 132, 0.36);
    cursor: default;
  }

  .ai-game-page .ai-game-kifu-panel .ai-game-kifu-desktop-kicker,
  .ai-game-page .ai-game-kifu-panel .ai-game-kifu-desktop-title,
  .ai-game-page .ai-game-kifu-panel .ai-game-record-help {
    display: none !important;
  }

  .ai-game-page .ai-game-kifu-panel .ai-game-kifu-mobile-title {
    display: inline;
  }

  .ai-game-page .ai-game-kifu-panel .ai-game-kifu-header h2 {
    margin: 0 !important;
    color: #35282a;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 20px !important;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1.25;
  }

  .ai-game-page .ai-game-kifu-panel .ai-game-panel-count {
    min-width: 78px;
    min-height: 29px;
    padding: 5px 10px;
    border: 1px solid rgba(238, 126, 133, 0.5);
    border-radius: 999px;
    background: rgba(255, 253, 251, 0.94);
    color: #3b3032;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    box-sizing: border-box;
  }

  .ai-game-page .ai-game-kifu-panel .ai-game-mobile-accordion-toggle {
    display: none !important;
  }

  .ai-game-page .ai-game-kifu-toolbar {
    position: relative;
    z-index: 2;
    display: flex;
    min-height: 34px;
    align-items: center;
    justify-content: flex-end;
    margin: 0 1px 5px;
  }

  .ai-game-page .ai-game-kifu-toolbar #aiGameMoveCurrentBtn {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 5px 11px;
    border: 1px solid rgba(229, 142, 142, 0.52);
    border-radius: 11px;
    background: rgba(255, 253, 251, 0.95);
    box-shadow: 0 3px 8px rgba(119, 73, 64, 0.07);
    color: #5a3936;
    font-family: "Noto Sans JP", "Yu Gothic", sans-serif;
    font-size: 12px;
    font-weight: 800;
  }

  .ai-game-page .ai-game-kifu-toolbar #aiGameMoveCurrentBtn svg {
    width: 15px;
    height: 15px;
    fill: #ed6671;
  }

  .ai-game-page .ai-game-kifu-tree {
    position: relative;
    z-index: 1;
    width: 100%;
    height: clamp(108px, 17dvh, 132px);
    min-height: 108px;
    max-height: 132px;
    padding: 5px 3px 3px;
    overflow: auto;
    overscroll-behavior: contain;
    touch-action: pan-x pan-y;
    border: 1px solid rgba(235, 157, 151, 0.42);
    border-radius: 12px;
    background:
      radial-gradient(circle at 92% 9%, rgba(244, 172, 182, 0.1), transparent 26%),
      linear-gradient(180deg, rgba(255, 253, 251, 0.94), rgba(255, 250, 248, 0.9));
    scrollbar-gutter: auto;
    scrollbar-width: thin;
    scrollbar-color: #e9a2a5 #fff2f1;
    box-sizing: border-box;
  }

  .ai-game-page .ai-game-kifu-tree::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }

  .ai-game-page .ai-game-kifu-tree::-webkit-scrollbar-track {
    border-radius: 999px;
    background: #fff2f1;
  }

  .ai-game-page .ai-game-kifu-tree::-webkit-scrollbar-thumb {
    border: 1px solid #fff2f1;
    border-radius: 999px;
    background: #e9a2a5;
  }

  .ai-game-page .ai-game-kifu-tree-canvas {
    min-width: 100%;
    min-height: 92px;
  }

  .ai-game-page .ai-game-kifu-tree .main-line {
    stroke: #aa8c84;
    stroke-width: 1.5;
  }

  .ai-game-page .ai-game-kifu-tree-node,
  .ai-game-page .ai-game-kifu-tree-node.root-node {
    display: flex;
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0 !important;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(104, 80, 73, 0.35);
    border-radius: 50%;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    text-indent: 0;
    box-shadow: 0 3px 7px rgba(73, 54, 49, 0.16);
  }

  .ai-game-page .ai-game-kifu-tree-node.black-node {
    border-color: rgba(15, 15, 16, 0.9);
    background: radial-gradient(circle at 34% 26%, #656668 0 6%, #303133 34%, #101112 76%, #050505 100%);
    color: #fff;
  }

  .ai-game-page .ai-game-kifu-tree-node.white-node {
    border-color: rgba(167, 155, 150, 0.72);
    background: radial-gradient(circle at 34% 26%, #fff 0 9%, #f6f4f1 40%, #e8e5e1 76%, #d5d0ca 100%);
    color: #4b2928;
  }

  .ai-game-page .ai-game-kifu-tree-node.root-node {
    border-radius: 9px;
    background: #fff3f2;
    color: #74433f;
  }

  .ai-game-page .ai-game-kifu-tree-node.current {
    z-index: 5;
    outline: 2px solid #ef6570;
    outline-offset: 3px;
    box-shadow: 0 0 0 5px rgba(239, 101, 112, 0.12), 0 3px 8px rgba(100, 54, 58, 0.2);
  }

  .ai-game-page .ai-game-kifu-current-label {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    display: block;
    min-width: 34px;
    padding: 3px 6px;
    border-radius: 7px;
    background: linear-gradient(135deg, #f47781, #e65b68);
    color: #fff;
    font-family: "Noto Sans JP", "Yu Gothic", sans-serif;
    font-size: 9px;
    font-weight: 800;
    line-height: 1.1;
    transform: translateX(-50%);
    box-shadow: 0 2px 5px rgba(221, 88, 101, 0.18);
    pointer-events: none;
  }
}

@media (max-width: 390px) {
  .ai-game-page .ai-game-trend-summary {
    grid-template-columns: auto auto minmax(34px, 1fr) auto;
    gap: 4px;
    padding: 7px 6px;
  }

  .ai-game-page .ai-game-trend-lead {
    min-height: 28px;
    padding-inline: 7px;
    font-size: 13px;
  }

  .ai-game-page .ai-game-trend-rate {
    font-size: 9px;
  }
}

/* Mobile AI game board full-bleed r1 (2026-08-16). */
@media (max-width: 1439px) and (orientation: portrait) {
  .ai-game-page .ai-game-board-area,
  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-board-area {
    padding-right: 0 !important;
    padding-left: 0 !important;
    overflow-x: hidden !important;
  }

  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-board-area {
    padding-right: 0 !important;
    padding-left: 0 !important;
  }

  .ai-game-page .ai-game-board-frame,
  :root[data-board-coordinates="off"] .ai-game-page .ai-game-board-frame {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    overflow: hidden !important;
    border-right: 0 !important;
    border-left: 0 !important;
    box-sizing: border-box;
  }

  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-board-frame,
  :root[data-board-coordinates="off"] .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-board-frame {
    padding: 0 !important;
  }

  :root[data-board-coordinates="on"] .ai-game-page .ai-game-board-frame {
    padding: 19px 1px 2px 19px !important;
  }

  .ai-game-page .ai-game-board.goban {
    max-width: none !important;
  }
}

/* Site-wide spring trend and kifu tree theme r1 (2026-08-16). */
.ai-game-page .ai-game-trend-panel,
.ai-game-page .ai-game-kifu-panel,
.analysis-review-card .kap-trend-group,
.board-tree-panel {
  border-color: rgba(239, 153, 151, 0.58) !important;
  background:
    radial-gradient(circle at 6% 8%, rgba(245, 157, 170, 0.11) 0 18px, transparent 19px),
    radial-gradient(circle at 96% 94%, rgba(245, 157, 170, 0.08) 0 24px, transparent 25px),
    linear-gradient(180deg, rgba(255, 254, 251, 0.99), rgba(255, 249, 247, 0.98)) !important;
  box-shadow: 0 7px 18px rgba(126, 72, 61, 0.07) !important;
}

.ai-game-page .ai-game-trend-panel,
.ai-game-page .ai-game-kifu-panel,
.analysis-review-card .kap-trend-group,
.board-tree-panel {
  position: relative;
  overflow: hidden;
}

.analysis-review-card .kap-trend-group {
  width: calc(100% - 24px);
  margin: 12px;
  padding: 12px 10px 11px !important;
  border: 1px solid rgba(239, 153, 151, 0.58);
  border-radius: 15px;
  box-sizing: border-box;
}

.analysis-review-card .kap-trend-group::before,
.board-tree-panel::before {
  position: absolute;
  z-index: 0;
  color: rgba(240, 112, 130, 0.29);
  content: "✿";
  font-family: serif;
  font-size: 20px;
  line-height: 1;
  pointer-events: none;
}

.analysis-review-card .kap-trend-group::before {
  top: 13px;
  left: 13px;
}

.analysis-review-card .kap-trend-group .kap-result-th-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin: 0 0 9px;
  padding: 0 2px 8px 28px;
  border-bottom: 1px solid rgba(238, 121, 132, 0.36);
}

.analysis-review-card .kap-trend-group .kap-group-label {
  margin: 0 !important;
  color: #35282a;
  font-family: "Noto Serif JP", "Yu Mincho", serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.25;
}

.analysis-review-card .kap-trend-move {
  min-width: 58px;
  padding: 5px 10px;
  border: 1px solid rgba(238, 126, 133, 0.5);
  border-radius: 999px;
  background: rgba(255, 253, 251, 0.94);
  color: #3b3032;
  font-family: "Noto Serif JP", "Yu Mincho", serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  box-sizing: border-box;
}

.analysis-review-card .kap-trend-group .kap-winrate-summary {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-column: 1 / -1;
  grid-template-columns: auto auto minmax(44px, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(235, 157, 151, 0.42);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
  color: #302a2b;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  box-sizing: border-box;
}

.analysis-review-card .kap-score-lead {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  border: 1px solid rgba(222, 123, 132, 0.62);
  border-radius: 999px;
  background: linear-gradient(135deg, #fffaf9, #fff0f2);
  box-shadow: 0 2px 6px rgba(125, 53, 60, 0.08);
  color: #7d353c;
  font-family: "Noto Sans JP", "Yu Gothic", sans-serif;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.analysis-review-card .kap-trend-group .kap-wr-black,
.analysis-review-card .kap-trend-group .kap-wr-white {
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.analysis-review-card .kap-trend-group .kap-wr-black { color: #292d31; }
.analysis-review-card .kap-trend-group .kap-wr-white { color: #2f87c7; }

.analysis-review-card .kap-trend-group .kap-wr-bar-wrap {
  position: relative;
  width: auto;
  min-width: 0;
  height: 9px;
  overflow: hidden;
  border: 1px solid rgba(113, 123, 132, 0.23);
  border-radius: 999px;
  background: linear-gradient(90deg, #b9dcf5, #91c7ec);
  box-shadow: inset 0 1px 2px rgba(53, 67, 77, 0.12), 0 0 0 2px rgba(255, 255, 255, 0.78);
}

.analysis-review-card .kap-trend-group .kap-wr-bar-black {
  border-right: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 999px 0 0 999px;
  background: linear-gradient(90deg, #34383d, #55595e);
}

.analysis-review-card .kap-trend-group .kap-score-graph-wrap {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 4px 3px 1px;
  border: 1px solid rgba(231, 161, 154, 0.42);
  border-radius: 12px;
  background:
    radial-gradient(circle at 12% 12%, rgba(244, 172, 182, 0.13), transparent 26%),
    linear-gradient(180deg, rgba(255, 242, 243, 0.56) 0%, rgba(255, 255, 255, 0.8) 49%, rgba(235, 247, 255, 0.7) 51%, rgba(244, 250, 255, 0.82) 100%);
  box-sizing: border-box;
}

.analysis-review-card .kap-trend-group .kap-score-graph {
  border-radius: 10px;
  touch-action: manipulation;
}

.analysis-review-card .kap-trend-group .kap-graph-bg { fill: transparent; }
.analysis-review-card .kap-trend-group .kap-graph-grid { stroke: rgba(92, 92, 92, 0.14); stroke-dasharray: 2 2; }
.analysis-review-card .kap-trend-group .kap-graph-zero { stroke: rgba(101, 83, 79, 0.58); stroke-width: 1; }
.analysis-review-card .kap-trend-group .kap-graph-area-black { fill: url(#kapTrendBlackArea); }
.analysis-review-card .kap-trend-group .kap-graph-area-white { fill: url(#kapTrendWhiteArea); }
.analysis-review-card .kap-trend-group .kap-graph-line { stroke: url(#kapTrendLine); stroke-width: 2.2; }
.analysis-review-card .kap-trend-group .kap-graph-current-line { stroke: #ef6570; stroke-width: 1.5; stroke-dasharray: none; }
.analysis-review-card .kap-trend-group .kap-graph-current-dot { fill: #ef6570; stroke-width: 2; }
.analysis-review-card .kap-trend-group :is(.kap-graph-y-label, .kap-graph-x-label, .kap-graph-side-label) {
  fill: #66595a;
  font-family: "Noto Sans JP", sans-serif;
  font-weight: 700;
}

.analysis-review-card .kap-trend-group .kap-score-graph-hint {
  position: relative;
  z-index: 1;
  margin-bottom: 0;
  color: #7a6865;
}

.board-tree-panel::before {
  top: 12px;
  left: 12px;
}

.board-tree-panel .board-tree-header {
  position: relative;
  z-index: 2;
  min-height: 42px;
  padding: 6px 8px 7px 9px;
  border-bottom-color: rgba(238, 121, 132, 0.36);
  background: transparent;
}

.board-tree-panel .board-tree-heading {
  padding-left: 25px;
}

.board-tree-panel .board-tree-heading-icon {
  display: none;
}

.board-tree-panel .board-tree-heading strong {
  color: #35282a;
  font-family: "Noto Serif JP", "Yu Mincho", serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.board-tree-panel .board-tree-summary > span,
.board-tree-panel #gameTreeToggleBtn {
  border-color: rgba(238, 126, 133, 0.42);
  background: rgba(255, 253, 251, 0.94);
  color: #5a3936;
}

.board-tree-panel #gameTreeMoveBadge {
  min-width: 72px;
  font-family: "Noto Serif JP", "Yu Mincho", serif;
  font-size: 10px;
}

.board-tree-panel .board-tree-toolbar {
  position: relative;
  z-index: 2;
  border-bottom-color: rgba(238, 121, 132, 0.18);
  background: rgba(255, 253, 251, 0.72);
}

.board-tree-panel .board-tree-toolbar #gameTreeFocusBtn {
  border-color: rgba(229, 142, 142, 0.52);
  border-radius: 10px;
  background: rgba(255, 253, 251, 0.95);
  color: #5a3936;
}

.board-tree-panel .board-tree-toolbar #gameTreeFocusBtn:hover {
  border-color: #e65b68;
  background: #e65b68;
  color: #fff;
}

.board-tree-panel .game-tree,
.ai-game-page .ai-game-kifu-tree,
.qk-move-chips-scroll.qk-cont-tree {
  border-color: rgba(235, 157, 151, 0.42);
  background:
    radial-gradient(circle at 92% 9%, rgba(244, 172, 182, 0.1), transparent 26%),
    linear-gradient(180deg, rgba(255, 253, 251, 0.94), rgba(255, 250, 248, 0.9)) !important;
  scrollbar-color: #e9a2a5 #fff2f1;
}

.ai-game-page .ai-game-kifu-tree {
  border-color: rgba(235, 157, 151, 0.42);
  scrollbar-color: #e9a2a5 #fff2f1;
}

.board-tree-panel .game-tree::-webkit-scrollbar,
.ai-game-page .ai-game-kifu-tree::-webkit-scrollbar,
.qk-move-chips-scroll.qk-cont-tree::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.board-tree-panel .game-tree::-webkit-scrollbar-track,
.ai-game-page .ai-game-kifu-tree::-webkit-scrollbar-track,
.qk-move-chips-scroll.qk-cont-tree::-webkit-scrollbar-track {
  background: #fff2f1;
}

.board-tree-panel .game-tree::-webkit-scrollbar-thumb,
.ai-game-page .ai-game-kifu-tree::-webkit-scrollbar-thumb,
.qk-move-chips-scroll.qk-cont-tree::-webkit-scrollbar-thumb {
  border: 1px solid #fff2f1;
  border-radius: 999px;
  background: #e9a2a5;
}

.board-workspace-panel .board-tree-panel .main-line,
.ai-game-page .ai-game-kifu-tree .main-line,
.qk-cont-tree .main-line {
  stroke: #aa8c84;
  stroke-width: 1.5;
}

.ai-game-page .ai-game-kifu-tree-node {
  border-color: rgba(104, 80, 73, 0.35);
  font-family: "Noto Serif JP", "Yu Mincho", serif;
  box-shadow: 0 3px 7px rgba(73, 54, 49, 0.16);
}

.board-workspace-panel .board-tree-panel .tree-node {
  border-color: rgba(104, 80, 73, 0.35);
  font-family: "Noto Serif JP", "Yu Mincho", serif;
  box-shadow: 0 3px 7px rgba(73, 54, 49, 0.16);
}

.board-workspace-panel .board-tree-panel .black-node,
.ai-game-page .ai-game-kifu-tree-node.black-node,
.qk-cont-tree .black-node {
  border-color: rgba(15, 15, 16, 0.9);
  background: radial-gradient(circle at 34% 26%, #656668 0 6%, #303133 34%, #101112 76%, #050505 100%);
  color: #fff;
}

.board-workspace-panel .board-tree-panel .white-node,
.ai-game-page .ai-game-kifu-tree-node.white-node,
.qk-cont-tree .white-node {
  border-color: rgba(167, 155, 150, 0.72);
  background: radial-gradient(circle at 34% 26%, #fff 0 9%, #f6f4f1 40%, #e8e5e1 76%, #d5d0ca 100%);
  color: #4b2928;
}

.board-workspace-panel .board-tree-panel .root-node {
  border-color: rgba(229, 142, 142, 0.42);
  background: #fff3f2;
  color: #74433f;
}

.ai-game-page .ai-game-kifu-tree-node.root-node {
  border-color: rgba(229, 142, 142, 0.42);
  background: #fff3f2;
  color: #74433f;
}

.board-workspace-panel .board-tree-panel .tree-node.current,
.ai-game-page .ai-game-kifu-tree-node.current,
.qk-cont-tree .tree-node.current {
  z-index: 5;
  outline: 2px solid #ef6570;
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(239, 101, 112, 0.12), 0 3px 8px rgba(100, 54, 58, 0.2);
}

/* Site-wide kifu tree stones must remain stationary on hover and focus. */
.tree-node:hover,
.tree-node:focus-visible {
  transform: translate(-50%, -50%) !important;
}

.board-tree-current-label {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  display: block;
  min-width: 34px;
  padding: 3px 6px;
  border-radius: 7px;
  background: linear-gradient(135deg, #f47781, #e65b68);
  box-shadow: 0 2px 5px rgba(221, 88, 101, 0.18);
  color: #fff;
  font-family: "Noto Sans JP", "Yu Gothic", sans-serif;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.1;
  transform: translateX(-50%);
  pointer-events: none;
}

@media (orientation: portrait) and (max-width: 1439px) {
  .analysis-review-card .kap-trend-group {
    width: calc(100% - 16px);
    margin: 8px;
  }

  .analysis-review-card .kap-trend-group .kap-winrate-summary {
    grid-template-columns: auto auto minmax(34px, 1fr) auto;
    gap: 4px;
    padding: 7px 6px;
  }

  .analysis-review-card .kap-score-lead {
    min-height: 28px;
    padding-inline: 7px;
    font-size: 13px;
  }

  body.workspace-mobile-minimal .board-tree-panel {
    position: relative;
    width: 100% !important;
    margin: 0 0 8px !important;
    padding: 10px 9px 9px !important;
    overflow: hidden !important;
    border: 1px solid rgba(239, 153, 151, 0.58) !important;
    border-radius: 15px !important;
    box-sizing: border-box;
  }

  body.workspace-mobile-minimal .board-tree-panel .board-tree-header {
    min-height: 38px;
    margin: 0 0 6px;
    padding: 0 2px 7px 28px;
    border-bottom: 1px solid rgba(238, 121, 132, 0.36);
  }

  body.workspace-mobile-minimal .board-tree-panel .board-tree-heading {
    padding-left: 0;
  }

  body.workspace-mobile-minimal .board-tree-panel .board-tree-heading strong {
    font-size: 20px;
    font-weight: 700;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-tree-host .board-tree-summary,
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-tree-host .board-tree-summary {
    display: flex !important;
  }

  body.workspace-mobile-minimal .board-tree-panel .board-tree-toolbar {
    min-height: 34px;
    margin: 0 1px 5px;
    padding: 0;
    justify-content: flex-end;
    border: 0;
    background: transparent;
  }

  body.workspace-mobile-minimal .board-tree-panel .board-tree-toolbar #gameTreeFocusBtn {
    min-height: 34px;
    padding: 5px 11px;
    font-family: "Noto Sans JP", "Yu Gothic", sans-serif;
    font-size: 12px;
  }

  body.workspace-mobile-minimal .board-tree-panel .game-tree {
    width: 100%;
    height: clamp(108px, 17dvh, 132px) !important;
    min-height: 108px !important;
    max-height: 132px !important;
    padding: 5px 3px 3px !important;
    overflow: auto !important;
    overscroll-behavior: contain;
    touch-action: pan-x pan-y;
    border: 1px solid rgba(235, 157, 151, 0.42) !important;
    border-radius: 12px;
    box-sizing: border-box;
  }

  body.workspace-mobile-minimal .board-tree-panel .game-tree-canvas {
    min-height: 92px;
  }

  body.workspace-mobile-minimal .board-tree-panel .tree-node,
  body.workspace-mobile-minimal .board-tree-panel .root-node {
    display: flex;
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0 !important;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 11px;
    line-height: 1;
  }

  body.workspace-mobile-minimal .board-tree-panel .root-node {
    border-radius: 9px;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-tree-host .board-tree-panel,
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-tree-host .board-tree-panel {
    position: relative;
    display: block !important;
    width: 100% !important;
    margin: 0 0 8px !important;
    padding: 10px 9px 9px !important;
    overflow: hidden !important;
    border: 1px solid rgba(239, 153, 151, 0.58) !important;
    border-radius: 15px !important;
    background:
      radial-gradient(circle at 5% 8%, rgba(245, 157, 170, 0.11) 0 18px, transparent 19px),
      linear-gradient(180deg, rgba(255, 254, 251, 0.99), rgba(255, 249, 247, 0.98)) !important;
    box-shadow: 0 7px 18px rgba(126, 72, 61, 0.07) !important;
    box-sizing: border-box;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-tree-host .board-tree-header,
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-tree-host .board-tree-header {
    min-height: 38px;
    margin: 0 0 6px;
    padding: 0 2px 7px 28px;
    border: 0;
    border-bottom: 1px solid rgba(238, 121, 132, 0.36);
    background: transparent;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-tree-host .board-tree-heading,
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-tree-host .board-tree-heading {
    padding-left: 0;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-tree-host .board-tree-heading strong,
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-tree-host .board-tree-heading strong {
    color: #35282a;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.05em;
  }

  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-tree-host .board-tree-heading strong::before {
    content: none;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-tree-host .board-tree-toolbar,
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-tree-host .board-tree-toolbar {
    display: flex !important;
    min-height: 34px;
    justify-content: flex-end;
    margin: 0 1px 5px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-tree-host #gameTreeFocusBtn,
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-tree-host #gameTreeFocusBtn {
    min-height: 34px;
    padding: 5px 11px;
    border: 1px solid rgba(229, 142, 142, 0.52);
    border-radius: 10px;
    background: rgba(255, 253, 251, 0.95);
    color: #5a3936;
    font-family: "Noto Sans JP", "Yu Gothic", sans-serif;
    font-size: 12px;
    font-weight: 800;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-tree-host .game-tree,
body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-tree-host .game-tree {
    width: 100%;
    height: clamp(108px, 17dvh, 132px) !important;
    min-height: 108px !important;
    max-height: 132px !important;
    padding: 5px 3px 3px !important;
    overflow: auto !important;
    overscroll-behavior: contain;
    touch-action: pan-x pan-y;
    border: 1px solid rgba(235, 157, 151, 0.42) !important;
    border-radius: 12px;
    background:
      radial-gradient(circle at 92% 9%, rgba(244, 172, 182, 0.1), transparent 26%),
      linear-gradient(180deg, rgba(255, 253, 251, 0.94), rgba(255, 250, 248, 0.9)) !important;
    box-sizing: border-box;
  }

  body[data-mode="study"].workspace-mobile-minimal .study-mobile-tree-host .tree-node,
  body[data-mode="study"].workspace-mobile-minimal .study-mobile-tree-host .root-node,
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-tree-host .tree-node,
  body[data-mode="editor"].workspace-mobile-minimal .editor-mobile-tree-host .root-node {
    display: flex;
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0 !important;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    line-height: 1;
  }
}

/* Mobile main-board surface aligned with free study r3 (2026-08-16). */
@media (orientation: portrait) and (max-width: 1439px) {
  body.workspace-mobile-minimal:is([data-mode="analysis"], [data-mode="study"], [data-mode="editor"]) .board-workspace-panel {
    width: 100vw !important;
    width: 100dvw !important;
    max-width: 100vw !important;
    max-width: 100dvw !important;
    margin-inline: calc(50% - 50vw) !important;
    margin-inline: calc(50% - 50dvw) !important;
    padding: 2px !important;
    overflow: visible !important;
    border: 0 !important;
    border-radius: 14px !important;
    background: none !important;
    box-shadow: none !important;
    box-sizing: border-box;
  }

  body.workspace-mobile-minimal:is([data-mode="analysis"], [data-mode="study"], [data-mode="editor"]) .board-workspace-panel > .board-stage {
    width: 100% !important;
    max-width: 100% !important;
    margin: 2px 0 0 !important;
    padding: 1px !important;
    overflow: hidden !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: none !important;
    box-shadow: none !important;
    box-sizing: border-box;
  }

  body.workspace-mobile-minimal:is([data-mode="analysis"], [data-mode="study"], [data-mode="editor"]) .board-workspace-panel > .board-stage > #board.goban {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 0 !important;
    border-radius: 4px !important;
    box-sizing: content-box;
  }

  .ai-game-page .ai-game-board-area,
  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-board-area,
  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-board-area {
    position: static !important;
    width: calc(100% + 16px) !important;
    max-width: calc(100% + 16px) !important;
    margin-inline: -8px !important;
    padding: 2px !important;
    overflow: visible !important;
    border: 0 !important;
    border-radius: 14px !important;
    background: none !important;
    box-shadow: none !important;
    box-sizing: border-box;
  }

  .ai-game-page .ai-game-board-frame,
  :root[data-board-coordinates="off"] .ai-game-page .ai-game-board-frame,
  .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-board-frame,
  :root[data-board-coordinates="off"] .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-board-frame {
    width: 100% !important;
    max-width: 100% !important;
    margin: 2px 0 0 !important;
    padding: 1px !important;
    overflow: hidden !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: none !important;
    box-shadow: none !important;
    box-sizing: border-box;
  }

  :root[data-board-coordinates="on"] .ai-game-page .ai-game-board-frame {
    margin-top: 2px !important;
    overflow: hidden !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: none !important;
    box-shadow: none !important;
  }

  html:root[data-board-coordinates="off"] body.ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-board-area > .ai-game-board-frame {
    padding: 1px !important;
  }

  .ai-game-page #aiGameBoard.ai-game-board.goban {
    max-width: none !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 0 !important;
    border-radius: 4px !important;
    box-sizing: content-box;
  }
}

/* AI対局場: PC対局中UI最終カスケード r2 (2026-08-17). */
@media (min-width: 1440px), (orientation: landscape) {
  .ai-game-page .ai-game-shell[data-phase="playing"] {
    --ai-game-playing-board-size: min(calc(100dvh - 108px), calc(100vw - 700px));
    width: min(calc(100vw - 24px), calc(var(--ai-game-playing-board-size) + 664px)) !important;
    min-height: calc(100dvh - 76px) !important;
    grid-template-columns: 280px minmax(0, var(--ai-game-playing-board-size)) 360px !important;
    align-content: start;
    margin-bottom: 0 !important;
  }

  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-board-frame {
    width: var(--ai-game-playing-board-size) !important;
    max-width: 100% !important;
  }

  .ai-game-page .ai-game-shell[data-phase="playing"][data-mode="study"] .ai-game-left-toolbar .ai-game-play-controls,
  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-left-toolbar .ai-game-play-controls {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-auto-flow: row !important;
  }

  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-character-presence-backdrop {
    display: none !important;
    background-image: none !important;
  }

  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-trend-summary {
    grid-template-columns: auto auto minmax(42px, 1fr) auto;
    gap: 6px;
    margin-bottom: 9px;
    padding: 8px;
    border-radius: 12px;
  }

  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-trend-lead {
    min-height: 30px;
    padding: 4px 9px;
    font-size: 14px;
  }

  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-trend-rate { font-size: 10px; }
  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-trend-winrate-bar { height: 9px; }

  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-trend-graph-wrap {
    padding: 4px 3px 1px;
    border-radius: 12px;
  }

  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-trend-mobile-surface .ai-game-trend-graph {
    height: auto !important;
    aspect-ratio: 320 / 150;
    overflow: visible;
  }
}

/* Mobile board coordinate gutters restored after full-bleed board rules (2026-08-19). */
@media (orientation: portrait) and (max-width: 1439px) {
  :root[data-board-coordinates="on"] body.workspace-mobile-minimal:is([data-mode="analysis"], [data-mode="study"], [data-mode="editor"])
    .board-workspace-panel > .board-stage > #board.goban.coordinates-active {
    width: calc(100% - 22px) !important;
    max-width: calc(100% - 22px) !important;
    margin: 19px 0 0 20px !important;
    overflow: visible !important;
  }

  :root[data-board-coordinates="on"] .ai-game-page .ai-game-board-frame,
  :root[data-board-coordinates="on"] .ai-game-page .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-board-frame {
    padding: 23px 1px 2px 24px !important;
  }

  :root[data-board-coordinates="on"] .ai-game-page #aiGameBoard.ai-game-board.goban {
    overflow: visible !important;
  }
}

/* AI対局場: PCサイドバー文字サイズ調整 r3 (2026-08-17). */
@media (min-width: 1440px), (orientation: landscape) {
  .ai-game-page .ai-game-character-presence-backdrop {
    display: none !important;
    background-image: none !important;
  }

  .ai-game-page .ai-game-status-panel > header h1 { font-size: 24px; }
  .ai-game-page .ai-game-desktop-turn-summary strong { font-size: 16px; }
  .ai-game-page .ai-game-desktop-turn-summary span { font-size: 17px; }
  .ai-game-page .ai-game-desktop-scoreboard strong { font-size: 12px; }
  .ai-game-page .ai-game-desktop-scoreboard small { font-size: 9px; }
  .ai-game-page .ai-game-desktop-scoreboard b { font-size: 11px; }
  .ai-game-page .ai-game-status-panel .ai-game-status-list dt { font-size: 11px; }
  .ai-game-page .ai-game-status-panel .ai-game-status-list dd { font-size: 12px; }
  .ai-game-page .ai-game-left-notice { font-size: 10px; }
  .ai-game-page .ai-game-left-toolbar .ai-game-view-controls button { font-size: 11px; }
  .ai-game-page .ai-game-left-toolbar .ai-game-play-controls button { font-size: 13px; }
  .ai-game-page .ai-game-desktop-abort { font-size: 13px; }

  .ai-game-page .ai-game-desktop-character-profile > strong { font-size: 17px; }
  .ai-game-page .ai-game-desktop-character-profile dl > div { font-size: 10px; }
  .ai-game-page .ai-game-voice-identity strong { font-size: 12px; }
  .ai-game-page .ai-game-voice-identity small { font-size: 9px; }
  .ai-game-page .ai-game-voice-actions button { font-size: 10px; }

  .ai-game-page .ai-game-trend-panel .ai-game-trend-header h2,
  .ai-game-page .ai-game-kifu-panel .ai-game-kifu-header h2 { font-size: 17px !important; }
  .ai-game-page .ai-game-trend-panel .ai-game-panel-count,
  .ai-game-page .ai-game-kifu-panel .ai-game-panel-count { font-size: 11px; }
  .ai-game-page .ai-game-shell[data-phase="playing"] .ai-game-trend-rate { font-size: 11px; }
  .ai-game-page .ai-game-trend-graph .trend-tick-label,
  .ai-game-page .ai-game-trend-graph .trend-move-label,
  .ai-game-page .ai-game-trend-graph .trend-callout-text { font-size: 8px; }
  .ai-game-page .ai-game-trend-graph .trend-side-label { font-size: 8.5px; }
  .ai-game-page .ai-game-kifu-toolbar #aiGameMoveCurrentBtn { font-size: 10px; }
  .ai-game-page .ai-game-kifu-tree-node,
  .ai-game-page .ai-game-kifu-tree-node.root-node { font-size: 11px; }
  .ai-game-page .ai-game-study-question-outside #aiGameMobileQuestionBtn { font-size: 13px; }
}

/* サイト利用者一覧（管理者向け・閲覧専用） r1 (2026-08-17). */
.site-users-admin-page {
  min-height: 100vh;
  color: #3f2b26;
  background:
    radial-gradient(circle at 9% 18%, rgba(255, 201, 211, .22), transparent 23%),
    radial-gradient(circle at 91% 35%, rgba(173, 216, 244, .22), transparent 25%),
    linear-gradient(180deg, #fffdfb 0%, #fff8f6 55%, #f7fbf5 100%);
}

.site-users-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 40px 0 80px;
}

.site-users-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
  padding: 30px 34px;
  border: 1px solid rgba(224, 152, 160, .42);
  border-radius: 26px;
  background:
    linear-gradient(110deg, rgba(255, 255, 255, .97), rgba(255, 240, 243, .88)),
    url("./assets/landing/sakura-pattern.svg") center / cover;
  box-shadow: 0 18px 48px rgba(97, 57, 45, .09);
}

.site-users-eyebrow {
  display: block;
  margin-bottom: 7px;
  color: #ca6473;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .18em;
}

.site-users-hero h1 {
  margin: 0;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 700;
  letter-spacing: .06em;
}

.site-users-hero p {
  margin: 9px 0 0;
  color: #79645e;
  font-size: 14px;
}

.site-users-hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.site-users-hero-actions a,
.site-users-hero-actions button,
.site-users-pagination button {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid #e8b7bc;
  border-radius: 13px;
  color: #9e4c57;
  background: rgba(255, 255, 255, .88);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.site-users-hero-actions button {
  color: #fff;
  border-color: #c96573;
  background: linear-gradient(135deg, #d66d7b, #bd5362);
}

.site-users-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.site-users-summary article {
  position: relative;
  overflow: hidden;
  min-width: 0;
  padding: 20px 22px;
  border: 1px solid rgba(225, 173, 177, .46);
  border-radius: 20px;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 10px 28px rgba(86, 61, 50, .06);
}

.site-users-summary article::after {
  content: "✿";
  position: absolute;
  right: 14px;
  bottom: -7px;
  color: rgba(225, 111, 127, .12);
  font-size: 52px;
}

.site-users-summary span,
.site-users-summary small {
  display: block;
  color: #8a746e;
  font-size: 12px;
}

.site-users-summary strong {
  display: inline-block;
  margin: 5px 7px 1px 0;
  color: #ba5362;
  font-size: 30px;
  line-height: 1;
}

.site-users-summary small { display: inline; }
.site-users-online-card {
  border-color: rgba(91, 171, 124, .48) !important;
  background: linear-gradient(145deg, rgba(255, 255, 255, .96), rgba(232, 249, 238, .92)) !important;
}
.site-users-online-card strong { color: #238455; }

.site-users-panel {
  overflow: hidden;
  border: 1px solid rgba(225, 173, 177, .5);
  border-radius: 24px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 18px 50px rgba(86, 61, 50, .08);
}

.site-users-panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 26px 18px;
  border-bottom: 1px solid #f0dbdc;
}

.site-users-panel-heading h2 {
  margin: 0;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 23px;
}

.site-users-panel-heading p {
  margin: 5px 0 0;
  color: #8b7771;
  font-size: 12px;
}

.site-users-filters {
  display: flex;
  align-items: flex-end;
  gap: 9px;
}

.site-users-filters label span {
  display: block;
  margin: 0 0 5px 3px;
  color: #836e68;
  font-size: 10px;
  font-weight: 700;
}

.site-users-filters input,
.site-users-filters select {
  height: 40px;
  min-width: 138px;
  padding: 0 12px;
  border: 1px solid #e7ced0;
  border-radius: 11px;
  color: #46322d;
  background: #fff;
  font: inherit;
  font-size: 12px;
}

.site-users-filters input { min-width: 220px; }
.site-users-table-wrap { overflow-x: auto; }

.site-users-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

.site-users-table th {
  padding: 12px 18px;
  color: #846e68;
  background: #fff8f7;
  font-size: 11px;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}

.site-users-table td {
  padding: 15px 18px;
  border-top: 1px solid #f2e5e3;
  color: #5e4c47;
  font-size: 12px;
  vertical-align: middle;
}

.site-users-table tbody tr:hover { background: #fffafa; }

.site-users-identity {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 210px;
}

.site-users-avatar {
  display: grid;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid #efb8bf;
  border-radius: 50%;
  color: #a94957;
  background: linear-gradient(145deg, #fff, #ffe5e9);
  font-family: "Yu Mincho", serif;
  font-size: 17px;
  font-weight: 700;
}

.site-users-identity strong,
.site-users-identity small,
.site-users-activity small { display: block; }
.site-users-identity strong { color: #3f2b26; font-size: 13px; }
.site-users-identity small,
.site-users-activity small { margin-top: 3px; color: #998680; font-size: 10px; }
.site-users-online-label {
  display: block;
  margin-top: 3px;
  color: #198552;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.site-users-role,
.site-users-methods span,
.site-users-activity > span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.site-users-role.is-admin { color: #a13d4b; background: #ffe7ea; }
.site-users-role.is-user { color: #416a55; background: #eaf5ed; }
.site-users-methods { display: flex; flex-wrap: wrap; gap: 5px; }
.site-users-methods span { color: #685650; background: #f5f1ef; }
.site-users-methods .is-google { color: #3568b7; background: #eaf2ff; }
.site-users-methods .is-line { color: #167a47; background: #e6f8ed; }
.site-users-activity > span.is-active { color: #177349; background: #e5f6ec; }
.site-users-activity > span.is-online { color: #fff; background: #2b9b64; }
.site-users-activity > span.is-recent { color: #9b681a; background: #fff3d9; }
.site-users-activity > span.is-quiet { color: #786b67; background: #f1efee; }
.site-users-usage { color: #b6505f !important; font-size: 15px !important; font-weight: 800; }

.site-users-empty,
.site-users-error {
  padding: 58px 20px;
  color: #806d67;
  text-align: center;
}

.site-users-empty strong,
.site-users-error strong { color: #5b413a; font-size: 16px; }
.site-users-empty p,
.site-users-error p { margin: 7px 0 0; font-size: 12px; }
.site-users-error { color: #a6424f; background: #fff6f7; }

.site-users-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 18px 24px 22px;
  border-top: 1px solid #f0e1df;
}

.site-users-pagination span { color: #78645e; font-size: 12px; font-weight: 700; }
.site-users-pagination button:disabled { opacity: .38; cursor: default; }
.site-users-privacy-note { margin: 15px 4px 0; color: #8f7e78; font-size: 11px; text-align: right; }

@media (max-width: 820px) {
  .site-users-shell { width: min(100% - 24px, 680px); padding: 22px 0 94px; }
  .site-users-hero { align-items: flex-start; padding: 23px 20px; }
  .site-users-hero-actions { flex-direction: column; }
  .site-users-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-users-panel-heading { align-items: stretch; flex-direction: column; padding: 20px 18px 16px; }
  .site-users-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-users-filters label:first-child { grid-column: 1 / -1; }
  .site-users-filters input,
  .site-users-filters select { width: 100%; min-width: 0; }
}

@media (min-width: 821px) and (max-width: 1080px) {
  .site-users-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .site-users-shell { width: calc(100% - 16px); padding-top: 14px; }
  .site-users-hero { display: block; border-radius: 20px; }
  .site-users-hero p { font-size: 12px; }
  .site-users-hero-actions { flex-direction: row; justify-content: flex-start; margin-top: 18px; }
  .site-users-hero-actions a,
  .site-users-hero-actions button { min-height: 38px; padding: 0 13px; font-size: 11px; }
  .site-users-summary { gap: 8px; }
  .site-users-summary article { padding: 16px 14px; border-radius: 16px; }
  .site-users-summary strong { font-size: 25px; }
  .site-users-panel { border-radius: 19px; }
  .site-users-table { min-width: 820px; }
  .site-users-table th,
  .site-users-table td { padding-right: 13px; padding-left: 13px; }
  .site-users-pagination { gap: 10px; padding-right: 12px; padding-left: 12px; }
  .site-users-pagination button { padding: 0 12px; font-size: 11px; }
  .site-users-privacy-note { padding: 0 5px; text-align: left; }
}

/* Independent black / white Go stone themes (2026-08-17) */
/* Microphone permission recovery, also used by the persistent salon bar. */
#goSalonMicrophonePermissionDialog {
  box-sizing:border-box; width:min(480px, calc(100vw - 24px)); max-height:calc(100dvh - 32px);
  margin:auto; padding:24px; overflow:auto; border:1px solid #dccac1; border-radius:16px;
  background:#fffaf7; color:#382c27; box-shadow:0 20px 65px #241b1933; font:14px/1.7 sans-serif;
}
#goSalonMicrophonePermissionDialog::backdrop { background:#17151d99; }
#goSalonMicrophonePermissionDialog h2 { margin:0 0 12px; color:inherit; font-size:20px; line-height:1.5; }
#goSalonMicrophonePermissionDialog p { margin:12px 0; }
#goSalonMicrophonePermissionDialog details { margin:16px 0; border-top:1px solid #e2d5cf; padding-top:12px; }
#goSalonMicrophonePermissionDialog summary { font-weight:700; cursor:pointer; }
#goSalonMicrophonePermissionDialog ol { padding-left:22px; }
#goSalonMicrophonePermissionDialog li + li { margin-top:8px; }
#goSalonMicrophonePermissionDialog .salon-mic-permission-status { border-left:3px solid #a94562; padding:10px 12px; background:#fff0f3; }
#goSalonMicrophonePermissionDialog .salon-mic-permission-note { font-size:12px; color:#68544c; }
#goSalonMicrophonePermissionDialog .salon-mic-permission-actions { display:flex; flex-wrap:wrap; gap:10px; justify-content:flex-end; }
#goSalonMicrophonePermissionDialog button { min-height:44px; padding:10px 14px; border:1px solid #b5907e; border-radius:8px; background:#fff; color:#382c27; font:inherit; cursor:pointer; }
#goSalonMicrophonePermissionDialog button[data-mic-permission-check] { background:#874256; border-color:#874256; color:#fff; }
#goSalonMicrophonePermissionDialog button:focus-visible { outline:3px solid #625ed0; outline-offset:2px; }
#goSalonMicrophonePermissionDialog microphone { display:inline-block; font-size:16px; color:#382c27; background-color:#fff; opacity:1; }
#goSalonMicrophonePermissionDialog [hidden] { display:none !important; }
:root {
  --go-black-stone-image: url("./assets/go-stones/black-stone.svg");
  --go-white-stone-image: url("./assets/go-stones/white-stone.svg");
}

[data-black-stone-theme="glossy"] { --go-black-stone-image: url("./assets/go-stones/black-stone.svg"); }
[data-black-stone-theme="matte"] { --go-black-stone-image: url("./assets/go-stones/black-stone-classic-matte.svg"); }
[data-black-stone-theme="deep-gloss"] { --go-black-stone-image: url("./assets/go-stones/black-stone-design-1.png"); }
[data-black-stone-theme="crystal"] { --go-black-stone-image: url("./assets/go-stones/black-stone-design-2.png"); }
[data-black-stone-theme="textured-matte"] { --go-black-stone-image: url("./assets/go-stones/black-stone-design-3.png"); }
[data-white-stone-theme="glossy"] { --go-white-stone-image: url("./assets/go-stones/white-stone.svg"); }
[data-white-stone-theme="matte"] { --go-white-stone-image: url("./assets/go-stones/white-stone-classic-matte.svg"); }
[data-white-stone-theme="deep-gloss"] { --go-white-stone-image: url("./assets/go-stones/white-stone-design-1.png"); }
[data-white-stone-theme="crystal"] { --go-white-stone-image: url("./assets/go-stones/white-stone-design-2.png"); }
[data-white-stone-theme="textured-matte"] { --go-white-stone-image: url("./assets/go-stones/white-stone-design-3.png"); }

[data-black-stone-theme] .stone.black,
[data-black-stone-theme] .qa-stone.black,
[data-black-stone-theme] .ghost-stone.black,
[data-black-stone-theme] .qk-sc.black,
[data-black-stone-theme] .landing-board-stone.black {
  border: 0 !important;
  background: transparent var(--go-black-stone-image) center / contain no-repeat !important;
  box-shadow: none !important;
}

[data-white-stone-theme] .stone.white,
[data-white-stone-theme] .qa-stone.white,
[data-white-stone-theme] .ghost-stone.white,
[data-white-stone-theme] .qk-sc.white,
[data-white-stone-theme] .landing-board-stone.white {
  border: 0 !important;
  background: transparent var(--go-white-stone-image) center / contain no-repeat !important;
  box-shadow: none !important;
}

[data-black-stone-theme] .ai-game-player-stone[data-color="B"],
[data-black-stone-theme] .ai-game-mobile-score-stone[data-color="B"] {
  background-image: var(--go-black-stone-image) !important;
}

[data-white-stone-theme] .ai-game-player-stone[data-color="W"],
[data-white-stone-theme] .ai-game-mobile-score-stone[data-color="W"] {
  background-image: var(--go-white-stone-image) !important;
}

[data-black-stone-theme] .ai-game-page .ai-game-board[data-playable="true"][data-turn="B"] > .ai-game-point[data-occupied="false"]:not(:disabled):hover::before {
  background-image: var(--go-black-stone-image) !important;
}

[data-white-stone-theme] .ai-game-page .ai-game-board[data-playable="true"][data-turn="W"] > .ai-game-point[data-occupied="false"]:not(:disabled):hover::before {
  background-image: var(--go-white-stone-image) !important;
}

.mp-stone-choice-groups {
  display: grid;
  gap: 18px;
}

.mp-stone-choice-group {
  padding: 15px;
  border: 1px solid #e7e1d8;
  border-radius: 15px;
  background: linear-gradient(145deg, #fffdfa, #fbf8f3);
}

.mp-stone-choice-group h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  color: #46362f;
  font-family: "Noto Serif JP", serif;
  font-size: 14px;
}

.mp-stone-choice-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
}

.mp-stone-choice-dot.is-black { background: var(--go-black-stone-image) center / contain no-repeat; }
.mp-stone-choice-dot.is-white { background: var(--go-white-stone-image) center / contain no-repeat; }

.mp-stone-theme-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.mp-stone-option-card {
  grid-template-columns: 54px minmax(0, 1fr) 18px;
  gap: 8px;
  padding: 8px;
}

.mp-stone-option-card .mp-stone-theme-preview {
  width: 54px;
  border-color: rgba(103, 70, 36, 0.22);
}

.mp-stone-option-card .mp-theme-stone {
  top: 50%;
  left: 50%;
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent var(--mp-stone-option-image) center / contain no-repeat !important;
  box-shadow: none;
  transform: translate(-50%, -50%);
}

[data-black-stone-option="glossy"] { --mp-stone-option-image: url("./assets/go-stones/black-stone.svg"); }
[data-black-stone-option="matte"] { --mp-stone-option-image: url("./assets/go-stones/black-stone-classic-matte.svg"); }
[data-black-stone-option="deep-gloss"] { --mp-stone-option-image: url("./assets/go-stones/black-stone-design-1.png"); }
[data-black-stone-option="crystal"] { --mp-stone-option-image: url("./assets/go-stones/black-stone-design-2.png"); }
[data-black-stone-option="textured-matte"] { --mp-stone-option-image: url("./assets/go-stones/black-stone-design-3.png"); }
[data-white-stone-option="glossy"] { --mp-stone-option-image: url("./assets/go-stones/white-stone.svg"); }
[data-white-stone-option="matte"] { --mp-stone-option-image: url("./assets/go-stones/white-stone-classic-matte.svg"); }
[data-white-stone-option="deep-gloss"] { --mp-stone-option-image: url("./assets/go-stones/white-stone-design-1.png"); }
[data-white-stone-option="crystal"] { --mp-stone-option-image: url("./assets/go-stones/white-stone-design-2.png"); }
[data-white-stone-option="textured-matte"] { --mp-stone-option-image: url("./assets/go-stones/white-stone-design-3.png"); }

.mp-stone-legacy-label,
.mp-stone-new-label {
  display: inline-flex;
  align-items: center;
  min-height: 17px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 999px;
  font-family: "Noto Sans JP", sans-serif;
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
  vertical-align: 1px;
}

.mp-stone-legacy-label { background: #eef1ed; color: #667269; }
.mp-stone-new-label { background: #fff0f2; color: #c05d6c; }

@media (max-width: 960px) {
  .mp-stone-theme-grid { grid-template-columns: 1fr; }
  .mp-stone-option-card { grid-template-columns: 62px minmax(0, 1fr) 20px; }
  .mp-stone-option-card .mp-stone-theme-preview { width: 62px; }
  .mp-stone-option-card .mp-theme-stone { width: 48px; height: 48px; }
}

/* Kifu editor: PC character workspace r1 (2026-08-17).
   The center remains board-only; existing functional controls are distributed without duplication. */
@media (min-width: 1440px), (orientation: landscape) {
  body.editor-desktop-redesign[data-mode="editor"] {
    --editor-pc-pink: #ef6673;
    --editor-pc-pink-soft: #fff3f3;
    --editor-pc-line: rgba(229, 142, 142, 0.46);
    --editor-pc-ink: #3d2d2a;
  }

  body.editor-desktop-redesign[data-mode="editor"] .workspace {
    max-width: none !important;
    padding: 12px 18px 24px !important;
    grid-template-columns: 310px minmax(0, var(--workspace-primary-board-stage-size, 646px)) 350px !important;
    gap: 14px !important;
    justify-content: center;
  }

  body.editor-desktop-redesign[data-mode="editor"] .main-grid,
  body.editor-desktop-redesign[data-mode="editor"].workspace-board-focus .main-grid {
    width: 100% !important;
    grid-template-columns: 310px minmax(0, var(--workspace-primary-board-stage-size, 646px)) 350px !important;
    gap: 14px !important;
    align-items: start;
    justify-content: center;
  }

  body.editor-desktop-redesign[data-mode="editor"] #leftNav.editor-workspace-nav {
    position: sticky;
    top: 76px;
    display: block !important;
    width: 310px !important;
    max-height: calc(100dvh - 92px) !important;
    padding: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    border: 0 !important;
    border-radius: 15px !important;
    background: transparent !important;
    box-shadow: none !important;
    scrollbar-width: thin;
    scrollbar-color: #e9a2a5 transparent;
  }

  body.editor-desktop-redesign[data-mode="editor"] #leftNav.editor-workspace-nav > :not(.editor-desktop-left-stack) {
    display: none !important;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack {
    display: flex;
    width: 100%;
    flex-direction: column;
    gap: 10px;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-hero {
    position: relative;
    min-height: 158px;
    overflow: hidden;
    border: 1px solid var(--editor-pc-line);
    border-radius: 15px;
    background:
      radial-gradient(circle at 90% 12%, rgba(245, 178, 187, 0.25), transparent 31%),
      linear-gradient(135deg, rgba(255, 253, 250, 0.98), rgba(255, 240, 242, 0.96));
    box-shadow: 0 8px 22px rgba(116, 70, 60, 0.07);
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-hero::before,
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-hero::after {
    position: absolute;
    color: rgba(239, 102, 115, 0.32);
    content: "✿";
    font-family: serif;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-hero::before {
    top: 12px;
    left: 14px;
    font-size: 25px;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-hero::after {
    right: 11px;
    bottom: 2px;
    font-size: 45px;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-hero-copy {
    position: relative;
    z-index: 2;
    width: 58%;
    padding: 43px 0 0 18px;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-hero-copy h1 {
    margin: 0;
    color: #342320;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 27px;
    font-weight: 500;
    letter-spacing: 0.04em;
    white-space: nowrap;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-hero-copy p {
    margin: 10px 0 0;
    color: #6c5149;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 11px;
    line-height: 1.7;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-hero > img {
    position: absolute;
    z-index: 1;
    right: -48px;
    bottom: -45px;
    width: 160px;
    height: auto;
    max-width: none;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack > .board-workspace-header {
    display: grid !important;
    min-height: 62px;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 5px 8px !important;
    margin: 0 !important;
    padding: 10px 12px !important;
    border: 1px solid var(--editor-pc-line) !important;
    border-radius: 13px !important;
    background: rgba(255, 253, 250, 0.96) !important;
    box-shadow: 0 6px 16px rgba(116, 70, 60, 0.055) !important;
    box-sizing: border-box;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack .board-workspace-context {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack .board-workspace-mode {
    display: none !important;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack .board-turn-status {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #7a5c53;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 11px;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack .board-turn-status strong {
    color: #342725;
    font-size: 17px;
    font-weight: 600;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack .capture-table {
    margin: 0;
    font-size: 9px;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack .capture-table th,
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack .capture-table td {
    padding: 4px 5px;
    border-color: rgba(217, 183, 174, 0.46);
    white-space: nowrap;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack .board-view-toggles {
    display: flex !important;
    grid-column: 1 / -1;
    justify-content: flex-end;
    gap: 5px;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack .board-view-toggles > * {
    min-height: 23px;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 9px;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-file-actions,
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-edit-actions {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    gap: 8px;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-file-actions > button:nth-child(-n + 3) {
    grid-column: span 2 !important;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-file-actions > button:nth-child(n + 4) {
    grid-column: span 3 !important;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-edit-actions > button {
    grid-column: span 3 !important;
  }

  body.editor-desktop-redesign[data-mode="editor"] #leftNav .editor-desktop-file-actions > button {
    display: flex !important;
    min-width: 0 !important;
    min-height: 70px !important;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 6px !important;
    margin: 0 !important;
    padding: 9px 6px !important;
    border: 1px solid rgba(228, 159, 153, 0.48) !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 5px 13px rgba(105, 69, 60, 0.045) !important;
    font-size: 11px !important;
    font-weight: 700;
    line-height: 1.25;
  }

  body.editor-desktop-redesign[data-mode="editor"] #leftNav .editor-desktop-file-actions > button svg {
    width: 29px !important;
    height: 29px !important;
    flex: 0 0 29px !important;
  }

  body.editor-desktop-redesign[data-mode="editor"] #leftNav .editor-desktop-file-actions #leftNavEditorNewBtn { color: #e65d68 !important; }
  body.editor-desktop-redesign[data-mode="editor"] #leftNav .editor-desktop-file-actions #editorOpenServerHistoryBtn { color: #67964d !important; }
  body.editor-desktop-redesign[data-mode="editor"] #leftNav .editor-desktop-file-actions #leftNavSgfLoadBtn { color: #368ac5 !important; }
  body.editor-desktop-redesign[data-mode="editor"] #leftNav .editor-desktop-file-actions #exportSgfBtn { color: #66944b !important; }
  body.editor-desktop-redesign[data-mode="editor"] #leftNav .editor-desktop-file-actions #editorSaveServerBtn { color: #dc5f70 !important; }

  body.editor-desktop-redesign[data-mode="editor"] #leftNav .editor-desktop-edit-actions > button {
    display: flex !important;
    min-width: 0 !important;
    min-height: 54px !important;
    align-items: center;
    justify-content: center;
    gap: 8px !important;
    margin: 0 !important;
    padding: 9px 7px !important;
    border: 1px solid rgba(228, 159, 153, 0.48) !important;
    border-radius: 11px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 5px 13px rgba(105, 69, 60, 0.04) !important;
    color: #4f3c38 !important;
    font-family: "Noto Sans JP", "Yu Gothic", sans-serif;
    font-size: 12px !important;
    font-weight: 700;
  }

  body.editor-desktop-redesign[data-mode="editor"] #leftNav .editor-desktop-edit-actions > button svg,
  body.editor-desktop-redesign[data-mode="editor"] #leftNav .editor-desktop-edit-actions .editor-quick-action-icon svg {
    width: 21px !important;
    height: 21px !important;
    flex: 0 0 21px !important;
  }

  body.editor-desktop-redesign[data-mode="editor"] #leftNav .editor-desktop-edit-actions .editor-quick-action-copy {
    display: block;
  }

  body.editor-desktop-redesign[data-mode="editor"] #leftNav .editor-desktop-edit-actions .editor-quick-action-copy small {
    display: none !important;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-pass-icon {
    color: #7c665f;
    font-size: 18px;
    letter-spacing: 0.08em;
    line-height: 1;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack > .move-controls {
    display: grid !important;
    width: 100% !important;
    grid-template-columns: 42px 42px minmax(82px, 1fr) 42px 42px !important;
    grid-template-rows: 42px 30px;
    gap: 5px 6px !important;
    margin: 0 !important;
    padding: 10px !important;
    border: 1px solid var(--editor-pc-line) !important;
    border-radius: 12px !important;
    background: rgba(255, 253, 251, 0.96) !important;
    box-shadow: 0 6px 16px rgba(116, 70, 60, 0.05);
    box-sizing: border-box;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack > .move-controls #backFiveMoveBtn,
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack > .move-controls #forwardFiveMoveBtn {
    display: none !important;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack > .move-controls > button {
    display: flex !important;
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid rgba(231, 133, 138, 0.42) !important;
    border-radius: 9px !important;
    background: #fff !important;
    color: #8a4d4f !important;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack > .move-controls #firstMoveBtn { grid-column: 1; grid-row: 1; }
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack > .move-controls #prevMoveBtn { grid-column: 2; grid-row: 1; }
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack > .move-controls #nextMoveBtn { grid-column: 4; grid-row: 1; }
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack > .move-controls #lastMoveBtn { grid-column: 5; grid-row: 1; }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack > .move-controls .move-number-jump {
    display: flex !important;
    min-width: 0;
    grid-column: 3;
    grid-row: 1;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: #493536;
    font-size: 12px;
    font-weight: 800;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack > .move-controls .move-number-jump input {
    width: 34px !important;
    min-width: 0 !important;
    padding: 3px !important;
    text-align: center;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack > .move-controls .seek-wrapper {
    display: block !important;
    width: 100% !important;
    grid-column: 1 / -1;
    grid-row: 2;
    align-self: center;
    margin: 0 !important;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack > .board-workspace-feedback {
    min-height: 0;
    margin: 0;
    padding: 0 2px;
    color: #66756b;
    font-size: 10px;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-details {
    overflow: hidden;
    border: 1px solid var(--editor-pc-line);
    border-radius: 12px;
    background: rgba(255, 253, 251, 0.96);
    box-shadow: 0 5px 14px rgba(116, 70, 60, 0.045);
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-details > summary {
    display: grid;
    min-height: 48px;
    grid-template-columns: 24px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: #493633;
    cursor: pointer;
    list-style: none;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-details > summary::-webkit-details-marker { display: none; }
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-details > summary > span { color: #e76473; font-size: 19px; text-align: center; }
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-details > summary > strong { font-size: 13px; }
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-details > summary > i::before { content: "＋"; font-style: normal; }
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-details[open] > summary > i::before { content: "−"; }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-details[open] > summary {
    border-bottom: 1px solid rgba(229, 142, 142, 0.28);
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-details > :not(summary) {
    margin: 0 !important;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-markup-details .editor-diagram-group {
    display: grid !important;
    gap: 8px;
    padding: 11px !important;
    border: 0 !important;
    background: transparent !important;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-markup-details .editor-tool-label { display: none !important; }
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-markup-details .diagram-tool-marks { display: grid !important; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-markup-details .diagram-tool-marks > button { width: 100% !important; min-width: 0 !important; height: 37px; border-radius: 8px !important; }
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-markup-details .diagram-label-row { display: grid !important; grid-template-columns: auto 74px; justify-content: start; gap: 8px; }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-info-details .editor-game-card {
    overflow: hidden;
    padding: 11px !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-info-details .editor-tool-card-head {
    display: flex !important;
    min-height: 36px;
    align-items: center;
    justify-content: flex-end;
    padding: 0 0 8px !important;
    border-bottom: 1px solid rgba(229, 142, 142, 0.25);
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-info-details .editor-tool-card-head > div > span,
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-info-details .editor-tool-card-head > div > strong {
    display: none !important;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-info-details #editorInfoToggleBtn {
    min-width: 84px;
    min-height: 34px;
    padding: 6px 13px;
    border: 1px solid rgba(218, 126, 132, 0.5);
    border-radius: 9px;
    background: linear-gradient(180deg, #fff, #fff8f7);
    color: #8b4c50;
    box-shadow: 0 3px 9px rgba(111, 67, 60, 0.055);
    font-family: "Noto Sans JP", "Yu Gothic", sans-serif;
    font-size: 11px;
    font-weight: 700;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-info-details .editor-info-bar {
    display: block !important;
    padding: 10px 2px 2px !important;
    border: 0 !important;
    background: transparent !important;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-info-details .editor-info-bar > svg {
    display: none !important;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-info-details .editor-info-summary {
    margin: 0 !important;
    color: #5d4943;
    font-family: "Noto Sans JP", "Yu Gothic", sans-serif;
    font-size: 11px;
    line-height: 1.65;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-info-details .editor-info-panel {
    padding: 8px 0 0 !important;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-info-details .editor-info-fields:not(.hidden) {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-info-details .editor-info-fields label {
    gap: 4px;
    color: #6d5550;
    font-family: "Noto Sans JP", "Yu Gothic", sans-serif;
    font-size: 10px;
    font-weight: 700;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-info-details .editor-info-fields input,
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-info-details .editor-info-fields select {
    width: 100%;
    min-width: 0;
    min-height: 34px;
    padding: 5px 7px;
    border: 1px solid rgba(208, 174, 165, 0.66);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    color: #433531;
    font-family: "Noto Sans JP", "Yu Gothic", sans-serif;
    font-size: 11px;
    box-sizing: border-box;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-info-details .editor-info-fields .checkbox-label {
    display: flex;
    min-height: 34px;
    align-items: center;
    flex-direction: row;
    gap: 7px;
    padding: 5px 7px;
    border: 1px solid rgba(208, 174, 165, 0.52);
    border-radius: 8px;
    background: rgba(255, 250, 249, 0.9);
    box-sizing: border-box;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-info-details .editor-info-fields .checkbox-label input {
    width: 15px;
    min-height: 15px;
    padding: 0;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-info-details .editor-info-links,
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-info-details .editor-file-actions {
    display: none !important;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack button,
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack button,
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack input,
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack select,
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack textarea {
    font-family: "Noto Sans JP", "Yu Gothic", sans-serif;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack button:not(:disabled),
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack button:not(:disabled) {
    transition: border-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease, transform 0.16s ease;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack button:not(:disabled):hover,
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack button:not(:disabled):hover {
    border-color: rgba(226, 102, 113, 0.68) !important;
    box-shadow: 0 6px 15px rgba(128, 75, 65, 0.1) !important;
    transform: translateY(-1px);
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-left-stack button:focus-visible,
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack button:focus-visible {
    outline: 2px solid rgba(239, 102, 115, 0.52);
    outline-offset: 2px;
  }

  body.editor-desktop-redesign[data-mode="editor"] .workspace-right-rail #editorPanel.editor-toolbox {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body.editor-desktop-redesign[data-mode="editor"] .workspace-board-only {
    position: sticky;
    top: 76px;
    max-height: calc(100dvh - 92px);
    align-self: start;
    overflow: hidden;
  }

  body.editor-desktop-redesign[data-mode="editor"] .workspace-board-only > .board-stage {
    width: min(100%, var(--workspace-primary-board-stage-size, calc(100dvh - 130px))) !important;
    margin: 0 !important;
    padding: 10px !important;
    border: 1px solid rgba(218, 187, 166, 0.7) !important;
    border-radius: 14px !important;
    background: rgba(255, 252, 246, 0.96) !important;
    box-shadow: 0 12px 30px rgba(93, 64, 48, 0.1) !important;
    box-sizing: border-box;
  }

  body.editor-desktop-redesign[data-mode="editor"] .workspace-board-only > .board-stage > #board.goban {
    width: 100% !important;
    max-width: none !important;
  }

  body.editor-desktop-redesign[data-mode="editor"] .side-panel[data-board-focus-ready="true"] {
    position: sticky;
    top: 76px;
    display: block !important;
    width: 350px !important;
    height: fit-content !important;
    min-height: 0 !important;
    max-height: calc(100dvh - 92px) !important;
    align-self: start;
    padding: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    scrollbar-width: thin;
    scrollbar-color: #e9a2a5 transparent;
  }

  body.editor-desktop-redesign[data-mode="editor"] .side-panel > .editor-desktop-fixed-empty,
  body.editor-desktop-redesign[data-mode="editor"] .side-panel > .editor-desktop-rail-empty,
  body.editor-desktop-redesign[data-mode="editor"] .side-panel > #dropZone,
  body.editor-desktop-redesign[data-mode="editor"] .side-panel > #analysisRightStack {
    display: none !important;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack {
    display: flex;
    width: 100%;
    flex-direction: column;
    gap: 10px;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-comment-card {
    overflow: hidden;
    padding: 12px;
    border: 1px solid var(--editor-pc-line);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255, 254, 252, 0.99), rgba(255, 249, 247, 0.98));
    box-shadow: 0 8px 22px rgba(121, 75, 62, 0.07);
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-comment-card > header {
    display: flex;
    min-height: 34px;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 9px;
    padding: 0 2px 8px;
    border-bottom: 1px solid rgba(238, 121, 132, 0.32);
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-comment-card h2 {
    margin: 0;
    color: #382b2a;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 0.06em;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-comment-card h2 span {
    margin-right: 7px;
    color: rgba(240, 112, 130, 0.48);
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-comment-card header small {
    color: #829187;
    font-size: 9px;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-comment-card .editor-comment-card {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-comment-card .editor-comment-card > span {
    display: none !important;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-comment-card textarea {
    width: 100% !important;
    min-height: 126px !important;
    max-height: 220px;
    padding: 11px 12px !important;
    resize: vertical;
    border: 1px solid rgba(229, 142, 146, 0.5) !important;
    border-radius: 10px !important;
    background: rgba(255, 255, 255, 0.88) !important;
    color: #433431;
    font-size: 12px;
    line-height: 1.7;
    box-sizing: border-box;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack .board-tree-panel {
    position: relative;
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 11px 10px 10px !important;
    overflow: hidden;
    border: 1px solid var(--editor-pc-line) !important;
    border-radius: 14px !important;
    background:
      radial-gradient(circle at 94% 10%, rgba(244, 172, 182, 0.11), transparent 22%),
      linear-gradient(180deg, rgba(255, 254, 251, 0.99), rgba(255, 249, 247, 0.98)) !important;
    box-shadow: 0 8px 22px rgba(121, 75, 62, 0.07) !important;
    box-sizing: border-box;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack .board-tree-panel::before {
    top: 12px;
    left: 13px;
    color: rgba(240, 112, 130, 0.42);
    font-size: 20px;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack .board-tree-header {
    min-height: 38px;
    margin: 0 0 6px;
    padding: 0 2px 7px 28px;
    border: 0;
    border-bottom: 1px solid rgba(238, 121, 132, 0.34);
    background: transparent;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack .board-tree-heading { padding: 0; }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack .board-tree-heading-icon,
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack .board-tree-eyebrow,
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack .board-tree-heading small,
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack .board-tree-legend,
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack #gameTreeBranchBadge,
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack #gameTreeToggleBtn,
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack .board-tree-help {
    display: none !important;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack .board-tree-heading strong {
    color: #382b2a;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 0.06em;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack .board-tree-header-actions { margin-left: auto; }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack #gameTreeMoveBadge {
    display: inline-flex;
    min-width: 72px;
    min-height: 28px;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border: 1px solid rgba(238, 126, 133, 0.5);
    border-radius: 999px;
    background: #fff;
    color: #493536;
    font-size: 10px;
    font-weight: 800;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack .board-tree-toolbar {
    display: flex !important;
    min-height: 31px;
    align-items: center;
    justify-content: flex-end;
    margin: 0 1px 5px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack #gameTreeFocusBtn {
    min-height: 29px;
    padding: 4px 10px;
    border: 1px solid #e9a5a5;
    border-radius: 8px;
    background: #fff;
    color: #65433d;
    font-size: 10px;
    font-weight: 800;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack .game-tree {
    width: 100%;
    height: clamp(210px, 27dvh, 300px) !important;
    min-height: 210px !important;
    max-height: 300px !important;
    padding: 5px 3px 3px !important;
    overflow: auto !important;
    overscroll-behavior: contain;
    touch-action: pan-x pan-y;
    border: 1px solid rgba(235, 157, 151, 0.42) !important;
    border-radius: 10px;
    background: rgba(255, 253, 251, 0.9) !important;
    scrollbar-width: thin;
    scrollbar-color: #e9a2a5 #fff2f1;
    box-sizing: border-box;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack .game-tree-canvas { min-height: 192px; }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack .tree-node,
  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack .root-node {
    display: flex;
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    border-radius: 50%;
    font-size: 10px;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack .analysis-qa-section {
    width: 100%;
    margin: 0;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack .analysis-qa-action {
    display: flex !important;
    width: 100%;
    min-height: 58px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 14px !important;
    border: 1px solid #a8c7b0 !important;
    border-radius: 12px !important;
    background: linear-gradient(135deg, #16804a, #0d6b3b) !important;
    box-shadow: 0 7px 17px rgba(26, 104, 62, 0.15) !important;
    color: #fff !important;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 16px !important;
    font-weight: 700;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-right-stack .analysis-qa-action svg {
    width: 27px !important;
    height: 27px !important;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-character-tip {
    position: relative;
    display: flex;
    min-height: 98px;
    align-items: center;
    overflow: hidden;
    border: 1px solid var(--editor-pc-line);
    border-radius: 13px;
    background: linear-gradient(105deg, #fff7f6, #fffdfb);
    box-shadow: 0 6px 16px rgba(116, 70, 60, 0.055);
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-character-tip::after {
    position: absolute;
    right: 12px;
    color: rgba(240, 112, 130, 0.28);
    content: "✿";
    font-size: 24px;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-character-tip img {
    align-self: flex-end;
    width: 119px;
    height: 101px;
    object-fit: contain;
    object-position: center bottom;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-character-tip p {
    position: relative;
    z-index: 1;
    flex: 1;
    margin: 0 13px 0 -2px;
    padding: 11px 14px;
    border: 1px solid rgba(229, 142, 142, 0.42);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: #51403c;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 11px;
    text-align: center;
  }
}

@media (max-width: 1180px) and (orientation: portrait) {
  .editor-desktop-hero,
  .editor-desktop-character-tip {
    display: none !important;
  }

  .editor-desktop-left-stack,
  .editor-desktop-right-stack,
  .editor-desktop-comment-card,
  .editor-desktop-file-actions,
  .editor-desktop-edit-actions,
  .editor-desktop-details {
    display: contents !important;
  }

  .editor-desktop-details > summary {
    display: none !important;
  }

  .editor-desktop-details:not([open]) > :not(summary) {
    display: block !important;
  }
}

/* PC game review: spring three-column workspace r1 (2026-08-17).
   The center stays board-only; review controls and results are split across both rails. */
@media (min-width: 1440px), (orientation: landscape) {
  body.analysis-desktop-redesign[data-mode="analysis"] {
    --analysis-pc-pink: #ee6673;
    --analysis-pc-pink-soft: #fff3f3;
    --analysis-pc-line: rgba(229, 142, 142, 0.48);
    --analysis-pc-ink: #3f2f2c;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .workspace {
    max-width: none !important;
    padding: 12px 18px 22px !important;
    grid-template-columns: 300px minmax(0, var(--workspace-primary-board-stage-size, 646px)) 350px !important;
    gap: 14px !important;
    justify-content: center;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .main-grid,
  body.analysis-desktop-redesign[data-mode="analysis"].workspace-board-focus .main-grid {
    width: 100% !important;
    grid-template-columns: 300px minmax(0, var(--workspace-primary-board-stage-size, 646px)) 350px !important;
    gap: 14px !important;
    align-items: start;
    justify-content: center;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] #leftNav.analysis-workspace-nav {
    position: sticky;
    top: 76px;
    display: block !important;
    width: 300px !important;
    max-height: calc(100dvh - 92px);
    padding: 0 !important;
    overflow-x: hidden;
    overflow-y: auto;
    border: 0 !important;
    border-radius: 15px !important;
    background: transparent !important;
    box-shadow: none !important;
    scrollbar-width: thin;
    scrollbar-color: #e9a2a5 transparent;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] #leftNav.analysis-workspace-nav > :not(.analysis-desktop-left-stack) {
    display: none !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-left-stack {
    display: grid;
    width: 100%;
    min-width: 0;
    gap: 10px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-hero {
    position: relative;
    height: 162px;
    overflow: hidden;
    border: 1px solid var(--analysis-pc-line);
    border-radius: 15px;
    background:
      radial-gradient(circle at 12% 17%, rgba(255, 255, 255, 0.98) 0 4px, transparent 5px),
      radial-gradient(circle at 91% 18%, rgba(244, 163, 169, 0.25) 0 43px, transparent 44px),
      linear-gradient(105deg, #fffdfb 4%, #fff8f6 48%, #fdeae7 100%);
    box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.64), 0 8px 20px rgba(116, 70, 60, 0.07);
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-hero::before,
  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-hero::after {
    position: absolute;
    z-index: 1;
    color: rgba(239, 104, 114, 0.33);
    content: "✿";
    font-family: serif;
    pointer-events: none;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-hero::before {
    top: 10px;
    left: 12px;
    font-size: 26px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-hero::after {
    right: 12px;
    bottom: 8px;
    font-size: 30px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-hero-copy {
    position: relative;
    z-index: 3;
    width: 52%;
    padding: 43px 0 0 18px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-hero-copy h1 {
    margin: 0;
    color: #392826;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0.07em;
    line-height: 1.15;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-hero-copy p {
    margin: 10px 0 0;
    color: #725a54;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 11px;
    line-height: 1.65;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-hero > img {
    position: absolute;
    z-index: 2;
    right: -7px;
    bottom: -55px;
    width: 176px;
    height: 222px;
    object-fit: contain;
    object-position: center bottom;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-load-actions,
  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-file-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] #leftNav .analysis-desktop-load-actions > button,
  body.analysis-desktop-redesign[data-mode="analysis"] #leftNav .analysis-file-actions > button {
    display: flex !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 58px !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 !important;
    padding: 8px 9px !important;
    border: 1px solid rgba(219, 172, 159, 0.62) !important;
    border-radius: 11px !important;
    background: linear-gradient(180deg, #fff, #fffaf8) !important;
    box-shadow: 0 5px 14px rgba(116, 70, 60, 0.055) !important;
    font-family: "Noto Sans JP", "Yu Gothic", sans-serif;
    font-size: 12px !important;
    font-weight: 750;
    line-height: 1.35;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] #leftNav .analysis-desktop-load-actions > button svg,
  body.analysis-desktop-redesign[data-mode="analysis"] #leftNav .analysis-file-actions > button svg {
    width: 25px !important;
    height: 25px !important;
    flex: 0 0 auto;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] #leftNav #leftNavSgfLoadBtn { color: #368ac5 !important; }
  body.analysis-desktop-redesign[data-mode="analysis"] #leftNav #analysisOpenAiGamesBtn { color: #71944f !important; }
  body.analysis-desktop-redesign[data-mode="analysis"] #leftNav #exportSgfBtn { color: #66944b !important; }
  body.analysis-desktop-redesign[data-mode="analysis"] #leftNav #saveHistoryBtn { color: #df5f70 !important; }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-current-kifu,
  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-left-stack > .board-workspace-header,
  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card {
    width: 100% !important;
    margin: 0 !important;
    padding: 12px !important;
    overflow: hidden;
    border: 1px solid var(--analysis-pc-line) !important;
    border-radius: 13px !important;
    background: linear-gradient(180deg, rgba(255, 254, 252, 0.99), rgba(255, 249, 247, 0.98)) !important;
    box-shadow: 0 6px 16px rgba(116, 70, 60, 0.055) !important;
    box-sizing: border-box;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-current-kifu {
    min-height: 72px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-left-stack > .board-workspace-header {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
    min-height: 64px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-left-stack .board-workspace-mode,
  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-left-stack .board-view-toggles {
    display: none !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-left-stack .board-workspace-context {
    display: flex !important;
    min-width: 0;
    align-items: center;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-left-stack .board-turn-status {
    display: flex !important;
    min-width: 0;
    align-items: center;
    gap: 7px;
    color: #6b5650;
    font-size: 11px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-left-stack .board-turn-status strong {
    color: #312725;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 17px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-left-stack .capture-table th,
  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-left-stack .capture-table td {
    padding: 3px 5px !important;
    font-size: 10px !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-left-stack > .move-controls {
    display: grid !important;
    width: 100% !important;
    grid-template-columns: 38px 38px minmax(80px, 1fr) 38px 38px;
    gap: 5px;
    margin: 0 !important;
    padding: 10px !important;
    border: 1px solid var(--analysis-pc-line) !important;
    border-radius: 13px !important;
    background: rgba(255, 253, 251, 0.98) !important;
    box-shadow: 0 5px 14px rgba(116, 70, 60, 0.05) !important;
    box-sizing: border-box;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-left-stack > .move-controls #backFiveMoveBtn,
  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-left-stack > .move-controls #forwardFiveMoveBtn {
    display: none !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-left-stack > .move-controls #firstMoveBtn { grid-column: 1; grid-row: 1; }
  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-left-stack > .move-controls #prevMoveBtn { grid-column: 2; grid-row: 1; }
  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-left-stack > .move-controls #nextMoveBtn { grid-column: 4; grid-row: 1; }
  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-left-stack > .move-controls #lastMoveBtn { grid-column: 5; grid-row: 1; }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-left-stack > .move-controls > button {
    width: 38px !important;
    min-width: 38px !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 !important;
    border: 1px solid rgba(225, 143, 145, 0.5) !important;
    border-radius: 9px !important;
    background: #fff !important;
    color: #9a5559 !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-left-stack > .move-controls .move-number-jump {
    display: grid !important;
    width: 100% !important;
    max-width: 100% !important;
    grid-column: 3;
    grid-row: 1;
    grid-template-columns: minmax(32px, 1fr) auto auto;
    align-items: center;
    gap: 3px;
    min-width: 0 !important;
    box-sizing: border-box;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-left-stack > .move-controls .move-number-jump input {
    width: 100% !important;
    min-width: 0 !important;
    padding: 4px !important;
    text-align: center;
    box-sizing: border-box;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-left-stack > .move-controls .move-number-jump span {
    white-space: nowrap;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-left-stack > .move-controls .seek-wrapper {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-left-stack > .board-workspace-feedback {
    width: 100% !important;
    margin: 0 !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-left-stack > .board-workspace-feedback > :empty {
    display: none !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card > header {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 9px;
    padding: 0 2px 8px;
    border-bottom: 1px solid rgba(238, 121, 132, 0.3);
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card > header > span {
    color: rgba(240, 112, 130, 0.48);
    font-size: 21px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card > header h2 {
    margin: 0;
    color: #392c2a;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 17px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card > header p {
    margin: 2px 0 0;
    color: #8b7670;
    font-size: 9px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card .kap-pre-section {
    display: grid;
    gap: 7px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card .kap-analyze-wrap {
    display: flex;
    align-items: stretch;
    flex-direction: column;
    gap: 7px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card .kap-header,
  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card .kap-desc,
  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card .kap-display-list,
  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card .kap-empty {
    display: none !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card .kap-group,
  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card .kap-divider {
    margin: 0 !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card .kap-group-label {
    margin-bottom: 5px !important;
    font-size: 10px !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card .kap-analyze-btn {
    display: flex !important;
    width: 100% !important;
    min-height: 47px !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 0 12px !important;
    border: 0 !important;
    border-radius: 10px !important;
    background: linear-gradient(135deg, #ef6a76, #df5968) !important;
    box-shadow: 0 6px 14px rgba(208, 80, 94, 0.18) !important;
    color: #fff !important;
    font-size: 13px !important;
    font-weight: 800 !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card .kap-analyze-btn:disabled {
    background: linear-gradient(135deg, #d8d9d8, #c6cbc8) !important;
    box-shadow: none !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card .kap-analyze-btn svg {
    width: 21px !important;
    height: 21px !important;
    flex: 0 0 21px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card .kap-target-card {
    display: flex !important;
    min-height: 38px !important;
    align-items: center;
    gap: 8px;
    padding: 7px 9px !important;
    border: 1px solid rgba(219, 172, 159, 0.5);
    border-radius: 8px;
    background: rgba(255, 250, 247, 0.82);
    color: #51413d;
    font-size: 11px;
    box-sizing: border-box;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card .kap-target-card svg {
    width: 18px !important;
    height: 18px !important;
    flex: 0 0 18px;
    color: #df6070;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card .kap-range-btns {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card .kap-range-btn {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 34px !important;
    padding: 5px 3px !important;
    border: 1px solid rgba(219, 172, 159, 0.58) !important;
    border-radius: 8px !important;
    background: #fff !important;
    color: #70544f !important;
    font-size: 9px !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card .kap-range-btn.active {
    border-color: #e26874 !important;
    background: #fff0f1 !important;
    color: #c34d5b !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .workspace-board-only {
    position: sticky;
    top: 76px;
    max-height: calc(100dvh - 92px);
    align-self: start;
    overflow: hidden;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .workspace-board-only > .board-stage {
    width: min(100%, var(--workspace-primary-board-stage-size, calc(100dvh - 130px))) !important;
    margin: 0 !important;
    padding: 10px !important;
    border: 1px solid rgba(218, 187, 166, 0.7) !important;
    border-radius: 14px !important;
    background: rgba(255, 252, 246, 0.96) !important;
    box-shadow: 0 12px 30px rgba(93, 64, 48, 0.1) !important;
    box-sizing: border-box;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .workspace-board-only > .board-stage > #board.goban {
    width: 100% !important;
    max-width: none !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .side-panel[data-board-focus-ready="true"] {
    position: sticky;
    top: 76px;
    display: block !important;
    width: 350px !important;
    height: fit-content !important;
    min-height: 0 !important;
    max-height: calc(100dvh - 92px) !important;
    align-self: start;
    padding: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    scrollbar-width: thin;
    scrollbar-color: #e9a2a5 transparent;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .side-panel > .analysis-desktop-fixed-empty,
  body.analysis-desktop-redesign[data-mode="analysis"] .side-panel > .analysis-desktop-rail-empty,
  body.analysis-desktop-redesign[data-mode="analysis"] .side-panel > #dropZone,
  body.analysis-desktop-redesign[data-mode="analysis"] .side-panel > #analysisRightStack {
    display: none !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack {
    display: flex;
    width: 100%;
    min-width: 0;
    flex-direction: column;
    gap: 10px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack #studyPanel.study-panel {
    display: block;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack #studyPanel.study-panel.hidden {
    display: none !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack #studyPanel .winrate-bar-panel {
    position: relative;
    margin: 0 !important;
    padding: 12px !important;
    overflow: hidden;
    border: 1px solid var(--analysis-pc-line) !important;
    border-radius: 14px !important;
    background: linear-gradient(180deg, rgba(255, 254, 252, 0.99), rgba(255, 249, 247, 0.98)) !important;
    box-shadow: 0 8px 22px rgba(121, 75, 62, 0.07) !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack #studyPanel .study-result-heading {
    margin-bottom: 7px !important;
    padding-bottom: 7px !important;
    border-bottom: 1px solid rgba(238, 121, 132, 0.32);
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack #studyPanel .study-result-heading span,
  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack #studyPanel .study-result-heading small,
  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack #studyPanel .winrate-complexity-row {
    display: none !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack #studyPanel .study-result-heading strong {
    color: #382b2a;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 19px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack #studyPanel .bar-score {
    color: #176e4a;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 18px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack #studyPanel .winrate-bar-row {
    display: grid !important;
    grid-template-columns: auto minmax(60px, 1fr) auto;
    gap: 7px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack #studyPanel .winrate-stone-label {
    font-size: 10px !important;
    white-space: nowrap;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack #studyPanel .winrate-stone {
    width: 18px !important;
    height: 18px !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack .analysis-review-card {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    border: 1px solid var(--analysis-pc-line) !important;
    border-radius: 14px !important;
    background: linear-gradient(180deg, rgba(255, 254, 252, 0.99), rgba(255, 249, 247, 0.98)) !important;
    box-shadow: 0 8px 22px rgba(121, 75, 62, 0.07) !important;
    box-sizing: border-box;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack .analysis-review-card:has(#kapPostSection.hidden) {
    display: none !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack .kap-post-section {
    max-height: 430px;
    padding: 10px !important;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: #e9a2a5 #fff2f1;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack .kap-post-section > .kap-header {
    margin: 0 0 8px !important;
    padding: 0 2px 8px !important;
    border-bottom: 1px solid rgba(238, 121, 132, 0.32);
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack .kap-title {
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 19px !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack .kap-trend-group {
    width: 100%;
    margin: 8px 0 !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack .board-tree-panel {
    position: relative;
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 11px 10px 10px !important;
    overflow: hidden;
    border: 1px solid var(--analysis-pc-line) !important;
    border-radius: 14px !important;
    box-shadow: 0 8px 22px rgba(121, 75, 62, 0.07) !important;
    box-sizing: border-box;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack .board-tree-header {
    min-height: 38px;
    margin: 0 0 6px;
    padding: 0 2px 7px 28px;
    border: 0;
    border-bottom: 1px solid rgba(238, 121, 132, 0.34);
    background: transparent;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack .board-tree-heading {
    padding: 0;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack .board-tree-heading-icon,
  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack .board-tree-eyebrow,
  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack .board-tree-heading small,
  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack .board-tree-legend,
  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack #gameTreeBranchBadge,
  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack #gameTreeToggleBtn,
  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack .board-tree-help {
    display: none !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack .board-tree-heading strong {
    color: #382b2a;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 19px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack .board-tree-toolbar {
    display: flex !important;
    min-height: 31px;
    align-items: center;
    justify-content: flex-end;
    margin: 0 1px 5px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack .game-tree {
    width: 100%;
    height: clamp(190px, 24dvh, 260px) !important;
    min-height: 190px !important;
    max-height: 260px !important;
    padding: 5px 3px 3px !important;
    overflow: auto !important;
    touch-action: pan-x pan-y;
    border-radius: 10px;
    box-sizing: border-box;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack .tree-node,
  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack .root-node {
    display: flex;
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    border-radius: 50%;
    font-size: 10px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack .analysis-qa-section {
    width: 100%;
    margin: 0;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack .analysis-qa-action {
    display: flex !important;
    width: 100%;
    min-height: 58px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 14px !important;
    border: 1px solid #a8c7b0 !important;
    border-radius: 12px !important;
    background: linear-gradient(135deg, #16804a, #0d6b3b) !important;
    box-shadow: 0 7px 17px rgba(26, 104, 62, 0.15) !important;
    color: #fff !important;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 16px !important;
    font-weight: 700;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack .analysis-qa-action svg {
    width: 27px !important;
    height: 27px !important;
    flex: 0 0 27px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-character-tip {
    position: relative;
    display: flex;
    min-height: 98px;
    align-items: center;
    overflow: hidden;
    border: 1px solid var(--analysis-pc-line);
    border-radius: 13px;
    background: linear-gradient(105deg, #fff7f6, #fffdfb);
    box-shadow: 0 6px 16px rgba(116, 70, 60, 0.055);
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-character-tip::after {
    position: absolute;
    right: 12px;
    color: rgba(240, 112, 130, 0.28);
    content: "✿";
    font-size: 24px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-character-tip img {
    align-self: flex-end;
    width: 119px;
    height: 101px;
    object-fit: contain;
    object-position: center bottom;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-character-tip p {
    position: relative;
    z-index: 1;
    flex: 1;
    margin: 0 13px 0 -2px;
    padding: 11px 14px;
    border: 1px solid rgba(229, 142, 142, 0.42);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: #51403c;
    font-family: "Noto Serif JP", "Yu Mincho", serif;
    font-size: 11px;
    text-align: center;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-left-stack button,
  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack button,
  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-left-stack input {
    font-family: "Noto Sans JP", "Yu Gothic", sans-serif;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-left-stack button:not(:disabled),
  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack button:not(:disabled) {
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-left-stack button:not(:disabled):hover,
  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack button:not(:disabled):hover {
    border-color: rgba(226, 102, 113, 0.68) !important;
    box-shadow: 0 6px 15px rgba(128, 75, 65, 0.1) !important;
    transform: translateY(-1px);
  }
}

@media (max-width: 1180px) and (orientation: portrait) {
  .analysis-desktop-hero,
  .analysis-desktop-character-tip,
  .analysis-desktop-analysis-card > header {
    display: none !important;
  }

  .analysis-desktop-left-stack,
  .analysis-desktop-right-stack,
  .analysis-desktop-load-actions,
  .analysis-desktop-analysis-card {
    display: contents !important;
  }
}

/* Keep the refreshed PC analysis cards after the desktop layout cascade. */
@media (min-width: 1440px), (orientation: landscape) {
  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card {
    overflow: hidden;
    border: 1px solid rgba(235, 153, 151, 0.58);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255, 254, 252, 0.99), rgba(255, 249, 247, 0.98));
    box-shadow: 0 8px 20px rgba(121, 75, 62, 0.065);
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card > header {
    position: relative;
    min-height: 54px;
    margin: 0;
    padding: 11px 12px 10px 39px;
    border-bottom: 1px solid rgba(238, 121, 132, 0.32);
    background: linear-gradient(90deg, rgba(255, 239, 242, 0.75), rgba(255, 253, 250, 0.32));
    box-sizing: border-box;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card > header > span {
    position: absolute;
    top: 15px;
    left: 13px;
    color: rgba(237, 103, 121, 0.72);
    font-size: 19px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card > header h2 {
    font-size: 16px;
    letter-spacing: 0.035em;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card > header p {
    color: #856d68;
    font-size: 10px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card > header small {
    margin-left: auto;
    padding: 4px 8px;
    border: 1px solid rgba(225, 129, 136, 0.42);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: #b0525c;
    font-size: 9px;
    font-weight: 800;
    white-space: nowrap;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card .kap-pre-section {
    gap: 4px;
    padding: 9px 10px 10px;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card .kap-group {
    padding: 7px 5px !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card .kap-divider {
    margin: 0 5px !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card .kap-group-label {
    margin-bottom: 6px !important;
    font-size: 11px !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card .kap-analyze-btn {
    min-height: 50px !important;
    border-color: rgba(221, 87, 105, 0.38) !important;
    background: linear-gradient(135deg, #ef7480, #df5968) !important;
    box-shadow: 0 7px 16px rgba(200, 72, 89, 0.19) !important;
    font-size: 14px !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-analysis-card .kap-analyze-btn:disabled {
    border-color: rgba(177, 173, 170, 0.36) !important;
    background: linear-gradient(135deg, #d8d8d6, #c7cbc8) !important;
    box-shadow: none !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack .kap-post-section {
    max-height: min(48dvh, 520px);
    padding: 0 0 3px !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack .kap-post-section > .kap-header {
    margin: 0 !important;
    padding: 12px 13px 10px !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack .kap-title {
    font-size: 18px !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-right-stack .kap-post-section > .kap-group:not(.kap-trend-group) {
    margin: 9px !important;
    padding: 11px !important;
  }
}

/* Mobile free-study undo/redo and touch tree commands r1 20260819. */
@media (orientation: portrait) and (max-width: 1439px) {
  body[data-mode="study"].workspace-mobile-minimal .workspace-mobile-study-actions {
    display: block !important;
  }

  body[data-mode="study"].workspace-mobile-minimal .workspace-mobile-study-actions .study-edit-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body[data-mode="study"].workspace-mobile-minimal .tree-context-menu {
    width: min(280px, calc(100vw - 16px));
    min-width: min(240px, calc(100vw - 16px));
    padding: 6px 0;
    border-color: rgba(230, 119, 132, 0.4);
    border-radius: 13px;
    box-shadow: 0 12px 28px rgba(91, 50, 55, 0.2);
  }

  body[data-mode="study"].workspace-mobile-minimal .tree-context-menu button {
    min-height: 48px;
    padding: 11px 16px;
    color: #5b3633;
    font-size: 14px;
    font-weight: 700;
  }
}

/* AI対局場: スマホ・タブレット横向きはPC版の3カラム構造を使用する。 */
@media (orientation: landscape) and (max-width: 1179px) {
  body.ai-game-page:not(.ai-teaching-game-page) {
    overflow-x: hidden;
  }

  body.ai-game-page:not(.ai-teaching-game-page).ai-game-mobile-setup-open {
    overflow: auto;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell,
  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell:is(
    [data-phase="setup"],
    [data-phase="playing"],
    [data-phase="suspended"],
    [data-phase="scoring"],
    [data-phase="ended"]
  ) {
    --ai-game-landscape-left: clamp(156px, 22vw, 280px);
    --ai-game-landscape-right: clamp(184px, 27vw, 360px);
    --ai-game-landscape-board: min(
      calc(100dvh - 86px),
      calc(100% - var(--ai-game-landscape-left) - var(--ai-game-landscape-right) - 12px)
    );
    display: grid !important;
    width: calc(100% - 12px) !important;
    max-width: none !important;
    min-height: calc(100dvh - 70px) !important;
    grid-template-areas: "left board right" !important;
    grid-template-columns:
      var(--ai-game-landscape-left)
      minmax(0, var(--ai-game-landscape-board))
      var(--ai-game-landscape-right) !important;
    align-items: start !important;
    gap: 6px !important;
    margin: 6px auto 24px !important;
    padding: 0 !important;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-left-panel,
  .ai-game-page:not(.ai-teaching-game-page) .ai-game-right-panel {
    position: sticky !important;
    top: 66px !important;
    display: grid !important;
    width: auto !important;
    min-width: 0 !important;
    max-height: calc(100dvh - 74px) !important;
    padding: 0 2px 6px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-left-panel { grid-area: left; }
  .ai-game-page:not(.ai-teaching-game-page) .ai-game-board-area { grid-area: board; }
  .ai-game-page:not(.ai-teaching-game-page) .ai-game-right-panel { grid-area: right; }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-board-area,
  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell[data-phase="playing"] .ai-game-board-area,
  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-board-area {
    position: static !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 6px !important;
    overflow: visible !important;
    border: 1px solid rgba(221, 198, 186, 0.66) !important;
    border-radius: 12px !important;
    background: rgba(255, 254, 251, 0.96) !important;
    box-shadow: 0 8px 22px rgba(102, 66, 54, 0.08) !important;
    box-sizing: border-box;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-board-frame,
  :root[data-board-coordinates="off"] .ai-game-page:not(.ai-teaching-game-page) .ai-game-board-frame,
  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell:is([data-phase="playing"], [data-phase="scoring"], [data-phase="ended"])[data-match-type="human-ai"] .ai-game-board-frame {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 5px !important;
    overflow: visible !important;
    border: 1px solid rgba(215, 184, 160, 0.7) !important;
    border-radius: 7px !important;
    background: #fff6e8 !important;
    box-shadow: none !important;
    box-sizing: border-box;
  }

  :root[data-board-coordinates="on"] .ai-game-page:not(.ai-teaching-game-page) .ai-game-board-frame {
    padding: 18px 4px 4px 18px !important;
  }

  .ai-game-page:not(.ai-teaching-game-page) #aiGameBoard.ai-game-board.goban {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    border-radius: 4px !important;
    box-sizing: content-box;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-mobile-after-start,
  .ai-game-page:not(.ai-teaching-game-page) .ai-game-mobile-lobby-panel,
  .ai-game-page:not(.ai-teaching-game-page) .ai-game-mobile-setup-hero,
  .ai-game-page:not(.ai-teaching-game-page) .ai-game-setup-close {
    display: none !important;
  }
}

/* 盤面ワークスペース: スマホ・タブレット横向きはPC版の3カラム構造を使用する。 */
@media (orientation: landscape) and (max-width: 1180px) {
  /* 幅700px以下向けの縦並び指定を横向き時だけ解除する。 */
  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .main-grid {
    display: contents !important;
    flex-direction: initial !important;
    overflow: visible !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) :is(#leftNav, .workspace-board-only, .side-panel) {
    order: initial !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-board-only {
    width: var(--workspace-landscape-board) !important;
    min-width: 0 !important;
    max-width: var(--workspace-landscape-board) !important;
    justify-self: start !important;
    margin-inline: 0 !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) {
    overflow-x: hidden;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace {
    --workspace-landscape-left: clamp(156px, 22vw, 300px);
    --workspace-landscape-right: clamp(184px, 27vw, 350px);
    --workspace-landscape-board: min(
      calc(100dvh - 86px),
      calc(100dvw - var(--workspace-landscape-left) - var(--workspace-landscape-right) - 24px)
    );
    --workspace-primary-board-stage-size: var(--workspace-landscape-board);
    width: 100% !important;
    max-width: none !important;
    grid-template-columns:
      var(--workspace-landscape-left)
      minmax(0, var(--workspace-landscape-board))
      var(--workspace-landscape-right) !important;
    gap: 6px !important;
    padding: 6px !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .main-grid {
    width: calc(100% - 12px) !important;
    max-width: none !important;
    grid-template-columns:
      var(--workspace-landscape-left)
      minmax(0, var(--workspace-landscape-board))
      var(--workspace-landscape-right) !important;
    gap: 6px !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) #leftNav,
  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .side-panel[data-board-focus-ready="true"] {
    width: auto !important;
    min-width: 0 !important;
    max-height: calc(100dvh - 74px) !important;
    top: 66px !important;
  }

  body.study-desktop-redesign[data-mode="study"] #leftNav.analysis-workspace-nav,
  body.editor-desktop-redesign[data-mode="editor"] #leftNav.editor-workspace-nav,
  body.analysis-desktop-redesign[data-mode="analysis"] #leftNav.analysis-workspace-nav {
    width: auto !important;
    min-width: 0 !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-board-only {
    top: 66px !important;
    max-height: calc(100dvh - 74px) !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-board-only > .board-stage {
    width: 100% !important;
    max-width: 100% !important;
    padding: 6px !important;
    border-radius: 10px !important;
  }
}

/* 狭い横向きスマホでは、PC用サイドバーの中身も列幅に合わせて縮小する。 */
@media (orientation: landscape) and (max-width: 849px) {
  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) {
    --workspace-landscape-left-content-zoom: 0.52;
    --workspace-landscape-left-content-width: 192.31%;
    --workspace-landscape-right-content-zoom: 0.56;
    --workspace-landscape-right-content-width: 178.58%;
  }
}

@media (orientation: landscape) and (min-width: 850px) and (max-width: 999px) {
  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) {
    --workspace-landscape-left-content-zoom: 0.68;
    --workspace-landscape-left-content-width: 147.06%;
    --workspace-landscape-right-content-zoom: 0.72;
    --workspace-landscape-right-content-width: 138.89%;
  }
}

/* 横向きタブレット r2: 旧zoom方式を解除し、1000-1700pxは列そのものを可変幅にする。 */
@media (orientation: landscape) and (min-width: 1000px) and (max-width: 1700px) {
  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) {
    --workspace-adaptive-left-rail: clamp(220px, 22vw, 300px);
    --workspace-adaptive-right-rail: clamp(240px, 24vw, 350px);
    --workspace-adaptive-gap: clamp(6px, 0.7vw, 10px);
    --workspace-adaptive-board: min(
      calc(100dvh - 130px),
      calc(100dvw - var(--workspace-adaptive-left-rail) - var(--workspace-adaptive-right-rail) - 40px)
    );
    --workspace-landscape-board: var(--workspace-adaptive-board);
    --workspace-primary-board-stage-size: var(--workspace-adaptive-board) !important;
    --workspace-landscape-left-content-zoom: 1;
    --workspace-landscape-left-content-width: 100%;
    --workspace-landscape-right-content-zoom: 1;
    --workspace-landscape-right-content-width: 100%;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace {
    width: 100% !important;
    max-width: none !important;
    grid-template-columns:
      minmax(0, var(--workspace-adaptive-left-rail))
      minmax(0, var(--workspace-adaptive-board))
      minmax(0, var(--workspace-adaptive-right-rail)) !important;
    gap: var(--workspace-adaptive-gap) !important;
    padding-inline: 6px !important;
    box-sizing: border-box;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .main-grid,
  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ).workspace-board-focus .main-grid {
    width: 100% !important;
    max-width: none !important;
    grid-template-columns:
      minmax(0, var(--workspace-adaptive-left-rail))
      minmax(0, var(--workspace-adaptive-board))
      minmax(0, var(--workspace-adaptive-right-rail)) !important;
    gap: var(--workspace-adaptive-gap) !important;
  }

  body.study-desktop-redesign[data-mode="study"] #leftNav.analysis-workspace-nav,
  body.editor-desktop-redesign[data-mode="editor"] #leftNav.editor-workspace-nav,
  body.analysis-desktop-redesign[data-mode="analysis"] #leftNav.analysis-workspace-nav {
    width: var(--workspace-adaptive-left-rail) !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .side-panel[data-board-focus-ready="true"] {
    width: var(--workspace-adaptive-right-rail) !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) :is(
    .study-desktop-left-stack,
    .editor-desktop-left-stack,
    .analysis-desktop-left-stack
  ),
  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .side-panel[data-board-focus-ready="true"] > :not([hidden]) {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    zoom: 1 !important;
    box-sizing: border-box;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) :is(#leftNav, .side-panel[data-board-focus-ready="true"]) :is(button, input, select, textarea) {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-hero > img {
    width: min(184px, 64%) !important;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-hero > img {
    width: min(160px, 56%) !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-hero > img {
    width: min(177px, 62%) !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) :is(.study-desktop-hero-copy, .editor-desktop-hero-copy, .analysis-desktop-hero-copy) h1 {
    font-size: clamp(22px, 2vw, 28px) !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .side-panel[data-board-focus-ready="true"] .winrate-bar-row {
    min-width: 0 !important;
    grid-template-columns: max-content minmax(36px, 1fr) max-content !important;
    gap: 4px !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .side-panel[data-board-focus-ready="true"] :is(.winrate-stone-label, .bar-score) {
    min-width: 0 !important;
    font-size: clamp(11px, 1.1vw, 16px) !important;
  }
}

/* 横向きタブレット: 碁盤を高さ基準で維持し、左右レールだけを表示幅に合わせて縮める。 */
@media (orientation: landscape) and (min-width: 1181px) and (max-width: 1500px) {
  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) {
    --workspace-tablet-left-rail: clamp(230px, 22vw, 300px);
    --workspace-tablet-right-rail: clamp(250px, 24vw, 350px);
    --workspace-tablet-gap: clamp(8px, 0.85vw, 12px);
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace {
    --workspace-primary-board-stage-size: min(
      calc(100dvh - 130px),
      calc(100dvw - var(--workspace-tablet-left-rail) - var(--workspace-tablet-right-rail) - 44px)
    ) !important;
    width: 100% !important;
    max-width: none !important;
    grid-template-columns:
      minmax(0, var(--workspace-tablet-left-rail))
      minmax(0, var(--workspace-primary-board-stage-size))
      minmax(0, var(--workspace-tablet-right-rail)) !important;
    gap: var(--workspace-tablet-gap) !important;
    padding-inline: 8px !important;
    box-sizing: border-box;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .main-grid,
  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ).workspace-board-focus .main-grid {
    width: 100% !important;
    max-width: none !important;
    grid-template-columns:
      minmax(0, var(--workspace-tablet-left-rail))
      minmax(0, var(--workspace-primary-board-stage-size))
      minmax(0, var(--workspace-tablet-right-rail)) !important;
    gap: var(--workspace-tablet-gap) !important;
  }

  body.study-desktop-redesign[data-mode="study"] #leftNav.analysis-workspace-nav,
  body.editor-desktop-redesign[data-mode="editor"] #leftNav.editor-workspace-nav,
  body.analysis-desktop-redesign[data-mode="analysis"] #leftNav.analysis-workspace-nav {
    width: var(--workspace-tablet-left-rail) !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .side-panel[data-board-focus-ready="true"] {
    width: var(--workspace-tablet-right-rail) !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) :is(#leftNav, .side-panel[data-board-focus-ready="true"]) :is(button, input, select, textarea),
  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .side-panel[data-board-focus-ready="true"] > :not([hidden]) {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  body.study-desktop-redesign[data-mode="study"] .study-desktop-hero > img {
    width: min(184px, 64%) !important;
  }

  body.editor-desktop-redesign[data-mode="editor"] .editor-desktop-hero > img {
    width: min(160px, 56%) !important;
  }

  body.analysis-desktop-redesign[data-mode="analysis"] .analysis-desktop-hero > img {
    width: min(177px, 62%) !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) :is(.study-desktop-hero-copy, .editor-desktop-hero-copy, .analysis-desktop-hero-copy) h1 {
    font-size: clamp(23px, 2vw, 28px) !important;
  }
}

/* 通常表示では補助ラッパーをグリッド構造へ影響させない。 */
.workspace-landscape-left-scroll {
  display: contents;
}

/* 狭い横向きスマホ: 左列だけをスクロールし、右列の碁盤を画面内へ固定する。 */
@media (orientation: landscape) and (max-width: 849px) {
  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) {
    --workspace-landscape-left-content-zoom: 0.72;
    --workspace-landscape-left-content-width: 138.89%;
    --workspace-landscape-right-content-zoom: 0.72;
    --workspace-landscape-right-content-width: 138.89%;
    height: 100dvh !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace {
    --workspace-landscape-board: min(calc(100dvh - 110px), 44dvw);
    width: calc(100% - 8px) !important;
    height: calc(100dvh - 98px) !important;
    max-height: calc(100dvh - 98px) !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, var(--workspace-landscape-board)) !important;
    grid-template-rows: minmax(0, 1fr) !important;
    align-items: start !important;
    gap: 6px !important;
    padding: 4px !important;
    overflow: hidden !important;
    overscroll-behavior: none;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-landscape-left-scroll {
    display: flex !important;
    grid-column: 1;
    grid-row: 1;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    scrollbar-gutter: stable;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) #leftNav {
    position: static !important;
    flex: 0 0 auto;
    width: auto !important;
    min-width: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    top: auto !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .side-panel[data-board-focus-ready="true"] {
    position: static !important;
    flex: 0 0 auto;
    width: auto !important;
    min-width: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    top: auto !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-board-only {
    grid-column: 2;
    grid-row: 1;
    position: sticky !important;
    top: 0 !important;
    width: var(--workspace-landscape-board) !important;
    max-width: var(--workspace-landscape-board) !important;
    max-height: 100% !important;
    align-self: start;
    overflow: hidden !important;
    overscroll-behavior: none;
    touch-action: none;
  }
}

/* 横向き端末でも盤上候補値を交点内へ収め、Androidの文字自動拡大を抑える。 */
@media (orientation: landscape) and (max-width: 1180px) {
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body:is([data-mode="study"], [data-mode="analysis"]) #board.goban > .candidate .candidate-metrics {
    width: 108% !important;
    row-gap: 0 !important;
  }

  body:is([data-mode="study"], [data-mode="analysis"]) #board.goban > .candidate .candidate-score {
    width: 110% !important;
    font-size: clamp(7px, 0.9vw, 9px) !important;
    letter-spacing: 0 !important;
    line-height: 1 !important;
  }

  body:is([data-mode="study"], [data-mode="analysis"]) #board.goban > .candidate .candidate-score.candidate-score-wide {
    width: 104% !important;
    font-size: clamp(6px, 0.75vw, 8px) !important;
  }

  body:is([data-mode="study"], [data-mode="analysis"]) #board.goban > .candidate .candidate-score.candidate-score-extra-wide {
    width: 102% !important;
    font-size: clamp(5px, 0.65vw, 7px) !important;
  }

  body:is([data-mode="study"], [data-mode="analysis"]) #board.goban > .candidate .candidate-winrate {
    width: 106% !important;
    font-size: clamp(5px, 0.6vw, 7px) !important;
    letter-spacing: 0 !important;
    line-height: 1 !important;
    transform: none !important;
  }

  body .site-header.site-header {
    transform: translateY(0);
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
  }

  body .site-header.site-header.is-scroll-hidden:not(.is-menu-open) {
    transform: translateY(calc(-100% - 2px)) !important;
    pointer-events: none;
  }
}

@media (orientation: landscape) and (max-width: 849px) {
  body:is([data-mode="study"], [data-mode="analysis"]) #board.goban > .candidate .candidate-score {
    font-size: 7px !important;
  }

  body:is([data-mode="study"], [data-mode="analysis"]) #board.goban > .candidate .candidate-score.candidate-score-wide {
    font-size: 6px !important;
  }

  body:is([data-mode="study"], [data-mode="analysis"]) #board.goban > .candidate .candidate-score.candidate-score-extra-wide,
  body:is([data-mode="study"], [data-mode="analysis"]) #board.goban > .candidate .candidate-winrate {
    font-size: 5px !important;
  }
}

@media (orientation: landscape) and (min-width: 1000px) and (max-width: 1180px) {
  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) {
    --workspace-landscape-left-content-zoom: 0.8;
    --workspace-landscape-left-content-width: 125%;
    --workspace-landscape-right-content-zoom: 0.84;
    --workspace-landscape-right-content-width: 119.05%;
  }
}

@media (orientation: landscape) and (max-width: 1180px) {
  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) :is(
    .study-desktop-left-stack,
    .editor-desktop-left-stack,
    .analysis-desktop-left-stack
  ) {
    width: var(--workspace-landscape-left-content-width) !important;
    max-width: none !important;
    zoom: var(--workspace-landscape-left-content-zoom);
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .side-panel[data-board-focus-ready="true"] > :not([hidden]) {
    width: var(--workspace-landscape-right-content-width) !important;
    max-width: none !important;
    zoom: var(--workspace-landscape-right-content-zoom);
  }
}

/* 701px以上でPCヘッダーになる狭い横向き端末は、ナビ全体を比率を保って収める。 */
@media (orientation: landscape) and (min-width: 701px) and (max-width: 849px) {
  body:is(
    .ai-game-page:not(.ai-teaching-game-page),
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .site-header-inner {
    width: 138.89% !important;
    max-width: none !important;
    zoom: 0.72;
  }
}

@media (orientation: landscape) and (min-width: 850px) and (max-width: 999px) {
  body:is(
    .ai-game-page:not(.ai-teaching-game-page),
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .site-header-inner {
    width: 121.96% !important;
    max-width: none !important;
    zoom: 0.82;
  }
}

/* 横向きタブレット r2 cascade guard: 後続の旧1180pxルールより可変列を優先する。 */
@media (orientation: landscape) and (min-width: 1000px) and (max-width: 1700px) {
  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) {
    --workspace-landscape-left-content-zoom: 1;
    --workspace-landscape-left-content-width: 100%;
    --workspace-landscape-right-content-zoom: 1;
    --workspace-landscape-right-content-width: 100%;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace {
    --workspace-landscape-board: var(--workspace-adaptive-board);
    --workspace-primary-board-stage-size: var(--workspace-adaptive-board) !important;
    width: 100% !important;
    grid-template-columns:
      minmax(0, var(--workspace-adaptive-left-rail))
      minmax(0, var(--workspace-adaptive-board))
      minmax(0, var(--workspace-adaptive-right-rail)) !important;
    gap: var(--workspace-adaptive-gap) !important;
    padding-inline: 6px !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .main-grid,
  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ).workspace-board-focus .main-grid {
    width: 100% !important;
    grid-template-columns:
      minmax(0, var(--workspace-adaptive-left-rail))
      minmax(0, var(--workspace-adaptive-board))
      minmax(0, var(--workspace-adaptive-right-rail)) !important;
    gap: var(--workspace-adaptive-gap) !important;
  }

  body.study-desktop-redesign[data-mode="study"] #leftNav.analysis-workspace-nav,
  body.editor-desktop-redesign[data-mode="editor"] #leftNav.editor-workspace-nav,
  body.analysis-desktop-redesign[data-mode="analysis"] #leftNav.analysis-workspace-nav {
    width: var(--workspace-adaptive-left-rail) !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .side-panel[data-board-focus-ready="true"] {
    width: var(--workspace-adaptive-right-rail) !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) :is(
    .study-desktop-left-stack,
    .editor-desktop-left-stack,
    .analysis-desktop-left-stack
  ),
  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .side-panel[data-board-focus-ready="true"] > :not([hidden]) {
    width: 100% !important;
    max-width: 100% !important;
    zoom: 1 !important;
  }
}

/* Portrait compact header final cascade guard. */
@media (orientation: portrait) and (min-width: 701px) and (max-width: 1439px) {
  .site-header.qa-topnav {
    height: auto !important;
    min-height: var(--mobile-header-height) !important;
    padding: 0 !important;
  }

  .site-header .site-header-inner {
    max-width: none !important;
    min-height: var(--mobile-header-height) !important;
    gap: 8px !important;
    padding: 7px 10px !important;
  }

  .site-header .qa-topnav-logo {
    width: auto !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
    gap: 0 !important;
  }

  .site-header .qa-topnav-logo::after {
    width: 34px !important;
    height: 34px !important;
    flex-basis: 34px !important;
    margin-left: -10px !important;
  }

  .site-header .qa-topnav-right {
    min-width: 0 !important;
    align-self: center !important;
    gap: 5px !important;
    order: 1;
    padding-left: 0 !important;
    border-left: 0 !important;
  }

  .site-header .qa-account-menu-button {
    min-width: 96px !important;
    max-width: 112px !important;
    min-height: 40px !important;
    gap: 5px !important;
    margin-left: 0 !important;
    padding: 3px 6px 3px 3px !important;
  }

  .site-header .qa-account-menu-panel {
    position: fixed;
    top: calc(var(--mobile-header-height) + 4px);
    right: 8px;
    left: 8px;
    width: auto;
    max-height: calc(100dvh - var(--mobile-header-height) - 16px);
  }
}

/* Board workspace responsive layout r3 cascade guard. */
@media (orientation: landscape) and (max-width: 759px) {
  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) {
    height: auto !important;
    min-height: 100dvh !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) :is(.workspace, .main-grid) {
    display: flex !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    flex-direction: column !important;
    overflow: visible !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-board-only {
    order: 1 !important;
    position: static !important;
    width: calc(100dvw - 10px) !important;
    max-width: calc(100dvw - 10px) !important;
    max-height: none !important;
    overflow: visible !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-landscape-left-scroll {
    order: 2 !important;
    display: flex !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    flex-direction: column;
    overflow: visible !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) :is(#leftNav, .side-panel[data-board-focus-ready="true"]) {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    zoom: 1 !important;
  }
}

@media (orientation: landscape) and (min-width: 760px) and (max-width: 1439px),
       (orientation: landscape) and (min-width: 1440px) and (max-height: 719px) {
  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) {
    --workspace-responsive-board: min(calc(100dvh - 86px), calc(58dvw - 14px));
    height: 100dvh !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .app-shell {
    height: calc(100dvh - 70px) !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace {
    --workspace-primary-board-stage-size: var(--workspace-responsive-board) !important;
    display: grid !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-width: none !important;
    grid-template-columns: minmax(280px, 1fr) minmax(0, var(--workspace-responsive-board)) !important;
    grid-template-rows: minmax(0, 1fr) !important;
    align-items: start !important;
    gap: clamp(6px, 0.8vw, 10px) !important;
    padding: 6px !important;
    overflow: hidden !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .main-grid {
    display: contents !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-landscape-left-scroll {
    display: flex !important;
    grid-column: 1;
    grid-row: 1;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-height: 100% !important;
    flex-direction: column;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    touch-action: pan-y;
    scrollbar-gutter: stable;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-landscape-left-scroll > :is(#leftNav, .side-panel[data-board-focus-ready="true"]) {
    position: static !important;
    flex: 0 0 auto;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    max-height: none !important;
    inset: auto !important;
    overflow: visible !important;
    zoom: 1 !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-board-only {
    grid-column: 2;
    grid-row: 1;
    position: sticky !important;
    top: 0 !important;
    align-self: start;
    width: var(--workspace-responsive-board) !important;
    min-width: 0 !important;
    max-width: var(--workspace-responsive-board) !important;
    max-height: 100% !important;
    margin: 0 !important;
    overflow: hidden !important;
  }

  body.ai-game-page:not(.ai-teaching-game-page):has(.ai-game-shell:is(
    [data-phase="playing"],
    [data-phase="suspended"],
    [data-phase="scoring"],
    [data-phase="ended"]
  )) {
    height: auto !important;
    min-height: 100dvh !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell:is(
    [data-phase="playing"],
    [data-phase="suspended"],
    [data-phase="scoring"],
    [data-phase="ended"]
  ) {
    --ai-game-responsive-board: min(calc(100dvh - 86px), calc(58dvw - 14px));
    display: grid !important;
    width: calc(100% - 12px) !important;
    height: auto !important;
    min-height: calc(100dvh - 76px) !important;
    max-width: none !important;
    grid-template-areas: "controls board" !important;
    grid-template-columns: minmax(280px, 1fr) minmax(0, var(--ai-game-responsive-board)) !important;
    grid-template-rows: auto !important;
    gap: clamp(6px, 0.8vw, 10px) !important;
    margin: 6px auto 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-responsive-controls-scroll {
    display: flex !important;
    grid-area: controls;
    width: 100%;
    height: auto;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    max-height: none;
    overflow: visible;
    overscroll-behavior: auto;
    touch-action: pan-y;
    scrollbar-gutter: stable;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-responsive-controls-scroll > :is(
    .ai-game-left-panel,
    .ai-game-right-panel
  ) {
    position: static !important;
    flex: 0 0 auto;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    max-height: none !important;
    inset: auto !important;
    overflow: visible !important;
  }

  body.ai-game-page:not(.ai-teaching-game-page) .ai-game-shell:is(
    [data-phase="playing"],
    [data-phase="suspended"],
    [data-phase="scoring"],
    [data-phase="ended"]
  )[data-match-type] .ai-game-board-area {
    grid-area: board;
    position: sticky !important;
    top: 84px !important;
    align-self: start;
    width: var(--ai-game-responsive-board) !important;
    min-width: 0 !important;
    max-width: var(--ai-game-responsive-board) !important;
    max-height: none !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell[data-phase="setup"] {
    display: block !important;
    width: min(720px, calc(100% - 20px)) !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 10px auto 32px !important;
    overflow: visible !important;
  }
}

@media (orientation: landscape) and (min-width: 1440px) and (min-height: 720px) {
  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) {
    --workspace-responsive-left: clamp(240px, 18vw, 300px);
    --workspace-responsive-right: clamp(260px, 21vw, 340px);
    --workspace-responsive-board: min(
      calc(100dvh - 86px),
      calc(100dvw - var(--workspace-responsive-left) - var(--workspace-responsive-right) - 40px)
    );
    height: 100dvh !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) :is(.app-shell, .workspace) {
    height: calc(100dvh - 70px) !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace {
    --workspace-primary-board-stage-size: var(--workspace-responsive-board) !important;
    display: grid !important;
    width: 100% !important;
    max-width: none !important;
    grid-template-columns:
      minmax(0, var(--workspace-responsive-left))
      minmax(0, var(--workspace-responsive-board))
      minmax(0, var(--workspace-responsive-right)) !important;
    grid-template-rows: minmax(0, 1fr) !important;
    gap: clamp(8px, 0.8vw, 12px) !important;
    padding: 6px !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) :is(.main-grid, .workspace-landscape-left-scroll) {
    display: contents !important;
  }

  body.study-desktop-redesign[data-mode="study"] #leftNav.analysis-workspace-nav,
  body.editor-desktop-redesign[data-mode="editor"] #leftNav.editor-workspace-nav,
  body.analysis-desktop-redesign[data-mode="analysis"] #leftNav.analysis-workspace-nav,
  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .side-panel[data-board-focus-ready="true"] {
    position: sticky !important;
    top: 0 !important;
    min-width: 0 !important;
    max-width: 100% !important;
    max-height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    zoom: 1 !important;
    scrollbar-gutter: stable;
  }

  body.study-desktop-redesign[data-mode="study"] #leftNav.analysis-workspace-nav,
  body.editor-desktop-redesign[data-mode="editor"] #leftNav.editor-workspace-nav,
  body.analysis-desktop-redesign[data-mode="analysis"] #leftNav.analysis-workspace-nav {
    grid-column: 1;
    grid-row: 1;
    width: var(--workspace-responsive-left) !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-board-only {
    grid-column: 2;
    grid-row: 1;
    position: sticky !important;
    top: 0 !important;
    width: var(--workspace-responsive-board) !important;
    max-width: var(--workspace-responsive-board) !important;
    max-height: 100% !important;
    overflow: hidden !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .side-panel[data-board-focus-ready="true"] {
    grid-column: 3;
    grid-row: 1;
    width: var(--workspace-responsive-right) !important;
  }

  body.ai-game-page:not(.ai-teaching-game-page):has(.ai-game-shell:is(
    [data-phase="playing"],
    [data-phase="suspended"],
    [data-phase="scoring"],
    [data-phase="ended"]
  )) {
    height: 100dvh !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell:is(
    [data-phase="playing"],
    [data-phase="suspended"],
    [data-phase="scoring"],
    [data-phase="ended"]
  ) {
    height: calc(100dvh - 76px) !important;
    min-height: 0 !important;
    max-height: calc(100dvh - 76px) !important;
    overflow: hidden !important;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell:is(
    [data-phase="playing"],
    [data-phase="suspended"],
    [data-phase="scoring"],
    [data-phase="ended"]
  ) :is(.ai-game-left-panel, .ai-game-right-panel) {
    position: sticky !important;
    top: 0 !important;
    max-height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    scrollbar-gutter: stable;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell:is(
    [data-phase="playing"],
    [data-phase="suspended"],
    [data-phase="scoring"],
    [data-phase="ended"]
  ) .ai-game-board-area {
    position: sticky !important;
    top: 0 !important;
    align-self: start;
    max-height: 100% !important;
    overflow: hidden !important;
  }
}

/* AI game desktop active phases: keep both rails inside the shell when the board grows. */
@media (orientation: landscape) and (min-width: 1440px) and (min-height: 720px) {
  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell:is(
    [data-phase="playing"],
    [data-phase="suspended"],
    [data-phase="scoring"],
    [data-phase="ended"]
  ) {
    --ai-game-desktop-left-rail: 300px;
    --ai-game-desktop-right-rail: 330px;
    --ai-game-desktop-column-gap: 18px;
    --ai-game-desktop-active-board: min(
      calc(100dvh - 130px),
      calc(
        100dvw
        - var(--ai-game-desktop-left-rail)
        - var(--ai-game-desktop-right-rail)
        - (var(--ai-game-desktop-column-gap) * 2)
        - 42px
      )
    );
    width: calc(
      var(--ai-game-desktop-left-rail)
      + var(--ai-game-desktop-active-board)
      + var(--ai-game-desktop-right-rail)
      + (var(--ai-game-desktop-column-gap) * 2)
    ) !important;
    max-width: calc(100dvw - 24px) !important;
    grid-template-areas: "left board right" !important;
    grid-template-columns:
      minmax(0, var(--ai-game-desktop-left-rail))
      minmax(0, var(--ai-game-desktop-active-board))
      minmax(0, var(--ai-game-desktop-right-rail)) !important;
    column-gap: var(--ai-game-desktop-column-gap) !important;
    justify-content: center !important;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell:is(
    [data-phase="playing"],
    [data-phase="suspended"],
    [data-phase="scoring"],
    [data-phase="ended"]
  ) :is(.ai-game-left-panel, .ai-game-board-area, .ai-game-right-panel) {
    min-width: 0 !important;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell:is(
    [data-phase="playing"],
    [data-phase="suspended"],
    [data-phase="scoring"],
    [data-phase="ended"]
  ) .ai-game-board-frame {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* Desktop three-column workspaces: preserve both rails before sizing the board. */
@media (orientation: landscape) and (min-width: 1440px) and (min-height: 720px) {
  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) {
    --workspace-safe-left-rail: max(300px, var(--workspace-responsive-left));
    --workspace-safe-right-rail: max(330px, var(--workspace-responsive-right));
    --workspace-safe-gap: clamp(8px, 0.8vw, 12px);
    --workspace-safe-board: min(
      calc(100dvh - 130px),
      calc(
        100dvw
        - var(--workspace-safe-left-rail)
        - var(--workspace-safe-right-rail)
        - (var(--workspace-safe-gap) * 2)
        - 40px
      )
    );
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace {
    --workspace-primary-board-stage-size: var(--workspace-safe-board) !important;
    width: calc(
      var(--workspace-safe-left-rail)
      + var(--workspace-safe-board)
      + var(--workspace-safe-right-rail)
      + (var(--workspace-safe-gap) * 2)
    ) !important;
    max-width: calc(100dvw - 16px) !important;
    grid-template-columns:
      var(--workspace-safe-left-rail)
      minmax(0, var(--workspace-safe-board))
      var(--workspace-safe-right-rail) !important;
    column-gap: var(--workspace-safe-gap) !important;
    margin-inline: auto !important;
  }

  body.study-desktop-redesign[data-mode="study"] #leftNav.analysis-workspace-nav,
  body.editor-desktop-redesign[data-mode="editor"] #leftNav.editor-workspace-nav,
  body.analysis-desktop-redesign[data-mode="analysis"] #leftNav.analysis-workspace-nav {
    width: var(--workspace-safe-left-rail) !important;
    min-width: var(--workspace-safe-left-rail) !important;
    max-width: var(--workspace-safe-left-rail) !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .side-panel[data-board-focus-ready="true"] {
    width: var(--workspace-safe-right-rail) !important;
    min-width: var(--workspace-safe-right-rail) !important;
    max-width: var(--workspace-safe-right-rail) !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-board-only {
    width: var(--workspace-safe-board) !important;
    min-width: 0 !important;
    max-width: var(--workspace-safe-board) !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-board-only > .board-stage,
  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-board-only .goban {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell:is(
    [data-phase="playing"],
    [data-phase="suspended"],
    [data-phase="scoring"],
    [data-phase="ended"]
  ) {
    grid-template-columns:
      var(--ai-game-desktop-left-rail)
      minmax(0, var(--ai-game-desktop-active-board))
      var(--ai-game-desktop-right-rail) !important;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell:is(
    [data-phase="playing"],
    [data-phase="suspended"],
    [data-phase="scoring"],
    [data-phase="ended"]
  ) .ai-game-left-panel {
    width: var(--ai-game-desktop-left-rail) !important;
    min-width: var(--ai-game-desktop-left-rail) !important;
    max-width: var(--ai-game-desktop-left-rail) !important;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell:is(
    [data-phase="playing"],
    [data-phase="suspended"],
    [data-phase="scoring"],
    [data-phase="ended"]
  ) .ai-game-right-panel {
    width: var(--ai-game-desktop-right-rail) !important;
    min-width: var(--ai-game-desktop-right-rail) !important;
    max-width: var(--ai-game-desktop-right-rail) !important;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell:is(
    [data-phase="playing"],
    [data-phase="suspended"],
    [data-phase="scoring"],
    [data-phase="ended"]
  ) .ai-game-board-area {
    width: var(--ai-game-desktop-active-board) !important;
    min-width: 0 !important;
    max-width: var(--ai-game-desktop-active-board) !important;
  }
}

/* Move navigation counter fit: keep the complete "current / total手" text inside its grid track. */
@media (min-width: 1440px), (orientation: landscape) {
  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"]
  ) :is(.study-desktop-left-stack, .editor-desktop-left-stack) > .move-controls {
    grid-template-columns: 42px 42px minmax(72px, 1fr) 42px 42px !important;
    gap: 5px !important;
    padding: 8px !important;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"]
  ) :is(.study-desktop-left-stack, .editor-desktop-left-stack) > .move-controls #moveNumberLabel {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: visible;
    box-sizing: border-box;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"]
  ) :is(.study-desktop-left-stack, .editor-desktop-left-stack) > .move-controls #moveNumberMaxLabel {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

@media (orientation: portrait) and (max-width: 1439px) {
  body[data-mode="editor"].workspace-mobile-minimal .board-workspace-panel > .move-controls {
    grid-template-columns: repeat(3, 34px) minmax(72px, 1fr) repeat(3, 34px) !important;
  }

  body[data-mode="editor"].workspace-mobile-minimal .board-workspace-panel > .move-controls #moveNumberLabel {
    display: flex !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    align-items: center;
    justify-content: center;
    gap: 3px;
    overflow: visible;
    box-sizing: border-box;
  }

  body[data-mode="editor"].workspace-mobile-minimal .board-workspace-panel > .move-controls #moveNumberInput {
    width: 27px !important;
    min-width: 27px !important;
    max-width: 27px !important;
    flex: 0 0 27px;
    padding-inline: 2px !important;
  }

  body[data-mode="editor"].workspace-mobile-minimal .board-workspace-panel > .move-controls #moveNumberMaxLabel {
    min-width: max-content;
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

@media (orientation: portrait) and (max-width: 380px) {
  body[data-mode="editor"].workspace-mobile-minimal .board-workspace-panel > .move-controls {
    grid-template-columns: repeat(3, 31px) minmax(68px, 1fr) repeat(3, 31px) !important;
  }
}

/* Mobile move navigation: endpoints + centered complete move count r6 20260823. */
@media (orientation: portrait) and (max-width: 1439px) {
  body.workspace-mobile-minimal:is(
    [data-mode="study"],
    [data-mode="analysis"],
    [data-mode="editor"]
  ) .board-workspace-panel > .move-controls {
    grid-template-columns: 44px 44px minmax(76px, 1fr) 44px 44px !important;
    grid-template-rows: 44px 31px !important;
    gap: 3px 5px !important;
  }

  body.workspace-mobile-minimal:is(
    [data-mode="study"],
    [data-mode="analysis"],
    [data-mode="editor"]
  ) .board-workspace-panel > .move-controls #backFiveMoveBtn,
  body.workspace-mobile-minimal:is(
    [data-mode="study"],
    [data-mode="analysis"],
    [data-mode="editor"]
  ) .board-workspace-panel > .move-controls #forwardFiveMoveBtn {
    display: none !important;
  }

  body.workspace-mobile-minimal:is(
    [data-mode="study"],
    [data-mode="analysis"],
    [data-mode="editor"]
  ) .board-workspace-panel > .move-controls :is(
    #firstMoveBtn,
    #prevMoveBtn,
    #nextMoveBtn,
    #lastMoveBtn
  ) {
    display: grid !important;
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    grid-row: 1 !important;
    place-items: center;
  }

  body.workspace-mobile-minimal:is(
    [data-mode="study"],
    [data-mode="analysis"],
    [data-mode="editor"]
  ) .board-workspace-panel > .move-controls #firstMoveBtn { grid-column: 1 !important; }

  body.workspace-mobile-minimal:is(
    [data-mode="study"],
    [data-mode="analysis"],
    [data-mode="editor"]
  ) .board-workspace-panel > .move-controls #prevMoveBtn { grid-column: 2 !important; }

  body.workspace-mobile-minimal:is(
    [data-mode="study"],
    [data-mode="analysis"],
    [data-mode="editor"]
  ) .board-workspace-panel > .move-controls #moveNumberLabel {
    display: flex !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 44px !important;
    grid-column: 3 !important;
    grid-row: 1 !important;
    align-items: center;
    justify-content: center;
    gap: 4px;
    overflow: visible;
    box-sizing: border-box;
    white-space: nowrap;
  }

  body.workspace-mobile-minimal:is(
    [data-mode="study"],
    [data-mode="analysis"],
    [data-mode="editor"]
  ) .board-workspace-panel > .move-controls #moveNumberInput {
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    flex: 0 0 38px;
    padding-inline: 2px !important;
  }

  body.workspace-mobile-minimal:is(
    [data-mode="study"],
    [data-mode="analysis"],
    [data-mode="editor"]
  ) .board-workspace-panel > .move-controls #moveNumberMaxLabel {
    min-width: max-content;
    flex: 0 0 auto;
    white-space: nowrap;
  }

  body.workspace-mobile-minimal:is(
    [data-mode="study"],
    [data-mode="analysis"],
    [data-mode="editor"]
  ) .board-workspace-panel > .move-controls #nextMoveBtn { grid-column: 4 !important; }

  body.workspace-mobile-minimal:is(
    [data-mode="study"],
    [data-mode="analysis"],
    [data-mode="editor"]
  ) .board-workspace-panel > .move-controls #lastMoveBtn { grid-column: 5 !important; }

  body.workspace-mobile-minimal:is(
    [data-mode="study"],
    [data-mode="analysis"],
    [data-mode="editor"]
  ) .board-workspace-panel > .move-controls .seek-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    justify-self: stretch;
  }
}

@media (orientation: portrait) and (max-width: 380px) {
  body.workspace-mobile-minimal:is(
    [data-mode="study"],
    [data-mode="analysis"],
    [data-mode="editor"]
  ) .board-workspace-panel > .move-controls {
    grid-template-columns: 44px 44px minmax(76px, 1fr) 44px 44px !important;
    gap-inline: 2px !important;
  }

  body.workspace-mobile-minimal:is(
    [data-mode="study"],
    [data-mode="analysis"],
    [data-mode="editor"]
  ) .board-workspace-panel > .move-controls :is(
    #firstMoveBtn,
    #prevMoveBtn,
    #nextMoveBtn,
    #lastMoveBtn
  ) {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
  }
}

/* Landscape two-column control rail: reset stale inverse zoom and keep every group inside the rail. */
@media (orientation: landscape) and (min-width: 760px) and (max-width: 1439px),
       (orientation: landscape) and (min-width: 1440px) and (max-height: 719px) {
  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-landscape-left-scroll > .side-panel {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-landscape-left-scroll > .side-panel[data-board-focus-ready="true"] > :not([hidden]) {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    zoom: 1 !important;
    box-sizing: border-box;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-landscape-left-scroll :is(
    .study-desktop-left-stack,
    .editor-desktop-left-stack,
    .analysis-desktop-left-stack,
    .study-desktop-right-stack,
    .editor-desktop-right-stack,
    .analysis-desktop-right-stack
  ) {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    zoom: 1 !important;
    box-sizing: border-box;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-landscape-left-scroll :is(
    .study-desktop-left-stack,
    .editor-desktop-left-stack,
    .analysis-desktop-left-stack,
    .study-desktop-right-stack,
    .editor-desktop-right-stack,
    .analysis-desktop-right-stack
  ) > * {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-landscape-left-scroll :is(
    .study-start-actions,
    .study-edit-actions,
    .study-save-actions,
    .analysis-file-actions,
    .editor-start-actions,
    .editor-left-file-actions,
    .move-controls
  ) {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  body:is(
    .study-desktop-redesign[data-mode="study"],
    .editor-desktop-redesign[data-mode="editor"],
    .analysis-desktop-redesign[data-mode="analysis"]
  ) .workspace-landscape-left-scroll :is(
    .study-start-actions,
    .study-edit-actions,
    .study-save-actions,
    .analysis-file-actions,
    .editor-start-actions,
    .editor-left-file-actions,
    .move-controls
  ) > * {
    min-width: 0 !important;
    max-width: 100% !important;
  }
}

/* AI game responsive setup: keep configuration in normal page flow. */
@media (orientation: landscape) and (max-width: 1439px) {
  body.ai-game-page:not(.ai-teaching-game-page):has(.ai-game-shell[data-phase="setup"]) {
    height: auto !important;
    min-height: 100dvh !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell[data-phase="setup"] {
    display: block !important;
    width: min(720px, calc(100% - 20px)) !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 10px auto 32px !important;
    overflow: visible !important;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell[data-phase="setup"] .ai-game-left-panel {
    position: static !important;
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-height: none !important;
    padding: 0 !important;
    overflow: visible !important;
    inset: auto !important;
  }

  .ai-game-page:not(.ai-teaching-game-page) .ai-game-shell[data-phase="setup"] :is(
    .ai-game-board-area,
    .ai-game-right-panel
  ) {
    display: none !important;
  }
}

/* Site appearance v20260907. UI surfaces only; board/stone/image assets keep their colors. */
.site-header.site-header .site-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid #dbc9c3;
  border-radius: 12px;
  background: #fffaf7;
  color: #694a42;
  font: inherit;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}
.site-theme-toggle > span:first-child { font-size: 20px; line-height: 1; }
.site-theme-toggle:focus-visible { outline: 3px solid #b14f71; outline-offset: 3px; }
#mpSiteTheme { min-height: 44px; padding: 8px 12px; border: 1px solid #b4c4bb; border-radius: 8px; font: inherit; }
@media (max-width: 700px), (orientation: portrait) and (max-width: 1439px) {
  .site-header.site-header .site-theme-toggle { width: 100%; min-height: 44px; justify-content: flex-start; }
}

html[data-site-theme="dark"] {
  color-scheme: dark;
  --site-dark-bg: #13181f;
  --site-dark-panel: #1c242e;
  --site-dark-raised: #25313e;
  --site-dark-text: #edf0f5;
  --site-dark-muted: #b5c0ce;
  --site-dark-line: #415064;
  --site-dark-accent: #f4acc1;
  --site-dark-accent-bg: #492c3c;
  --site-dark-green: #9cdebe;
  --bg: var(--site-dark-bg);
  --panel: var(--site-dark-panel);
  --soft-panel: var(--site-dark-raised);
  --soft-line: var(--site-dark-line);
  --ink: var(--site-dark-text);
  --muted: var(--site-dark-muted);
  --accent: #8bc4ff;
  --accent-dark: #afdaff;
  --danger: #ffadb1;
  --brand-green: var(--site-dark-green);
  --landing-title: var(--site-dark-text);
  --landing-copy: var(--site-dark-muted);
  background: var(--site-dark-bg);
}
html[data-site-theme="dark"] body {
  --salon-ink: var(--site-dark-text);
  --salon-red: var(--site-dark-accent);
  --salon-red-soft: var(--site-dark-accent-bg);
  --salon-green: var(--site-dark-green);
  --salon-line: var(--site-dark-line);
  --salon-paper: var(--site-dark-panel);
  --online-game-ink: var(--site-dark-text);
  --online-game-muted: var(--site-dark-muted);
  color: var(--site-dark-text) !important;
  background: var(--site-dark-bg) !important;
}
html[data-site-theme="dark"] body::before,
html[data-site-theme="dark"] body::after { opacity: .05 !important; }

/* Layered important declarations override legacy page-specific important colors,
   without specificity hacks or changing those pages in light mode. */
@layer site-theme {
/* Shared chrome, forms, dialogs, navigation, and the logged-out landing. */
html[data-site-theme="dark"] body :is(
  .site-header.site-header, .site-header-inner, .qa-topnav-right,
  .qa-topnav-nav, .site-header-game-dropdown, .qa-account-menu-panel,
  .qa-account-menu-summary, .qa-account-menu-footer, .site-footer,
  .site-boot-screen, .site-boot-card, .auth-overlay, .auth-card, .auth-form-card,
  .auth-question-card, .auth-best-answer, .auth-feature-band,
  .register-card, .register-panel, .legal-card, .legal-shell,
  .auth-dialog, .auth-login-intro, .auth-login-main, .auth-input-shell, .auth-register-card,
  .auth-login-divider span, .register-dialog, .legal-document,
  .legal-document-header, .guest-home, .guest-hero, .guest-benefits,
  .guest-feature, .guest-feature-copy, .guest-closing, .guest-footer,
  .guest-qa-bubble, .guest-benefits article,
  dialog, .modal-card, .dialog-panel, .site-guest-login-panel
) {
  color: var(--site-dark-text) !important;
  background: var(--site-dark-panel) !important;
  border-color: var(--site-dark-line) !important;
  box-shadow: 0 8px 28px #0003;
}
html[data-site-theme="dark"] body :is(.qa-account-menu-button, .site-theme-toggle, .site-header-menu-button, .site-header-points) {
  color: var(--site-dark-text) !important;
  background: var(--site-dark-raised) !important;
  border-color: var(--site-dark-line) !important;
}
html[data-site-theme="dark"] body :is(.qa-topnav-nav a, .site-header-game-trigger, .qa-account-menu-panel a, .qa-bell, .qa-user-name, #qaUserLabel, #mpNavUser, #accountMenuUser) {
  color: var(--site-dark-text) !important;
}
html[data-site-theme="dark"] body .site-header-menu-button span { background: var(--site-dark-text) !important; }
html[data-site-theme="dark"] .qa-topnav-nav-icon { color: inherit !important; }
/* The dark wordmark has its own light lettering; keep the original emblem colors. */
html[data-site-theme="dark"] .qa-brand-wordmark { background: transparent; border-radius: 0; }
html[data-site-theme="dark"] dialog::backdrop { background: #05090dc7; }
html[data-site-theme="dark"] body :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), select, textarea) {
  color: var(--site-dark-text) !important;
  background: var(--site-dark-bg) !important;
  border-color: var(--site-dark-line) !important;
  color-scheme: dark;
}
html[data-site-theme="dark"] :is(input, textarea)::placeholder { color: #a6b3c2 !important; opacity: 1; }
html[data-site-theme="dark"] :is(input, select, textarea, button, a):focus-visible { outline-color: #b0d4ff !important; }
html[data-site-theme="dark"] :is(input[type="checkbox"], input[type="radio"], input[type="range"]) { accent-color: #d888a4; }

/* Surface selectors are explicit: do not recolor a goban, stone, avatar, scene, or canvas. */
html[data-site-theme="dark"] body :is(
  .panel, .side-panel, .board-panel, .nav-panel, .control-panel,
  .analysis-workspace-nav, .editor-workspace-nav, .nav-head,
  .board-header, .board-workspace-panel, .capture-table, .move-controls, .move-number-jump,
  .message, .study-panel, .study-desktop-hero, .study-desktop-hero-balloon,
  .board-stage, .study-desktop-character-tip p, .editor-desktop-character-tip p,
  .analysis-desktop-character-tip p, .analysis-current-kifu,
  .analysis-desktop-analysis-card, .analysis-desktop-analysis-card > header,
  .kap-target-card, .analysis-desktop-right-stack, .editor-desktop-right-stack,
  .editor-desktop-details, .editor-desktop-comment-card,
  .study-desktop-character-tip, .study-settings-details, .study-candidate-limit-row,
  .study-auto-row, .winrate-bar-panel, .workspace-right-tab-panel,
  .game-tree-panel, .game-tree, .analysis-qa-section,
  .analysis-desktop-hero, .analysis-desktop-hero-balloon, .analysis-desktop-character-tip,
  .editor-desktop-hero, .editor-desktop-hero-balloon, .editor-desktop-character-tip,
  .analysis-result-panel, .analysis-settings, .analysis-summary, .editor-settings,
  .ai-game-panel, .ai-game-board-area, .ai-game-board-header,
  .ai-game-desktop-scoreboard, .ai-game-desktop-turn-summary > strong,
  .ai-game-board-notice, .ai-game-board-toolbar, .ai-game-board-frame,
  .ai-game-character-presence, .ai-game-character-prompt, .ai-game-voice-control,
  .ai-game-trend-summary, .ai-game-trend-lead, .ai-game-trend-graph-wrap,
  .ai-game-custom-settings, .ai-game-custom-settings-body, .ai-game-mode-card,
  .ai-game-player-card, .ai-game-status, .ai-game-setup-panel,
  .portal-hero, .portal-side-card, .portal-character-card, .portal-character-detail,
  .portal-action-card, .portal-character-toolbar, .portal-character-filters,
  .portal-page-heading, .portal-character-search, .portal-character-recommendation,
  .portal-hero-copy, .portal-section, .portal-card, .portal-side-promo,
  .portal-hero-secondary a, .portal-guest-login,
  .qa-main, .qa-main-panel, .qa-card, .qa-question-card, .qa-question-row,
  .qa-categories-section, .qa-home-section, .qa-home-status-tabs, .qa-sidebar-box,
  .qa-answer-card-summary, .qa-answer-card-count, .qa-open-card, .qa-entry-search,
  .qa-entry-action, .qa-sidebar-answer-btn, .qa-ticket-balance,
  .qa-entry-panel, .qa-entry-tools, .qa-sidebar-card, .qa-answer-card,
  .qa-detail-card, .qa-post-card, .qa-compose-card, .qa-filter-panel,
  .qa-detail-body, .qa-answer-form, .qa-thread-card, .qa-empty,
  .qd-card, .qd-ai-explanation, .qk-panel, .qk-card, .qk-comment-box,
  .qk-form-panel, .qk-board-panel, .qk-board-optional-note, .qk-step-bar,
  .qk-board-status-badge, .qk-step-actions, .qk-cont-input-row, .qk-cont-tree,
  .qa-question-detail, .qa-question-main, .qa-best-answer, .qa-ai-explanation,
  .qd-question-card, .qd-question-header, .qd-ai-summary, .qd-question-board-col,
  .qd-sidebar-box, .qd-answer-card, .qd-answer-header, .qd-best-answer,
  .qa-question-page-back,
  .mp-sidebar, .mp-sidebar-profile, .mp-profile-card, .mp-profile-detail-card,
  .mp-nav, .mp-stat-item, .mp-side-ticket-card, .mp-settings-section-heading,
  .mp-preference-message,
  .mp-settings-section, .mp-dashboard-hero, .mp-dashboard-metric,
  .mp-empty-state, .mp-card, .mp-notification, .mp-board-theme-card,
  .mp-preference-fieldset, .mp-profile-progress, .mp-sidebar-stats,
  .mp-ticket-card, .mp-points-card, .mp-shop-item, .mp-mission-card,
  .billing-plan, .billing-details, .billing-comparison-scroll,
  .billing-account, .billing-account-card,
  .go-salon-directory-nav, .go-salon-directory-hero,
  .go-salon-card, .go-salon-card-body, .go-salon-card-footer,
  .go-salon-directory-search, .go-salon-directory-filters,
  .go-salon-directory-tools, .go-salon-filters, .go-salon-profile-link,
  .go-salon-upcoming, .go-salon-upcoming-card, .go-salon-owner-offer,
  .go-salon-create-entry, .go-salon-organizer-tools, .go-salon-room-sidebar,
  .go-salon-room, .go-salon-room-header, .go-salon-room-head, .go-salon-room-nav,
  .go-salon-microphone-picker, .go-salon-voice-diagnostics > summary,
  .go-salon-voice-diagnostics-panel,
  .go-salon-dialog-panel, .go-salon-dialog form,
  .go-salon-member-card, .go-salon-participating, .go-salon-table-settings,
  .salon-create-card, .salon-create-section, .salon-create-preview,
  .salon-create-hero, .salon-create-lock, .salon-create-existing-card,
  .salon-profile-card, .salon-profile-section, .salon-profile-hero,
  .online-game-card, .online-game-panel, .online-game-player,
  .online-game-status-card, .rental-room-panel, .rental-room-card,
  .online-game-hero, .online-game-rental-link, .online-game-matchmaking-summary,
  .online-game-rating-summary, .online-game-option-group, .online-game-room,
  .online-game-game-card, .go-salon-dialog-body, .go-salon-dialog-card,
  .go-learning-heading, .go-learning-board-panel, .go-learning-dialogue,
  .go-learning-turn, .go-learning-board-status, .go-learning-log-panel,
  .go-learning-feedback, .go-learning-character-name,
  .go-learning-speech, .go-learning-controls, .go-learning-lesson-picker,
  .sm-intro, .sm-guide, .sm-test, .sm-result, .sm-history,
  .sm-guide article, .sm-section-heading > span, .sm-heading-mark,
  .sm-art-note, .sm-panel, .sm-facts > div,
  .site-users-panel, .site-users-summary > article,
  .admin-panel, .admin-card
) {
  color: var(--site-dark-text) !important;
  background: var(--site-dark-panel) !important;
  border-color: var(--site-dark-line) !important;
  box-shadow: 0 5px 20px #0002;
}

/* Typography: board labels and diagram contents are deliberately excluded. */
html[data-site-theme="dark"] body :is(h1, h2, h3, h4, h5, p, label, legend, dt, dd, summary, th, td, strong, b,
  .mp-stat-num, .mp-nav-item, .mp-side-ticket-label, .board-turn-status span,
  .ai-game-desktop-turn-summary span, .diagram-label-letter, .editor-info-summary,
  .qk-section-label, .qk-label, .qk-next-turn-label,
  .qd-question-body, .qd-answer-body, .qd-related-title, .qd-ai-label,
  .qd-board-col-label, .qd-q-board-nav-label, .qd-ai-reference-title,
  .qa-cat-label, .board-turn-status, .ai-game-desktop-turn-summary, .bar-score-main,
  .qa-summary-label, .qa-open-card-action, .qa-topnav-nav-icon,
  .ai-game-trend-mobile-title, .ai-game-kifu-mobile-title,
  .winrate-stone-label, .winrate-stone-label span:not(.winrate-stone)
):not(:where(.goban *, .qa-board *, .qk-board *, .go-learning-board *, .sm-board *, .go-salon-room-scene *, .tree-node *, .ai-game-kifu-tree-node *)) {
  color: var(--site-dark-text) !important;
}
html[data-site-theme="dark"] body :is(
  small, .muted, .help-text, .qa-meta, .qa-question-meta,
  .billing-plan-description, .billing-price-note, .billing-comparison-intro,
  .billing-comparison-hint, .billing-comparison-notes, .billing-comparison-no,
  .mp-settings-section-lead, .mp-settings-note, .mp-settings-label,
  .go-salon-card-description, .go-salon-card-meta, .go-salon-live-summary,
  .go-salon-card-stats, .go-salon-kicker, .portal-eyebrow,
  .billing-eyebrow, .billing-breadcrumb, .qa-cat-help,
  .study-settings-autosave-copy, .portal-detail-label, .ai-game-trend-rate,
  .portal-character-card em, .mp-stat-lbl, .mp-settings-eyebrow,
  .mp-side-ticket-card > span, .mp-side-ticket-card > small,
  .qk-tool-sublabel, .qk-cont-count, .qm-char-count, .qk-vis-card-text > span,
  .qd-content-label, .qd-meta-item, .qd-ai-explanation-kicker,
  .qd-sidebar-box-head, .qd-asker-rank
):not(:where(.goban *, .go-learning-board *, .qa-board *, .qk-board *)) { color: var(--site-dark-muted) !important; }
html[data-site-theme="dark"] body a { color: var(--site-dark-green); }
html[data-site-theme="dark"] body :is(.billing-comparison-yes, .mp-dashboard-metric > strong) { color: var(--site-dark-green) !important; }
html[data-site-theme="dark"] body :is(.billing-page, .mp-dashboard, .qa-main, .salon-profile-page) a { color: var(--site-dark-green) !important; }
html[data-site-theme="dark"] body :is(.site-footer a, .guest-footer a, .salon-create-back, .qa-open-card-action, .qd-asker-link, .qd-sidebar-more, .qk-step-badge.active) { color: var(--site-dark-green) !important; }
/* Coordinate margins are part of these diagrams, not the surrounding UI panel. */
html[data-site-theme="dark"] :is(.qd-q-board-slot, .qd-ai-reference-board) { background: #f5f2e8; border-radius: 8px; }
html[data-site-theme="dark"] :is(.ai-game-trend-graph, .analysis-score-graph) text { fill: var(--site-dark-muted) !important; }
/* Tree stones remain black/white, including readable move numbers. */
html[data-site-theme="dark"] :is(.tree-node, .ai-game-kifu-tree-node).white-node { color: #3b302c !important; }
html[data-site-theme="dark"] :is(.tree-node, .ai-game-kifu-tree-node).black-node { color: #fff !important; }
html[data-site-theme="dark"] .board-tree-current-label { color: #fff !important; background: #994156 !important; }
html[data-site-theme="dark"] .mp-nav-count { color: var(--site-dark-text) !important; background: var(--site-dark-raised) !important; }
html[data-site-theme="dark"] body :is(th, td, fieldset, hr, .billing-plan li) { border-color: var(--site-dark-line) !important; }
html[data-site-theme="dark"] body :is(th, td, .billing-comparison-table [scope="row"], .billing-comparison-table thead th:first-child) {
  background: var(--site-dark-panel) !important;
  color: var(--site-dark-text) !important;
}
html[data-site-theme="dark"] body :is(thead th, .billing-comparison-group th, .billing-comparison-table thead th:first-child) { background: var(--site-dark-raised) !important; }
html[data-site-theme="dark"] body .billing-comparison-table [data-comparison-plan="owner"] { background: #342635 !important; }
html[data-site-theme="dark"] body .billing-comparison-table [scope="row"] { box-shadow: 1px 0 0 var(--site-dark-line); }

/* Buttons retain distinct primary, selected, hover, disabled and destructive states. */
html[data-site-theme="dark"] body :is(
  button, .billing-action, .mp-dashboard-action, .mp-btn-primary, .mp-btn-secondary,
  .ai-game-secondary, .go-salon-card-footer a, .go-salon-create-entry a,
  .qa-topnav-ask-btn, .rental-room-back, .portal-primary-button,
  .portal-character-actions a, .salon-create-primary, .salon-create-secondary,
  .auth-provider-login, .sm-history-link
):not(:where(.goban *, .qa-board *, .qk-board *, .go-learning-board *, .sm-board *,
  .go-salon-room-scene *, .tree-node, .ai-game-kifu-tree-node,
  [class*="stone"], [class*="intersection"], [class*="point"], [class*="candidate"])) {
  color: var(--site-dark-text) !important;
  background-color: var(--site-dark-raised) !important;
  background-image: none !important;
  border-color: var(--site-dark-line) !important;
  text-shadow: none;
}
html[data-site-theme="dark"] body :is(
  .qa-topnav-nav a.active, .site-header-game-trigger.active,
  button.active, button.is-active, button.selected, button.primary,
  button[type="submit"], [role="tab"][aria-selected="true"],
  .go-salon-directory-nav button.active, .go-salon-directory-filters button.active,
  button[aria-pressed="true"], .mp-sidebar-nav .active, .mp-nav-item.active,
  .mp-btn-primary, .mp-dashboard-action--primary, .ai-game-primary,
  .go-salon-dialog-primary, .sm-primary, .go-learning-primary,
  .qa-submit-button, .auth-submit, .qa-topnav-ask-btn
):not(:where(.goban *, .go-learning-board *, .qa-board *, .qk-board *, .sm-board *, .go-salon-room-scene *, .tree-node, .ai-game-kifu-tree-node)) {
  color: #ffe5ed !important;
  background: var(--site-dark-accent-bg) !important;
  border-color: #c97f9a !important;
}
html[data-site-theme="dark"] body :is(button, .billing-action, .mp-dashboard-action):hover:not(:disabled):not(:where(.goban *, .go-learning-board *, .qa-board *, .qk-board *, .sm-board *, .go-salon-room-scene *, .tree-node, .ai-game-kifu-tree-node, [class*="stone"], [class*="point"], [class*="candidate"])) {
  color: #fff !important;
  background-color: #35465b !important;
  border-color: #93abc8 !important;
}
html[data-site-theme="dark"] body :is(button, .billing-action):disabled:not(:where(.goban *, .go-learning-board *, .qa-board *, .qk-board *, .sm-board *, .go-salon-room-scene *, .tree-node, .ai-game-kifu-tree-node, [class*="stone"], [class*="point"], [class*="candidate"])) { color: #aab5c4 !important; background: #252c36 !important; border-color: #404a58 !important; opacity: .65; }
html[data-site-theme="dark"] body :is(.error, .danger, .mp-settings-msg--err, .billing-error, .go-salon-flash[data-error="true"]) { color: #ffb4bd !important; }
html[data-site-theme="dark"] body :is(.billing-connection, .billing-connection-notice, .billing-notice, .go-salon-status-warning, .qa-warning, .mp-device-save-badge) {
  color: #f3dca6 !important;
  background: #3b3222 !important;
  border-color: #8e784d !important;
}
html[data-site-theme="dark"] body :is(.go-salon-card-open, .billing-current-badge, .sm-pill) {
  color: var(--site-dark-green) !important;
  background: #223c32 !important;
}
}
@media (prefers-reduced-motion: reduce) {
  .site-theme-toggle { transition: none; }
}

/* 二段階認証：認証操作を主役にし、補足・管理を折りたたむ。 */
body.security-page {
  --security-bg: #faf7f5; --security-surface: #fff; --security-soft: #fbf7f5;
  --security-ink: #49372f; --security-muted: #79675d; --security-border: #e7ddd6;
  --security-accent: #b13c5a; --security-accent-hover: #942e48; --security-tint: #fbedf0;
  --security-success: #28704e; --security-success-bg: #edf6ef;
  --security-error: #a1263d; --security-error-bg: #fff0f2;
  background: var(--security-bg); color: var(--security-ink);
}
.security-main { width: min(calc(100% - 3rem), 61rem); margin: 2.5rem auto 5rem; overflow-wrap: anywhere; font-size: 1rem; line-height: 1.8; }
.security-main [hidden] { display: none !important; }
.security-main :is(h1, h2, h3, p) { margin-top: 0; }
.security-main :is(h2, h3) { font-family: var(--body-font); color: var(--security-ink); }
.security-main h1 { margin: 0; font-size: clamp(1.4rem, 3.4vw, 1.85rem); font-weight: 600; line-height: 1.5; }
.security-main h2 { margin-bottom: .85rem; font-size: 1.35rem; line-height: 1.6; }
.security-main h3 { margin: 1.75rem 0 .75rem; font-size: 1rem; }
.security-main a { color: var(--security-accent); text-underline-offset: .2em; }
.security-back { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: .5rem; font-size: .875rem; text-decoration: none; }
.security-heading-row { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.75rem; }
.security-icon { display: grid; place-items: center; flex: 0 0 3.25rem; height: 3.25rem; border-radius: 1rem; background: var(--security-tint); color: var(--security-accent); }
.security-icon svg { width: 1.7rem; height: 1.7rem; }
.security-main .security-eyebrow { margin: 0 0 .35rem; color: var(--security-muted); font-size: .8125rem; font-weight: 600; letter-spacing: .07em; }
.security-layout { display: grid; grid-template-columns: minmax(0, 1fr) 16rem; gap: 2rem; align-items: start; }
.security-workspace { min-width: 0; }
.security-message { padding: .85rem 1rem; border: 1px solid var(--security-border); border-left: 3px solid var(--security-accent); border-radius: .6rem; background: var(--security-surface); color: var(--security-muted); font-size: .875rem; line-height: 1.8; }
.security-main #securityMessage[data-error="true"] { border-color: var(--security-error); background: var(--security-error-bg); color: var(--security-error); }
.security-card { padding: 2rem; background: var(--security-surface); border: 1px solid var(--security-border); border-radius: 1.25rem; box-shadow: 0 8px 32px rgba(64, 37, 28, .045); }
.security-card > p { color: var(--security-muted); }
.security-card > :first-child { margin-top: 0; }
.security-card > :last-child { margin-bottom: 0; }
.security-card label:not(.security-check) { display: grid; gap: .5rem; margin: 1.1rem 0 .5rem; font-size: .875rem; font-weight: 600; }
.security-card input:not([type="checkbox"]) { width: 100%; min-width: 0; min-height: 48px; box-sizing: border-box; padding: .8rem 1rem; font: inherit; font-size: 1rem; color: var(--security-ink); background: var(--security-surface); border: 1px solid #b6a69c; border-radius: .65rem; }
.security-card input::placeholder { color: var(--security-muted); opacity: 1; font-family: var(--body-font); font-size: 1rem; letter-spacing: .04em; }
.security-card input.security-code-input { min-height: 62px; font-family: ui-monospace, Consolas, monospace; font-size: 1.5rem; letter-spacing: .13em; }
.security-card input[readonly] { background: var(--security-soft); font-family: ui-monospace, Consolas, monospace; font-size: .875rem; }
.security-card button, .security-main .security-continue { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; margin: .4rem 0; padding: .8rem 1rem; min-height: 48px; max-width: 100%; border: 1px solid var(--security-border); border-radius: .65rem; background: var(--security-surface); color: var(--security-ink); cursor: pointer; font: inherit; font-size: .9375rem; font-weight: 600; line-height: 1.5; text-decoration: none; text-align: center; }
.security-card button:hover:not(:disabled) { background: var(--security-soft); border-color: var(--security-muted); }
.security-card .security-primary, .security-main .security-continue { width: 100%; margin-top: 1.25rem; background: var(--security-accent); border-color: var(--security-accent); color: #fff; }
.security-card .security-primary:hover:not(:disabled), .security-main .security-continue:hover { background: var(--security-accent-hover); border-color: var(--security-accent-hover); color: #fff; }
.security-card button:disabled { opacity: .45; cursor: not-allowed; }
.security-card[aria-busy="true"] button { cursor: wait; }
.security-main :is(a, button, input, summary):focus-visible { outline: 3px solid var(--security-accent); outline-offset: 3px; }
.security-main .security-help { color: var(--security-muted); font-size: .875rem; line-height: 1.8; }
.security-check { display: flex; align-items: flex-start; gap: .65rem; margin: 1rem 0; min-height: 44px; font-size: .875rem; cursor: pointer; }
.security-check input { width: 18px; height: 18px; flex: 0 0 auto; margin: .25rem 0 0; accent-color: var(--security-accent); }
.security-check span { min-width: 0; }
.security-check small { display: block; margin-top: .3rem; font-size: .8125rem; color: var(--security-muted); font-weight: 400; line-height: 1.8; }
.security-trust { padding: .85rem 1rem; margin-top: 1.4rem; background: var(--security-soft); border: 1px solid var(--security-border); border-radius: .75rem; }
.security-trust .security-check { margin: 0; }
.security-main summary { min-height: 44px; padding: .65rem 0; font-size: .875rem; font-weight: 600; cursor: pointer; color: var(--security-ink); }
.security-trust summary { color: var(--security-muted); font-size: .8125rem; }
.security-qr-frame { width: fit-content; max-width: 100%; padding: .75rem; margin: 1.25rem auto; border: 1px solid var(--security-border); border-radius: .85rem; background: #fff; }
.security-qr { display: block; width: min(100%, 13rem); height: auto; margin: auto; }
.security-manual-key { margin-bottom: 1rem; border-bottom: 1px solid var(--security-border); }
.security-codes { margin: 1.25rem 0; padding: 1.25rem; background: var(--security-soft); color: var(--security-ink); border: 1px dashed var(--security-border); border-radius: .75rem; font: .9375rem/2 ui-monospace, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; text-align: center; }
.security-steps { list-style: none; padding: 0; margin: 1.5rem 0; counter-reset: security-step; }
.security-steps li { position: relative; padding: 0 0 1.4rem 2.9rem; counter-increment: security-step; }
.security-steps li:last-child { padding-bottom: 0; }
.security-steps li::before { content: counter(security-step); position: absolute; left: 0; top: .1rem; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--security-tint); color: var(--security-accent); font-size: .875rem; font-weight: 700; }
.security-steps strong, .security-steps span { display: block; }
.security-steps strong { font-size: .9375rem; }
.security-steps span { margin-top: .25rem; font-size: .875rem; color: var(--security-muted); }
.security-badge { display: inline-flex; align-items: center; gap: .45rem; padding: .3rem .7rem; margin-bottom: .85rem; border-radius: 2rem; background: var(--security-success-bg); color: var(--security-success); font-size: .8125rem; font-weight: 600; }
.security-badge::before { content: '✓'; }
.security-recovery-count { padding-bottom: 1.25rem; border-bottom: 1px solid var(--security-border); font-size: .875rem; }
.security-devices { padding: 0; margin: 0 0 1.25rem; list-style: none; }
.security-devices li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; padding: .75rem; background: var(--security-soft); border-radius: .65rem; font-size: .875rem; }
.security-devices li span { min-width: 0; }
.security-devices button { flex: 0 0 auto; min-height: 44px; margin: 0; padding: .5rem .85rem; font-size: .875rem; }
.security-management { border-top: 1px solid var(--security-border); padding-top: .25rem; }
.security-actions { display: grid; gap: .5rem; padding-bottom: .5rem; }
.security-actions button { margin: 0; text-align: left; justify-content: flex-start; font-size: .875rem; }
.security-main .security-logout { display: block; margin: .65rem auto 0; padding: .6rem; min-height: 44px; border: 0; background: transparent; color: var(--security-muted); font: inherit; font-size: .8125rem; text-decoration: underline; text-underline-offset: .25em; cursor: pointer; }
.security-guide { margin-top: .25rem; padding-left: 1.5rem; border-left: 1px solid var(--security-border); }
.security-guide h2 { font-size: .9375rem; line-height: 1.8; }
.security-guide p { color: var(--security-muted); font-size: .875rem; line-height: 1.9; }
.security-guide details { border-top: 1px solid var(--security-border); }
.security-guide details p { padding: 0 0 .5rem; }
html[data-site-theme="dark"] body.security-page {
  --security-bg: #191c22; --security-surface: #232830; --security-soft: #1c2129;
  --security-ink: #f1e9e3; --security-muted: #bdb0a7; --security-border: #45444a;
  --security-accent: #eaa2b4; --security-accent-hover: #f4bdca; --security-tint: #412c38;
  --security-success: #9dd7b2; --security-success-bg: #20392b;
  --security-error: #ffb4bd; --security-error-bg: #40242c;
}
/* Keep the page's status hierarchy over the site's broad dark-theme rules. */
html[data-site-theme="dark"] body.security-page .security-main :is(.security-help, .security-eyebrow, .security-message, .security-guide p) { color: var(--security-muted) !important; }
html[data-site-theme="dark"] body.security-page #securityMessage[data-error="true"] { color: var(--security-error) !important; }
html[data-site-theme="dark"] body.security-page .security-card .security-primary,
html[data-site-theme="dark"] body.security-page .security-continue { background: #b13c5a !important; color: #fff !important; border-color: #d58499 !important; }
html[data-site-theme="dark"] body.security-page .security-card .security-primary:hover:not(:disabled),
html[data-site-theme="dark"] body.security-page .security-continue:hover { background: #942e48 !important; color: #fff !important; }
@media (max-width: 760px) {
  .security-main { width: min(calc(100% - 2rem), 36rem); margin-top: 1.5rem; }
  .security-layout { grid-template-columns: minmax(0, 1fr); gap: 1.75rem; }
  .security-guide { margin: 0; padding: 0 .25rem; border-left: 0; }
}
@media (max-width: 420px) {
  .security-main { width: calc(100% - 1.5rem); }
  .security-heading-row { gap: .75rem; margin-bottom: 1.25rem; }
  .security-icon { flex-basis: 2.75rem; height: 2.75rem; border-radius: .8rem; }
  .security-card { padding: 1.25rem; border-radius: 1rem; }
  .security-card h2 { font-size: 1.2rem; }
  .security-trust { padding: .75rem; }
}
.admin-monitoring .admin-health-cards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.admin-monitoring .admin-health-card { min-width: 0; overflow-wrap: anywhere; }
.admin-monitoring [data-monitor-state="critical"], .admin-monitoring [data-monitor-state="warning"], .admin-monitoring [data-monitor-state="unknown"] { border-inline-start: .3rem solid #b74e35; }
.admin-monitoring [data-state="error"] { color: #a92336; font-weight: 700; }
.admin-monitoring-help { font-size: .85rem; line-height: 1.7; }
html[data-site-theme="dark"] .admin-monitoring [data-state="error"] { color: #ffb4bd; }

/* The tool workspace has its own header; the salon keeps a single tools entry. */
.site-tools-nav { --tools-bg: #fffdfa; --tools-text: #523e35; --tools-line: #e9dfd8; --tools-hover: #f7eeea; color: var(--tools-text); font-family: "Noto Sans JP", sans-serif; }
.site-tools-nav details { min-width: 0; }
.site-tools-nav summary { display: flex; align-items: center; gap: .5rem; min-height: 44px; padding: .55rem .75rem; box-sizing: border-box; list-style: none; border: 1px solid var(--tools-line); border-radius: .65rem; background: var(--tools-bg); font-size: .9rem; font-weight: 600; cursor: pointer; }
.site-tools-nav summary::-webkit-details-marker { display: none; }
.site-tools-nav summary::after { content: '⌄'; margin-left: auto; }
.site-tools-nav details[open] > summary::after { transform: rotate(180deg); }
.site-tools-nav summary small { font-size: .75rem; font-weight: 400; margin-left: .5rem; }
.site-tools-panel { padding: .75rem; background: var(--tools-bg); border: 1px solid var(--tools-line); border-radius: .75rem; }
.site-tools-nav .site-tools-group h3 { margin: .5rem 0 .3rem; padding: 0 .5rem; font: 600 .75rem/1.6 "Noto Sans JP", sans-serif; color: var(--tools-text); opacity: .75; }
.site-tools-nav .site-tools-group a { display: flex; align-items: center; min-height: 44px; box-sizing: border-box; padding: .55rem .5rem; border-radius: .45rem; color: var(--tools-text); font-size: .85rem; text-decoration: none; }
.site-tools-nav .site-tools-group a:hover, .site-tools-nav .site-tools-group a[aria-current="page"] { background: var(--tools-hover); }
.site-tools-nav summary:focus-visible, .site-tools-nav a:focus-visible { outline: 2px solid #ad5a70; outline-offset: 2px; }
.site-tools-nav--sidebar { margin-top: 1.25rem; border-top: 1px solid var(--tools-line); padding-top: 1rem; }
.site-tools-nav--sidebar summary { border-color: transparent; background: transparent; }
.site-tools-nav--sidebar .site-tools-panel { border: 0; padding: .25rem; background: transparent; }
.site-tools-nav--page { position: relative; z-index: 80; display:flex; align-items:center; flex-wrap:wrap; gap:8px 20px; width: min(100% - 2rem, 1480px); margin: .65rem auto; }
.site-tools-nav--page details { width: fit-content; max-width: 100%; }
.site-tools-entry { display:flex; align-items:center; justify-content:space-between; min-height:44px; padding:8px 12px; color:var(--tools-text); text-decoration:none; font-weight:600; }
.site-tools-entry:hover { background:var(--tools-hover); border-radius:8px; }
.site-tools-home, .site-tools-return { display:inline-flex; align-items:center; min-height:44px; color:var(--tools-text); font-size:14px; text-underline-offset:4px; }
.site-tools-home { font-weight:700; }
.site-tools-return { margin-left:auto; }
.site-tools-brand-label { color:#805865; font-size:14px; font-weight:600; white-space:nowrap; }
.site-header--tools .site-header-inner { grid-template-columns:auto 1fr auto; }
.tools-page { background:#faf9f8; color:#493d39; }
.tools-hub { width:min(100% - 40px, 1080px); margin:32px auto 64px; font-family:var(--body-font, sans-serif); }
.tools-hub-heading { margin-bottom:32px; }
.tools-hub-heading h1 { margin:0 0 8px; font-size:clamp(26px, 4vw, 34px); line-height:1.4; }
.tools-hub-heading p { margin:0; color:#756965; font-size:16px; }
.tools-hub > section { margin:28px 0; }
.tools-hub h2 { margin:0 0 14px; font-size:16px; font-weight:700; }
.tools-hub-grid { display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:16px; }
.tools-hub-grid--pair { grid-template-columns:repeat(2, minmax(0,1fr)); }
.tools-hub-card { display:flex; flex-direction:column; align-items:flex-start; padding:24px; border:1px solid #e7dedb; border-radius:14px; background:#fff; color:inherit; text-decoration:none; transition:border-color .15s, box-shadow .15s; }
.tools-hub-card:hover { border-color:#ad5a70; box-shadow:0 4px 16px #38271c0d; }
.tools-hub-symbol { display:inline-flex; padding:5px 9px; border-radius:6px; background:#f7edf0; color:#9e405d; font-size:12px; font-weight:700; }
.tools-hub h3 { margin:16px 0 8px; font-size:21px; }
.tools-hub-card p { margin:0 0 22px; font-size:16px; line-height:1.8; color:#72645e; }
.tools-hub-action { display:flex; justify-content:space-between; gap:12px; width:100%; margin-top:auto; color:#9e405d; font-size:14px; font-weight:600; }
.tools-hub-secondary { display:flex; flex-wrap:wrap; gap:12px 32px; padding:20px 0; border-top:1px solid #e7dedb; }
.tools-hub-secondary a { display:flex; gap:12px; flex-wrap:wrap; align-items:center; padding:8px 0; color:inherit; font-weight:600; font-size:16px; text-decoration:none; }
.tools-hub-secondary span { font-size:14px; font-weight:400; color:#72645e; }
.tools-hub-account { margin-top:20px; padding:22px; border-radius:12px; background:#f1eeec; font-size:14px; line-height:1.8; }
.tools-hub-account p { margin:6px 0 12px; }
.tools-hub-account a { display:inline-block; margin-right:24px; color:#8f3c56; text-underline-offset:3px; padding:4px 0; }
.tools-hub a:focus-visible { outline:2px solid #ad5a70; outline-offset:4px; }
.tools-auth-status:empty { display:none; }
.service-home-page #portalHome { display:block; width:min(100% - 32px, 1080px); margin:40px auto 64px; }
.service-home-intro { margin-bottom:28px; }
.service-home-intro h1 { font-size:28px; margin:0 0 12px; }
.service-home-intro p { font-size:16px; }
.service-home-choices { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:24px; }
.service-home-choices section { padding:32px; border:1px solid #e7dedb; border-radius:16px; background:#fff; }
.service-home-choices h2 { margin:0 0 12px; font-size:24px; }
.service-home-choices p { font-size:16px; line-height:1.9; margin:0 0 24px; }
.service-home-choices a, .service-home-choices small { display:block; width:fit-content; margin-top:16px; font-size:14px; }
html[data-site-theme="dark"] .service-home-choices section { background:#28313f; border-color:#465062; }
html[data-site-theme="dark"] .tools-page { background:#202733; color:#e5ebf4; }
html[data-site-theme="dark"] .tools-hub-card { background:#28313f; border-color:#465062; }
html[data-site-theme="dark"] .tools-hub :is(p, .tools-hub-secondary span) { color:#bac5d4; }
html[data-site-theme="dark"] .tools-hub-account { background:#28313f; }
html[data-site-theme="dark"] :is(.tools-hub-action, .tools-hub-account a, .site-tools-brand-label) { color:#f1aabf; }
@media(max-width:700px) {
  .service-home-choices { grid-template-columns:minmax(0,1fr); }
  .service-home-choices section { padding:24px; }
  .tools-hub { width:calc(100% - 28px); margin-top:24px; }
  .tools-hub-grid, .tools-hub-grid--pair { grid-template-columns:minmax(0,1fr); gap:12px; }
  .tools-hub-card { padding:20px; }
  .site-tools-nav--page { column-gap:12px; row-gap:0; }
  .site-tools-return { font-size:13px; }
  .site-header--tools .site-tools-brand-label { display:none; }
  .site-header--tools .site-header-inner { grid-template-columns:minmax(0,1fr) auto; }
}
.site-tools-nav--page .site-tools-panel { position: absolute; top: calc(100% + .35rem); left: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; width: min(600px, 100%); box-sizing: border-box; box-shadow: 0 10px 28px #38271c1a; max-height: 65dvh; overflow-y: auto; }
html[data-site-theme="dark"] .site-tools-nav { --tools-bg: #202733; --tools-text: #e5ebf4; --tools-line: #465062; --tools-hover: #303b4a; }
@media (max-width: 700px) {
  .site-tools-nav--page .site-tools-panel { grid-template-columns: minmax(0, 1fr); gap: .25rem; }
  .site-tools-nav--page summary small { max-width: 10rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
/* Purchase confirmation and disclosures share existing light/dark site variables. */
.billing-purchase-terms { margin: 12px 0; font-size: 12px; line-height: 1.7; }
.billing-purchase-terms p { margin: 6px 0; }
.billing-purchase-terms label { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; min-height: 44px; }
.billing-purchase-terms input { width: 18px; height: 18px; margin: 0; flex: 0 0 auto; }
.commerce-confirm { width: min(680px, calc(100vw - 28px)); max-height: 85dvh; box-sizing: border-box; overflow-y: auto; border-radius: 16px; padding: 24px; border: 1px solid #bbaaa0; background: #fffdf9; color: #3a302b; }
.commerce-confirm::backdrop { background: rgb(0 0 0 / .55); }
.commerce-page .legal-shell { max-width: 880px; }
.commerce-page .legal-document { padding: clamp(22px, 4vw, 42px); }
.commerce-page .legal-document h1 { font-size: clamp(20px, 3vw, 26px); line-height: 1.6; }
.commerce-page .commerce-lead, .commerce-page #commerceDisclosure { font-size: 14px; line-height: 1.85; }
.commerce-page #commerceDisclosure p { font-size: inherit; line-height: inherit; }
.commerce-guide-links, .legal-section-links { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 18px 0 24px; font-size: 13px; line-height: 1.8; }
.commerce-page .commerce-section, .commerce-confirm .commerce-section { margin: 24px 0 0; padding-top: 20px; border-top: 1px solid #e6ddd8; }
.commerce-page .commerce-section h2, .commerce-confirm .commerce-section h2 { padding: 0; border: 0; margin: 0 0 12px; font: 600 16px/1.6 var(--body-font); }
.commerce-status { font-size: 13px; line-height: 1.8; padding: 10px 12px; border-left: 3px solid #ab9276; background: #faf6ef; }
.commerce-facts, .legal-operator-info { margin: 16px 0; }
.commerce-facts > div, .legal-operator-info > div { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 8px 20px; padding: 12px 0; border-bottom: 1px solid #eee8e4; }
.commerce-confirm .commerce-facts dt, #commerceDisclosure .commerce-facts dt, .legal-operator-info dt { font-size: 13px; font-weight: 500; margin: 0; color: #72675f; }
.commerce-confirm .commerce-facts dd, #commerceDisclosure .commerce-facts dd, .legal-operator-info dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; line-height: 1.85; }
.commerce-page #commerceDisclosure .commerce-note, .commerce-confirm .commerce-note, .commerce-policy-notes { font-size: 13px; line-height: 1.85; color: #71665e; }
.commerce-page #commerceDisclosure .commerce-policy-notes { margin-top: 22px; padding-top: 14px; border-top: 1px solid #e6ddd8; font-size: 13px; }
.commerce-page .commerce-offer strong { font-weight: 600; }
.legal-document :is(section[id], h3[id]) { scroll-margin-top: 28px; }
.legal-document h3 { margin: 22px 0 10px; font: 600 16px/1.8 var(--body-font); }
.legal-operator-info { font-size: 14px; }
@media (max-width: 480px) {
  .commerce-facts > div, .legal-operator-info > div { grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 12px 0; }
  .commerce-confirm { padding: 20px; }
}
html[data-site-theme="dark"] :is(.commerce-section, .commerce-facts > div, .legal-operator-info > div, .commerce-policy-notes) { border-color: var(--site-dark-line); }
html[data-site-theme="dark"] .commerce-status { background: #302b24; border-color: #ae9872; }
.commerce-confirm label { display: block; margin: 22px 0; line-height: 1.8; }
.commerce-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.commerce-actions button { min-height: 44px; padding: 10px 16px; }
html[data-site-theme="dark"] .commerce-confirm { background: #242120; color: #f4efea; }
/* Site-wide salon participation bar; isolated from page-specific bottom controls. */
#siteSalonBar { position:fixed; z-index:110; bottom:calc(var(--mobile-bottom-nav-height, 0px) + env(safe-area-inset-bottom) + 12px); left:50%; transform:translateX(-50%); width:min(860px,calc(100% - 24px)); box-sizing:border-box; display:flex; align-items:center; gap:16px; padding:12px 16px; border:1px solid #eab4bf; border-radius:14px; background:#fff8f9; color:#5d302b; box-shadow:0 8px 30px #52202a26; }
#siteSalonBar[hidden] { display:none; }
#siteSalonBar > div { flex:1; min-width:0; overflow-wrap:anywhere; }
#siteSalonBar strong, #siteSalonBar [data-status] { display:block; }
#siteSalonBar [data-status] { font-size:12px; margin-top:4px; }
#siteSalonBar nav { display:flex; gap:8px; }
#siteSalonBar button, #siteSalonBar a { display:inline-flex; align-items:center; justify-content:center; min-height:44px; padding:8px 12px; box-sizing:border-box; border:1px solid #e0bbc2; border-radius:10px; color:inherit; background:transparent; font:inherit; font-size:13px; text-decoration:none; cursor:pointer; }
body.has-site-salon-bar { padding-bottom:calc(190px + var(--mobile-bottom-nav-height, 0px) + env(safe-area-inset-bottom)); }
[data-theme="dark"] #siteSalonBar { background:#292226; color:#f6e5e8; border-color:#69535c; }
@media(max-width:600px) { #siteSalonBar { flex-direction:column; align-items:stretch; gap:8px; } #siteSalonBar nav { display:grid; grid-template-columns:1fr 1fr auto; } }
/* Voice destination is independent from the visible room tab. */
.go-salon-voice-destination { display:flex; align-items:center; justify-content:center; text-align:center; gap:3px; min-width:0; min-height:44px; box-sizing:border-box; padding:5px 7px; border:1px solid #d5b8a4; border-radius:9px; font-size:12px; color:inherit; }
.go-salon-voice-destination select { min-width:0; max-width:140px; flex:0 1 auto; text-align:center; text-align-last:center; background:transparent; color:inherit; border:0; font:inherit; padding:5px 0; }
.go-salon-voice-destination select option { color:#382a22; background:#fffaf6; }
.go-salon-voice-destination select:disabled { appearance:none; -webkit-appearance:none; opacity:1; -webkit-text-fill-color:currentColor; cursor:default; background-image:none; }
.go-salon-quick-actions { flex-wrap:wrap; }
@media(max-width:980px) {
  .go-salon-page .go-salon-room > .go-salon-quick-actions { grid-template-columns:minmax(0,1fr) minmax(0,1fr) 65px; gap:5px; padding-inline:6px; }
  .go-salon-quick-actions .go-salon-voice-toggle { min-width:0; font-size:11px; }
  .go-salon-quick-actions .go-salon-voice-destination { font-size:11px; padding-inline:3px; }
  .go-salon-participating-actions, #siteSalonBar nav { grid-template-columns:1fr 1fr !important; flex-wrap:wrap; }
}

/* Compact common header and salon search. */
.site-header .site-header-inner { min-height:52px !important; padding-block:4px !important; gap:16px; }
.site-header .qa-brand-wordmark { max-height:40px; width:auto; }
.site-salon-search { position:relative; display:flex; align-items:center; flex:1 1 480px; max-width:520px; margin:auto; border:1px solid #cfc6c0; border-radius:24px; background:var(--surface, #fff); color:var(--text, #382a22); }
.site-salon-search input { width:100%; min-width:0; border:0; background:transparent; color:inherit; padding:8px 14px; font:inherit; }
.site-salon-search button, .site-search-open { background:transparent; color:inherit; border:0; cursor:pointer; min-width:40px; min-height:40px; }
.site-header .site-search-icon { display:block; width:26px !important; height:26px !important; margin:auto; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.go-salon-card .go-salon-card-caption { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; overflow-wrap:anywhere; white-space:normal; font-size:13px; line-height:1.6; margin:7px 0; min-height:3.2em; color:inherit; opacity:.8; }
.go-salon-card .go-salon-caption-edit { display:inline-block; font-size:12px; margin-bottom:7px; text-underline-offset:3px; }
.site-search-open, .site-search-back { display:none; }
.site-search-history { position:absolute; top:calc(100% + 8px); left:0; right:0; padding:14px; border:1px solid #cfc6c0; border-radius:14px; background:var(--surface, #fff); box-shadow:0 8px 24px #0002; }
.site-search-history[hidden] { display:none; }
.site-search-history div button { display:block; width:100%; text-align:left; overflow-wrap:anywhere; }
.has-header-salon-search .go-salon-directory-search { display:none; }
@media(max-width:760px), (orientation:portrait) and (max-width:1439px) {
  body.tools-page { --mobile-header-height:52px; padding-top:53px; }
  body.has-header-salon-search { --mobile-header-height:52px; }
  .site-header .site-header-inner { min-height:52px !important; gap:4px !important; padding:4px 8px !important; }
  .site-header .qa-topnav-logo { flex:0 1 auto !important; min-width:0 !important; }
  .site-search-open { display:block; flex:none; font-size:26px; }
  .site-salon-search { display:none; }
  .site-header.is-search-open .site-salon-search { display:flex; max-width:none; width:100%; }
  .site-header.is-search-open .site-search-back { display:block; }
  .site-header.is-search-open .qa-topnav-logo, .site-header.is-search-open .qa-topnav-right, .site-header.is-search-open .site-search-open { display:none !important; }
}

/* Photo-first salon directory: compact copy and optional actions. */
.go-salon-directory .go-salon-card { border:0 !important; background:transparent !important; box-shadow:none !important; overflow:visible; }
.go-salon-card .go-salon-card-body { padding:9px 0 0; row-gap:0; border:0 !important; background:transparent !important; }
.go-salon-card .go-salon-card-heading { position:relative; align-items:center; gap:0; margin:0; padding-right:76px; }
.go-salon-card .go-salon-card-heading h3 { flex:1; min-width:0; margin:0; font-size:13px; line-height:1.5; }
.go-salon-card .go-salon-card-caption { font-size:16px; font-weight:700; line-height:1.5; height:3em; min-height:3em; margin:3px 30px 4px 0; opacity:1; }
.go-salon-card .go-salon-card-host { font-size:12px; gap:0 4px; margin:0; padding-right:76px; line-height:1.4; }
.go-salon-card .go-salon-card-favorite { flex:0 0 32px; width:32px; height:32px; padding:0; border:0; background:transparent; color:inherit; font-size:23px; cursor:pointer; }
.go-salon-card .go-salon-card-favorite[aria-pressed="true"] { color:#df4976; }
.go-salon-card .go-salon-card-heading > .go-salon-card-favorite { position:absolute; right:32px; top:0; }
.go-salon-card .go-salon-card-heading > .go-salon-card-menu { position:absolute; right:0; top:0; width:28px; }
.go-salon-image-status { position:absolute; bottom:8px; right:8px; padding:3px 7px; border-radius:4px; background:#000b; color:white; font-size:11px; pointer-events:none; }
.go-salon-card-menu { position:relative; flex:0 0 28px; }
.go-salon-card-menu summary { cursor:pointer; list-style:none; text-align:center; font-size:24px; line-height:28px; border-radius:50%; }
.go-salon-card-menu summary::-webkit-details-marker { display:none; }
.go-salon-card-menu summary:focus-visible { outline:2px solid currentColor; }
.go-salon-card-menu > div { position:absolute; top:32px; right:0; z-index:30; width:200px; max-width:80vw; padding:6px; border-radius:10px; background:#fff; color:#382a22; box-shadow:0 4px 20px #0003; }
.go-salon-card-menu > div :is(a,button) { display:block; box-sizing:border-box; width:100%; text-align:left; padding:10px; font:inherit; font-size:13px; border:0; background:transparent; color:inherit; text-decoration:none; cursor:pointer; }
.go-salon-card-menu > div :is(a,button):hover { background:#0001; }
html[data-site-theme="dark"] .go-salon-card-menu > div { background:#292725; color:#f5eee8; }

/* Friends: compact request navigation, usable on narrow screens. */
.mp-friend-tabs { display:flex; gap:8px; overflow-x:auto; margin-bottom:20px; padding-bottom:4px; }
.mp-friend-tabs button { flex:0 0 auto; border:1px solid #b89f9466; border-radius:20px; background:transparent; color:inherit; padding:10px 14px; font:inherit; font-size:14px; cursor:pointer; }
.mp-friend-tabs button[aria-pressed="true"] { background:#a33e59; color:white; border-color:#a33e59; }
.mp-friend-tabs span { margin-left:8px; font-size:12px; }
.mp-friend-date { color:inherit; opacity:.7; font-size:12px; }
.mp-friend-menu { position:relative; }
.mp-friend-menu summary { cursor:pointer; list-style:none; padding:8px 16px; font-size:20px; }
.mp-friend-menu[open] { z-index:5; }
.mp-friend-menu-panel { position:absolute; right:0; top:100%; width:160px; padding:6px; border:1px solid #b89f9466; border-radius:12px; background:var(--friend-surface); box-shadow:0 8px 24px #0002; }
.mp-friend-menu-panel .mp-row-btn { display:block; width:100%; text-align:left; margin:2px 0; }
#mpFriendsContent { --friend-surface:#fff; --friend-text:#493d39; --friend-line:#eadfdb; color:var(--friend-text); }
#mpFriendsContent .mp-friend-tabs { border:0; gap:10px; padding:2px; flex-wrap:wrap; overflow:visible; }
#mpFriendsContent .mp-friend-tabs button { display:inline-flex; align-items:center; justify-content:center; gap:10px; border:1px solid var(--friend-line); border-radius:10px; padding:11px 14px; font-weight:600; line-height:1.5; white-space:nowrap; background:var(--friend-surface); }
#mpFriendsContent .mp-friend-tabs button[aria-pressed="true"] { background:#a33e59; color:white; border-color:#a33e59; }
#mpFriendsContent .mp-friend-tabs span { display:inline-flex; align-items:center; justify-content:center; box-sizing:border-box; min-width:24px; height:24px; margin:0; padding:0 6px; border-radius:12px; background:#8882; text-align:center; font-size:12px; font-variant-numeric:tabular-nums; }
#mpFriendsContent .mp-friend-tabs button[aria-pressed="true"] span { background:#fff3; color:white; }
#mpFriendsContent .mp-community-card { padding:20px; border-color:var(--friend-line); background:var(--friend-surface); box-shadow:none; }
#mpFriendsContent .mp-community-card > h3 { font-size:16px; color:var(--friend-text); }
#mpFriendsContent .mp-community-list { gap:0; }
#mpFriendsContent .mp-community-user { padding:16px 0; border:0; border-bottom:1px solid var(--friend-line); border-radius:0; background:transparent; }
#mpFriendsContent .mp-community-user:last-child { border-bottom:0; }
#mpFriendsContent .mp-community-avatar { width:48px; height:48px; flex-basis:48px; }
#mpFriendsContent .mp-community-user-copy strong { font-size:16px; white-space:normal; overflow-wrap:anywhere; color:var(--friend-text); }
#mpFriendsContent .mp-community-user-copy small { font-size:12px; overflow-wrap:anywhere; }
#mpFriendsContent .mp-row-btn { min-height:40px; font-size:14px; border-radius:9px; }
#mpFriendsContent .mp-community-form input { min-height:44px; box-sizing:border-box; font-size:16px; background:var(--friend-surface); color:var(--friend-text); border-color:var(--friend-line); }
#mpFriendsContent .mp-community-message:empty { display:none; }
#mpFriendsContent .mp-empty, #mpFriendsContent .mp-empty-state { padding:28px 12px; text-align:center; }
#mpFriendsContent button:focus-visible, #mpFriendsContent summary:focus-visible { outline:2px solid #b63c60; outline-offset:3px; }
html[data-site-theme="dark"] #mpFriendsContent { --friend-surface:#282523; --friend-text:#f0e8e4; --friend-line:#4d403d; }
#mpFriendsContent [hidden] { display:none !important; }
/* Tools-only navigation and account views. Shared accounts/data stay untouched. */
body.tools-workspace { --mobile-header-height:60px; padding-top:0 !important; }
body.tools-workspace > .site-header { position:sticky !important; top:0; z-index:120; height:auto !important; min-height:0 !important; padding:0 !important; transform:none !important; background:#fffdfa; border-bottom:1px solid #e7dfd8; box-shadow:0 2px 12px #3d302108; }
.site-header--tools .site-header-inner { display:flex !important; align-items:center; height:60px !important; min-height:60px !important; max-width:1440px; padding:6px 24px !important; gap:24px !important; box-sizing:border-box; }
.site-header--tools .qa-topnav-logo { display:flex; flex-direction:column; align-items:flex-start; gap:0; flex-shrink:0; width:auto !important; min-width:0 !important; height:auto !important; text-decoration:none; }
.site-header--tools .qa-topnav-logo::after { display:none !important; content:none !important; }
.site-header--tools .qa-brand-wordmark { width:164px !important; max-width:none !important; height:32px !important; object-fit:contain; object-position:left; }
.site-header--tools .site-tools-brand-label { display:block !important; font-size:10px; line-height:1.3; letter-spacing:.13em; padding-left:3px; color:#75625b; }
.site-tools-header-navigation { flex:1; min-width:0; }
.site-header--tools .site-tools-nav--page { position:static; width:auto; margin:0; }
.site-header--tools .site-tools-nav details { max-width:100%; }
.site-header--tools .site-tools-nav summary { min-height:40px; padding:8px 12px; background:transparent; border-color:transparent; font-size:14px; white-space:nowrap; overflow:hidden; }
.site-header--tools .site-tools-nav summary:hover, .site-header--tools .site-tools-nav details[open] summary { background:var(--tools-hover); }
.site-header--tools .site-tools-panel { top:calc(100% + 6px); left:24px; width:min(650px, calc(100% - 48px)); max-height:calc(100dvh - 100px); box-shadow:0 12px 35px #38271c26; }
.site-header--tools .site-tools-home { grid-column:1 / -1; padding:0 8px; text-decoration:none; }
.site-header--tools .qa-topnav-right { margin-left:auto; flex-shrink:0; gap:12px; }
.site-header--tools .site-header-page-actions [hidden] { display:none !important; }
.tools-hub-service-link { display:inline-block; margin-top:24px; font-size:12px; color:#78685f; text-underline-offset:4px; }
.tools-account-page .mp-dashboard-metrics { grid-template-columns:repeat(4,minmax(0,1fr)); }
.tools-account-page .mp-dashboard-columns { grid-template-columns:repeat(2,minmax(0,1fr)); }
.tools-account-page .mp-side-ticket-card { margin-bottom:20px; }
.tools-account-page .mp-dashboard-hero h3 { font-size:22px; }
html[data-site-theme="dark"] body.tools-workspace > .site-header { background:#24282e; border-color:#43494f; }
html[data-site-theme="dark"] .site-header--tools .site-tools-brand-label,
html[data-site-theme="dark"] .tools-hub-service-link { color:#c9bab0; }
@media(max-width:700px) {
  .site-header--tools .site-header-inner { height:58px !important; min-height:58px !important; padding:5px 10px !important; gap:8px !important; }
  .site-header--tools .qa-brand-wordmark { width:132px !important; }
  .site-header--tools .site-tools-brand-label { font-size:9px; }
  .site-header--tools .site-tools-nav summary { font-size:12px; padding:8px 6px; gap:4px; }
  .site-header--tools .site-tools-panel { left:10px; width:calc(100% - 20px); }
  .site-header--tools .qa-topnav-right { gap:6px; }
  .site-header--tools .qa-account-menu-button { min-width:38px; min-height:40px; padding:4px !important; }
  .site-header--tools .qa-topnav-user { display:block !important; position:absolute; width:1px !important; height:1px; padding:0; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
  .site-header--tools .qa-topnav-chevron { display:none !important; }
  .site-header--tools .qa-bell { width:32px; min-width:32px; }
  .site-header--tools .qa-topnav-ask-btn { padding:8px !important; font-size:12px; }
  .tools-account-page .mp-dashboard-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .tools-account-page .mp-dashboard-columns { grid-template-columns:minmax(0,1fr); }
}
@media(max-width:600px) {
  #mpFriendsContent .mp-community-user { flex-wrap:wrap; }
  #mpFriendsContent .mp-community-actions { flex-wrap:wrap; gap:8px; }
  #mpFriendsContent .mp-community-user { display:grid; grid-template-columns:48px minmax(0,1fr); gap:10px; }
  #mpFriendsContent .mp-community-actions { grid-column:2; padding-left:0; width:auto; justify-content:flex-start; }
  #mpFriendsContent .mp-community-card { padding:14px; }
  #mpFriendsContent .mp-friend-tabs { gap:8px; }
  #mpFriendsContent .mp-friend-tabs button { padding:10px 12px; }
}
/* Zundamon narration: a switch, not a volume slider. */
#goSalonAnnouncerToggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  flex-wrap: wrap; max-width: 100%; min-height: 44px; padding: 8px 12px;
}
#goSalonAnnouncerToggle .announcer-switch-track {
  position: relative; display: inline-block; flex: 0 0 44px; width: 44px; height: 24px;
  border-radius: 999px; background: #756d64; box-shadow: inset 0 0 0 1px #ffffff30;
  transition: background .18s ease;
}
#goSalonAnnouncerToggle .announcer-switch-track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fffaf2; box-shadow: 0 1px 3px #0004;
  transition: transform .18s ease;
}
#goSalonAnnouncerToggle[aria-checked="true"] .announcer-switch-track { background: #508c60; }
#goSalonAnnouncerToggle[aria-checked="true"] .announcer-switch-track::after { transform: translateX(20px); }
#goSalonAnnouncerToggle [data-announcer-status] { min-width: 3ch; font-size: .85em; }
#goSalonAnnouncerToggle [data-announcer-status]:empty { display: none; }
#goSalonAnnouncerToggle:focus-visible { outline: 2px solid #cfaa67; outline-offset: 3px; }
#goSalonAnnouncerToggle:disabled { cursor: wait; }
@media (prefers-reduced-motion: reduce) {
  #goSalonAnnouncerToggle .announcer-switch-track,
  #goSalonAnnouncerToggle .announcer-switch-track::after { transition: none; }
}
