/* 记忆翻牌（与斗地主/UNO 同一套视觉语言：暗绿毛毡 + 白卡片 + 金点缀） */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --felt: #1c6b46;
  --felt-dark: #145034;
  --panel: #fff;
  --panel-border: #d9e2dc;
  --ink: #1c2b24;
  --accent: #0f8a5f;
  --warn: #c0392b;
  --gold: #d4a017;
  --gold-bright: #f3ce62;
  --gold-pale: #fff8df;
  --gold-deep: #8a6400;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: linear-gradient(160deg, #10281d 0%, #173a2a 55%, #10281d 100%);
  color: var(--ink); min-height: 100vh;
}
.app { max-width: 760px; margin: 0 auto; padding: 16px; }
.screen { display: none; }
.screen.active { display: block; }
.hidden { display: none !important; }

/* ---------- 通用 ---------- */
.btn {
  background: var(--accent); color: #fff; border: none; padding: 10px 22px;
  border-radius: 10px; font-size: 15px; cursor: pointer; transition: .15s; font-weight: 600;
}
.btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.big { font-size: 19px; padding: 14px 34px; }
.btn.small { font-size: 13px; padding: 6px 14px; }
.btn.warn { background: linear-gradient(180deg, var(--gold-bright), var(--gold)); color: var(--gold-deep); }
.btn.gold { background: linear-gradient(180deg, var(--gold-bright), var(--gold)); color: var(--gold-deep); border: 2px solid var(--gold-deep); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--panel-border); }
.modal .btn.ghost { color: #666; }

.head { text-align: center; color: #fff; padding: 10px 0 18px; }
.head h1 { font-size: 30px; letter-spacing: 2px; text-shadow: 0 2px 6px rgba(0,0,0,.4); }
.tagline { color: var(--gold-bright); margin-top: 4px; font-size: 14px; }
.slogan { margin-top: 8px; font-size: 12px; color: rgba(255,255,255,.75); }

.card-panel {
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 14px; padding: 16px; margin-bottom: 14px;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
}
.panel-head {
  display: flex; justify-content: space-between; font-weight: 700;
  color: var(--gold-deep); border-bottom: 2px solid var(--gold-pale);
  padding-bottom: 8px; margin-bottom: 12px;
}
.row { display: flex; gap: 8px; margin-top: 10px; }
.hint { font-size: 12px; color: #7a8a80; margin-top: 10px; line-height: 1.6; }

.acct-form input {
  width: 100%; padding: 9px 12px; margin-bottom: 8px; border: 1px solid var(--panel-border);
  border-radius: 8px; font-size: 14px;
}
.acct-form .row { margin-top: 2px; }
.acct-info p { font-size: 14px; line-height: 1.7; }

.bet-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.bet-row .btn { flex: 1; min-width: 84px; }
.bet-row .btn.on { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- 牌桌 ---------- */
.topbar {
  display: flex; gap: 18px; align-items: center; justify-content: center;
  background: var(--felt-dark); color: #fff; border-radius: 12px;
  padding: 10px 14px; margin-bottom: 14px; font-size: 15px;
}
.topbar b { color: var(--gold-bright); }
#t-time.warn { color: var(--warn); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }

.grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  max-width: 560px; margin: 0 auto; perspective: 600px;
}
.cell { aspect-ratio: 1; cursor: pointer; }
.cell-inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d; transition: transform .3s;
}
.cell.flipped .cell-inner, .cell.matched .cell-inner { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; border-radius: 12px;
  backface-visibility: hidden; display: flex; align-items: center; justify-content: center;
  font-size: 40px; user-select: none;
}
.back {
  background: var(--felt); border: 2px solid var(--gold);
  box-shadow: inset 0 0 18px rgba(0,0,0,.45), 0 3px 8px rgba(0,0,0,.3);
  color: var(--gold-bright); font-size: 34px; font-weight: 800;
}
.front { background: #fff; border: 1px solid var(--panel-border); transform: rotateY(180deg); }

.cell.matched .front { border: 2px solid var(--gold); opacity: .7; }
.cell.matched { animation: pop .35s ease; pointer-events: none; }
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.15); } 100% { transform: scale(1); } }

.cell.shake { animation: shake .25s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); } 50% { transform: translateX(4px); }
  75% { transform: translateX(-4px); }
}

/* ---------- 结算卡 ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(6, 20, 14, .72);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal-card {
  position: relative; background: var(--panel); border-radius: 16px; overflow: hidden;
  padding: 34px 44px; text-align: center; border: 2px solid var(--gold);
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
}
.modal-card h2 { color: var(--gold-deep); font-size: 26px; margin-bottom: 10px; }
.settle-detail { font-size: 15px; line-height: 1.8; }
.settle-chips { font-size: 20px; font-weight: 800; color: var(--accent); margin: 12px 0 18px; }
.modal-card .btn { margin: 0 6px; }

.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i {
  position: absolute; top: -14px; width: 9px; height: 14px;
  background: var(--gold); animation: fall 2.2s linear infinite;
}
@keyframes fall {
  0% { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(420px) translateX(var(--dx, 0)) rotate(540deg); opacity: 0; }
}

footer { text-align: center; color: rgba(255,255,255,.55); font-size: 12px; padding: 18px 0 8px; }
