/* 贪吃蛇 · 娱乐小游戏（纯积分，无任何真实货币）
   视觉沿用 doudizhu / uno / slot：暗绿毛毡、白卡片、金点缀 */

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

:root {
  --felt: #1c6b46;
  --felt-dark: #145034;
  --panel: #fff;
  --panel-border: #d9e2dc;
  --ink: #1c2b24;
  --accent: #0f8a5f;
  --accent-dark: #0b6b49;
  --warn: #c0392b;
  --gold: #d4a017;
  --gold-bright: #f3ce62;
  --gold-pale: #fff8df;
  --gold-deep: #8a6400;
  --red: #d63031;
  --gray: #7a8a80;
  --bg-deep: #07180f;
}

html { color-scheme: dark; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: linear-gradient(160deg, #07180f 0%, #10281d 48%, #07180f 100%);
  background-attachment: fixed;
  color: var(--ink);
  min-height: 100vh;
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
.hint { font-size: 12px; color: var(--gray); line-height: 1.6; margin-top: 8px; }

.app { max-width: 1060px; margin: 0 auto; padding: 16px 14px 26px; }

/* ---------- 顶栏 ---------- */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 12px; color: #eaf5ee; }
.brand-badge {
  width: 46px; height: 46px; border-radius: 12px; font-size: 26px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--felt) 0%, #0b3a27 100%);
  border: 1px solid rgba(243, 206, 98, .45);
}
.brand-copy h1 { font-size: 21px; letter-spacing: 1px; }
.brand-en { font-size: 11px; color: var(--gold-bright); letter-spacing: 2px; margin-left: 6px; }
.slogan { font-size: 12px; color: #a9c9b6; margin-top: 2px; }
.slogan b { color: var(--gold-bright); }
.topbar-side { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.conn-tag {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border-radius: 999px; padding: 5px 12px; font-size: 12px; border: 1px solid #3d5c4c;
  background: rgba(255, 255, 255, .06); color: #cfe3d7;
}
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: #888; }
.conn-tag.online .conn-dot { background: #35d07f; }
.conn-tag.connecting .conn-dot { background: var(--gold-bright); }
.conn-tag.offline .conn-dot { background: var(--red); }

.settle-strip { display: flex; gap: 8px; }
.settle-item {
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: 10px;
  padding: 4px 12px; font-size: 11px; color: var(--gray); text-align: center; min-width: 76px;
}
.settle-item strong { display: block; font-size: 15px; color: var(--gold-deep); }

/* ---------- 布局 ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
.side-col { display: flex; flex-direction: column; gap: 12px; }

/* ---------- HUD ---------- */
.hud { display: flex; gap: 8px; margin-bottom: 10px; }
.hud-item {
  flex: 1; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 10px; padding: 6px 10px; color: #b7d6c4; font-size: 11px; text-align: center;
}
.hud-item b { display: block; font-size: 17px; color: var(--gold-bright); margin-top: 2px; }

/* ---------- 棋盘：毛毡底 + 40×40 交替格纹（2 行格纹 CSS）+ 透明画布 ---------- */
.board-wrap {
  position: relative; width: 100%; max-width: 560px; aspect-ratio: 1 / 1;
  margin: 0 auto; border-radius: 14px; overflow: hidden; touch-action: none;
  border: 3px solid rgba(212, 160, 23, .55);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45), inset 0 0 44px rgba(0, 0, 0, .35);
  background-color: var(--felt-dark);
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .05) 0 40px, transparent 40px 80px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .05) 0 40px, transparent 40px 80px);
}
#board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.board-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 8px;
  align-items: center; justify-content: center; text-align: center; padding: 20px;
  background: rgba(7, 24, 15, .55); color: #eaf5ee; pointer-events: none;
}
.ov-title { font-size: 20px; font-weight: 800; color: var(--gold-bright); text-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
.ov-sub { font-size: 12px; color: #b7d6c4; }

/* 吃到食物：『+1』上浮淡出 */
#floats { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.plus-one {
  position: absolute; transform: translate(-50%, -50%);
  font-size: 15px; font-weight: 800; color: var(--gold-bright);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
  animation: rise .95s ease-out forwards;
}
@keyframes rise {
  0% { opacity: 0; margin-top: 0; }
  18% { opacity: 1; }
  100% { opacity: 0; margin-top: -34px; }
}

/* ---------- 卡片 / 按钮（沿用 slot） ---------- */
.card-panel {
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 14px; padding: 14px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .28);
}
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.panel-head h2 { font-size: 15px; color: var(--ink); }
.tag { font-size: 11px; color: var(--accent); background: rgba(15, 138, 95, .1); border-radius: 999px; padding: 3px 10px; }
.tag.gold { color: var(--gold-deep); background: var(--gold-pale); }

