/* 기본 초기화 */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary:      #c0392b;
  --primary-dark: #a93226;
  --bg:           #f2f2f2;
  --card-bg:      #ffffff;
  --border:       #e0e0e0;
  --text:         #222222;
  --muted:        #888888;
  --pos:          #27ae60;
  --neg:          #e74c3c;
  --warn:         #e67e22;
  --turn-glow:    #f1c40f;
  --select-blue:  #2980b9;
  --radius:       12px;
  --shadow:       0 2px 8px rgba(0, 0, 0, 0.09);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Noto Sans KR', '맑은 고딕', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

/* 게임 결과 오버레이 등 전체 화면 모달이 떠 있는 동안 배경 스크롤을 잠근다
   (renderGameResultOverlay/closeGameResultOverlay 참고) */
body.modal-open {
  overflow: hidden;
}

/* ── 앱 레이아웃 ── */

.app {
  max-width: 540px;
  margin: 0 auto;
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--primary);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.app-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.main-content {
  padding: 12px 12px 40px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── 카드 ── */

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 4차: 게임 진행 화면 제목 줄에 끼워 넣는 "현재 게임 저장" 버튼 */
.btn-save-game-inline {
  margin-left: auto;
  font-size: 11px;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 700;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.round-badge {
  font-size: 11px;
  background: var(--primary);
  color: #fff;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

/* ── 버튼 ── */

.btn {
  display: inline-block;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  line-height: 1;
  transition: opacity 0.15s, transform 0.1s;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

/* 9차: 버튼 hover 효과 - 클릭 가능함을 살짝 밝기로 알려준다 */
.btn:hover:not(:disabled) {
  opacity: 0.85;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
  padding: 13px;
  font-size: 15px;
  border-radius: 10px;
}

.btn-primary:not(:disabled):hover {
  background: var(--primary-dark);
}

.btn-danger {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.5);
  padding: 7px 13px;
  font-size: 13px;
}

.btn-danger:hover {
  background: rgba(255, 255, 255, 0.25);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 7차: 효과음 토글은 header-actions(점수 등록 화면에서만 보임) 밖에 둬서 어느 화면에서든 보인다 */
.header-right-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-sound-toggle {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
}

.btn-mode {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.6);
  padding: 7px 13px;
  font-size: 13px;
  border-radius: 8px;
  font-weight: 600;
}

.btn-mode:hover {
  background: rgba(255, 255, 255, 0.3);
}

.app-header {
  transition: background 0.25s;
}

/* ── 플레이어 등록 ── */

.player-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.player-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.player-num {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  width: 26px;
  flex-shrink: 0;
}

.input-text {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-text:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.12);
}

.input-text::placeholder {
  color: #bbb;
}

/* ── 점수 입력 ── */

.score-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 8px;
  border-radius: 8px;
  margin-bottom: 2px;
  transition: background 0.15s, opacity 0.15s;
}

.score-input-row.is-participant,
.game-participant-row.is-participant {
  background: #fdf5f5;
}

.score-input-row.is-resting,
.game-participant-row.is-resting {
  opacity: 0.4;
}

.participant-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  cursor: pointer;
  min-width: 0;
}

