/* =====================================================================
   Go Online — giao diện "sặc sỡ & có khối" (nạp SAU phần <style> của base.html)
   Bảng màu: cam hoàng hôn → hồng (nút chính), ngọc lam (nhấn phụ), tím than (thanh đầu trang),
   nền kem ấm có hoạ tiết lưới bàn cờ mờ. Chỉ đổi giao diện, không đổi bố cục / chức năng.
   ===================================================================== */
:root {
  --bg: #fff5e6;
  --card: #ffffff;
  --ink: #2a1f3d;
  --muted: #76688f;
  --accent: #ff6a3d;
  --line: #eadff5;
  --grad-hot: linear-gradient(135deg, #ffb238 0%, #ff6a3d 45%, #e8336f 100%);
  --grad-cool: linear-gradient(135deg, #2ee6c5 0%, #12a8c9 55%, #4c6fff 100%);
  --grad-night: linear-gradient(120deg, #2b1846 0%, #4a2177 45%, #1d5c8c 100%);
  --grad-gold: linear-gradient(135deg, #ffe08a 0%, #ffb627 50%, #e88a00 100%);
  --shadow-1: 0 1px 2px rgba(42, 31, 61, .06), 0 4px 10px rgba(42, 31, 61, .07);
  --shadow-2: 0 2px 4px rgba(42, 31, 61, .06), 0 10px 26px rgba(74, 33, 119, .14), 0 22px 48px rgba(255, 106, 61, .08);
  --shadow-3: 0 6px 14px rgba(42, 31, 61, .18), 0 24px 60px rgba(74, 33, 119, .28);
}

/* ---------- Nền: kem ấm + quầng màu + lưới bàn cờ mờ ---------- */
body {
  background:
    radial-gradient(900px 520px at 6% -8%, rgba(255, 178, 56, .38), transparent 70%),
    radial-gradient(760px 480px at 104% 4%, rgba(46, 230, 197, .30), transparent 70%),
    radial-gradient(900px 600px at 50% 115%, rgba(232, 51, 111, .16), transparent 70%),
    repeating-linear-gradient(0deg, rgba(122, 82, 40, .055) 0 1px, transparent 1px 34px),
    repeating-linear-gradient(90deg, rgba(122, 82, 40, .055) 0 1px, transparent 1px 34px),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
}

/* ---------- Thanh đầu trang ---------- */
header {
  background: var(--grad-night);
  border-bottom: 0;
  box-shadow: 0 6px 24px rgba(43, 24, 70, .35);
  position: relative;
  z-index: 5;
}
header a, header .brand { color: #fff; }
header::after {                               /* dải màu sáng dưới thanh đầu */
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 4px; background: var(--grad-hot);
}
.brand { font-size: 20px; letter-spacing: .3px; text-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
.langs { border-color: rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .08); border-radius: 999px; }
.langs a { color: #fff; }
.langs a.on { background: var(--grad-hot); color: #fff; }
header nav > a:not(.btn) { color: #fff; opacity: .92; }
header nav > a:not(.btn):hover { opacity: 1; text-decoration: underline; }

/* Nút tài khoản trên nền tối */
.acct summary { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .3); color: #fff; }
.acct summary:hover, .acct[open] summary { border-color: #ffd36b; box-shadow: 0 0 0 3px rgba(255, 211, 107, .25); }
.acct-name { color: #fff; }
.caret { color: rgba(255, 255, 255, .8); }
.ava { background: var(--grad-hot); box-shadow: inset 0 -3px 6px rgba(0, 0, 0, .25), 0 2px 6px rgba(0, 0, 0, .25); }
.acct-pop { border: 0; box-shadow: var(--shadow-3); border-radius: 16px; }
.acct-pop a, .acct-pop button { color: var(--ink); }
.acct-pop button { color: #d0215a; }
.acct-pop a:hover, .acct-pop button:hover { background: #fff1e8; }

/* ---------- Thanh chuyển trang: nút viên thuốc ---------- */
.tabs {
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(74, 33, 119, .10);
  padding: 8px 16px; gap: 6px;
  box-shadow: 0 4px 16px rgba(42, 31, 61, .06);
}
.tabs a, .tabs button {
  border-radius: 999px; border-bottom: 0; padding: 8px 15px; font-weight: 600; color: var(--ink);
  transition: background .15s, transform .15s, box-shadow .15s;
}
.tabs a:hover, .tabs button:hover { background: #fff0e6; transform: translateY(-1px); }
.tabs a.on {
  background: var(--grad-hot); color: #fff;
  box-shadow: 0 4px 0 #b8264f, 0 8px 18px rgba(232, 51, 111, .35);
}
.tabs .back { border-right: 0; color: var(--muted); background: #f4eefb; }

/* ---------- Thẻ (card): nổi khối, viền màu chuyển sắc ---------- */
.card {
  border: 1.5px solid transparent;
  border-radius: 18px;
  background:
    linear-gradient(#fff, #fffdf9) padding-box,
    linear-gradient(135deg, rgba(255, 178, 56, .7), rgba(232, 51, 111, .45) 45%, rgba(46, 230, 197, .6)) border-box;
  box-shadow: var(--shadow-2);
  transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover { box-shadow: 0 3px 6px rgba(42, 31, 61, .08), 0 16px 36px rgba(74, 33, 119, .18), 0 26px 56px rgba(255, 106, 61, .12); }
.card h2, .card h3 { position: relative; }
.card > h3:first-child, .card > h2:first-child {
  background: linear-gradient(90deg, #4a2177, #e8336f 60%, #ff8a1f);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-weight: 800;
}
/* Phần tử con trong tiêu đề (nhãn Rank/Free, chấm LIVE…) giữ màu riêng, không bị "trong suốt" theo tiêu đề */
.card > h3:first-child *, .card > h2:first-child * { -webkit-text-fill-color: initial; }
details.card > summary { color: #4a2177; font-weight: 800; }
details.card > summary::marker { color: #e8336f; }
.card > h3:first-child::after, .card > h2:first-child::after {
  content: ""; display: block; width: 46px; height: 4px; margin-top: 6px; border-radius: 4px; background: var(--grad-hot);
}
details.card > summary { cursor: pointer; font-size: 16px; }

/* ---------- Nút: khối 3D, nhấn lún xuống ---------- */
button, .btn {
  background: var(--grad-hot);
  color: #fff; font-weight: 700; letter-spacing: .2px;
  border-radius: 12px; padding: 9px 16px;
  box-shadow: 0 4px 0 #b8264f, 0 8px 16px rgba(232, 51, 111, .28), inset 0 1px 0 rgba(255, 255, 255, .45);
  text-shadow: 0 1px 1px rgba(0, 0, 0, .18);
  transition: transform .08s ease, box-shadow .08s ease, filter .15s;
}
button:hover:not(:disabled), .btn:hover { filter: brightness(1.07) saturate(1.1); }
button:active:not(:disabled), .btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #b8264f, 0 3px 8px rgba(232, 51, 111, .25), inset 0 1px 0 rgba(255, 255, 255, .35);
}
button.secondary, .btn.secondary {
  background: linear-gradient(180deg, #ffffff, #f6f0ff);
  color: #4a2177; border: 1px solid #ddd0f0; text-shadow: none;
  box-shadow: 0 3px 0 #d6c8ee, 0 6px 14px rgba(74, 33, 119, .12), inset 0 1px 0 #fff;
}
button.secondary:active:not(:disabled), .btn.secondary:active { box-shadow: 0 1px 0 #d6c8ee, inset 0 1px 0 #fff; }
button:disabled { filter: grayscale(.5); box-shadow: none; }
/* các nút nhỏ dạng biểu tượng giữ gọn (không khối) */
.invite .x, .invite .snd, .acct-pop a, .acct-pop button, .tabs a, .tabs button, .boardtools button,
.lr .btn { text-shadow: none; }
.invite .x, .invite .snd { box-shadow: none; background: none; color: var(--muted); }
.acct-pop a, .acct-pop button { box-shadow: none; background: none; font-weight: 500; }

/* ---------- Ô nhập ---------- */
input, select, textarea {
  border: 1.5px solid #e4d9f2; border-radius: 10px; background: #fff;
  box-shadow: inset 0 2px 4px rgba(42, 31, 61, .05);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: #12a8c9; box-shadow: 0 0 0 4px rgba(46, 230, 197, .22), inset 0 2px 4px rgba(42, 31, 61, .05);
}
input[type="checkbox"] { accent-color: #ff6a3d; width: 16px; height: 16px; vertical-align: -3px; box-shadow: none; }
input[type="range"] { accent-color: #e8336f; box-shadow: none; border: 0; }
label { color: var(--muted); font-weight: 600; }

/* ---------- Bảng ---------- */
table { border-collapse: separate; border-spacing: 0; }
thead th {
  background: linear-gradient(180deg, #f7f0ff, #efe5fb); color: #4a2177; font-weight: 700;
  border-bottom: 2px solid #dccbf3;
}
thead th:first-child { border-top-left-radius: 10px; }
thead th:last-child { border-top-right-radius: 10px; }
tbody tr { transition: background .15s; }
tbody tr:nth-child(even) td { background: #fffaf3; }
tbody tr:hover td { background: #fff0e4; }
th, td { border-bottom: 1px solid #f0e8f8; }

/* ---------- Huy hiệu ---------- */
.rank-badge {
  background: var(--grad-gold); color: #5a3300;
  box-shadow: 0 2px 0 #c06f00, 0 3px 8px rgba(232, 138, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .6);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
}
.rank-badge.prov { background: linear-gradient(135deg, #f3ecff, #e4d6fa); color: #4a2177; box-shadow: 0 2px 0 #d2c0ef; text-shadow: none; }
.mode-tag.rank { background: var(--grad-hot) !important; color: #fff !important; box-shadow: 0 2px 6px rgba(232, 51, 111, .3); }
.mode-tag.free { background: var(--grad-cool) !important; color: #fff !important; box-shadow: 0 2px 6px rgba(18, 168, 201, .3); }
.live-badge, .live-dot { filter: drop-shadow(0 0 6px rgba(232, 51, 111, .6)); }

/* ---------- Nút nổi về trang chính ---------- */
.home-fab {
  background: var(--grad-hot);
  box-shadow: 0 5px 0 #b8264f, 0 12px 26px rgba(232, 51, 111, .45);
  animation: fabFloat 3.2s ease-in-out infinite;
}
@keyframes fabFloat { 50% { transform: translateY(-4px); } }

/* ---------- Hộp lời mời ---------- */
.invite {
  border: 0; border-radius: 16px; border-left: 0;
  background: linear-gradient(#fff, #fff) padding-box, var(--grad-hot) border-box;
  border: 2px solid transparent;
  box-shadow: var(--shadow-3);
}
.invite h4 { color: #4a2177; }

/* ---------- Bàn cờ: khung gỗ nổi trên trang ---------- */
body #board {
  border-radius: 14px !important;
  box-shadow:
    0 2px 0 #8a5a2b,
    0 10px 0 -2px #6b4220,
    0 18px 28px rgba(60, 30, 5, .38),
    0 40px 70px rgba(74, 33, 119, .28) !important;
}
.boardtools {
  background: rgba(255, 255, 255, .85) !important; border-radius: 14px !important;
  box-shadow: var(--shadow-2) !important; border: 1px solid #eadff5 !important;
}
.boardtools button { box-shadow: 0 2px 0 #e4d9f2; }
.boardtools button.on { background: var(--grad-hot); color: #fff; border-color: #e8336f; box-shadow: 0 2px 0 #b8264f, 0 0 0 3px rgba(232, 51, 111, .25); }

/* Người đang tới lượt: viền phát sáng */
.player.turn { border-radius: 12px; background: linear-gradient(90deg, rgba(255, 178, 56, .22), transparent); box-shadow: inset 4px 0 0 #ff6a3d; }
.clock.run { color: #e8336f !important; text-shadow: 0 0 10px rgba(232, 51, 111, .35); }
.clock.low { color: #fff !important; background: #e8336f; border-radius: 8px; padding: 0 6px; animation: lowBlink 1s steps(2) infinite; }
@keyframes lowBlink { 50% { filter: brightness(1.3); } }

/* Thẻ "kết thúc ván" và các banner */
.banner, .over { border-radius: 18px; }
.notice { border-radius: 14px; background: linear-gradient(135deg, #fff7e0, #ffe9f0) !important; border-color: #ffc9a8 !important; }

/* Dải hồ sơ ở sảnh */
.me-strip { background: linear-gradient(135deg, #fff4e3, #f3ecff) !important; border: 0 !important; box-shadow: inset 0 0 0 1.5px #efdcf8, 0 6px 16px rgba(74, 33, 119, .08); }

/* Thanh cuộn mảnh, có màu */
* { scrollbar-color: #e8b4d0 transparent; }

/* Màn hình nhỏ: bớt lớp bóng cho mượt */
@media (max-width: 600px) {
  .card { border-radius: 14px; }
  .card:hover { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  /* Người dùng muốn giảm chuyển động: tắt MỌI hiệu ứng động / chuyển tiếp / dịch chuyển của giao diện */
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .tabs a:hover, .tabs button:hover, .card:hover,
  button:active:not(:disabled), .btn:active { transform: none !important; }
}
