/* サンマ対局＆初心者学習ナビ CSS (牌レイアウト改善版) */

:root {
  --bg-table: radial-gradient(circle, #1e563b 0%, #0d281a 100%);
  --bg-panel: rgba(18, 30, 24, 0.9);
  --color-gold: #f39c12;
  --color-green: #2ecc71;
  --color-red: #e74c3c;
  --color-blue: #3498db;
  --text-main: #ecf0f1;
  --text-sub: #bdc3c7;
  --tile-width: 48px;
  --tile-height: 70px;
  --tile-radius: 6px;
}

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

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--bg-table);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ヘッダー */
.app-header {
  background: rgba(10, 20, 15, 0.92);
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid rgba(243, 156, 18, 0.4);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
}

.logo {
  font-family: 'Shippori Mincho', serif;
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--color-gold);
  letter-spacing: 1px;
}

.game-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 0.95rem;
}

.dora-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(243, 156, 18, 0.5);
}

.dora-label {
  font-size: 0.85rem;
  color: var(--color-gold);
  font-weight: bold;
}

.header-actions {
  display: flex;
  gap: 10px;
}

/* ボタン基本設計 */
.btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.btn-primary { background: #27ae60; color: white; }
.btn-secondary { background: #34495e; color: white; }
.btn-action { font-size: 1rem; padding: 10px 22px; border-radius: 20px; box-shadow: 0 4px 10px rgba(0,0,0,0.4); }
.btn-riichi { background: #e67e22; color: white; }
.btn-tsumo { background: #f1c40f; color: #2c3e50; }
.btn-ron { background: #e74c3c; color: white; }
.btn-pon { background: #3498db; color: white; }
.btn-nuki { background: #9b59b6; color: white; }
.btn-pass { background: #7f8c8d; color: white; }

/* メインコンテナ */
.game-container {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 310px;
  grid-template-rows: auto 1fr auto;
  gap: 15px;
  padding: 15px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* 対戦相手領域 */
.opponent-top {
  grid-column: 1 / 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0, 0, 0, 0.25);
  padding: 10px;
  border-radius: 10px;
}

.table-center {
  grid-column: 1 / 2;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 15px;
  align-items: center;
}

.opponent-left {
  background: rgba(0, 0, 0, 0.25);
  padding: 10px;
  border-radius: 10px;
}

.player-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--text-sub);
}

.score-badge {
  background: #2c3e50;
  color: #f1c40f;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: bold;
  font-size: 0.85rem;
  border: 1px solid rgba(241, 196, 15, 0.4);
}

.score-player {
  font-size: 1.05rem;
  padding: 4px 12px;
}

.player-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.status-panel {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

.status-message {
  font-size: 1.15rem;
  color: #f1c40f;
  font-weight: bold;
  line-height: 1.4;
}

/* プレイヤー領域 */
.player-area {
  grid-column: 1 / 2;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 15px;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.river-container {
  margin-bottom: 10px;
}

.river-label {
  font-size: 0.8rem;
  color: var(--text-sub);
}

.discard-river {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 50px;
  padding: 6px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
}

.action-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 10px 0;
  min-height: 42px;
}

.hand-container {
  display: flex;
  align-items: flex-end;
  gap: 15px;
  justify-content: center;
  margin-top: 10px;
}

.hand-tiles {
  display: flex;
  gap: 4px;
}

.drawn-tile-slot {
  margin-left: 12px;
}

/* ★ リアル本物麻雀牌スタイル（絵柄中心・文字下部配置） ★ */
.tile {
  width: var(--tile-width);
  height: var(--tile-height);
  background: linear-gradient(145deg, #ffffff 0%, #f7f9fa 50%, #e1e8ed 100%);
  border-radius: var(--tile-radius);
  border-bottom: 6px solid #1e824c;
  box-shadow: 
    0 5px 10px rgba(0, 0, 0, 0.5), 
    inset 0 1px 2px rgba(255, 255, 255, 1),
    inset 0 -2px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 5px 2px 2px 2px;
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.15s ease;
  position: relative;
  border-right: 1px solid rgba(0,0,0,0.1);
  border-top: 1px solid rgba(255,255,255,0.9);
}

.tile:hover {
  transform: translateY(-10px) scale(1.04);
  box-shadow: 
    0 12px 20px rgba(0, 0, 0, 0.7), 
    inset 0 1px 3px rgba(255, 255, 255, 1);
  z-index: 10;
}

.drawn-tile .tile {
  border: 2px solid var(--color-gold);
  box-shadow: 0 0 12px rgba(243, 156, 18, 0.8);
}

/* 絵柄を中心エリアに大きく配置 */
.tile-glyph {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: 'Shippori Mincho', 'Yuji Syuku', serif;
  font-size: 1.85rem;
  font-weight: bold;
  line-height: 1;
  text-shadow: 0 1px 1px rgba(0,0,0,0.15);
}

/* 名称ガイド文字を牌の最下部にスッキリ配置 */
.tile-name-label {
  font-size: 0.6rem;
  font-weight: 700;
  color: #333333;
  background: rgba(220, 224, 230, 0.7);
  width: 100%;
  text-align: center;
  padding: 1px 0;
  border-radius: 0 0 2px 2px;
  letter-spacing: -0.5px;
}

/* リアル麻雀牌の彩色 */
.color-pin { color: #1f4e78; }
.color-sou { color: #1e824c; }
.color-man { color: #b03a2e; }
.color-kaze { color: #2c3e50; }
.color-haku { color: #95a5a6; }
.color-hatsu { color: #27ae60; }
.color-chun { color: #c0392b; }

.nuki-badge, .meld-badge {
  background: rgba(155, 89, 182, 0.3);
  border: 1px solid #9b59b6;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.8rem;
  color: #e84393;
}

/* アシストパネル */
.assist-panel {
  grid-column: 2 / 3;
  grid-row: 1 / 4;
  background: var(--bg-panel);
  border-radius: 12px;
  padding: 15px;
  border: 1px solid rgba(243, 156, 18, 0.4);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.assist-header {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--color-gold);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
}

.assist-shanten {
  font-size: 1rem;
  font-weight: bold;
  background: rgba(39, 174, 96, 0.2);
  padding: 10px;
  border-radius: 8px;
  border-left: 4px solid var(--color-green);
}

.assist-furiten {
  font-size: 0.85rem;
  background: rgba(231, 76, 60, 0.25);
  padding: 10px;
  border-radius: 8px;
  border-left: 4px solid var(--color-red);
  color: #ff7675;
}

.assist-effective {
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 10px;
  border-radius: 8px;
  line-height: 1.4;
}

.assist-effective span {
  color: #f1c40f;
  font-weight: bold;
}

.assist-hints-title {
  font-size: 0.9rem;
  color: var(--text-sub);
  margin-top: 5px;
}

.assist-hints {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hint-pill {
  font-size: 0.8rem;
  background: rgba(52, 152, 219, 0.2);
  color: #74b9ff;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid rgba(116, 185, 255, 0.3);
}

/* モーダル */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-card {
  background: #1e272e;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px;
  border: 1px solid var(--color-gold);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 10px;
}

.modal-header h2 {
  font-size: 1.2rem;
  color: var(--color-gold);
}

.modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-body {
  margin-top: 15px;
  line-height: 1.6;
  font-size: 0.95rem;
}

.modal-body h3 {
  color: var(--color-green);
  margin-top: 15px;
  margin-bottom: 5px;
}

.modal-body ul, .modal-body ol {
  padding-left: 20px;
}

/* レスポンシブ対応 (スマホ用) */
@media (max-width: 900px) {
  :root {
    --tile-width: 38px;
    --tile-height: 56px;
  }

  .game-container {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .assist-panel {
    grid-column: 1 / 2;
    grid-row: auto;
  }

  .table-center {
    grid-template-columns: 1fr;
  }
}
