/* Valiant Mob - Clash style */
:root {
  --night: #1e1838; --night2: #2a2346; --stone: #4a4f66; --stone2: #6b7189; --stone3: #9aa0b5;
  --parch: #efe8d6; --parch2: #e3d9c2; --parch3: #d3c6a8; --ink: #2d2a26; --ink2: #5d564b;
  --gold: #ffd84a; --gold2: #f2a91d; --elixir: #c34fe0; --dark: #3a2a4f;
  --green: #8fdc2f; --green2: #4f9e12; --greenb: #2c5a08;
  --blue: #5cc6ff; --blue2: #1f7fd6; --blueb: #0d4c8a;
  --red: #ff6a52; --red2: #d22a19; --redb: #7d1209;
  --me: #cdeb93; --radius: 14px;
  --tabh: 68px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: #1e1838; }
body {
  margin: 0; color: var(--ink); font: 700 16px/1.4 Nunito, system-ui, sans-serif;
  background:
    radial-gradient(1200px 600px at 50% -200px, #5b3fb5 0%, transparent 60%),
    repeating-linear-gradient(135deg, rgba(255,255,255,.025) 0 14px, transparent 14px 28px),
    linear-gradient(180deg, var(--night2), var(--night));
  background-attachment: fixed; min-height: 100vh; padding-bottom: calc(var(--tabh) + 16px + env(safe-area-inset-bottom));
}
a { color: #3a5fd0; }
img { max-width: 100%; }
button { font: inherit; }
.ol, .title, .btn, .tabs a span:last-child, .num-big {
  color: #fff; font-family: 'Lilita One', Nunito, sans-serif; font-weight: 400; letter-spacing: .3px;
  text-shadow: -1.5px -1.5px 0 #000, 1.5px -1.5px 0 #000, -1.5px 1.5px 0 #000, 1.5px 1.5px 0 #000, 0 3px 0 #000;
}
.view { max-width: 1000px; margin: 0 auto; padding: 12px; outline: none; }
.loading, .empty { text-align: center; padding: 40px 16px; color: #e8e2ff; font-size: 18px; }
.empty.dark { color: var(--ink2); padding: 18px; }

/* header card */
.top { max-width: 1000px; margin: 0 auto; padding: 12px 12px 0; }
.clancard {
  display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center;
  background: linear-gradient(180deg, #57607c, #3f4560); border: 3px solid #23263a; border-radius: 18px;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.25), 0 6px 0 rgba(0,0,0,.35); padding: 12px;
}
.clancard img.badge { width: 96px; height: 96px; filter: drop-shadow(0 4px 0 rgba(0,0,0,.4)); }
.clancard h1 { margin: 0; font-size: 34px; line-height: 1.05; }
.clancard .tagline { color: #e9e6ff; font-size: 14px; margin-top: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
  background: rgba(0,0,0,.35); color: #fff; font-size: 13px; border: 1px solid rgba(255,255,255,.18);
}
.chip img { width: 18px; height: 18px; }
.stale { background: #7d5a00; }

/* panels */
.panel {
  background: linear-gradient(180deg, var(--parch), var(--parch2)); border: 3px solid #8e7f5d; border-radius: var(--radius);
  box-shadow: inset 0 2px 0 #fff8e6, 0 5px 0 rgba(0,0,0,.35); padding: 14px; margin: 14px 0;
}
.panel > h2, .ptitle {
  margin: -14px -14px 12px; padding: 9px 14px; border-radius: 11px 11px 0 0;
  background: linear-gradient(180deg, #6d7592, #4f5672); border-bottom: 3px solid #2f3348;
  font: 400 21px 'Lilita One', sans-serif; color: #fff;
  text-shadow: -1.5px -1.5px 0 #000, 1.5px -1.5px 0 #000, -1.5px 1.5px 0 #000, 1.5px 1.5px 0 #000, 0 3px 0 #000;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.panel > h2 small { font: 700 13px Nunito, sans-serif; text-shadow: none; color: #e6e9ff; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 800px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.desc { white-space: pre-wrap; background: #fffaf0; border: 2px solid var(--parch3); border-radius: 10px; padding: 10px 12px; margin: 0; }
.muted { color: var(--ink2); font-size: 14px; }
.big { font-size: 18px; }

/* stat bars like resource bars */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.stat {
  position: relative; background: linear-gradient(180deg, #3c3550, #2a2340); border: 2px solid #15111f; border-radius: 10px;
  padding: 6px 10px 6px 40px; color: #fff; min-height: 48px; box-shadow: inset 0 2px 0 rgba(255,255,255,.12);
}
.stat .ic { position: absolute; left: 7px; top: 50%; transform: translateY(-50%); font-size: 22px; filter: drop-shadow(0 2px 0 #000); }
.stat .v { font: 400 20px 'Lilita One', sans-serif; text-shadow: 0 2px 0 #000; display: block; line-height: 1.15; }
.stat .k { font-size: 12px; color: #cfc8e8; display: block; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; text-decoration: none;
  border-radius: 12px; padding: 9px 16px; font-size: 18px; border: 2px solid #000; min-height: 44px;
  box-shadow: inset 0 -5px 0 rgba(0,0,0,.22), inset 0 2px 0 rgba(255,255,255,.45), 0 3px 0 #000;
  transition: transform .05s;
}
.btn:active { transform: translateY(2px); box-shadow: inset 0 -3px 0 rgba(0,0,0,.22), 0 1px 0 #000; }
.btn.green { background: linear-gradient(180deg, #b9f26a, var(--green) 45%, var(--green2)); }
.btn.blue { background: linear-gradient(180deg, #9fe0ff, var(--blue) 45%, var(--blue2)); }
.btn.red { background: linear-gradient(180deg, #ffa595, var(--red) 45%, var(--red2)); }
.btn.gold { background: linear-gradient(180deg, #fff1a8, var(--gold) 45%, var(--gold2)); }
.btn.stone { background: linear-gradient(180deg, #b4b9c9, var(--stone3) 45%, var(--stone2)); }
.btn.small { font-size: 15px; padding: 5px 11px; min-height: 36px; border-radius: 10px; }
.btn.wide { width: 100%; }
.btn[disabled] { filter: grayscale(.8); opacity: .6; cursor: default; }
.btn.on { outline: 3px solid var(--gold); outline-offset: 1px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.seg button {
  border: 2px solid #2f3348; background: linear-gradient(180deg, #a9afc2, #7d8399); color: #fff; border-radius: 10px;
  padding: 6px 12px; font: 400 15px 'Lilita One', sans-serif; text-shadow: 0 2px 0 #000; cursor: pointer; min-height: 38px;
}
.seg button.on { background: linear-gradient(180deg, var(--parch), var(--parch3)); color: var(--ink); text-shadow: none; border-color: #8e7f5d; }

/* member list like the clan screen */
.search { width: 100%; padding: 10px 12px; border-radius: 10px; border: 2px solid #8e7f5d; font: 700 16px Nunito, sans-serif; background: #fffaf0; margin-bottom: 10px; }
.mlist { list-style: none; margin: 0; padding: 0; }
.mrow {
  display: grid; grid-template-columns: 34px 34px 1fr auto; gap: 8px; align-items: center; padding: 7px 8px; margin: 0 0 5px;
  background: linear-gradient(180deg, #f6f0e0, #e6dcc5); border: 2px solid #b5a47d; border-radius: 10px; cursor: pointer;
  text-decoration: none; color: inherit;
}
.mrow:nth-child(even) { background: linear-gradient(180deg, #ece4cf, #ddd1b5); }
.mrow.me { background: linear-gradient(180deg, #e3f7b8, var(--me)); border-color: #6f9a2a; }
.mrow:hover, .mrow:focus-visible { border-color: #3a5fd0; outline: none; }
.rank { font: 400 18px 'Lilita One', sans-serif; text-align: center; color: #fff; background: #4f5672; border-radius: 8px; padding: 3px 0; text-shadow: 0 2px 0 #000; }
.lg img, .lg .noimg { width: 34px; height: 34px; display: block; }
.lg .noimg { border-radius: 50%; background: #9aa0b5; }
.mname { min-width: 0; }
.mname b { display: block; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mname span { font-size: 13px; color: var(--ink2); }
.mval { text-align: right; font: 400 19px 'Lilita One', sans-serif; color: var(--ink); }
.mval small { display: block; font: 700 12px Nunito, sans-serif; color: var(--ink2); }
.th { display: inline-block; background: #2f3348; color: #fff; border-radius: 6px; padding: 0 6px; font-size: 12px; margin-right: 4px; }
.role-leader, .role-coLeader { color: #9a2bb8; }
.role-admin { color: #2b6fb8; }

/* profile */
.phead { display: grid; grid-template-columns: 78px 1fr; gap: 12px; align-items: center; }
.phead img { width: 78px; height: 78px; }
.phead h2 { margin: 0; font-size: 28px; }
.units { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 7px; }
.unit { background: #fffaf0; border: 2px solid var(--parch3); border-radius: 10px; padding: 6px 8px; }
.unit b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unit.max { border-color: #d9a400; background: linear-gradient(180deg, #fff6cf, #ffe9a0); }
.bar { height: 9px; border-radius: 6px; background: #cbbf9f; overflow: hidden; margin-top: 4px; border: 1px solid #9d8f6c; }
.bar i { display: block; height: 100%; background: linear-gradient(180deg, #ffe066, #f0a514); }
.bar.purple i { background: linear-gradient(180deg, #e19bff, #9a3fd0); }
.bar.green i { background: linear-gradient(180deg, #c7f57e, #5aa516); }
.lvl { font-size: 13px; color: var(--ink2); }
.eqline { font-size: 12px; color: var(--ink2); margin-top: 3px; }
.ach { display: grid; grid-template-columns: 70px 1fr; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--parch3); }
.stars { color: #c7b98f; font-size: 18px; letter-spacing: -2px; white-space: nowrap; }
.stars .s { color: var(--gold2); text-shadow: 0 1px 0 #7a4b00; }
details > summary { cursor: pointer; font: 400 18px 'Lilita One', sans-serif; padding: 6px 0; }

/* chart */
.chartbox { position: relative; background: #fffaf0; border: 2px solid var(--parch3); border-radius: 10px; padding: 8px; }
.chartbox canvas { width: 100%; height: 220px; display: block; touch-action: pan-y; }
.tip { position: absolute; pointer-events: none; background: #2a2340; color: #fff; border-radius: 8px; padding: 5px 9px; font-size: 13px; white-space: nowrap; transform: translate(-50%, -110%); display: none; border: 2px solid #000; }
.chartnote { font-size: 13px; color: var(--ink2); margin-top: 6px; }

/* war */
.score { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; text-align: center; }
.score img { width: 54px; height: 54px; }
.score .nm { font-size: 16px; font-weight: 900; }
.score .st { font: 400 34px 'Lilita One', sans-serif; color: #fff; text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000, 0 3px 0 #000; }
.vs { font: 400 22px 'Lilita One', sans-serif; color: #b02a1a; }
.lineup { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.base { background: #fffaf0; border: 2px solid var(--parch3); border-radius: 9px; padding: 5px 7px; font-size: 13px; min-height: 52px; }
.base.us { border-left: 5px solid #3a8f12; }
.base.them { border-left: 5px solid #b02a1a; }
.base b { font-size: 14px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.base .left { color: #b02a1a; font-weight: 900; }
.timer { font: 400 22px 'Lilita One', sans-serif; color: #fff; text-shadow: 0 2px 0 #000; text-align: center; margin: 8px 0; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 6px; border-bottom: 1px solid var(--parch3); text-align: left; }
.tbl th { font: 400 14px 'Lilita One', sans-serif; color: var(--ink2); }
.tbl td.n, .tbl th.n { text-align: right; }
.tbl tr.us td { background: #e3f7b8; font-weight: 900; }
.res-win { color: #2f7d0e; font-weight: 900; }
.res-lose { color: #b02a1a; font-weight: 900; }
.res-tie { color: #7a6a2a; font-weight: 900; }

/* board */
.podium { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.award { background: linear-gradient(180deg, #fff6cf, #ffe39a); border: 3px solid #c99300; border-radius: 14px; padding: 10px; text-align: center; box-shadow: 0 4px 0 rgba(0,0,0,.25); }
.award .aic { font-size: 30px; filter: drop-shadow(0 2px 0 #7a4b00); }
.award .at { font: 400 18px 'Lilita One', sans-serif; color: #6b3d00; }
.award .an { font-size: 17px; font-weight: 900; overflow-wrap: anywhere; }
.award .av { font-size: 13px; color: var(--ink2); }

/* hub */
.lbl { display: block; font-weight: 900; margin: 10px 0 4px; }
input[type=text], textarea, select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 2px solid #8e7f5d; background: #fffaf0;
  font: 700 16px Nunito, sans-serif; color: var(--ink);
}
textarea { resize: vertical; }
.who { display: flex; flex-wrap: wrap; gap: 5px; }
.who span { background: #fffaf0; border: 2px solid var(--parch3); border-radius: 999px; padding: 2px 10px; font-size: 14px; }
.who span.in { border-color: #4f9e12; background: #e8f8cc; }
.who span.out { border-color: #b02a1a; background: #ffe3dd; }
.who span.maybe { border-color: #c99300; background: #fff3c4; }
.poll { background: #fffaf0; border: 2px solid var(--parch3); border-radius: 10px; padding: 10px; margin-bottom: 10px; }
.poll h3 { margin: 0 0 6px; font-size: 18px; }
.opt { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; margin: 6px 0; }
.opt button { text-align: left; border: 2px solid #8e7f5d; background: #fff; border-radius: 10px; padding: 7px 10px; cursor: pointer; font: 800 15px Nunito, sans-serif; position: relative; overflow: hidden; min-height: 40px; }
.opt button i { position: absolute; inset: 0 auto 0 0; background: rgba(143,220,47,.35); z-index: 0; }
.opt button span { position: relative; z-index: 1; }
.opt button.mine { border-color: #4f9e12; box-shadow: 0 0 0 2px #8fdc2f inset; }
.notice { background: #fffaf0; border: 2px solid var(--parch3); border-left: 6px solid var(--gold2); border-radius: 10px; padding: 9px 11px; margin-bottom: 8px; white-space: pre-wrap; }
.notice .by { display: block; font-size: 12px; color: var(--ink2); margin-top: 4px; white-space: normal; }
.how { background: #fff6cf; border: 2px dashed #c99300; border-radius: 10px; padding: 10px; font-size: 15px; }
.how ol { margin: 6px 0 0; padding-left: 22px; }
.msg { min-height: 1.4em; font-weight: 900; }
.msg.err { color: #b02a1a; }
.msg.ok { color: #2f7d0e; }

/* bottom tabs like game buttons */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 4px; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, #3c3550, #1d1730);
  border-top: 3px solid #000; box-shadow: 0 -4px 12px rgba(0,0,0,.4);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; text-decoration: none;
  background: linear-gradient(180deg, #a9afc2, #6b7189); border: 2px solid #000; border-radius: 12px; min-height: 54px;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.25), inset 0 2px 0 rgba(255,255,255,.35);
}
.tabs a .ti { font-size: 22px; line-height: 1.1; filter: drop-shadow(0 2px 0 rgba(0,0,0,.6)); }
.tabs a span:last-child { font-size: 13px; }
.tabs a.on { background: linear-gradient(180deg, #fff1a8, var(--gold) 45%, var(--gold2)); }
@media (min-width: 900px) {
  body { padding-bottom: 20px; padding-top: 74px; }
  .tabs { top: 0; bottom: auto; border-top: 0; border-bottom: 3px solid #000; padding: 6px max(12px, calc(50% - 500px)); }
  .tabs a { flex-direction: row; gap: 8px; min-height: 48px; }
  .tabs a span:last-child { font-size: 17px; }
}

.toast { position: fixed; left: 50%; bottom: calc(var(--tabh) + 24px); transform: translateX(-50%); background: #2a2340; color: #fff; border: 2px solid #000; border-radius: 12px; padding: 10px 16px; font-weight: 900; display: none; z-index: 30; max-width: 90vw; }
.toast.show { display: block; }
.foot { max-width: 1000px; margin: 20px auto 0; padding: 0 16px; color: #cfc8e8; font-size: 13px; text-align: center; }
.foot .legal { font-size: 12px; color: #a99fcb; }
.foot a { color: #d8ccff; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
body.setup { padding-bottom: 20px; }
body.setup .panel { max-width: 560px; margin: 30px auto; }
body.setup .title { font-size: 28px; margin: 0 0 10px; }
@media (max-width: 420px) {
  .clancard { grid-template-columns: 72px 1fr; }
  .clancard img.badge { width: 72px; height: 72px; }
  .clancard h1 { font-size: 27px; }
  .mrow { grid-template-columns: 30px 30px 1fr auto; gap: 6px; }
  .lg img, .lg .noimg { width: 30px; height: 30px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