.chk-participant,
.chk-game-participant {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.chk-participant:disabled,
.chk-game-participant:disabled {
  cursor: not-allowed;
}

/* ── 게임 화면: 참여자 선택 (점수 등록 화면과 별개의 UI) ── */

.game-setup-desc {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}

.card-subtitle {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  margin: 14px 0 8px;
}

/* 1차: 휴식 플레이어 안내 - 참여자 3명이 정확히 선택됐을 때만 텍스트가 채워짐 */
.game-resting-summary {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  margin: 4px 0 4px;
  min-height: 16px;
}

/* 1차: 점당 금액 선택 라디오 */
.point-value-section {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.point-value-option {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  cursor: pointer;
}

.point-value-custom-input {
  width: 80px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}

.animation-settings-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.animation-setting-option {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}

/* 1차: 게임 결과 화면의 점당 금액 환산 표시 - 점수판 누적 금액과는 무관한 이번 판 전용 정보 */
.game-settle-money {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  margin-top: 4px;
}

.game-participant-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 8px;
  border-radius: 8px;
  margin-bottom: 2px;
  transition: background 0.15s, opacity 0.15s;
}

.player-name-label {
  font-size: 14px;
  font-weight: 500;
  user-select: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-input-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.input-score {
  width: 72px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 6px;
  font-size: 15px;
  font-family: inherit;
  text-align: right;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s;
}

.input-score:not(:disabled):focus {
  outline: none;
  border-color: var(--primary);
}

.input-score:disabled {
  background: #f5f5f5;
  color: var(--muted);
}

.unit {
  font-size: 13px;
  color: var(--muted);
}

/* ── 점수 합계 / 유효성 ── */

.score-footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.score-sum-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 14px;
}

.score-sum-row strong {
  font-size: 20px;
  font-weight: 800;
}

.valid-msg {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  line-height: 1.4;
}

.msg-ok    { background: #eafaf1; color: var(--pos); }
.msg-error { background: #fdecea; color: var(--neg); }
.msg-warn  { background: #fef3e8; color: var(--warn); }

/* ── 누적 점수판 ── */

.board-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.board-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fafafa;
  border: 1px solid var(--border);
}

.board-item.rank-1 { background: #fffcf0; border-color: #f9ca24; }
.board-item.rank-2 { background: #f9fafb; border-color: #c0c0c0; }
.board-item.rank-3 { background: #fdf8f5; border-color: #cd7f32; }

.board-rank {
  font-size: 18px;
  width: 30px;
  text-align: center;
  flex-shrink: 0;
}

.board-body {
  flex: 1;
  min-width: 0;
}

.board-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.board-name {
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-total {
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
}

.board-sub {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  flex-wrap: wrap;
}

.sub-label {
  font-size: 11px;
  color: var(--muted);
  background: #efefef;
  padding: 1px 5px;
  border-radius: 4px;
}

.sub-sep {
  color: var(--border);
  font-size: 12px;
}

/* 돼지먹기 버튼 */

.btn-pig {
  background: #d35400;
  color: #fff;
  width: 100%;
  padding: 13px;
  font-size: 15px;
  border-radius: 10px;
}

.btn-pig:not(:disabled):hover {
  background: #b74600;
}

/* 돼지먹기 승자 선택 */

.pig-winner-option {
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  user-select: none;
}

.pig-winner-option.is-selected {
  border-color: #d35400;
  background: #fef0e8;
  color: #d35400;
  font-weight: 700;
}

.radio-pig-winner {
  display: none;
}

/* 넓은 금액 입력 */

.input-wide {
  width: 100px;
}

/* ── 공용 색상 ── */

.pos { color: var(--pos); }
.neg { color: var(--neg); }

/* ── 게임 기록 ── */

.history-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 0 4px;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 280px;
}

.history-table th,
.history-table td {
  padding: 8px 6px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.history-table th {
  background: #f5f5f5;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.history-table tr:last-child td {
  border-bottom: none;
}

.round-num {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

/* 회차 기록의 자동(게임)/수동 구분 배지 */
.round-source-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 8px;
  background: #efefef;
  color: var(--muted);
}

.round-source-badge.is-game {
  background: #fdecea;
  color: var(--primary);
}

.rest {
  color: var(--muted);
  font-size: 11px;
}

/* ── 빈 상태 ── */

.empty-msg {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 24px 0;
}

/* ── 홈 화면 ── */

.screen-home {
  padding: 24px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.home-hero {
  text-align: center;
  padding: 8px 0 4px;
}

.home-icon {
  font-size: 56px;
  line-height: 1;
  margin-bottom: 10px;
}

.home-subtitle {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}

.home-menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 홈 메뉴 카드 버튼 */
.home-menu-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 120px;
  padding: 20px 20px;
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.home-menu-btn:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(192, 57, 43, 0.14);
}

.home-menu-btn:active {
  transform: scale(0.98);
}

.home-menu-icon {
  font-size: 40px;
  line-height: 1;
  flex-shrink: 0;
}

.home-menu-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.home-menu-label {
  display: block;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.home-menu-desc {
  display: block;
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
  margin-top: 4px;
}

/* 점수 등록 / 게임 화면 래퍼: 내부 섹션 사이 gap 유지 */
#screen-score,
#screen-game {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 뒤로 가기 버튼 */
.btn-back {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.6);
  padding: 7px 13px;
  font-size: 13px;
  border-radius: 8px;
  font-weight: 600;
  white-space: nowrap;
}

.btn-back:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ── 계산기 패널 ── */

.hidden {
  display: none !important;
}

.calc-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.calc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.calc-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  width: 58px;
  flex-shrink: 0;
}

/* 고 선택 */

.go-options {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  flex: 1;
}

.go-option {
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  user-select: none;
}

.go-option.is-selected {
  border-color: var(--primary);
  background: #fdf5f5;
  color: var(--primary);
  font-weight: 700;
}

.radio-go {
  display: none;
}

/* 고 선택 */

.go-options {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  flex: 1;
}

.go-option {
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  user-select: none;
}

.go-option.is-selected {
  border-color: var(--primary);
  background: #fdf5f5;
  color: var(--primary);
  font-weight: 700;
}

.radio-go {
  display: none;
}

/* 승자 선택 */

.winner-options {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}

.winner-option {
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  user-select: none;
}

.winner-option.is-selected {
  border-color: var(--primary);
  background: #fdf5f5;
  color: var(--primary);
  font-weight: 700;
}

.radio-winner {
  display: none;
}

/* 박 선택 */

.bak-section-title {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}

.bak-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fafafa;
  border: 1px solid var(--border);
  margin-bottom: 5px;
}

.bak-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.bak-chk-label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  user-select: none;
  flex-shrink: 0;
}

.bak-chk-label.is-checked {
  border-color: var(--neg);
  background: #fdecea;
  color: var(--neg);
  font-weight: 700;
}

.chk-bak {
  display: none;
}

.bak-result {
  font-size: 13px;
  font-weight: 700;
  min-width: 46px;
  text-align: right;
  flex-shrink: 0;
}

/* 결과 미리보기 */

.score-preview {
  background: #f8f8f8;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 8px;
}

.preview-title {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}

.preview-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 14px;
}

.preview-row:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.preview-name {
  font-weight: 500;
}

.preview-info {
  font-size: 10px;
  color: var(--muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

/* ── 정산 ── */

.btn-settle {
  background: #2c3e50;
  color: #fff;
  width: 100%;
  padding: 13px;
  font-size: 15px;
  border-radius: 10px;
}

.btn-settle:hover {
  background: #1a252f;
}

.settle-detail {
  margin-top: 14px;
}

.settle-section-title {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
}

.settle-totals {
  background: #f8f8f8;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.settle-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 14px;
  font-size: 14px;
}

.settle-total-row:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.settle-name {
  font-weight: 500;
}

.settle-amount {
  font-weight: 700;
  font-size: 15px;
}

.settle-transactions {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.settle-tx {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
}

.tx-from {
  font-weight: 600;
  color: var(--neg);
  flex: 1;
}

.tx-arrow {
  color: var(--muted);
  font-size: 16px;
  flex-shrink: 0;
}

.tx-to {
  font-weight: 600;
  color: var(--pos);
  flex: 1;
}

.tx-amount {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  text-align: right;
  flex-shrink: 0;
}

.settle-even {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 16px 0;
}

/* ── 게임 시작 버튼 ── */

.btn-game-start {
  background: #27ae60;
  color: #fff;
  width: 100%;
  padding: 13px;
  font-size: 15px;
  border-radius: 10px;
  margin-bottom: 8px;
}

.btn-game-start:not(:disabled):hover {
  background: #219a52;
}

/* ── 고스톱 게임 보드 ── */

.game-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  background: #fdf5f5;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 10px;
  font-size: 13px;
}

.game-turn-label {
  font-weight: 700;
  color: var(--primary);
}

.btn-turn-log-toggle {
  flex-shrink: 0;
  font-size: 11px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

/* 상대 획득패 표시 밀도(전체/요약/숨김) 순환 토글 - 다른 상태바 버튼과 같은 톤 */
.btn-opp-mode-toggle {
  flex-shrink: 0;
  font-size: 11px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

/* 상태 표시줄 오른쪽 버튼 묶음(실행 취소 + 게임 로그) */
.game-status-bar-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* 5차: 실행 취소 버튼 */
.btn-undo-toggle {
  flex-shrink: 0;
  font-size: 11px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.btn-undo-toggle:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 6차: 턴별 진행 로그 패널 - "N턴 / 이름 / 있었던 일" 블록을 순서대로 나열 */
.turn-log-panel {
  background: #fbfbfb;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  max-height: 220px;
  overflow-y: auto;
  font-size: 12px;
}

.turn-log-title {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}

.turn-log-empty {
  color: var(--muted);
}

.turn-log-entry {
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}

.turn-log-entry:last-child {
  border-bottom: none;
}

.turn-log-entry-header {
  font-weight: 700;
  margin-bottom: 2px;
}

.turn-log-entry-line {
  color: var(--muted);
  padding-left: 8px;
}

/* 게임 로그 "전체보기" 토글 - 기본은 최근 3턴만 보이고 이 버튼으로 전체를 펼친다 */
.btn-turn-log-expand {
  display: block;
  width: 100%;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: none;
  border: 1px dashed var(--primary);
  border-radius: 6px;
  padding: 5px 0;
  cursor: pointer;
}

/* 3차: 리플레이 패널 - turn-log-panel과 같은 카드 톤을 쓰되 이전/다음 내비게이션을 덧붙인다 */
.replay-panel {
  background: #fbfbfb;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 10px;
  font-size: 12px;
}

.replay-current-entry {
  border-bottom: none;
  min-height: 40px;
}

.replay-nav {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.replay-nav-btn {
  flex: 1;
  font-size: 12px;
  padding: 6px 0;
}

.replay-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── 뉴맞고 스타일 게임판 ──────────────────────────────────────────────────────
   상대 2석(상단) → 중앙(바닥패+덱) → 최근 이벤트 메시지 → 내 정보+손패(하단, 가장
   크게)를 전부 펠트 배경 하나(.gt-root)가 감싸는 실제 "게임판" 컨테이너로 조립한다.
   상대/획득패 상세는 인라인으로 펼치지 않고 모달(.captured-modal-overlay)로 띄운다. */
.gt-root {
  background: radial-gradient(ellipse at 50% 20%, #2f8f5e 0%, #1f7047 55%, #124025 100%);
  border: 3px solid #0d3d23;
  border-radius: 14px;
  padding: 10px;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.4), 0 3px 10px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 펠트 배경 위에서는 회색 라벨이 잘 안 보여서 밝은 색으로 덮어씀 */
.gt-root .area-label {
  color: #d9fbe6;
}

/* 6차: 덱 셔플/분배 연출 화면 - .gt-root와 같은 펠트 톤으로 게임판 자리를 그대로 대신한다 */
.gt-dealing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 320px;
  background: radial-gradient(ellipse at 50% 30%, #2f8f5e 0%, #1f7047 55%, #124025 100%);
  border: 3px solid #0d3d23;
  border-radius: 14px;
  padding: 20px;
}

.gt-dealing-deck {
  width: 70px;
  aspect-ratio: 5 / 8;
  border-radius: 8px;
  border: 2px solid #888;
  background: repeating-linear-gradient(45deg, #c0392b, #c0392b 6px, #922b21 6px, #922b21 12px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.gt-dealing-deck.is-shuffling {
  animation: dealing-shuffle 0.4s ease-in-out infinite;
}

@keyframes dealing-shuffle {
  0%, 100% { transform: rotate(-4deg) translateX(-2px); }
  50%      { transform: rotate(4deg) translateX(2px); }
}

.gt-dealing-deck.is-dealing {
  animation: dealing-pulse 0.5s ease-in-out infinite;
}

@keyframes dealing-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(0.92); }
}

.gt-dealing-label {
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.gt-dealing-mini-cards {
  display: flex;
  gap: 10px;
}

.gt-dealing-mini-card {
  width: 26px;
  aspect-ratio: 5 / 8;
  border-radius: 4px;
  border: 1.5px solid #888;
  background: repeating-linear-gradient(45deg, #c0392b, #c0392b 4px, #922b21 4px, #922b21 8px);
  animation: dealing-mini-fly 0.6s ease-in-out infinite alternate;
}

.gt-dealing-mini-card:nth-child(2) { animation-delay: 0.15s; }
.gt-dealing-mini-card:nth-child(3) { animation-delay: 0.3s; }

@keyframes dealing-mini-fly {
  0%   { transform: translateY(0); opacity: 0.6; }
  100% { transform: translateY(-10px); opacity: 1; }
}

.btn-dealing-skip {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
}

/* 상대1/중앙(바닥패+덱)/상대2를 한 grid 컨테이너의 직계 자식 3개로 담는다(순서는
   renderGameTable()이 항상 상대1 → 중앙 → 상대2로 조립). 기본(세로 화면)에서는 상대 두 명을
   한 줄, 중앙을 그 아래 한 줄로 - 기존 세로 스택과 동일하게 보이도록 grid-template-areas로
   배치한다. 가로 레이아웃에서는 이 규칙을 3열 한 줄로 덮어쓴다(아래 랜드스케이프 미디어 쿼리). */
.gt-top-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "seat1 seat2"
    "center center";
  gap: 8px;
}

.gt-top-row > *:nth-child(1) { grid-area: seat1; }
.gt-top-row > *:nth-child(2) { grid-area: center; }
.gt-top-row > *:nth-child(3) { grid-area: seat2; }

.gt-mid-row {
  min-width: 0;
}

.gt-seat {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 10px;
  padding: 8px 10px;
}

.gt-seat-header {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.gt-seat-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.gt-seat-hand-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.gt-seat-handcount {
  font-size: 11px;
  color: var(--muted);
}

.gt-seat .captured-summary-line {
  margin-top: 0;
}

/* 상대/덱 카드 뒷면 아이콘 - 실제 손패 앞면은 노출하지 않는다 */
.gt-hand-back-icon,
.gt-deck-back {
  aspect-ratio: 5 / 8;
  border-radius: 4px;
  border: 1.5px solid #888;
  background: repeating-linear-gradient(45deg, #c0392b, #c0392b 4px, #922b21 4px, #922b21 8px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  flex-shrink: 0;
}

.gt-hand-back-icon {
  width: 22px;
}

/* 중앙: 바닥패 + 덱을 나란히, 충분한 간격을 두고 배치 */
.gt-center-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.gt-floor-area {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 98px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
}

.gt-deck {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding-top: 6px;
}

.gt-deck-back {
  width: 44px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.gt-deck-count {
  font-size: 11px;
  font-weight: 700;
  color: #d9fbe6;
}

/* 최근 이벤트 메시지 - 전체 로그를 펼치지 않고 마지막 한 줄만 상시 노출 */
.gt-message {
  text-align: center;
  font-size: 12px;
  color: #fff;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 8px;
  padding: 6px 10px;
}

/* 내 정보 + 손패 (게임판 하단, 가장 크게) */
.gt-player-area {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 10px;
  padding: 10px;
}

.gt-player-info {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  border-radius: 8px;
  padding: 4px 6px;
}

/* 현재 턴 강조 - "낼 수 있는 패"(빨강)와 겹치지 않도록 골드 계열 + 펄스 애니메이션으로 구분 */
.gt-player-info.is-current-turn {
  animation: turn-pulse 1.6s ease-in-out infinite;
  box-shadow: 0 0 0 3px rgba(241, 196, 15, 0.4);
  background: #fffdf5;
}

@keyframes turn-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(241, 196, 15, 0.4); }
  50%      { box-shadow: 0 0 0 7px rgba(241, 196, 15, 0.22); }
}

.game-turn-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  color: #7a5f00;
  background: var(--turn-glow);
  padding: 2px 8px;
  border-radius: 10px;
  vertical-align: middle;
  animation: turn-badge-blink 1.6s ease-in-out infinite;
}

@keyframes turn-badge-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

/* 내 획득패 - 손패 바로 위, 카드 이미지가 항상 보이는 영역(계산 과정은 상세보기 모달에서만) */
.gt-captured-cards {
  margin-bottom: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
}

.gt-captured-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.gt-captured-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.gt-captured-row-label {
  flex-shrink: 0;
  width: 32px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

/* 카드가 많아도 겹쳐서 가로로 최대한 담고, 그래도 넘치면 세로 스크롤로 높이를 제한 */
.gt-captured-row-cards {
  display: flex;
  flex-wrap: wrap;
  max-height: 130px;
  overflow-y: auto;
}

.gt-captured-row-cards .hanahuda-card {
  position: relative;
  margin-left: -8px;
}

.gt-captured-row-cards .hanahuda-card:first-child {
  margin-left: 0;
}

/* 피는 장수가 많아지기 쉬우므로 겹침 간격을 더 좁게 */
.gt-captured-row-cards--tight .hanahuda-card {
  margin-left: -20px;
}

.gt-captured-row-cards--tight .hanahuda-card:first-child {
  margin-left: 0;
}

/* 쌍피 카드 우상단에 붙는 작은 배지 */
.gt-ssangpi-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  z-index: 2;
  background: var(--primary);
  color: #fff;
  font-size: 8px;
  font-weight: 800;
  padding: 1px 3px;
  border-radius: 4px;
  line-height: 1;
}

/* 카드 정보 툴팁(PC 호버 / 모바일 탭) - document.body에 직접 붙어 fixed로 떠서 카드
   레이아웃에 영향을 주지 않는다. pointer-events:none이라 마우스가 툴팁 위로 지나가도
   mouseleave가 씹히지 않는다. */
.card-tooltip {
  position: fixed;
  z-index: 250;
  background: rgba(20, 20, 20, 0.95);
  color: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 11px;
  line-height: 1.5;
  max-width: 220px;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.card-tooltip-title {
  font-weight: 800;
  font-size: 12px;
  margin-bottom: 2px;
}

.card-tooltip-line {
  color: #ddd;
}

/* 상대 획득패 미리보기 - 좌석이 커져서 바닥패/내 손패를 밀지 않도록 항상 한 줄(nowrap)로만
   보여준다. 표시 장수는 renderCapturedCategoryPreview()의 maxVisible로 제한한다. */
.gt-opp-captured-preview {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}

.gt-opp-preview-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 4px;
}

.gt-opp-preview-label {
  flex-shrink: 0;
  width: 22px;
  font-size: 9px;
  font-weight: 700;
  color: var(--muted);
}

.gt-opp-preview-cards {
  display: flex;
  flex-wrap: nowrap;
  overflow: hidden;
}

.gt-opp-preview-cards .hanahuda-card {
  position: relative;
  margin-left: -6px;
}

.gt-opp-preview-cards .hanahuda-card:first-child {
  margin-left: 0;
}

/* 피는 장수가 많아지기 쉬우므로 겹침 간격을 더 좁게 */
.gt-opp-preview-cards--tight .hanahuda-card {
  margin-left: -14px;
}

.gt-opp-preview-cards--tight .hanahuda-card:first-child {
  margin-left: 0;
}

.gt-opp-preview-more {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
}

/* 상대 획득패 점수 임박 경고("피 1장 더 획득 시 1점" 등) */
.gt-opp-preview-warning {
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 700;
  color: var(--warn);
  white-space: nowrap;
}

/* 족보 완성 진행률 - 한 장도 없는 족보는 애초에 렌더링하지 않고(JS 필터),
   완성 직전(is-almost)은 강조색, 완성(is-completed)은 톤을 낮춰 "이미 끝남"을 표시 */
.gt-combo-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.gt-combo-progress--compact {
  gap: 3px;
}

.gt-combo-progress-item {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  background: #f3f3f3;
  border-radius: 8px;
  padding: 1px 6px;
  white-space: nowrap;
}

.gt-combo-progress--compact .gt-combo-progress-item {
  font-size: 9px;
  padding: 1px 5px;
}

.gt-combo-progress-item.is-almost {
  color: var(--primary);
  background: #fdecea;
}

.gt-combo-progress-item.is-completed {
  color: var(--pos);
  background: #e8f8ee;
}

/* 미리보기 카드는 획득패 상세(38px)보다 더 작게 표시 */
.hanahuda-card[data-role="captured-mini"] {
  width: 26px;
  font-size: 7px;
}

.gt-ssangpi-badge--mini {
  font-size: 6px;
  padding: 0 2px;
  top: 1px;
  right: 1px;
}

/* 손패 선택 미리보기 한 줄 - 선택 중일 때만 나타나고 손패 위 공간을 거의 차지하지 않는다 */
.gt-hand-preview {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: #fdf0f0;
  border: 1px dashed var(--primary);
  border-radius: 6px;
  padding: 5px 8px;
  margin-bottom: 6px;
}

/* 내 손패 - 겹쳐서 부채꼴처럼 보이도록 음수 마진으로 겹치고, hover/선택 시 위로 떠오른다 */
.gt-hand {
  gap: 0;
  background: transparent;
  border: none;
  padding: 4px 0 0;
}

.gt-hand .hanahuda-card {
  margin-left: -14px;
  position: relative;
  z-index: 1;
}

.gt-hand .hanahuda-card:first-child {
  margin-left: 0;
}

.gt-hand .hanahuda-card:hover,
.gt-hand .hanahuda-card.is-selected {
  z-index: 5;
}

/* 획득패 한 줄 요약 + 상세보기 토글 */
.captured-summary-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
  margin-top: 6px;
  flex-wrap: wrap;
}

.btn-detail-toggle {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: none;
  border: 1px solid var(--primary);
  border-radius: 10px;
  padding: 2px 8px;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-detail-toggle:active {
  transform: scale(0.96);
}

.captured-detail {
  margin-top: 4px;
}

/* 획득패 - 광/띠/열끗/피 계산 과정을 한 줄씩 보여주는 표(카드 수 → 판정 기준 → 점수) */
.captured-calc {
  font-size: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 6px;
}

.captured-calc-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}

.captured-calc-row:last-child {
  font-weight: 700;
  color: var(--primary);
  border-top: 1px dashed var(--border);
  margin-top: 2px;
  padding-top: 4px;
}

/* 쪽/따닥/싹쓸이/폭탄으로 상대 피를 실제로 가져왔는지(또는 못 가져왔는지) 보여주는 로그 */
.pi-transfer-log {
  font-size: 11px;
  color: var(--muted);
  background: #fff;
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 6px;
}

.pi-transfer-log-title {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.pi-transfer-log-line {
  padding: 1px 0;
}

.game-player-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.game-player-name.is-current-turn {
  color: #8a6d00;
}

.game-go-badge {
  font-size: 11px;
  background: #fdecea;
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
}

.game-score-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: #fdf0f0;
  padding: 2px 8px;
  border-radius: 10px;
}

/* 9차: 점수가 오른 순간 짧게 확대되는 강조 애니메이션 */
.game-score-value.score-bump {
  animation: score-bump 0.4s ease-out;
}

@keyframes score-bump {
  0%   { transform: scale(1);   background: #fdf0f0; }
  40%  { transform: scale(1.35); background: var(--turn-glow); }
  100% { transform: scale(1);   background: #fdf0f0; }
}

/* 화투패 카드 칩 */

.card-area {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 88px;
  padding: 6px;
  background: #f9f9f9;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.card-area.captured-area {
  background: #f5f5ff;
  border-color: #c5c5e8;
  min-height: 88px;
}

/* 화투 카드 칩: 최소 44px 너비로 모바일 터치 대응, 화투패 비율(가로:세로 ≈ 5:8)로 표시 */

.hanahuda-card {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 50px;
  aspect-ratio: 5 / 8;
  border-radius: 6px;
  border: 1.5px solid #ccc;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  padding: 4px 2px;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s, box-shadow 0.1s, border-color 0.15s;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.hanahuda-card .card-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.hanahuda-card:active {
  transform: scale(0.94);
}

/* 9차: 낼 수 있는 손패만 hover 시 살짝 떠오르게 - 클릭 가능한 카드임을 알려준다
   (바닥패/획득패/상대 손패 뒷면 등 클릭과 무관한 칩에는 적용하지 않음) */
.hanahuda-card[data-role="hand"]:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}

.hanahuda-card.is-matched {
  border-color: #27ae60;
  box-shadow: 0 0 0 2px rgba(39, 174, 96, 0.35);
  background: #eafaf1;
}

/* 5차: 폭탄 가능 카드 표시 */
.hanahuda-card.is-bombable {
  border-color: #e67e22;
  box-shadow: 0 0 0 2px rgba(230, 126, 34, 0.45);
  animation: bombable-pulse 1s ease-in-out infinite;
}

@keyframes bombable-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(230, 126, 34, 0.45); }
  50%      { box-shadow: 0 0 0 4px rgba(230, 126, 34, 0.25); }
}

/* 7차: 카드 등장 애니메이션 - 매 렌더마다 카드 DOM이 새로 생성되므로, 방금 생긴 카드에만
   이 클래스를 붙여 "자연스럽게 나타나는" 느낌을 준다(컨테이너를 가로지르는 이동 자체는 아님) */
@keyframes card-drop-in {
  0%   { transform: translateY(-16px) scale(0.85); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

.hanahuda-card.card-drop-in {
  animation: card-drop-in 0.35s ease-out;
}

@keyframes card-capture-in {
  0%   { transform: scale(1.3); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.hanahuda-card.card-capture-in {
  animation: card-capture-in 0.35s ease-out;
}

/* 이번 턴 이벤트 강조 - 방금 낸 패(teal) / 덱에서 뒤집은 패(magenta) / 최종 획득한 패(amber),
   서로 다른 색으로 잠시 반짝인 뒤 자동으로 사라진다(클래스 자체는 다음 렌더에서 안 붙음). */
@keyframes just-played-flash {
  0%   { box-shadow: 0 0 0 3px rgba(22, 160, 133, 0.85); border-color: #16a085; }
  100% { box-shadow: 0 0 0 3px rgba(22, 160, 133, 0); }
}

.hanahuda-card.is-just-played {
  animation: just-played-flash 1.4s ease-out;
}

@keyframes just-flipped-flash {
  0%   { box-shadow: 0 0 0 3px rgba(232, 67, 147, 0.85); border-color: #e84393; }
  100% { box-shadow: 0 0 0 3px rgba(232, 67, 147, 0); }
}

.hanahuda-card.is-just-flipped {
  animation: just-flipped-flash 1.4s ease-out;
}

@keyframes just-captured-flash {
  0%   { box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.85); border-color: #f39c12; }
  100% { box-shadow: 0 0 0 3px rgba(243, 156, 18, 0); }
}

.hanahuda-card.is-just-captured-highlight {
  animation: just-captured-flash 1.4s ease-out;
}

/* 5차: 흔든 패 표시 */
.hanahuda-card.is-shaken {
  border-color: #8e44ad;
  box-shadow: 0 0 0 2px rgba(142, 68, 173, 0.4);
}

/* 낼 수 있는(캡처가 되는) 패 강조 - 현재 턴 플레이어에게만 표시 */
.hanahuda-card.playable-card {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.35);
}

/* 현재 턴이 아닌 플레이어의 손패 - 클릭 불가를 시각적으로 표시 */
.hanahuda-card[data-role="hand-inactive"] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* 선택된 손패 - 파란 테두리로 표시. 낼 수 있는 패(빨강)/폭탄 가능(주황)/흔든 패(보라)와
   동시에 해당돼도 "지금 선택 중"이라는 상태가 가장 중요하므로 이 규칙을 뒤에 둬서 항상 이기게 한다. */
.hanahuda-card.is-selected {
  border-color: var(--select-blue);
  box-shadow: 0 0 0 2px rgba(41, 128, 185, 0.45);
  transform: translateY(-4px);
}

/* 지금 낼 수 있는 손패로 가져갈 수 있는 바닥패 강조 (초록 테두리) */
.hanahuda-card.floor-capturable {
  border-color: #27ae60;
  box-shadow: 0 0 0 2px rgba(39, 174, 96, 0.4);
}

/* 바닥패 선택 대기 중인 후보 2장 - floor-capturable과 같은 초록 계열이되, 선택을
   기다리는 중이라는 것을 알 수 있도록 살짝 펄스를 준다(별도 클래스로 구분) */
.hanahuda-card.is-floor-choice-candidate {
  border-color: #27ae60;
  box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.55);
  animation: floor-choice-pulse 1s ease-in-out infinite;
  cursor: pointer;
}

@keyframes floor-choice-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.55); }
  50%      { box-shadow: 0 0 0 6px rgba(39, 174, 96, 0.3); }
}

/* 바닥패 선택 안내 배너 */
.gt-floor-choice-banner {
  background: #fff3cd;
  color: #7a5f00;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  padding: 6px 10px;
  border-radius: 8px;
  margin-bottom: 6px;
}

/* 온라인 맞고 스타일: 내 손패가 가장 크고, 바닥패는 중간, 획득패 상세는 작게 표시해
   시선이 "바닥패 → 내 손패" 순으로 자연스럽게 가도록 카드 크기에 위계를 둔다 */
.hanahuda-card[data-role="hand"],
.hanahuda-card[data-role="hand-inactive"] {
  width: 62px;
}

.hanahuda-card[data-role="captured"] {
  width: 38px;
}

/* 폭탄권(더미 패) - 실제 화투패가 아니므로 점선 테두리로 구분 */
.bomb-token-card {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 62px;
  aspect-ratio: 5 / 8;
  border-radius: 6px;
  border: 1.5px dashed var(--warn);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  padding: 4px 2px;
  cursor: pointer;
  user-select: none;
  background: #fff8ee;
  color: var(--warn);
}

.bomb-token-card.is-inactive {
  opacity: 0.55;
  cursor: not-allowed;
}

.bomb-token-icon {
  font-size: 16px;
}

.bomb-token-label {
  font-size: 9px;
  margin-top: 2px;
}

/* 종류별 색상 */

.card-gwang  { background: #fffbe6; border-color: #f9ca24; }
.card-yeol   { background: #e8f5e9; border-color: #66bb6a; }
.card-tdi    { background: #e3f2fd; border-color: #64b5f6; }
.card-pi     { background: #fce4ec; border-color: #f48fb1; }

.card-month {
  font-size: 11px;
  font-weight: 800;
  color: #333;
}

.card-type-label {
  font-size: 9px;
  font-weight: 600;
  margin-top: 2px;
}

.card-gwang  .card-type-label { color: #c8a000; }
.card-yeol   .card-type-label { color: #2e7d32; }
.card-tdi    .card-type-label { color: #1565c0; }
.card-pi     .card-type-label { color: #c2185b; }

/* 뒤집힌 덱 카드 */

.deck-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  min-height: 54px;
  border-radius: 6px;
  border: 1.5px solid #888;
  background: repeating-linear-gradient(
    45deg,
    #c0392b,
    #c0392b 4px,
    #922b21 4px,
    #922b21 8px
  );
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: transform 0.1s;
}

.deck-card:hover {
  transform: scale(1.04);
}

/* 바닥 영역 레이블 */

.area-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* 고/스톱 선택 오버레이 */

.go-stop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.go-stop-modal {
  background: #fff;
  border-radius: 16px;
  padding: 24px 20px;
  max-width: 320px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  text-align: center;
}

.go-stop-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 6px;
}

.go-stop-score-info {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 18px;
  line-height: 1.5;
}

.go-stop-buttons {
  display: flex;
  gap: 10px;
}

.btn-go {
  flex: 1;
  background: var(--primary);
  color: #fff;
  padding: 13px;
  font-size: 16px;
  font-weight: 800;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn-go:hover { background: var(--primary-dark); }
.btn-go:active { transform: scale(0.97); }

.btn-stop {
  flex: 1;
  background: #2c3e50;
  color: #fff;
  padding: 13px;
  font-size: 16px;
  font-weight: 800;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn-stop:hover { background: #1a252f; }
.btn-stop:active { transform: scale(0.97); }

/* 획득패 상세 모달 - "상세보기"를 인라인으로 펼치지 않고 오버레이로 띄운다
   (펼쳐도 게임판의 손패/바닥패 위치가 전혀 밀리지 않는다) */
.captured-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 210;
  padding: 16px;
}

.captured-modal {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  max-width: 380px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.captured-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  font-size: 14px;
  color: var(--primary);
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.captured-modal-close {
  border: none;
  background: none;
  font-size: 16px;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 6px;
}

/* 게임 결과/나가리 오버레이 - #game-board 안에 길게 이어붙이지 않고 게임판 위에 띄운다 */
.game-result-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 220;
  padding: 16px;
}

.game-result-overlay-scroll {
  max-width: 420px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
}

/* 족보/특수 이벤트 토스트 - 화면 중앙에 잠깐 뜨는 축하 연출. pointer-events:none이라
   떠 있는 동안에도 손패/바닥패 클릭 등 게임 진행을 막지 않는다. 모든 모달/오버레이
   (go-stop 200, captured-modal 210, game-result 220)보다 위에 뜨도록 z-index를 가장 높게 둔다. */
.combo-toast {
  position: fixed;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.7);
  z-index: 300;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  border-radius: 18px;
  padding: 20px 32px;
  text-align: center;
  opacity: 0;
  animation: combo-toast-in 0.3s ease-out forwards;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  max-width: 85vw;
}

@keyframes combo-toast-in {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.combo-toast.combo-toast-out {
  animation: combo-toast-out 0.4s ease-in forwards;
}

@keyframes combo-toast-out {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
}

.combo-toast-icon {
  font-size: 40px;
  line-height: 1.2;
  margin-bottom: 6px;
}

.combo-toast-label {
  font-size: 22px;
  font-weight: 800;
  white-space: nowrap;
}

.combo-toast-points {
  font-size: 16px;
  font-weight: 700;
  color: #f1c40f;
  margin-top: 4px;
}

/* "계산 내역 보기" - 배수 계산식/이벤트 발생 턴/정산 계산식처럼 "왜 이 숫자인지"
   증명하는 세부 계산만 접어 두고, 승자/기본점수/박 적용여부/지불액/최종정산은 항상 보여준다 */
.btn-result-calc-toggle {
  display: block;
  width: 100%;
  margin: 4px 0 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: none;
  border: 1px dashed var(--primary);
  border-radius: 6px;
  padding: 5px 0;
  cursor: pointer;
}

.game-result-panel.calc-collapsed .result-calc-detail {
  display: none;
}

/* 게임 종료 결과 패널 */

.game-result-panel {
  background: #fdf5f5;
  border: 1.5px solid var(--primary);
  border-radius: 10px;
  padding: 14px;
  margin-top: 10px;
  position: relative;
  overflow: hidden;
}

/* 9차: 승리 축하 색종이 효과 - 결과 패널 안에서만 떨어지도록 패널 영역에 가둔다(overflow:hidden) */
.confetti-wrap {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -10px;
  width: 8px;
  height: 8px;
  opacity: 0.9;
  animation: confetti-fall 1.4s ease-in forwards;
}

@keyframes confetti-fall {
  0%   { transform: translateY(-10px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(260px) rotate(360deg); opacity: 0; }
}

/* 게임 결과가 점수판에 자동 반영되었음을 알리는 확인 문구 */
.game-result-saved-note {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 11px;
  font-weight: 700;
  color: var(--pos);
  text-align: center;
}

/* 게임 종료 후 아직 쓰이지 못하고 남은 덱/바닥패 안내("남은 패") */
.game-remaining-note {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 10px;
}

.game-result-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
  text-align: center;
}

/* 결과 화면을 "① 기본점수 → ② 배수·정산 → ③ 최종정산" 단계별 카드로 나눠서 보여준다 */
.game-result-section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.game-result-section:last-of-type {
  margin-bottom: 0;
}

/* ③ 최종 정산 카드 - 가장 마지막에 보이는 결론이므로 골드 톤으로 한 번 더 강조 */
.game-result-final {
  background: linear-gradient(180deg, rgba(241, 196, 15, 0.14), rgba(241, 196, 15, 0.02));
  border-color: var(--turn-glow);
}

.game-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

/* 9차: 승자 행 강조 - 기존 🏆 표시에 금색 배경/테두리를 덧붙여 한 번 더 눈에 띄게 함 */
.game-result-row.is-winner-row {
  background: linear-gradient(90deg, rgba(241, 196, 15, 0.18), rgba(241, 196, 15, 0.04));
  border-radius: 6px;
  padding-left: 6px;
  padding-right: 6px;
  border-bottom-color: transparent;
  font-weight: 700;
}

.game-result-row:last-child {
  border-bottom: none;
}

/* 4차: 박/배수/정산 표시 */

.game-settle-detail {
  font-size: 11px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  margin: 0 0 8px 0;
}

.bak-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 8px;
  margin: 0 4px 4px 0;
}

.bak-tag.applied {
  background: #f8d7da;
  color: #a94442;
}

.bak-tag.none {
  background: #efefef;
  color: var(--muted);
}

.game-settle-calc {
  margin-top: 4px;
  color: var(--text);
}

.game-settle-total {
  margin-top: 6px;
  font-weight: 700;
  border-top: 1.5px solid var(--primary);
  padding-top: 8px;
}

/* 패자 정산 칸 맨 위에 "OOO 지불: -3점"을 굵게 먼저 보여주는 headline */
.game-settle-headline {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

/* 4차 개선: 결과 화면 맨 위 "① 기본 점수" 요약 줄 - 흔들기 유무와 무관하게 항상 보인다 */
.game-calc-step {
  font-size: 12px;
  color: var(--primary);
  font-weight: 700;
  padding: 0 0 4px 0;
  text-align: center;
}

/* "② 배수 → ③ 상대별 지불은 아래에서 확인" 안내 문구 */
.game-calc-step-hint {
  font-size: 11px;
  color: var(--muted);
  padding: 0 0 8px 0;
  text-align: center;
}

/* 고박 독박 재분배가 있을 때만 나타나는 안내 줄(본인 부담+이전받음 / 대신 부담됨) */
.game-settle-gobak-note {
  font-size: 10.5px;
  font-weight: 600;
  color: #a94442;
  background: #f8d7da;
  border-radius: 5px;
  padding: 3px 6px;
  margin-bottom: 5px;
}

/* 패자 정산 칸 안에서 "② 배수" 단계를 표시하는 작은 라벨 */
.game-settle-step-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 3px;
}

/* 최종 정산 합계가 왜 그 값이 됐는지 "3점 + 3점 = +6점" 계산식을 보여주는 caption */
.game-settle-formula {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  margin-top: 2px;
}

/* 게임 결과 화면 하단 이동 버튼(점수판 보기 / 새 게임 시작) */
.game-result-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* 점수판 화면 상단 이동 버튼(게임으로 돌아가기 / 새 게임 시작) */
.score-game-actions {
  display: flex;
  gap: 8px;
}

.btn-result-action {
  flex: 1;
  padding: 11px;
  font-size: 13px;
  border-radius: 10px;
  background: #fff;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

.btn-result-action.is-primary {
  background: var(--primary);
  color: #fff;
}

.btn-result-action.is-primary:not(:disabled):hover {
  background: var(--primary-dark);
}

/* 게임 결과 화면 하단 간단 누적 점수판 요약 */
.mini-scoreboard {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.mini-scoreboard-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 6px;
}

.mini-scoreboard-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 3px 0;
}

/* 좁은 세로 화면(폰/태블릿 portrait)에서만 보이는 회전 권장 안내 - 가로 레이아웃이 적용되는
   조건(min-width:900px 또는 orientation:landscape)에서는 기본적으로 display:none. */
.rotate-suggestion {
  display: none;
}

@media (max-width: 899px) and (orientation: portrait) {
  .rotate-suggestion {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-dark);
    background: #fdf0f0;
    border: 1px dashed var(--primary);
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 10px;
    text-align: center;
  }
}

/* 게임 진행 화면 상단 색상 범례 */
.game-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 10px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: #fff;
  border: 2px solid transparent;
}

.legend-swatch.legend-red {
  border-color: var(--primary);
}

.legend-swatch.legend-green {
  border-color: #27ae60;
}

.legend-swatch.legend-yellow {
  border-color: var(--turn-glow);
}

.legend-swatch.legend-blue {
  border-color: var(--select-blue);
}


/* ── 2차: 플레이어 통계 화면 ── */

.stats-player-card {
  background: #fbfbfb;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.stats-player-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.stats-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 3px 0;
}

.stats-row-divider {
  border-top: 1px dashed var(--border);
  margin: 6px 0;
}

/* ── 스크롤바 ── */

.history-scroll::-webkit-scrollbar { height: 3px; }
.history-scroll::-webkit-scrollbar-track { background: var(--border); }
.history-scroll::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 2px; }

/* 9차: 아주 좁은 화면(구형 소형 폰 등)에서 여백/카드 크기를 살짝 줄여 답답해 보이지 않게 함.
   카드 영역은 이미 flex-wrap으로 줄바꿈되어 가로 넘침은 없지만, 폭이 너무 좁으면 줄바꿈이
   과도하게 자주 일어나 손패가 지나치게 길어지는 것을 완화한다. */
@media (max-width: 359px) {
  .main-content {
    padding: 10px 8px 32px;
  }
  .hanahuda-card {
    width: 42px;
  }
  .hanahuda-card[data-role="hand"],
  .hanahuda-card[data-role="hand-inactive"],
  .bomb-token-card {
    width: 54px;
  }
  .hanahuda-card[data-role="captured"] {
    width: 32px;
  }
  .hanahuda-card[data-role="captured-mini"] {
    width: 22px;
  }
}

/* ── 데스크톱 ── */

@media (min-width: 541px) {
  .app {
    margin: 20px auto;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    min-height: auto;
  }
}

/* 게임판 가로(랜드스케이프) 레이아웃 - PC/가로 태블릿은 항상, 폰/태블릿은 가로로 돌렸을 때
   적용된다(showScreen이 게임 화면 진입/이탈 시 .app에 is-game-active를 토글). 상대1(좌) /
   바닥패+덱(중앙) / 상대2(우)를 한 줄로, 그 아래 최근 이벤트, 그 아래 내 획득패+손패 순으로
   배치해 스크롤 없이 한 화면에 들어오게 한다. 다른 화면(점수판/통계)과 세로 폰 화면은
   기존 레이아웃 그대로 유지된다(전부 .app.is-game-active로 스코프됨).
   min-width: 900px는 PC/가로 태블릿, orientation: landscape는 폰/태블릿을 가로로 돌린
   경우까지 함께 잡기 위함이다(둘 중 하나만 만족해도 적용). */
@media (min-width: 900px), (orientation: landscape) {
  .app.is-game-active {
    max-width: 1400px;
    /* @media (min-width:541px)의 .app { margin: 20px auto } 를 0으로 되돌려야 실제로
       뷰포트 전체 높이를 스크롤 없이 채울 수 있다(margin이 남아있으면 그 몫만큼 넘친다) */
    margin: 0 auto;
    height: 100vh;
    height: 100dvh; /* 모바일 브라우저 주소창을 제외한 실제 보이는 높이 */
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .app.is-game-active .app-header {
    padding: 6px 14px;
    flex-shrink: 0;
  }
  .app.is-game-active .app-title {
    font-size: 14px;
  }
  .app.is-game-active .main-content {
    flex: 1;
    min-height: 0;
    padding: 6px 10px;
    gap: 4px;
  }
  .app.is-game-active #screen-game {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }
  .app.is-game-active #section-game-play {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 8px 10px;
  }
  .app.is-game-active #section-game-play .card-title {
    margin-bottom: 2px;
    font-size: 12px;
    flex-shrink: 0;
  }
  .app.is-game-active .game-legend {
    margin-bottom: 4px;
    gap: 8px;
    flex-shrink: 0;
  }
  .app.is-game-active .game-status-bar {
    padding: 4px 10px;
    margin-bottom: 4px;
    font-size: 12px;
    flex-shrink: 0;
  }
  .app.is-game-active #game-board {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .gt-root {
    flex: 1;
    min-height: 0;
    padding: 10px 16px;
    gap: 6px;
    /* 폰을 가로로 돌린 것처럼 세로 공간이 극히 작을 때(예: 390px) 아래 min-height들의
       합이 실제 배정된 공간보다 커질 수 있다 - 그럴 땐 각 행이 찌그러져 서로 겹치는 대신
       .gt-root 전체가 세로 스크롤되게 하는 최후의 안전장치. */
    overflow-y: auto;
  }

  /* 상대1 | 바닥패+덱 | 상대2 - 한 줄, 중앙(바닥패+덱)을 가장 넓게.
     아래 .gt-player-area와 flex-grow 비율(3:8)로 남는 세로 공간을 나눠 갖는다 - 뷰포트
     높이가 다양한 PC/태블릿/폰 가로에서도 고정 vh값 없이 자동으로 맞는 비율을 유지한다.
     내 손패를 한눈에 보는 것이 상대 패널보다 우선이라 손패 쪽에 더 많은 비율을 준다 -
     상대 패널이 눌려서 내용이 넘치면 .gt-seat 자체 스크롤(overflow-y:auto)로 흡수한다.
     min-height는 바닥패 카드 한 줄(약 80px)+라벨이 실제로 보이기 위한 최소값 - 이게 없으면
     flex-grow 비율 계산 결과 0에 가깝게 눌려서 바닥패/상대 패널이 서로 겹쳐 보이는 문제가
     있었다(따라서 위 .gt-root의 overflow-y:auto가 이 min-height를 지켜주는 짝 역할을 한다). */
  .gt-top-row {
    flex: 3 1 0;
    min-height: 130px;
    grid-template-columns: 1fr 2fr 1fr;
    grid-template-areas: "seat1 center seat2";
    gap: 16px;
  }
  .gt-seat {
    min-height: 0;
    overflow-y: auto;
  }
  .gt-center {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .gt-center-row {
    flex: 1;
    min-height: 0;
    justify-content: center;
    align-items: center;
    gap: 28px;
  }
  .gt-floor-area {
    flex: 1;
    min-width: 0;
    max-height: 100%;
    overflow-y: auto;
    align-content: center;
  }

  .gt-mid-row {
    flex-shrink: 0;
  }

  /* 내 획득패 + 손패 - .gt-top-row와 3:8 비율로 세로 공간을 나눠 가지며(손패를 한눈에 보기
     쉽게 상대 패널보다 훨씬 더 넉넉히) 대부분의 PC/태블릿/폰 가로 화면에서는 이 안에 그대로
     들어간다. 여기 자체에는 overflow-y를 주지 않는다 - .gt-player-area와 .gt-root의 스크롤이
     동시에 걸리면 이중 스크롤이 되어 오히려 손패를 찾기 어려워지므로, 정말 못 담는 극단적으로
     낮은 화면(예: 폰을 가로로 눕혔을 때)에서는 아래 .gt-top-row min-height와 맞물려 .gt-root
     전체가 스크롤되는 쪽으로 단일화한다. */
  .gt-player-area {
    flex: 8 1 0;
    min-height: 150px;
  }

  /* 가로 화면은 세로보다 여유가 있으니 카드를 조금 더 크게 */
  .gt-hand .hanahuda-card {
    width: 64px;
  }
  .gt-hand .hanahuda-card {
    margin-left: -16px;
  }
}