.btn {
  background: var(--accent); color: #fff; border: 1px solid transparent;
  padding: 10px 18px; border-radius: 10px; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: .15s; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:hover { background: var(--accent-dark); transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.big { font-size: 17px; padding: 13px 22px; }
.btn.alt { background: #2563a8; }
.btn.warn { background: var(--gold); color: #332500; }
.btn.warn:hover { background: #b58910; }
.btn.gold {
  background: linear-gradient(180deg, #f8dc86 0%, var(--gold) 55%, #ac7c08 100%);
  color: #2f2300; border-color: #ffe8a5; text-shadow: 0 1px 0 rgba(255, 255, 255, .35);
}
.btn.ghost { background: transparent; color: #cfe3d7; border-color: #3d5c4c; }
.btn.ghost:hover { background: rgba(255, 255, 255, .08); }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 8px; }

.bet-levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 10px; }
.bet-level {
  border: 1px solid var(--panel-border); background: #f4faf6; color: var(--ink);
  border-radius: 8px; padding: 9px 0; font-size: 13px; font-weight: 700; cursor: pointer; transition: .12s;
}
.bet-level:hover { border-color: var(--accent); }
.bet-level.active { background: var(--gold-pale); border-color: var(--gold); color: var(--gold-deep); }
.bet-level:disabled { opacity: .4; cursor: not-allowed; }

.start-row { display: flex; gap: 8px; }
.start-row .btn.gold { flex: 1; }
#btn-quit { width: 100%; margin-top: 8px; }

/* ---------- 账号 ---------- */
.acct-row { display: flex; flex-direction: column; gap: 6px; }
.acct-btns { display: flex; gap: 8px; margin-top: 8px; }
.acct-info { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--ink); }
.acct-info span { font-size: 12px; color: var(--gray); }
input {
  padding: 9px 11px; border: 1px solid #b9ccc1; border-radius: 8px; font-size: 14px;
  outline: none; background: #fbfdfc; color: var(--ink); min-width: 0;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 138, 95, .12); }

/* ---------- 奖励曲线 ---------- */
.tiers { display: flex; flex-direction: column; gap: 4px; }
.tier-row { display: flex; justify-content: space-between; font-size: 12.5px; padding: 4px 8px; border-radius: 6px; background: #f4faf6; color: var(--ink); }
.tier-row b { color: var(--gold-deep); }

/* ---------- 弹窗（结算白面板） ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background: rgba(7, 24, 15, .62); padding: 16px;
}
.modal-card {
  background: var(--panel); border-radius: 16px; padding: 20px;
  width: min(360px, 92vw); box-shadow: 0 18px 50px rgba(0, 0, 0, .5);
  border: 1px solid var(--gold);
}
.modal-btns { display: flex; gap: 8px; margin-top: 14px; }
.modal-btns .btn { flex: 1; }

.settle-head { display: flex; gap: 6px; margin-bottom: 12px; }
.sh-item { flex: 1; text-align: center; background: var(--gold-pale); border-radius: 8px; padding: 6px 4px; font-size: 10.5px; color: var(--gold-deep); }
.sh-item b { display: block; font-size: 15px; color: var(--ink); margin-top: 2px; }
.settle-title { text-align: center; font-size: 16px; color: var(--ink); font-weight: 700; }
.settle-mult { text-align: center; font-size: 13px; color: var(--gray); margin-top: 4px; }
.settle-reward { text-align: center; font-size: 38px; font-weight: 900; color: var(--gold-deep); margin: 6px 0 2px; }
.settle-net { text-align: center; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.net-pos { color: var(--gold-deep); }
.net-zero { color: var(--gray); }
.net-neg { color: var(--red); }

/* ---------- Toast（金色提速提示） ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px);
  background: rgba(20, 40, 30, .95); color: #eaf5ee; border: 1px solid #3d5c4c;
  padding: 10px 18px; border-radius: 10px; font-size: 14px; opacity: 0;
  transition: .25s; pointer-events: none; z-index: 60; max-width: 86vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.gold {
  background: linear-gradient(180deg, #f8dc86, var(--gold)); color: #2f2300;
  border-color: #ffe8a5; font-weight: 800;
}

/* ---------- 页脚 / 响应式 ---------- */
.footer {
  margin-top: 18px; text-align: center; color: #7a9a88; font-size: 12px;
  display: flex; flex-direction: column; gap: 4px;
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .hud-item b { font-size: 15px; }
  .bet-levels { grid-template-columns: repeat(5, 1fr); }
}
