/* 台灣麻將「聽牌猜張」頁面樣式（僅此頁使用） */
:root {
  --bg: #0f172a;         /* slate-900 */
  --fg: #e2e8f0;         /* slate-200 */
  --muted: #94a3b8;      /* slate-400 */
  --accent: #38bdf8;     /* sky-400 */
  --ok: #22c55e;         /* green-500 */
  --bad: #ef4444;        /* red-500 */
  --tile: #1f2937;       /* slate-800 */
  --tile-border: #334155;/* slate-700 */
  --tile-face: #f8fafc;  /* slate-50 */
  --tile-edge: #e2e8f0;  /* slate-200 */
  --man: #ef4444;        /* red-500 */
  --pin: #2563eb;        /* blue-600 */
  --sou: #16a34a;        /* green-600 */
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; padding: 16px;
  background: var(--bg); color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans TC', 'Helvetica Neue', Arial, 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
}

.page-header h1 { margin: 0 0 12px; font-size: 20px; }
.page-footer { margin-top: 24px; color: var(--muted); }

.hand-section, .guess-section, .result-section { margin-bottom: 16px; }
h2 { font-size: 16px; margin: 12px 0; color: var(--fg); }

.hand { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; background: #0b1220; border: 1px solid var(--tile-border); border-radius: 8px; }

.tile, .tile-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 56px; padding: 0;
  background: transparent; border: none;
  user-select: none; cursor: default;
}

/* 牌面 */
.tile-rect {
  position: relative;
  width: 38px; height: 54px;
  background: var(--tile-face);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px var(--tile-edge), 0 2px 0 rgba(0,0,0,0.25);
}

.tile-img { width: 38px; height: 54px; display: block; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--tile-edge), 0 2px 0 rgba(0,0,0,0.25); }

.face { position: absolute; inset: 3px; display: grid; place-items: center; }

/* 萬子：紅字 */
.man .man-text { font-weight: 700; color: var(--man); font-size: 16px; letter-spacing: 1px; }
.man .man-text .wan { margin-left: 1px; }

/* 筒子：藍色圓點 */
.pip-grid { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 10px; gap: 2px; width: 30px; }
.pin .pip-grid { grid-auto-rows: 12px; }
.grid-cell { display: grid; place-items: center; }
.pin-ring { width: 10px; height: 10px; border-radius: 999px; border: 2px solid var(--pin); background: transparent; }
.pin-one { position: relative; width: 28px; height: 28px; display: grid; place-items: center; }
.pin-one-ring { width: 22px; height: 22px; border-radius: 999px; border: 3px solid var(--pin); }
.pin-one-dot { position: absolute; width: 6px; height: 6px; border-radius: 999px; background: #93c5fd; }

/* 索子：綠色竹節 */
.sou .pip-grid { grid-auto-rows: 12px; }
.sou-stick { width: 6px; height: 12px; background: var(--sou); border-radius: 3px; position: relative; }
.sou-stick::before, .sou-stick::after { content: ""; position: absolute; left: 50%; transform: translateX(-50%); width: 4px; height: 2px; border-radius: 1px; background: #bbf7d0; }
.sou-stick::before { top: 2px; }
.sou-stick::after { bottom: 2px; }
.sou-one { position: relative; width: 26px; height: 26px; }
.sou-bird-body { position: absolute; inset: 5px; background: #2563eb; border-radius: 6px 6px 10px 10px; }
.sou-bird-crown { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); width: 6px; height: 6px; background: #dc2626; border-radius: 999px; }

/* 字牌 */
.honor .honor-text { font-weight: 800; font-size: 16px; color: #111827; }
.honor .honor-text.honor-red { color: #dc2626; }
.honor .honor-text.honor-green { color: #16a34a; }

.palette { display: grid; grid-template-columns: repeat(17, minmax(40px, 1fr)); gap: 6px; }
@media (max-width: 768px) { .palette { grid-template-columns: repeat(9, minmax(36px, 1fr)); } }

.tile-btn { cursor: pointer; transition: transform 0.05s ease; }
.tile-btn.selected { outline: 2px solid var(--accent); transform: translateY(-1px); }
.tile-btn.correct { outline: 2px solid var(--ok); }
.tile-btn.wrong { outline: 2px solid var(--bad); }
.tile-btn.disabled { opacity: 0.35; cursor: not-allowed; }

.controls { margin-top: 10px; display: flex; gap: 10px; flex-wrap: wrap; }
.btn { padding: 8px 12px; border-radius: 8px; border: 1px solid var(--tile-border); background: #0b1220; color: var(--fg); cursor: pointer; }
.btn-primary { background: var(--accent); color: #0b1220; border-color: transparent; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.result { min-height: 24px; }
.result .good { color: var(--ok); }
.result .bad { color: var(--bad); }
