/**
 * layout.css - スマホ縦画面・片手操作に最適化したコンパクトポートレートレイアウト
 */

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 500px;
  margin: 0 auto;
  padding: max(4px, env(safe-area-inset-top)) 8px max(6px, env(safe-area-inset-bottom));
  gap: 5px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 2px 0;
  flex-shrink: 0;
}

.brand-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.app-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-main);
  white-space: nowrap;
}

.app-subtitle {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

/* モード切替タブ（対局 / 検討 / 復習） */
.mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  background: var(--bg-surface-alt);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.mode-tab {
  position: relative;
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 6px 4px;
  min-height: 32px;
  border-radius: calc(var(--radius-md) - 3px);
  font-size: 0.79rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.mode-tab.active {
  background: var(--bg-elevated);
  color: var(--accent-primary);
  box-shadow: 0 1px 4px rgba(56, 42, 20, 0.09);
}

.tab-count {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.66rem;
  background: #fef3c7;
  color: #9a5409;
}

/* 局面・目数バランスバー */
.status-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  box-shadow: var(--shadow-soft);
  flex-shrink: 0;
}

.players-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
}

.player-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.player-tag.active-turn {
  color: var(--accent-primary);
  background: var(--accent-primary-soft);
}

.stone-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.stone-dot.black {
  background: radial-gradient(circle at 35% 35%, #555a60, #16181b);
  border: 1px solid rgba(30, 30, 30, 0.5);
}

.stone-dot.white {
  background: radial-gradient(circle at 35% 35%, #ffffff, #e5dfd3);
  border: 1px solid rgba(110, 96, 75, 0.45);
}

.score-lead-pill {
  font-weight: 800;
  font-size: 0.8rem;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--bg-surface-alt);
  color: var(--text-main);
}

.balance-bar-track {
  position: relative;
  height: 7px;
  border-radius: 999px;
  background: #ede7da;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.balance-bar-black {
  height: 100%;
  width: 50%;
  background: #272420;
  border-right: 2px solid var(--accent-primary);
  transition: width 0.25s ease;
}

.balance-bar-center {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: rgba(72, 58, 38, 0.35);
}

/* 状況バナー（盤面サイズがブレないよう高さ安定） */
.info-banner {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  line-height: 1.25;
  color: var(--text-main);
  flex-shrink: 0;
}

#info-banner-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.banner-sub {
  color: var(--text-muted);
  font-size: 0.68rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 下部操作ドック（親指で押しやすい高さと間隔） */
.bottom-dock {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.nav-group {
  display: flex;
  gap: 3px;
}

.nav-group .btn-icon {
  min-height: 34px;
  padding: 4px 8px;
  font-size: 0.74rem;
}

.action-dock {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.action-dock .btn {
  padding: 7px 4px;
  min-height: 48px;
  font-size: 0.73rem;
  flex-direction: column;
  gap: 2px;
}

#dock-review .action-dock .btn,
#dock-srs .action-dock .btn {
  min-height: 40px;
  padding: 6px 4px;
  flex-direction: row;
  font-size: 0.75rem;
}

#rev-main-actions,
#srs-play-bar,
#srs-branch-bar {
  grid-template-columns: repeat(3, 1fr);
}

#rev-branch-bar {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 420px) {
  .app-shell {
    padding: max(4px, env(safe-area-inset-top)) 6px max(6px, env(safe-area-inset-bottom));
    gap: 4px;
  }
  .app-subtitle {
    display: none;
  }
}
