:root {
  --bg: #14110c; --bg2: #1e1a13; --panel: #231e16; --panel2: #2c261c;
  --parch: #e9dcbc; --parch-dark: #cdb98d; --ink: #2a2116;
  --gold: #d4af37; --gold2: #f3d77a; --gold-dim: #8a6d1f;
  --text: #efe6d0; --muted: #a89c82; --good: #7fb069; --bad: #c8553d; --blue: #6c9bd2;
  --line: rgba(212,175,55,.35);
  --r: 14px; --shadow: 0 8px 28px rgba(0,0,0,.45);
  --head: 'Cinzel', Georgia, serif; --body: 'EB Garamond', Georgia, serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; height: 100dvh; }
body {
  background: radial-gradient(ellipse at 50% -10%, #3a2f1c 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text); font-family: var(--body); font-size: 18px; overflow: hidden; user-select: none;
}
body.has-backdrop { background: linear-gradient(rgba(20,17,12,.78), rgba(20,17,12,.92)), url('/img/backdrop.jpg') center/cover fixed; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
h1, h2, h3, h4 { font-family: var(--head); margin: 0; letter-spacing: .03em; }
.muted { color: var(--muted); }

/* ---------- Top bar ---------- */
.topbar { height: 68px; display: flex; align-items: center; gap: 16px; padding: 0 20px;
  background: linear-gradient(#1b1710, #120f0a); border-bottom: 2px solid var(--gold-dim); box-shadow: 0 2px 18px rgba(0,0,0,.6); }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--head); font-weight: 900; font-size: 22px; color: var(--gold2); white-space: nowrap; }
.brand img { width: 36px; height: 36px; }
nav { display: flex; gap: 8px; margin: 0 auto; }
.nav-btn { font-family: var(--head); font-weight: 700; padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.nav-btn.active { color: var(--ink); background: linear-gradient(var(--gold2), var(--gold)); border-color: var(--gold2); }
.nav-btn.icon { font-size: 22px; padding: 6px 14px; }
.clock { text-align: right; font-family: var(--head); line-height: 1.1; }
#clock-time { font-size: 28px; font-weight: 700; color: var(--gold2); }
#clock-date { font-size: 13px; color: var(--muted); }

main { height: calc(100vh - 68px); height: calc(100dvh - 68px); overflow-y: auto; padding: 18px 20px 120px;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y; }

/* ---------- Generic ---------- */
.panel { background: linear-gradient(var(--panel2), var(--panel)); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.btn { font-family: var(--head); font-weight: 700; padding: 12px 20px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); }
.btn.gold { color: var(--ink); background: linear-gradient(var(--gold2), var(--gold)); border-color: var(--gold2); }
.btn.big { font-size: 22px; padding: 16px 28px; }
.btn.small { padding: 6px 12px; font-size: 14px; border-radius: 8px; }
.btn.danger { border-color: var(--bad); color: #f0b3a5; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.coin { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--gold2); }
.coin::before { content: ''; width: .9em; height: .9em; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3b0, #d4af37 55%, #7a5c12); box-shadow: 0 0 0 1px #6b4f0e; }
.bar { height: 10px; border-radius: 99px; background: rgba(0,0,0,.45); overflow: hidden; border: 1px solid rgba(212,175,55,.25); }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-dim), var(--gold2)); }
.stars { color: var(--gold2); letter-spacing: 2px; }
.tag { font-size: 12px; font-family: var(--head); padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.tag.starter { color: #cfc6b0; } .tag.common { color: #9fc38f; border-color: #6f9e5c; } .tag.rare { color: #8fb4e0; border-color: #4d7fb3; }
.tag.epic { color: #c7a8ea; border-color: #8e6bb3; } .tag.legendary { color: var(--gold2); border-color: var(--gold); }

/* Picture placeholders: the <img> sits over a styled block and removes itself if the file is missing */
.pic { position: relative; overflow: hidden; border-radius: 10px; background: radial-gradient(circle at 50% 35%, #3d3322, #17130d); border: 1px solid var(--line); flex: none; }
.pic .ph { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--head); font-weight: 900; color: var(--gold2); text-shadow: 0 2px 6px #000; }
.pic .ph small { position: absolute; bottom: 4px; left: 0; right: 0; text-align: center; font-size: 9px; font-weight: 500; color: var(--muted); letter-spacing: .05em; }
.pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center top; }

/* ---------- Home ---------- */
.fellowship { padding: 12px 18px; display: flex; gap: 18px; align-items: center; margin-bottom: 14px; }
.fellowship h3 { font-size: 16px; color: var(--gold2); white-space: nowrap; }
.fellowship .bar { flex: 1; height: 14px; }
.quest-banner { padding: 12px 18px; margin-bottom: 14px; display: flex; align-items: center; gap: 14px; border-color: var(--gold);
  background: linear-gradient(90deg, #4a3a14, #2c261c); animation: glow 2.4s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 24px rgba(243,215,122,.45); } }
.players { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.pcard { padding: 14px; text-align: left; display: flex; flex-direction: column; gap: 8px; position: relative; border-top: 4px solid var(--pc, var(--gold)); transition: transform .15s; }
.pcard:active { transform: scale(.98); }
.pcard .top { display: flex; gap: 12px; align-items: center; }
.pcard .pic { width: 72px; height: 72px; border-radius: 50%; border: 3px solid var(--pc, var(--gold)); }
.pcard .pic .ph { font-size: 30px; }
.pcard .pic .ph small, .phead .pic .ph small { display: none; }
.pcard h2 { font-size: 21px; }
.pcard .rank { font-size: 14px; color: var(--muted); font-style: italic; }
.pcard .stats { display: flex; justify-content: space-between; font-size: 17px; }
.pcard .hero-line { font-size: 14px; color: var(--muted); }
.dots { display: flex; gap: 5px; flex-wrap: wrap; }
.dot { font-size: 11px; padding: 2px 7px; border-radius: 99px; border: 1px solid rgba(255,255,255,.15); color: var(--muted); }
.dot.on { background: rgba(127,176,105,.25); border-color: var(--good); color: #cfe8c4; }
.home-foot { display: grid; grid-template-columns: auto 1fr; gap: 16px; margin-top: 16px; align-items: start; }
.feed { padding: 12px 16px; font-size: 16px; }
.feed h3 { font-size: 15px; color: var(--gold2); margin-bottom: 6px; }
.feed div { padding: 3px 0; border-bottom: 1px dashed rgba(212,175,55,.15); }
.feed b { color: var(--gold2); }

/* ---------- Player page ---------- */
.phead { padding: 16px; display: flex; gap: 18px; align-items: center; border-top: 4px solid var(--pc); margin-bottom: 14px; }
.phead .pic { width: 110px; height: 110px; border-radius: 50%; border: 3px solid var(--pc); }
.phead .pic .ph { font-size: 44px; }
.phead h1 { font-size: 32px; }
.statbox { text-align: center; padding: 8px 14px; border-left: 1px solid var(--line); }
.statbox b { display: flex; justify-content: center; font-family: var(--head); font-size: 24px; color: var(--gold2); }
.statbox span { font-size: 13px; color: var(--muted); }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { font-family: var(--head); padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); }
.tabs button.active { color: var(--ink); background: var(--parch); border-color: var(--parch); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.card { padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.card .pic { width: 100%; aspect-ratio: 4/3; }
.card .pic .ph { font-size: 38px; }
.card h4 { font-size: 16px; }
.card .meta { font-size: 14px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.card.owned { border-color: var(--gold); }
.card.locked { opacity: .55; }
.card.active-hero { box-shadow: 0 0 0 2px var(--gold2), var(--shadow); }
.region { display: flex; gap: 12px; align-items: center; padding: 10px 14px; }
.region .pic { width: 90px; height: 60px; }
.region.done { opacity: .6; } .region.next { border-color: var(--gold2); box-shadow: 0 0 18px rgba(243,215,122,.25); }

/* ---------- Modals ---------- */
.overlay { position: fixed; inset: 0; background: rgba(8,6,3,.78); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(820px, 100%); max-height: 92vh; overflow: auto; padding: 22px; background: linear-gradient(var(--parch), var(--parch-dark)); color: var(--ink);
  border-radius: 16px; border: 3px solid var(--gold-dim); box-shadow: 0 20px 60px rgba(0,0,0,.7); }
.modal h2 { font-size: 26px; margin-bottom: 4px; }
.modal .sub { font-style: italic; margin-bottom: 14px; color: #5b4a30; }
.modal .btn { background: #efe3c6; border-color: #a58b55; color: var(--ink); }
.modal .btn.gold { background: linear-gradient(#f5dc85, #c99b27); }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 10px 16px; border-radius: 99px; border: 2px solid #a58b55; background: #f3e8cf; font-family: var(--head); font-weight: 700; }
.chip.on { background: var(--pc, #c99b27); color: #fff; border-color: var(--ink); text-shadow: 0 1px 2px #000; }
.task-group h4 { margin: 14px 0 6px; font-size: 15px; color: #6b5328; }
.task-btn { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; padding: 11px 14px; margin-bottom: 6px;
  border-radius: 10px; background: #f6edd8; border: 1px solid #b89f6a; text-align: left; font-size: 18px; }
.task-btn:active { background: #e6d3a6; }
.task-btn .pts { font-family: var(--head); font-weight: 700; color: #7a5a10; white-space: nowrap; }
.task-btn.done { opacity: .5; }
.check-table { width: 100%; border-collapse: collapse; font-size: 18px; }
.check-table th, .check-table td { padding: 8px; border-bottom: 1px solid #c4ad7c; text-align: center; }
.check-table th:first-child, .check-table td:first-child { text-align: left; font-family: var(--head); }
.tick { width: 52px; height: 44px; border-radius: 10px; border: 2px solid #a58b55; background: #f6edd8; font-size: 24px; }
.tick.on { background: #6f9e5c; color: #fff; border-color: #3f6232; }
.tick.locked { background: #cfe0c4; color: #3f6232; border-color: #9bb88b; }
.pinpad { display: grid; grid-template-columns: repeat(3, 84px); gap: 10px; justify-content: center; margin-top: 12px; }
.pinpad button { height: 72px; font-size: 30px; font-family: var(--head); border-radius: 14px; background: #f6edd8; border: 2px solid #a58b55; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 8px 0; }
.pin-dots i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--ink); }
.pin-dots i.on { background: var(--ink); }
.pin-err { text-align: center; color: #9c2f1c; min-height: 24px; font-weight: 600; }
.quest-modal { text-align: center; }
.quest-modal .seal { font-size: 60px; }
.quest-modal .reward { font-family: var(--head); font-size: 28px; color: #7a5a10; margin: 8px 0; }
.countdown { font-family: var(--head); color: #9c2f1c; }
input, select { font: inherit; font-size: 16px; padding: 7px 9px; border-radius: 8px; border: 1px solid #a58b55; background: #fffaf0; color: var(--ink); }
input[type=checkbox] { width: 22px; height: 22px; }
input[type=number] { width: 80px; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 80; align-items: center; }
.toast { padding: 12px 22px; border-radius: 12px; background: linear-gradient(var(--gold2), var(--gold)); color: var(--ink); font-family: var(--head); font-weight: 700; font-size: 20px;
  box-shadow: var(--shadow); animation: pop .35s cubic-bezier(.2,1.6,.4,1); }
.toast.err { background: #e9b8ab; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }

/* ---------- Calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.cal-head h2 { font-size: 26px; color: var(--gold2); }
.legend { display: flex; gap: 12px; font-size: 14px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; min-height: calc(100vh - 160px); }
.day { padding: 10px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.day.today { border-color: var(--gold2); box-shadow: 0 0 20px rgba(243,215,122,.2); }
.day h3 { font-size: 15px; color: var(--gold2); text-align: center; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.ev { padding: 6px 8px; border-radius: 8px; background: rgba(255,255,255,.05); border-left: 4px solid var(--c); font-size: 15px; line-height: 1.2; overflow-wrap: anywhere; }
.ev .t { font-family: var(--head); font-size: 12px; color: var(--muted); }
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.month .dow { text-align: center; font-family: var(--head); color: var(--gold2); font-size: 14px; }
.mcell { min-height: 108px; padding: 6px; font-size: 13px; }
.mcell.other { opacity: .4; } .mcell.today { border-color: var(--gold2); }
.mcell .n { font-family: var(--head); font-weight: 700; }
.mcell .ev { font-size: 12px; padding: 2px 5px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-error { padding: 14px; color: #f0b3a5; margin-bottom: 12px; }

/* ---------- Settings ---------- */
.settings section { padding: 16px; margin-bottom: 14px; }
.settings h3 { color: var(--gold2); margin-bottom: 10px; font-size: 18px; }
.settings table { width: 100%; border-collapse: collapse; font-size: 15px; }
.settings th { text-align: left; font-weight: 600; color: var(--muted); padding: 4px; font-size: 13px; }
.settings td { padding: 4px; vertical-align: middle; }
.settings td input[type=text] { width: 100%; }
.settings .day-toggle { width: 34px; height: 30px; border-radius: 6px; border: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.settings .day-toggle.on { background: var(--gold); color: var(--ink); }
.settings .mini-chip { font-size: 12px; padding: 3px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); margin: 2px; }
.settings .mini-chip.on { background: rgba(212,175,55,.3); color: var(--text); }
.settings .field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.settings-bar { position: sticky; top: -18px; z-index: 5; padding: 12px 16px; margin: -18px -20px 14px; background: rgba(20,17,12,.95); border-bottom: 1px solid var(--line); }
.log-row { display: flex; gap: 10px; align-items: center; padding: 5px 0; border-bottom: 1px dashed rgba(212,175,55,.15); font-size: 15px; }
.log-row.undone { text-decoration: line-through; opacity: .5; }

/* ---------- Night mode ---------- */
#night { position: fixed; inset: 0; background: #000; z-index: 100; display: grid; place-items: center; align-content: center; gap: 10px; }
#night[hidden] { display: none; }
.night-clock { font-family: var(--head); font-size: 110px; color: #4a3d1c; }
.night-hint { color: #2e2a20; }

/* ---------- House key ---------- */
.gate { max-width: 420px; margin: 12vh auto; padding: 28px; text-align: center; }
.gate input { width: 100%; margin: 14px 0; font-size: 20px; }

@media (max-width: 800px) {
  .brand span { display: none; } .nav-btn { padding: 8px 12px; font-size: 14px; }
  .week { grid-template-columns: 1fr; } .home-foot { grid-template-columns: 1fr; }
  main { padding: 12px 16px; } .phead { flex-wrap: wrap; }
}

/* ---------- Child mode ---------- */
.child-bar { display: flex; align-items: center; gap: 12px; margin: 0 auto; font-family: var(--head); font-size: 20px; color: var(--gold2); }
.child-bar[hidden], nav[hidden] { display: none; }
body.child-mode [data-award], body.child-mode main [data-nav] { display: none !important; }

/* ---------- Celebration ---------- */
.celebrate { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(circle at 50% 45%, rgba(60,45,10,.85), rgba(5,4,2,.93)); animation: fade .25s; cursor: pointer; }
.celebrate.out { opacity: 0; transition: opacity .3s; }
.celebrate .rays { position: absolute; width: 160vmax; height: 160vmax; left: 50%; top: 50%; margin: -80vmax 0 0 -80vmax; opacity: .22;
  background: repeating-conic-gradient(from 0deg, var(--gold2) 0deg 6deg, transparent 6deg 20deg); animation: spin 14s linear infinite; pointer-events: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.fall-coin { position: absolute; top: -40px; width: 30px; height: 30px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 35% 30%, #fff6c0, #e2b93b 50%, #8a6512); box-shadow: 0 0 0 2px #6b4f0e, 0 0 12px rgba(243,215,122,.6);
  animation: coinfall 2s cubic-bezier(.3,.1,.6,1) forwards; }
@keyframes coinfall { 0% { transform: translateY(0) rotateY(0); } 100% { transform: translateY(110vh) rotateY(900deg); } }
.celebrate-card { position: relative; text-align: center; padding: 26px 40px 18px; border-radius: 22px; min-width: min(460px, 92vw);
  background: linear-gradient(var(--parch), var(--parch-dark)); color: var(--ink); border: 4px solid var(--pc, var(--gold));
  box-shadow: 0 0 60px rgba(243,215,122,.55), 0 20px 60px rgba(0,0,0,.7); animation: bounceIn .6s cubic-bezier(.2,1.6,.4,1); }
@keyframes bounceIn { from { transform: scale(.3) rotate(-6deg); opacity: 0; } }
.celeb-pic .pic { width: 150px; height: 150px; border-radius: 50%; margin: -95px auto 8px; border: 5px solid var(--pc, var(--gold)); box-shadow: 0 6px 24px rgba(0,0,0,.6); }
.celeb-pic .ph { font-size: 60px; } .celeb-pic .ph small, .gift-pic .ph small { display: none; }
.celeb-name { font-family: var(--head); font-weight: 900; font-size: 34px; }
.celeb-gold { font-family: var(--head); font-weight: 900; font-size: 84px; line-height: 1; color: #8a6512; text-shadow: 0 3px 0 #f5dc85, 0 6px 14px rgba(0,0,0,.35);
  display: flex; justify-content: center; align-items: center; gap: 10px; animation: pulse 1s ease-in-out 2; }
.celeb-gold .coin::before { width: 64px; height: 64px; }
@keyframes pulse { 50% { transform: scale(1.12); } }
.celeb-reason { font-size: 20px; font-style: italic; color: #5b4a30; margin-top: 6px; }
.celeb-rank { margin-top: 14px; font-family: var(--head); font-weight: 900; font-size: 40px; color: #9c2f1c; animation: pulse .8s ease-in-out 4; }
.celeb-rank small { font-size: 22px; color: var(--ink); }
.celeb-gift { display: flex; gap: 14px; align-items: center; margin-top: 14px; padding: 10px 14px; border-radius: 14px; background: rgba(255,255,255,.5); font-size: 20px; text-align: left; }
.gift-pic .pic { width: 90px; height: 68px; }
.celeb-tap { margin-top: 12px; font-size: 13px; color: #7a6a4a; }
.celebrate.big .celebrate-card { border-width: 6px; }

/* ---------- FIFA-style hero cards ---------- */
.card.fifa .pic-wrap { position: relative; }
.card.fifa .ovr { position: absolute; top: 6px; left: 6px; width: 54px; padding: 4px 0; border-radius: 10px; text-align: center; font-family: var(--head);
  background: linear-gradient(#f5dc85, #b8891f); color: var(--ink); box-shadow: 0 3px 10px rgba(0,0,0,.5); line-height: 1; }
.card.fifa .ovr b { display: block; font-size: 24px; font-weight: 900; } .card.fifa .ovr span { font-size: 10px; letter-spacing: .08em; }
.card.fifa.legendary .ovr { background: linear-gradient(#fff3b0, #d4af37); box-shadow: 0 0 14px rgba(243,215,122,.8); }
.card.fifa.epic .ovr { background: linear-gradient(#e2cff5, #8e6bb3); } .card.fifa.rare .ovr { background: linear-gradient(#cfe0f5, #4d7fb3); }
.card.fifa.common .ovr { background: linear-gradient(#d8ecd0, #6f9e5c); }
.in-party { position: absolute; bottom: 6px; right: 6px; font-size: 11px; font-family: var(--head); padding: 2px 8px; border-radius: 99px; background: rgba(156,47,28,.9); color: #fff; }
.stats5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.stats5 .st { position: relative; text-align: center; background: rgba(0,0,0,.3); border-radius: 6px; padding: 3px 0 5px; overflow: hidden; }
.stats5 .st b { display: block; font-family: var(--head); font-size: 15px; color: var(--gold2); }
.stats5 .st span { font-size: 9px; color: var(--muted); letter-spacing: .05em; }
.stats5 .st i { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--gold); }
.equipped { font-size: 13px; color: #c7a8ea; } .boost { color: var(--good); font-weight: 600; }
.give { font-size: 14px; color: var(--muted); display: flex; gap: 6px; align-items: center; } .give select { flex: 1; }

/* ---------- Campaign ---------- */
.party-panel { padding: 14px; margin-bottom: 12px; } .party-panel h3 { color: var(--gold2); margin-bottom: 8px; font-size: 17px; }
.party-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 8px; }
.slot { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px; border-radius: 12px; border: 1px dashed var(--line); background: rgba(0,0,0,.25); }
.slot .pic { width: 72px; height: 72px; border-radius: 50%; } .slot .ph small { display: none; } .slot span { font-size: 13px; color: var(--muted); }
.slot.empty { justify-content: center; min-height: 110px; }
.odds-line { display: flex; gap: 16px; flex-wrap: wrap; margin: 4px 0; }
.odds { font-family: var(--head); font-weight: 700; padding: 1px 10px; border-radius: 99px; }
.odds.good { background: rgba(127,176,105,.3); color: #cfe8c4; } .odds.even { background: rgba(212,175,55,.3); color: var(--gold2); } .odds.bad { background: rgba(200,85,61,.3); color: #f0b3a5; }
.region .btn.big small { font-size: 12px; font-weight: 500; }
.pick-list { display: grid; gap: 8px; max-height: 60vh; overflow: auto; }
.pick { display: flex; gap: 12px; align-items: center; padding: 8px; border-radius: 10px; background: #f6edd8; border: 1px solid #b89f6a; text-align: left; }
.pick .pic { width: 64px; height: 48px; } .pick .ph small { display: none; }

/* ---------- Battle animation ---------- */
.region.fighting { padding: 16px; border-color: var(--gold2); background: radial-gradient(circle at 50% 50%, #4a2a14, #1a120b); }
.battle { display: grid; grid-template-columns: 1fr 140px 1fr; gap: 12px; align-items: center; width: 100%; }
.battle .side { display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center; }
.battle .faces { display: flex; gap: 6px; } .battle .faces .pic { width: 64px; height: 64px; border-radius: 50%; } .battle .ph small { display: none; }
.battle .right .faces .pic { width: 110px; height: 70px; border-radius: 10px; }
.battle .left { animation: lunge-l .45s ease-in-out infinite alternate; } .battle .right { animation: lunge-r .45s ease-in-out infinite alternate; }
@keyframes lunge-l { to { transform: translateX(10px); } } @keyframes lunge-r { to { transform: translateX(-10px); } }
.battle .hp { width: 100%; height: 14px; border-radius: 99px; background: rgba(0,0,0,.6); border: 1px solid var(--line); overflow: hidden; }
.battle .hp i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #7fb069, #c9e06a); transition: width .4s; }
.battle .right .hp i { background: linear-gradient(90deg, #c8553d, #e0906a); margin-left: auto; }
.clash { position: relative; height: 110px; display: grid; place-items: center; }
.clash .sw { position: absolute; font-size: 48px; top: 25px; transition: transform .15s; }
.clash .sw.l { left: 20px; transform: rotate(45deg); } .clash .sw.r { right: 20px; transform: scaleX(-1) rotate(45deg); }
.clash.hit .sw.l { animation: swing-l .4s; } .clash.hit .sw.r { animation: swing-r .4s; }
@keyframes swing-l { 50% { transform: translateX(22px) rotate(90deg); } } @keyframes swing-r { 50% { transform: scaleX(-1) translateX(22px) rotate(90deg); } }
.clash .spark { font-size: 40px; color: #fff3b0; opacity: 0; text-shadow: 0 0 20px #f3d77a; }
.clash.hit .spark { animation: spark .4s; } @keyframes spark { 40% { opacity: 1; transform: scale(1.6); } }
.verdict { position: absolute; bottom: -6px; font-family: var(--head); font-weight: 900; font-size: 30px; white-space: nowrap; }
.verdict.win { color: #9fdf7f; text-shadow: 0 0 18px rgba(127,176,105,.9); animation: pop .5s cubic-bezier(.2,1.6,.4,1); }
.verdict.lose { color: #f08a70; text-shadow: 0 0 18px rgba(200,85,61,.9); animation: pop .5s cubic-bezier(.2,1.6,.4,1); }
.region.won { box-shadow: 0 0 40px rgba(127,176,105,.6); } .region.lost { box-shadow: 0 0 40px rgba(200,85,61,.6); }
.region.won .left, .region.won .right, .region.lost .left, .region.lost .right { animation: none; }
@media (max-width: 800px) { .battle { grid-template-columns: 1fr; } .party-slots { grid-template-columns: 1fr; } }

/* ---------- Raids ---------- */
.raid-banner { border-color: var(--bad) !important; background: linear-gradient(90deg, #5a1c12, #2c1a14) !important; animation: raidglow 1.6s ease-in-out infinite !important; }
@keyframes raidglow { 50% { box-shadow: 0 0 26px rgba(200,85,61,.6); } }
.raid-modal .raid-title { font-family: var(--head); font-weight: 900; font-size: 44px; color: #9c2f1c; animation: pulse .8s ease-in-out infinite; }
.raid-vs { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 10px 0; }
.raid-vs .pic { width: 160px; height: 160px; border-radius: 50%; } .raid-vs .ph small { display: none; } .raid-vs .ph { font-size: 50px; }
.enemy-pic .pic { border: 5px solid #9c2f1c; box-shadow: 0 0 24px rgba(156,47,28,.6); animation: shake .5s ease-in-out infinite; }
.defender-pic .pic { border: 5px solid var(--pc, var(--gold)); }
@keyframes shake { 25% { transform: translateX(-4px) rotate(-2deg); } 75% { transform: translateX(4px) rotate(2deg); } }
.raid-vs .vs { font-family: var(--head); font-weight: 900; font-size: 38px; color: #7a5a10; }

/* ---------- Campaign map ---------- */
.campaign-layout { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(260px, 1fr); gap: 14px; align-items: start; }
.map-wrap { border-radius: 14px; overflow: hidden; border: 3px solid var(--gold-dim); box-shadow: var(--shadow); }
.map { position: relative; width: 100%; }
.map-img { display: block; width: 100%; height: auto; filter: sepia(.15) contrast(1.05); }
.map-fallback { display: none; }
.map.no-map { aspect-ratio: 4 / 3; background: radial-gradient(ellipse at 40% 45%, #e9dcbc, #b89f6a 75%, #7a6030); }
.map.no-map .map-fallback { display: grid; place-items: center; position: absolute; inset: 0; font-family: var(--head); font-size: 28px; color: rgba(60,40,10,.35); text-align: center; }
.map-path { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.map-path polyline { fill: none; stroke-width: .6; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.map-path .done { stroke: #9c2f1c; stroke-width: 6; vector-effect: non-scaling-stroke; }
.map-path .todo { stroke: #6b1f10; stroke-width: 4; stroke-dasharray: 4 9; vector-effect: non-scaling-stroke; opacity: .85; }
.node { position: absolute; transform: translate(-50%, -50%); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-size: 16px; border: 3px solid #3a2a10; background: #6b5a3a; color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.6); z-index: 2; }
.node .lbl { position: absolute; top: 100%; margin-top: 3px; white-space: nowrap; font-family: var(--head); font-size: 12px; font-weight: 700; color: #2a1a05;
  text-shadow: 0 0 3px #f3e6c4, 0 0 3px #f3e6c4, 0 0 5px #f3e6c4; }
.node.start { width: 18px; height: 18px; background: #6f9e5c; border-color: #2f4a22; }
.node.done { background: var(--pc); border-color: #fff3b0; } .node.done .flag { font-size: 18px; text-shadow: 0 1px 2px #000; }
.node.next { background: #9c2f1c; border-color: #f3d77a; width: 42px; height: 42px; font-size: 20px; animation: nodepulse 1.4s ease-in-out infinite; }
@keyframes nodepulse { 50% { box-shadow: 0 0 0 10px rgba(243,215,122,.35), 0 0 22px rgba(243,215,122,.8); } }
.node.locked { background: #3a342a; opacity: .85; }
.node.sel { outline: 3px solid #fff; outline-offset: 3px; }
.marker { position: absolute; transform: translate(-50%, -110%); z-index: 3; pointer-events: none; }
.marker .pic { width: 54px; height: 54px; border-radius: 50%; border: 3px solid var(--pc); box-shadow: 0 4px 12px rgba(0,0,0,.7); }
.marker .ph small { display: none; } .marker .ph { font-size: 20px; }
.marker::after { content: ''; position: absolute; left: 50%; bottom: -10px; margin-left: -8px; border: 8px solid transparent; border-top-color: var(--pc); }
.marker.marching { animation: bob .3s ease-in-out infinite alternate; } @keyframes bob { to { margin-top: -6px; } }
.campaign-side { display: flex; flex-direction: column; gap: 12px; }
.map-panel { padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.map-panel > .pic { width: 100%; aspect-ratio: 16/9; } .map-panel h3 { color: var(--gold2); font-size: 20px; }
.map-panel.next { border-color: var(--gold2); } .map-panel.locked { opacity: .75; }
.map-panel.fighting .battle { grid-template-columns: 1fr; } .map-panel.fighting .clash { height: 80px; }
.campaign-side .party-slots { grid-template-columns: repeat(3, 1fr); gap: 6px; } .campaign-side .slot { padding: 6px; } .campaign-side .slot .pic { width: 52px; height: 52px; }
.campaign-side .slot b { font-size: 13px; } .campaign-side .slot span { font-size: 11px; }
@media (max-width: 900px) { .campaign-layout { grid-template-columns: 1fr; } }

/* Tablet scrolling: keep the side panel in view while the page scrolls */
.campaign-side { position: sticky; top: 0; }
.map-wrap { touch-action: pan-y; }

/* ---------- Battle 2: commentary + prediction bar ---------- */
.battle2 { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.b-sides { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.b-sides .faces { display: flex; gap: 4px; } .b-sides .pic { width: 58px; height: 58px; border-radius: 50%; } .b-sides .ph small { display: none; } .b-sides .ph { font-size: 18px; }
.b-sides .enemy .pic { border-color: #9c2f1c; }
.b-vs { font-size: 30px; color: var(--gold2); animation: pulse .6s ease-in-out infinite; }
.hit-good .faces:not(.enemy) { animation: lunge-l .25s ease-in-out 2 alternate; } .hit-bad .faces.enemy { animation: lunge-r .25s ease-in-out 2 alternate; }
.hit-bad { animation: shakebox .3s; } @keyframes shakebox { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.b-names { display: flex; justify-content: space-between; font-family: var(--head); font-size: 14px; color: var(--gold2); }
.predict .pb { position: relative; height: 18px; border-radius: 99px; background: linear-gradient(90deg, #c8553d, #7a2a1a); border: 1px solid var(--line); overflow: visible; }
.predict .pb i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #4f8a3c, #9fdf7f); transition: width .9s cubic-bezier(.3,1.4,.5,1); }
.predict .pb b { position: absolute; top: -5px; width: 6px; height: 28px; margin-left: -3px; border-radius: 3px; background: #fff3b0; box-shadow: 0 0 10px #f3d77a; transition: left .9s cubic-bezier(.3,1.4,.5,1); }
.predict .pl { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; } .predict .pv { font-family: var(--head); color: var(--gold2); font-size: 14px; }
.commentary { min-height: 150px; display: flex; flex-direction: column; gap: 4px; font-size: 16px; }
.commentary .line { padding: 5px 8px; border-radius: 8px; background: rgba(0,0,0,.35); border-left: 3px solid var(--gold); animation: slidein .35s ease-out; }
.commentary .line:not(:first-child) { opacity: .6; font-size: 14px; }
.commentary .good { border-color: #7fb069; } .commentary .bad { border-color: #c8553d; } .commentary .intro { border-color: var(--gold2); font-style: italic; }
@keyframes slidein { from { transform: translateY(-8px); opacity: 0; } }
.verdict2 { text-align: center; font-family: var(--head); font-weight: 900; font-size: 42px; min-height: 0; }
.verdict2.win { color: #9fdf7f; text-shadow: 0 0 20px rgba(127,176,105,.9); animation: pop .5s cubic-bezier(.2,1.6,.4,1); }
.verdict2.lose { color: #f08a70; text-shadow: 0 0 20px rgba(200,85,61,.9); animation: pop .5s cubic-bezier(.2,1.6,.4,1); }

.armies { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 13px; line-height: 1.35; }
.army-col { padding: 8px; border-radius: 10px; background: rgba(0,0,0,.3); }
.army-col h4 { font-size: 14px; margin-bottom: 4px; } .army-col.mine { border-left: 3px solid #7fb069; } .army-col.foe { border-left: 3px solid #c8553d; }
.army-col.mine h4 { color: #cfe8c4; } .army-col.foe h4 { color: #f0b3a5; } .army-col div { margin-top: 3px; color: var(--text); }

/* =====================================================================
   HOGWARTS THEME (thomasgames.uk/hogwarts) — night-sky castle, house colours
   ===================================================================== */
body.theme-hp {
  --bg: #0e0a17; --bg2: #171126; --panel: #1c1430; --panel2: #261b3d;
  --gold: #d3a625; --gold2: #f4d77b; --gold-dim: #8c6a17;
  --text: #efe8f5; --muted: #a79bbd; --line: rgba(211,166,37,.35);
  --head: 'Cinzel Decorative', 'Almendra', Georgia, serif;
  background:
    radial-gradient(1px 1px at 12% 18%, #fff8 50%, transparent 51%), radial-gradient(1px 1px at 72% 12%, #fff9 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 42% 32%, #fffa 50%, transparent 51%), radial-gradient(1px 1px at 88% 44%, #fff7 50%, transparent 51%),
    radial-gradient(1px 1px at 25% 70%, #fff6 50%, transparent 51%), radial-gradient(1.5px 1.5px at 60% 82%, #fff8 50%, transparent 51%),
    radial-gradient(ellipse at 50% -10%, #3b2257 0%, #0e0a17 65%) fixed, #0e0a17;
}
body.theme-hp.has-backdrop { background: linear-gradient(rgba(14,10,23,.72), rgba(14,10,23,.9)), url('/img/hp/backdrop.jpg') center/cover fixed; }
body.theme-hp .topbar { background: linear-gradient(#2a0f18, #150810); border-bottom: 3px solid; border-image: linear-gradient(90deg, #740001, #d3a625 25%, #1a472a 50%, #0e1a40 75%, #ecb939) 1; }
body.theme-hp .brand { font-family: 'Cinzel Decorative', serif; color: #f4d77b; text-shadow: 0 0 12px rgba(244,215,123,.5); }
body.theme-hp h1, body.theme-hp h2, body.theme-hp h3, body.theme-hp h4 { font-family: 'Almendra', 'Cinzel', serif; letter-spacing: .02em; }
body.theme-hp .nav-btn.active { background: linear-gradient(#b3202a, #740001); color: #f4d77b; border-color: #d3a625; }
body.theme-hp .btn.gold { background: linear-gradient(#f4d77b, #c7961e); }
body.theme-hp .panel { background: linear-gradient(var(--panel2), var(--panel)); box-shadow: 0 8px 28px rgba(0,0,0,.5), inset 0 0 30px rgba(120,80,200,.08); }
body.theme-hp .fellowship h3::before { content: '🏆 '; }
body.theme-hp .quest-banner:not(.raid-banner) { background: linear-gradient(90deg, #3d2a5c, #261b3d); }
body.theme-hp .tabs button.active { background: #f0e4c8; color: #3a0d12; }
body.theme-hp .modal { border-color: #740001; background: linear-gradient(#f3e7c9, #dccba0); }
body.theme-hp .coin::before { background: radial-gradient(circle at 35% 30%, #fff6c8, #e8b923 50%, #8a6512); } /* Galleon */
body.theme-hp .map.no-map { background: radial-gradient(ellipse at 45% 45%, #efe2c0, #c7ae78 70%, #8d7040); }
body.theme-hp .node.next { background: #740001; }
body.theme-hp .celebrate { background: radial-gradient(circle at 50% 45%, rgba(70,40,110,.88), rgba(8,5,14,.94)); }
body.theme-hp .celebrate .rays { background: repeating-conic-gradient(from 0deg, #b69cf0 0deg 5deg, transparent 5deg 18deg); }
body.theme-hp .fall-coin { background: radial-gradient(circle at 35% 30%, #fff6c8, #e8b923 50%, #8a6512); }
body.theme-hp .region.fighting, body.theme-hp .map-panel.fighting { background: radial-gradient(circle at 50% 50%, #2e1a4d, #120b1f); }
body.theme-hp .b-vs { color: #b69cf0; text-shadow: 0 0 12px #8e6bd8; }
body.theme-hp .night-clock { color: #3b2a5c; }
