/* Crownmarch phone page: painted frames and effects (items 15 to 23). Loaded after style.css.
   Carved wood for the top and tab bars, leather panels with brass corners, rarity frames for heroes, shop tiers,
   flying rewards, the level-up banner and the hero pack show. Textures in ui/ are made by tools/ui-art/make_ui.py. */

:root { --brass: #c9973f; --brass-hi: #ffe39a; --brass-lo: #6b4a1c; }

/* ---- Frames (15) ---- */
#top { background: linear-gradient(#3b2a1ccc, #1c1510ee), url(ui/wood.jpg) center / 512px auto; border-bottom: 0;
  box-shadow: inset 0 -2px 0 var(--brass-lo), inset 0 -3px 0 var(--brass), 0 3px 10px #000a; }
#tabs { background: linear-gradient(#2e2219dd, #120d09f0), url(ui/wood.jpg) center / 512px auto; border-top: 0;
  box-shadow: inset 0 2px 0 var(--brass-lo), inset 0 3px 0 var(--brass), 0 -3px 10px #000a; }
#tabs button.on { background: radial-gradient(ellipse at 50% 100%, #dbad5740, #0000 70%); }
#tabs button.on::before { content: ""; position: absolute; top: 3px; left: 25%; right: 25%; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, #0000, var(--brass-hi), #0000); }
.res { background: linear-gradient(#0009, #000c); border-color: #7a5a2c; box-shadow: inset 0 1px 0 #ffffff14; }
#page { background: radial-gradient(ellipse at 50% 0, #3a2a1ccc, #17120fee 75%), url(ui/leather.jpg) 0 0 / 256px; }
#page > h2:first-child, #sheet-body > h2:first-child { display: flex; align-items: center; gap: 10px; }
#page > h2:first-child::after { content: ""; flex: 1; height: 2px; background: linear-gradient(90deg, var(--brass), #0000); opacity: .7; }
h3 { display: flex; align-items: center; gap: 8px; }
h3::before { content: "◆"; font-size: calc(9px * var(--ts)); color: var(--brass); }
.card { position: relative; background: linear-gradient(#2e2218e6, #1c140ef0), url(ui/leather.jpg) 0 0 / 256px;
  border: 1px solid #6b4a24; box-shadow: inset 0 0 0 1px #00000080, inset 0 1px 0 #ffffff12, 0 3px 8px #0007; }
.card::before, .card::after { content: ""; position: absolute; width: 12px; height: 12px; pointer-events: none;
  border: 2px solid var(--brass); opacity: .85; }
.card::before { left: 3px; top: 3px; border-right: 0; border-bottom: 0; border-radius: 4px 0 0 0; }
.card::after { right: 3px; bottom: 3px; border-left: 0; border-top: 0; border-radius: 0 0 4px 0; }
#sheet { background: linear-gradient(#3d2b1ff2, #2b1f17f8), url(ui/leather.jpg) 0 0 / 256px;
  border-top: 0; box-shadow: inset 0 3px 0 var(--brass), inset 0 4px 0 var(--brass-lo), 0 -8px 30px #000a; }
button { background: linear-gradient(#8a5c2e, #5a3818 55%, #4a2c12); border-color: var(--brass);
  box-shadow: 0 2px 0 #000a, inset 0 1px 0 #ffffff40, inset 0 -2px 0 #0004; text-shadow: 0 1px 0 #0008; }
button.primary { background: linear-gradient(#d39a44, #9a6424 55%, #7a4a18); color: #fff7e0; }
button:not(:disabled):hover { filter: brightness(1.08); }
.login-card { background: linear-gradient(#3d2b1fe6, #2b1f17f0), url(ui/leather.jpg) 0 0 / 256px; position: relative; z-index: 1;
  box-shadow: 0 0 0 1px #000, inset 0 0 0 3px #2b1f17, inset 0 0 0 4px var(--brass), 0 20px 50px #000c; }
.login-card h1 { background: linear-gradient(100deg, #b07a2a 20%, #fff2b8 40%, #e0a84a 50%, #b07a2a 70%) 0 0 / 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 6s linear infinite;
  filter: drop-shadow(0 2px 0 #000); }
@keyframes shine { from { background-position: 100% 0; } to { background-position: -200% 0; } }

/* ---- Login scene (22) ---- */
#login { background: #17120f; }
#login-scene { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }

/* ---- More pictures (16) and troop art (23) ---- */
.troop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 8px 0; }
.troop-card { margin: 0; text-align: center; padding-top: 4px; }
.troop-card img { width: 110px; height: 110px; object-fit: contain; filter: drop-shadow(0 6px 6px #000a); }
.troop-card b { display: block; font-family: Cinzel, serif; color: var(--gold); }
.troop-n { font: 700 calc(22px * var(--ts)) Cinzel, serif; color: #fff0c8; }
img.troop-art { flex: none; width: 64px; height: 64px; object-fit: contain; filter: drop-shadow(0 4px 4px #000a); }
.item-card .item-pic { flex: none; position: relative; width: 58px; height: 58px; display: grid; place-items: center;
  border-radius: 10px; background: radial-gradient(#5a3c1e, #24170d); border: 1px solid var(--brass-lo); }
.item-card .item-n { position: absolute; right: -4px; bottom: -6px; font: 700 calc(12px * var(--ts)) Alegreya, serif; background: #120d0a;
  border: 1px solid var(--brass); border-radius: 8px; padding: 0 5px; }
.report-ico { flex: none !important; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: #0006; }
.report-ico .glyph { width: 20px; height: 20px; }
.report-card.win { border-left: 3px solid #8cd973; }
.report-card.loss { border-left: 3px solid #f27361; }
.report-card.loss .glyph { background-color: #f27361 !important; }
.report-card.win .glyph { background-color: #8cd973 !important; }

/* ---- Hero frames (17) ---- */
.hero-card { cursor: pointer; }
.hero-card .portrait.small { box-shadow: 0 0 0 2px #000, 0 0 10px var(--rc, #0000); }
.hero-card.r-rare { --rc: #6fb2ff66; }
.hero-card.r-epic { --rc: #c58cff88; border-color: #6a4a8a; }
.hero-card.r-legendary { --rc: #ffc94daa; border-color: #8a6a2a;
  background: linear-gradient(115deg, #0000 30%, #ffe39a14 45%, #0000 60%) 0 0 / 300% 100%, linear-gradient(#2e2218e6, #1c140ef0), url(ui/leather.jpg) 0 0 / 256px;
  animation: legend 5s linear infinite; }
@keyframes legend { from { background-position: 100% 0, 0 0, 0 0; } to { background-position: -200% 0, 0 0, 0 0; } }
.hero-card.r-legendary .portrait.small { animation: halo 2.4s ease-in-out infinite; }
@keyframes halo { 50% { box-shadow: 0 0 0 2px #000, 0 0 18px #ffc94d; } }
.hero-detail { text-align: center; }
.hero-detail .hd-frame { display: inline-block; padding: 6px; border-radius: 16px; margin-top: 6px;
  background: conic-gradient(from 0deg, var(--fc1, #8a7a5a), var(--fc2, #e8dcc2), var(--fc1, #8a7a5a), var(--fc2, #e8dcc2), var(--fc1, #8a7a5a));
  box-shadow: 0 0 24px var(--glow, #0000); }
.hero-detail .portrait.big { margin: 0; border: 2px solid #000; filter: contrast(1.05) saturate(1.1); }
.hero-detail.r-rare { --fc1: #2c5a99; --fc2: #9fd0ff; --glow: #6fb2ff55; }
.hero-detail.r-epic { --fc1: #5a2c80; --fc2: #e0b8ff; --glow: #c58cff77; }
.hero-detail.r-legendary { --fc1: #8a5a12; --fc2: #fff0a8; --glow: #ffc94d99; }
.hero-detail.r-legendary .hd-frame { animation: spin-glow 3s ease-in-out infinite; }
@keyframes spin-glow { 50% { box-shadow: 0 0 40px #ffc94d; } }
.hd-level { margin: 8px auto; max-width: 220px; font-family: Cinzel, serif; color: var(--gold); }
.hd-level .bar { height: 8px; background: #0008; border-radius: 4px; overflow: hidden; margin-top: 4px; }
.hd-level .bar i { display: block; height: 100%; background: linear-gradient(90deg, #c9973f, #ffe39a); }
.hd-story { font-style: italic; }
.skill { display: flex; gap: 10px; align-items: center; text-align: left; }
.skill .lock { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(#5a3c1e, #24170d); border: 2px solid var(--brass); font-size: calc(18px * var(--ts)); }
.skill.locked { opacity: .5; }
/* Hero star-ups */
.hc-stars { color: #ffd86b; letter-spacing: 1px; font-size: calc(13px * var(--ts)); white-space: nowrap; }
.hd-stars { text-align: center; color: #ffd86b; font-size: calc(30px * var(--ts)); letter-spacing: 4px; text-shadow: 0 0 10px #ffc94d88, 0 2px 0 #000; margin: 2px 0 6px; }
.star-card .bar.shards { height: 10px; background: #0008; border-radius: 5px; overflow: hidden; margin: 4px 0 6px; }
.star-card .bar.shards i { display: block; height: 100%; background: linear-gradient(90deg, #8a5a12, #ffd86b); }
.star-needs { margin: 6px 0; } .star-needs .bad { color: #ff8a7a; }
.star-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; text-align: left; }
.star-compare > div { background: #0004; border-radius: 8px; padding: 6px 8px; }
.star-compare .next { border: 1px solid #ffd86b88; } .star-compare .next small { color: #ffd86b; }
.gear-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.gear-slot { aspect-ratio: 1; border-radius: 10px; border: 1px dashed #7a5a2c; display: grid; place-items: center; font-size: calc(11px * var(--ts));
  color: var(--ink-dim); background: #0005; text-align: center; padding: 2px; cursor: pointer; }
.gear-slot.on { border-style: solid; border-color: var(--brass); background: radial-gradient(#5a3c1e, #24170d); color: var(--ink); }

/* ---- Shop (19) ---- */
.shop-grid .card.product { padding-top: 14px; overflow: hidden; }
.product .shop-art { width: 120px; height: 90px; align-self: center; filter: drop-shadow(0 4px 6px #000a); }
.big-art.shop-art { width: 200px; height: 150px; }
.product.tier-3 { border-color: #8a6a2a; }
.product.tier-4 { border-color: #b08a3a; box-shadow: inset 0 0 30px #ffd76a14, 0 3px 8px #0007; }
.product.tier-5 { border-color: #e0b050; box-shadow: inset 0 0 40px #ffd76a22, 0 0 12px #ffd76a33; }
/* A flat tag in the top right corner. It used to be a slanted ribbon, but the corner cut longer words off
   ("Самое популярное", "Am beliebtesten", "Le plus populaire"). */
.product .flag { position: absolute; top: 10px; right: 10px; max-width: calc(100% - 110px); background: linear-gradient(#e8404a, #a0202a);
  color: #fff; font: 700 calc(10px * var(--ts)) Cinzel, serif; padding: 3px 10px; border-radius: 10px; box-shadow: 0 2px 4px #0008; z-index: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Flying rewards and level-up banner (20) ---- */
#fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 30; }
img.fly { position: fixed; left: 0; top: 0; width: 28px; height: 28px; filter: drop-shadow(0 0 6px #ffd76a) sepia(1) saturate(4) hue-rotate(-10deg); }
.levelup { position: fixed; left: 0; right: 0; top: 30%; display: grid; place-items: center; animation: lu-in .45s cubic-bezier(.2,1.4,.4,1); }
.levelup.out { animation: lu-out .5s ease-in forwards; }
.levelup .rays { position: absolute; width: 380px; height: 380px; border-radius: 50%;
  background: repeating-conic-gradient(#ffe39a33 0 8deg, #0000 8deg 20deg); animation: spin 8s linear infinite;
  mask: radial-gradient(#000 20%, #0000 70%); -webkit-mask: radial-gradient(#000 20%, #0000 70%); }
.lu-card { position: relative; display: flex; flex-direction: column; align-items: center; padding: 12px 34px;
  background: linear-gradient(#5a3818, #2b1a0c); border: 2px solid var(--brass-hi); border-radius: 12px; box-shadow: 0 0 30px #ffd76a66, 0 10px 30px #000c; }
.lu-card small { font-family: Cinzel, serif; color: var(--ink-dim); letter-spacing: .1em; text-transform: uppercase; font-size: calc(11px * var(--ts)); }
.lu-card b { font: 700 calc(24px * var(--ts)) Cinzel, serif; color: var(--brass-hi); text-shadow: 0 2px 0 #000; }
.lu-card span { font: 700 calc(16px * var(--ts)) Alegreya, serif; color: #fff; }
@keyframes lu-in { from { transform: scale(.4); opacity: 0; } }
@keyframes lu-out { to { transform: translateY(-40px); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Hero pack show (18) ---- */
.pack-show { position: fixed; inset: 0; z-index: 40; background: radial-gradient(#1a120cdd, #050302f5); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; padding: 20px; animation: fade-in .25s ease-out; perspective: 900px; }
.pack-show.out { animation: fade-out .3s ease-in forwards; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
.ps-rays { position: absolute; left: 50%; top: 38%; width: 700px; height: 700px; margin: -350px 0 0 -350px; border-radius: 50%; opacity: 0;
  background: repeating-conic-gradient(var(--rc) 0 6deg, #0000 6deg 18deg); animation: spin 14s linear infinite;
  mask: radial-gradient(#000 10%, #0000 65%); -webkit-mask: radial-gradient(#000 10%, #0000 65%); transition: opacity .6s; }
.pack-show.revealed .ps-rays { opacity: .5; }
.pack-show.tier-3.revealed .ps-rays { opacity: .85; }
.ps-sparks { position: fixed; inset: 0; pointer-events: none; }
.ps-card { position: relative; width: 210px; height: 290px; transform-style: preserve-3d; transition: transform .8s cubic-bezier(.3,1.3,.5,1);
  animation: ps-float 1.6s ease-in-out infinite; }
@keyframes ps-float { 50% { translate: 0 -8px; } }
.ps-card.flip { transform: rotateY(180deg); }
.ps-back, .ps-front { position: absolute; inset: 0; border-radius: 16px; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.ps-back { background: linear-gradient(135deg, #5a3818, #2b1a0c); border: 3px solid var(--brass); box-shadow: 0 0 30px #000;
  font: 700 calc(18px * var(--ts)) Cinzel, serif; color: var(--brass-hi); }
.ps-back img { width: 90px; height: 90px; filter: sepia(1) saturate(3) hue-rotate(-12deg); animation: pulse 0.9s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.12); } }
.ps-front { transform: rotateY(180deg); background: linear-gradient(#2e2218, #120d09); border: 3px solid var(--rc); box-shadow: 0 0 40px var(--rc); }
.ps-portrait { width: 160px; height: 160px; border-radius: 12px; border: 2px solid var(--rc); }
.ps-name { font: 700 calc(19px * var(--ts)) Cinzel, serif; color: #fff2d0; text-align: center; }
.ps-info { position: relative; max-width: 360px; text-align: center; opacity: 0; transform: translateY(14px); transition: all .5s .5s; }
.pack-show.revealed .ps-info { opacity: 1; transform: none; }
.pack-show.tier-3 .ps-front { animation: legend-glow 1.4s ease-in-out infinite; }
@keyframes legend-glow { 50% { box-shadow: 0 0 70px var(--rc), 0 0 120px #fff3; } }

/* ---- Zoom buttons and map hud ---- */
#map-hud button.round { background: radial-gradient(#7a5029, #3a2410); box-shadow: 0 3px 8px #000a, inset 0 1px 0 #fff3; }

/* Sound button (24, 25) */
#sound-btn { min-height: 28px; padding: 0 8px; border-radius: 14px; border-width: 1px; font-size: calc(14px * var(--ts)); margin-left: auto; margin-right: 6px; }
#who-crowns { margin-left: 0; }
#login { padding-top: calc(30vh + var(--safe-top)); }
.login-card { background: linear-gradient(#3d2b1fd9, #2b1f17e6), url(ui/leather.jpg) 0 0 / 256px; backdrop-filter: blur(3px); }

/* ---- Gameplay (items 26-41) ---- */
.bar { height: 7px; background: #0007; border-radius: 4px; overflow: hidden; margin-top: 5px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #c9973f, #ffe39a); transition: width .4s; }
.bar.red i { background: linear-gradient(90deg, #a33, #f77); }
.bar.gold i { background: linear-gradient(90deg, #d08a1c, #ffe07a); }
#gp-hud { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
#gp-hud > * { pointer-events: auto; }
/* The city buttons (Quests, Mail, Ranks, Events...) sit in their own wooden bar across the top of the town, just under
   the resources, like a second toolbar. When there are more than fit the width, the bar scrolls sideways and a soft
   fade on the right edge shows there is more. --gp-bar is the bar's height, so the chips below it can sit under it. */
#view { --gp-bar: calc(50px + 12px * var(--ts, 1)); --gp-top: 0px; }
body.under-attack #view { --gp-top: 66px; }
.gp-side { position: absolute; left: 0; right: 0; top: var(--gp-top); height: var(--gp-bar); display: flex; gap: 4px; align-items: center;
  padding: 0 8px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
  background: linear-gradient(#2b1a0cf2, #1c1108e6); border-bottom: 2px solid #7a5a2c; box-shadow: 0 3px 10px #0008, inset 0 1px 0 #ffd99a22;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), #0000); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), #0000); }
.gp-side::-webkit-scrollbar { display: none; }
.gp-side.end { -webkit-mask-image: none; mask-image: none; }
.gp-side > .gp-btn { flex: 0 0 auto; width: auto; min-width: 54px; min-height: 0; height: calc(var(--gp-bar) - 8px); padding: 3px 6px 2px;
  border-radius: 10px; justify-content: center; }
.gp-side > .gp-btn span { white-space: nowrap; }
.gp-side > .gp-btn .badge { top: 1px; right: 1px; }
#view:has(#gp-hud:not(.hidden)) #queue { top: calc(var(--gp-top) + var(--gp-bar) + 8px); }
.gp-btn { position: relative; width: 52px; min-height: 52px; padding: 4px 0 2px; display: flex; flex-direction: column; align-items: center; gap: 1px;
  border-radius: 12px; background: radial-gradient(circle at 50% 30%, #8a5a2e, #3d2410); box-shadow: 0 3px 8px #000a, inset 0 1px 0 #ffd99a55; }
.gp-btn img { width: 24px; height: 24px; filter: drop-shadow(0 1px 1px #000); }
.gp-btn span { font-size: calc(10px * var(--ts)); letter-spacing: .02em; }
.gp-btn .badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; border-radius: 9px; background: #d33; color: #fff;
  font: 700 calc(11px * var(--ts))/18px Inter, sans-serif; font-style: normal; box-shadow: 0 0 0 2px #2b1a0c; animation: gp-pop 1.6s ease-in-out infinite; }
@keyframes gp-pop { 50% { transform: scale(1.15); } }
.gp-quest { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; gap: 8px; align-items: center; padding: 7px 9px;
  border: 2px solid var(--gold); border-radius: 12px; background: linear-gradient(#3a2614ee, #22150aee); box-shadow: 0 4px 14px #000b; }
.gp-quest img { width: 30px; height: 30px; }
.gp-quest .t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gp-quest .t b { color: var(--gold); font-size: calc(14px * var(--ts)); }
.gp-quest .t .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gp-quest.done { border-color: #8fe07a; box-shadow: 0 0 16px #8fe07a66, 0 4px 14px #000b; }
.gp-guide { position: absolute; left: 8px; right: 8px; bottom: 76px; display: flex; gap: 8px; padding: 8px; border-radius: 12px;
  background: linear-gradient(#f6e7c7, #e0c99a); color: #3a2614; border: 2px solid #8a5a2e; box-shadow: 0 6px 18px #000a; animation: gp-in .4s ease-out; }
.gp-guide img { width: 62px; height: 62px; border-radius: 10px; object-fit: cover; border: 2px solid #8a5a2e; }
.gp-guide small { color: #8a5a2e; font-weight: 700; display: block; }
.gp-guide b { display: block; }
.gp-guide .btns { margin-top: 6px; gap: 6px; }
.gp-guide button { min-height: 34px; padding: 4px 10px; }
@keyframes gp-in { from { transform: translateY(12px); opacity: 0; } }
#gp-arrow { position: absolute; z-index: 5; width: 28px; text-align: center; color: #ffe39a; font-size: calc(30px * var(--ts)); pointer-events: none;
  text-shadow: 0 0 8px #000, 0 0 14px #ffb84d; animation: gp-bounce .8s ease-in-out infinite alternate; }
@keyframes gp-bounce { to { transform: translateY(12px); } }
#tabs button.gp-pulse { animation: gp-tab 1s ease-in-out infinite alternate; }
@keyframes gp-tab { to { background: #c9973f55; box-shadow: inset 0 0 0 2px #ffe39a; } }
.seg { display: flex; gap: 4px; margin-bottom: 10px; }
.seg button { flex: 1; min-height: 38px; padding: 6px; opacity: .7; }
.seg button.on { opacity: 1; background: linear-gradient(#b07a3a, #6d4520); }
.card.done { border-color: #8fe07a; }
.card .ico, .row .ico { width: 34px; height: 34px; flex: none; }
.reward { color: #e9d39a; margin-top: 4px; }
.daily-top .chests { display: flex; justify-content: space-around; margin-top: 10px; }
.chest { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 30%; text-align: center; opacity: .75; }
.chest img { width: 42px; height: 42px; }
.chest.ready { opacity: 1; animation: gp-pop 1.2s infinite; }
.chest.ready img { filter: drop-shadow(0 0 8px #ffd86b); }
.chest.claimed { opacity: .4; }
.calendar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0; }
.calendar .day { border: 1px solid var(--gold-dark); border-radius: 10px; padding: 6px 4px; text-align: center; background: #0005; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.calendar .day img { width: 34px; height: 34px; }
.calendar .day.got { opacity: .45; }
.calendar .day.today { border: 2px solid #ffe39a; box-shadow: 0 0 14px #ffd86b88; }
.calendar .day.big { grid-column: span 2; background: linear-gradient(#5b3a8a88, #2a1a4488); }
.titles { display: flex; flex-wrap: wrap; gap: 6px; }
.titles button { min-height: 34px; padding: 4px 10px; font-size: calc(13px * var(--ts)); }
.stars span { color: #6b5a3e; font-size: calc(18px * var(--ts)); } .stars span.on { color: #ffd86b; text-shadow: 0 0 6px #ffb84d; }
.mail-row { display: flex; gap: 10px; align-items: center; } .mail-row.unread b { color: #ffe39a; } .mail-row.unread { border-left: 4px solid #ffd86b; }
.ellip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.letter { white-space: pre-wrap; background: #f3e3bf; color: #3a2614; padding: 14px; border-radius: 8px; font-family: Georgia, serif; line-height: 1.5; }
textarea { width: 100%; font: inherit; color: var(--ink); background: #120d0a; border: 1px solid var(--gold-dark); border-radius: 6px; padding: 10px; }
.rank-row { display: flex; gap: 10px; align-items: center; } .rank-row .rank { width: 30px; text-align: center; font-weight: 700; }
.rank-row.me { border-color: #6fb0ff; box-shadow: 0 0 10px #6fb0ff55; } .rank-row.top1 { background: linear-gradient(90deg, #6b5320aa, transparent); }
.troop-mini { display: flex; gap: 12px; margin: 6px 0; } .troop-mini img { width: 20px; vertical-align: middle; margin-right: 3px; }
.trap-card .row input { width: 90px; margin: 0; }
.skill { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 8px; background: #0004; margin: 5px 0; opacity: .55; }
.skill.on { opacity: 1; border: 1px solid #ffd86b88; } .skill .lv { width: 40px; text-align: center; font-weight: 700; color: #ffd86b; }
.gear-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.gear-slot { display: flex; flex-direction: column; align-items: center; padding: 6px 2px; min-height: 100px; line-height: 1.15; gap: 2px; background: #0006; border: 2px dashed #85612b; }
.gear-slot img { width: 30px; height: 30px; opacity: .5; } .gear-slot small { font-size: calc(11px * var(--ts)); } .gear-slot i { font-size: calc(10px * var(--ts)); font-style: normal; color: #9fe08a; }
.gear-slot[class*=" t-"] { border-style: solid; } .gear-slot[class*=" t-"] img { opacity: 1; }
.t-common { border-color: #9aa3ad !important; } .t-rare { border-color: #7fc4ff !important; } .t-epic { border-color: #c58aff !important; } .t-legendary { border-color: #ffd86b !important; box-shadow: 0 0 10px #ffd86b55; }
.t-royal { border-color: #ffd86b !important; }
.gear-pick .col { display: flex; flex-direction: column; gap: 4px; }
.mat-row { display: flex; gap: 6px; justify-content: space-between; } .mat { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.mat img { width: 28px; height: 28px; } .mat small { font-size: calc(11px * var(--ts)); opacity: .8; }
.forge-item .cost span { white-space: nowrap; }
.forge-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-top: 6px; }
.forge-item { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; padding: 6px; background: #0005; border-radius: 8px; }
.forge-item img { width: 30px; } .forge-item.off { opacity: .5; } .forge-item .cost { justify-content: center; }
.ally-btns { gap: 6px; flex-wrap: wrap; margin: 8px 0; } .ally-btns button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 4px; font-size: calc(13px * var(--ts)); padding: 6px; }
.ally-btns img { width: 20px; }
.tech .row input, .tech .row select { margin: 0; } .tech .row input { width: 90px; } .tech .row select { width: 80px; }
.gift.t-royal { box-shadow: 0 0 12px #ffd86b55; }
#gp-alert { position: absolute; z-index: 6; left: 8px; right: 8px; top: 8px; display: flex; gap: 8px; align-items: center; padding: 8px 10px;
  background: linear-gradient(#8a1a14f0, #4a0a08f0); border: 2px solid #ff8a7a; border-radius: 12px; box-shadow: 0 0 24px #ff3b2b88; animation: gp-alarm 1s ease-in-out infinite alternate; }
#gp-alert img { width: 32px; } #gp-alert .t { flex: 1; display: flex; flex-direction: column; } #gp-alert b { color: #fff; }
#gp-alert button { min-height: 36px; padding: 4px 12px; }
@keyframes gp-alarm { to { box-shadow: 0 0 40px #ff3b2bcc; } }
body.under-attack #view:has(#page.hidden)::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 3;
  box-shadow: inset 0 0 36px 4px #d0201499; animation: gp-vig 1.2s ease-in-out infinite alternate; }
@keyframes gp-vig { from { opacity: .45; } }
#notify-btn { min-height: 30px; padding: 2px 6px; background: none; border: 0; font-size: calc(18px * var(--ts)); }
.replay { position: fixed; inset: 0; z-index: 60; background: #000; display: flex; flex-direction: column; }
.rp-top { display: flex; align-items: center; gap: 8px; padding: 10px 12px; padding-top: calc(10px + var(--safe-top, 0px)); background: linear-gradient(#3a2614, #22150a); border-bottom: 2px solid var(--gold); }
.rp-top b { flex: 1; color: var(--gold); }
.rp-canvas { flex: 1; width: 100%; min-height: 0; }
.rp-label { padding: 10px 14px; min-height: 44px; background: #120d0a; font-size: calc(14px * var(--ts)); }
.rp-ctl { display: flex; gap: 8px; justify-content: center; padding: 8px 8px calc(10px + var(--safe-bottom, 0px)); background: #120d0a; }

/* ---- Settings sheet ---- */
.set-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(219,173,87,.15); }
.set-row.set-col { flex-direction: column; align-items: stretch; gap: 4px; }
.set-name { flex: 1; font-size: calc(15px * var(--ts)); }
.set-row input[type=range] { flex: 1.4; width: auto; padding: 0; accent-color: var(--gold); background: transparent; border: 0; min-height: 32px; }
.set-val { width: 44px; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-dim); }
.set-chips { margin: 0; }
.set-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 6px 0; border-radius: 10px;
  border: 1px solid rgba(219,173,87,.35); background: rgba(0,0,0,.25); color: var(--ink); text-decoration: none; }
.set-link img { width: 28px; height: 28px; flex: none; }
.set-link span:first-of-type { display: flex; flex-direction: column; flex: 1; line-height: 1.25; }
.set-link small { color: var(--ink-dim); font-size: calc(13px * var(--ts)); }
.set-link.off { opacity: .6; }
.set-go { font-size: calc(24px * var(--ts)); color: var(--gold); }
.set-soon { font-size: calc(12px * var(--ts)); color: var(--ink-dim); border: 1px solid var(--ink-dim); border-radius: 999px; padding: 2px 8px; }
.set-legal a { color: var(--gold); }
#settings-btn { min-height: 28px; padding: 0 8px; border-radius: 14px; border-width: 1px; font-size: calc(15px * var(--ts)); margin-left: auto; margin-right: 6px; }

/* ---- Open many: 0 to max ---- */
.open-many { display: flex; align-items: center; gap: 8px; width: 100%; flex-wrap: wrap; }
.open-many input[type=range] { flex: 1; min-width: 120px; width: auto; padding: 0; accent-color: var(--gold); background: transparent; border: 0; min-height: 32px; }
.open-many .om-n { width: 62px; text-align: center; padding: 6px; font-size: calc(16px * var(--ts)); }
.open-many button { flex: none; }
.pack-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow: auto; }
.pack-list .row { gap: 10px; align-items: center; }

/* ---- Chat: world, alliance, whispers ---- */
#chat-btn { position: relative; min-height: 28px; padding: 0 8px; border-radius: 14px; border-width: 1px; font-size: calc(15px * var(--ts)); margin-left: auto; margin-right: 6px; }
#chat-btn + #settings-btn { margin-left: 0; }
#chat-dot { top: -4px; right: -4px; width: auto; min-width: 16px; height: 16px; padding: 0 3px; font-size: calc(10px * var(--ts)); font-style: normal;
  line-height: 16px; color: #fff; font-family: Alegreya, serif; text-align: center; }
.chat-tabs { margin: 4px 0 8px; }
.chat-big { max-height: 46vh; min-height: 180px; }
.chat-at { color: var(--ink-dim); font-size: calc(11px * var(--ts)); margin-right: 6px; }
.chat-me b { color: #9fd38a; }
.chat-name { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.chat-peer { align-items: center; gap: 10px; margin-bottom: 6px; }
.chat-thread { cursor: pointer; }
/* Chat translation (translate.js): the 🌐 button on a line, and the note under a translated one. */
.chat .chat-tr-btn { background: none; border: none; box-shadow: none; min-height: 0; padding: 0 4px; margin-left: 2px; font-size: 0.9em; opacity: 0.75; }
.chat .chat-tr { display: block; margin-top: 1px; color: var(--ink-dim); font-size: calc(11px * var(--ts)); cursor: pointer; }
.chat-unread { flex: none; min-width: 22px; padding: 2px 6px; border-radius: 999px; background: var(--bad); color: #fff; text-align: center; font-size: calc(12px * var(--ts)); }

/* ---- Profiles and VIP ---- */
.vip-badge { display: inline-block; flex: none; padding: 1px 7px; border-radius: 999px; font-size: calc(11px * var(--ts)); font-family: Cinzel, serif;
  color: #2b1a06; background: linear-gradient(#f3d58a, #c8973c); border: 1px solid #8a6424; cursor: pointer; vertical-align: middle; }
.vip-badge.big { font-size: calc(15px * var(--ts)); padding: 4px 12px; margin-right: 10px; }
#who-vip { margin-left: 6px; }
.vip-got { opacity: .65; }
.pf-head { display: flex; align-items: center; gap: 12px; }
.pf-head h2 { margin: 0; }
.pf-head > div { flex: 1; }
.pf-head .ico { width: 44px; height: 44px; }
.pf-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.pf-stat { background: #0004; border-radius: 8px; padding: 8px; text-align: center; }
.pf-stat b { display: block; font-size: calc(17px * var(--ts)); color: var(--gold); }
.pf-stat small { color: var(--ink-dim); }

/* ---- Events: world boss and Hero Trials ---- */
.ev-card { cursor: pointer; }
.ev-card .ico { width: 40px; height: 40px; }
.ev-card .badge { position: static; flex: none; }
.ev-good { border-color: var(--good); }
.ev-me { background: #e8c46a22; border-radius: 8px; }
.boss-bar { height: 12px; }
.boss-bar i { background: linear-gradient(90deg, #b8321c, #ff7a3d) !important; }
.ev-hero { cursor: pointer; border: 1px solid transparent; border-radius: 8px; }
.ev-hero.on { border-color: var(--gold); background: #e8c46a18; }
.ev-hero .pic { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; }

/* ---- Lucky wheel, season pass, invites ---- */
.wheel-wrap { position: relative; width: 260px; height: 260px; margin: 8px auto 12px; }
.wheel-disc { width: 100%; height: 100%; border-radius: 50%; border: 6px solid #c9973f; box-shadow: 0 6px 20px #0008, inset 0 0 30px #0006;
  transition: transform 3s cubic-bezier(.17, .67, .2, 1); position: relative; }
.wheel-num { position: absolute; left: 50%; top: 50%; width: 24px; margin: -11px 0 0 -12px; text-align: center; font-family: Cinzel, serif; color: #ffe9b0; font-weight: bold; }
.wheel-pin { position: absolute; left: 50%; top: -10px; margin-left: -12px; border: 12px solid transparent; border-top: 22px solid #ffe39a; filter: drop-shadow(0 2px 2px #000a); }
.season-head, .season-row { display: grid; grid-template-columns: 36px 1fr 1fr; gap: 6px; align-items: center; }
.season-head { color: var(--ink-dim); font-size: calc(12px * var(--ts)); margin: 8px 0 4px; }
.season-row { padding: 6px 0; border-top: 1px solid #ffffff14; opacity: .7; }
.season-row.reached { opacity: 1; }
.season-cell { background: #0004; border-radius: 6px; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.season-cell.premium { background: #c9973f22; border: 1px solid #c9973f55; }
.invite-name { font-family: Cinzel, serif; font-size: calc(22px * var(--ts)); color: var(--gold); margin: 4px 0; }
.kvk-bar { display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: #0006; margin: 10px 0 6px; }
.kvk-dawn { background: linear-gradient(90deg, #f3c25a, #e88a2a); }
.kvk-dusk { background: linear-gradient(90deg, #5a62c9, #2c2f7a); margin-left: auto; }
.kvk-names { justify-content: space-between; margin-bottom: 8px; }

/* ---- Troop tiers: T1 to T10 chips at each training building, tier tags on troop cards ---- */
.tier-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 8px; }
.tier-chip { flex: 1 0 15%; min-width: 46px; min-height: 40px; padding: 4px 0; font: 700 calc(14px * var(--ts)) Cinzel, serif; border-radius: 9px;
  background: linear-gradient(#4a3420, #2a1c10); color: #f5e6c2; border: 1px solid var(--brass-lo); }
.tier-chip.gold { border-color: #e8b94c; color: #ffe39a; }
.tier-chip.on { background: linear-gradient(#d9a441, #8a5a1c); color: #1d1208; border-color: #ffe39a; box-shadow: 0 0 10px #e8b94c88; }
.tier-chip.locked { opacity: .5; }
.tier-tag { display: table; font: 700 calc(11px * var(--ts)) Cinzel, serif; letter-spacing: .04em; color: #1d1208; background: #c98a3a;
  border-radius: 6px; padding: 1px 6px; margin-bottom: 2px; }
.elite .tier-tag { background: linear-gradient(#ffe39a, #d9a441); }
.troop-card { position: relative; }
.troop-card .tier-tag { position: absolute; top: 6px; left: 6px; }
.card.elite { border-color: #e8b94c; box-shadow: inset 0 0 18px #e8b94c22; }
.tstats { display: flex; gap: 6px; margin: 6px 0; }
.tstat { flex: 1; text-align: center; background: #0003; border-radius: 8px; padding: 3px 0; }
.tstat small { display: block; font-size: calc(11px * var(--ts)); color: var(--dim, #b9a888); }
.tstat b { font-size: calc(14px * var(--ts)); }
.troop-row img.troop-art { width: 92px; height: 92px; }

/* Academy group tabs */
.research-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.research-tabs button { flex: 1 1 auto; min-width: 0; }
.research-tabs button:not(.primary) { opacity: 0.55; filter: saturate(0.6); }

/* The chat button blinks while the chat is closed and someone has written since you last looked. */
@keyframes chat-blink { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 210, 110, 0); filter: none; } 50% { box-shadow: 0 0 0 4px rgba(255, 210, 110, 0.85); filter: brightness(1.45); } }
#chat-btn.chat-blink { animation: chat-blink 1s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { #chat-btn.chat-blink { animation: none; box-shadow: 0 0 0 3px rgba(255, 210, 110, 0.9); } }

/* ---- features.js: beasts, looks, formations, invasions, duels, caravans, alerts ---- */
.beast-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0; }
.beast-tile { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; min-height: 86px; border-color: var(--beast); }
.beast-tile img { width: 40px; height: 40px; filter: drop-shadow(0 0 6px var(--beast)); }
.beast-tile.egg img { opacity: .75; filter: none; }
.beast-tile.on { box-shadow: 0 0 0 2px var(--beast) inset, 0 0 12px var(--beast); }
.beast-tile.active::after { content: "⚔"; position: absolute; top: 4px; right: 6px; font-size: calc(13px * var(--ts)); }
.beast-tile { position: relative; }
.beast-tile small { font-size: calc(12px * var(--ts)); color: var(--ink-dim); }
.beast-card { border-color: var(--beast); }
.beast-pic { width: 64px; height: 64px; border-radius: 50%; margin-right: 12px; display: grid; place-items: center; flex: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--beast) 55%, transparent), transparent 70%); border: 2px solid var(--beast); }
.beast-pic img { width: 44px; height: 44px; }
.beast-bar i { background: var(--beast); }
.skin-card.on { border-color: var(--gold); box-shadow: 0 0 10px rgba(219, 173, 87, .35); }
.skin-swatch { width: 56px; height: 56px; border-radius: 10px; margin-right: 12px; flex: none; border: 2px solid rgba(0,0,0,.4); }
.fm-card { cursor: pointer; }
.fm-card.on { border-color: var(--gold); }
.fm-rows { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.fm-line { display: flex; align-items: center; gap: 6px; background: rgba(0,0,0,.25); border-radius: 8px; padding: 4px 8px; }
.fm-line small { width: 92px; color: var(--ink-dim); }
.fm-line img { width: 24px; height: 24px; }
.fm-pick { margin: 10px 0; }
.fm-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.fm-chips button { min-height: 40px; }
.army-extra { gap: 8px; }
.fm-mini { flex: 1; display: flex; align-items: center; gap: 8px; text-align: left; min-height: 56px; }
.fm-mini img { width: 30px; height: 30px; flex: none; }
.fm-mini div { display: flex; flex-direction: column; }
.fm-mini small { font-weight: 400; font-size: calc(12px * var(--ts)); color: var(--ink-dim); }
.inv-live { border-color: #c0281c; box-shadow: 0 0 12px rgba(192, 40, 28, .45); }
.inv-waves { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0; }
.inv-wave { display: flex; flex-direction: column; padding: 6px 8px; border-radius: 8px; background: rgba(0,0,0,.3); border: 1px solid #5a4632; font-size: calc(13px * var(--ts)); }
.inv-wave small { font-size: calc(11px * var(--ts)); }
.inv-wave.held { border-color: #6fbf5a; background: rgba(60, 120, 50, .3); }
.inv-wave.lost { border-color: #c0281c; background: rgba(140, 30, 20, .3); }
.inv-wave.done { opacity: .7; }
.inv-me { justify-content: space-between; gap: 8px; margin: 6px 0; }
.inv-me > div { flex: 1; text-align: center; background: rgba(0,0,0,.25); border-radius: 8px; padding: 6px 2px; }
.duel-me .duel-league { font-size: calc(34px * var(--ts)); margin-right: 10px; }
.duel-left { text-align: center; display: flex; flex-direction: column; }
.duel-left b { font-size: calc(24px * var(--ts)); color: var(--gold); }
.duel-left small { font-size: calc(11px * var(--ts)); color: var(--ink-dim); }
.duel-heroes { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.duel-hero { position: relative; flex: none; width: 76px; padding: 4px; display: flex; flex-direction: column; align-items: center; }
.duel-hero img { width: 60px; height: 60px; border-radius: 8px; object-fit: cover; }
.duel-hero small { font-size: calc(11px * var(--ts)); font-weight: 400; }
.duel-hero.on { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold) inset; }
.duel-shield { position: absolute; top: 2px; right: 4px; font-style: normal; }
.duel-foe .pic { width: 44px; height: 44px; border-radius: 8px; margin-right: 10px; object-fit: cover; }
.duel-stage { display: flex; align-items: center; gap: 6px; margin: 12px 0; }
.duel-side { flex: 1; display: flex; flex-direction: column; align-items: center; position: relative; gap: 3px; }
.duel-side img { width: 96px; height: 96px; border-radius: 12px; object-fit: cover; border: 2px solid var(--gold-dark); }
.duel-side.foe img { border-color: #a5463d; }
.duel-hp { width: 100%; }
.duel-hp i { transition: width .5s; }
.duel-side.foe .duel-hp i { background: #c0453a; }
.duel-vs { font-size: calc(22px * var(--ts)); font-weight: 800; color: var(--gold); }
.duel-hit { position: absolute; top: 30px; font-size: calc(22px * var(--ts)); font-weight: 800; color: #ff6b5b; text-shadow: 0 2px 4px #000; animation: duelHit .7s ease-out; }
@keyframes duelHit { from { transform: translateY(10px) scale(1.4); opacity: 0; } to { transform: none; opacity: 1; } }
.trade-bar { border-color: #7fb8ff; }
.trade-res { display: grid; grid-template-columns: 26px 1fr; gap: 4px 8px; align-items: center; margin: 6px 0; }
.trade-res img { width: 24px; height: 24px; }
.trade-res input { width: 100%; min-height: 40px; }
.trade-chips { grid-column: 2; display: flex; gap: 6px; }
.trade-chips button { flex: 1; min-height: 38px; padding: 4px; }
.caravan-sum { display: flex; justify-content: space-between; gap: 6px; }
.caravan-sum > div { flex: 1; display: flex; flex-direction: column; align-items: center; }
.caravan-sum b { font-size: calc(20px * var(--ts)); }
.caravan-sum small { font-size: calc(12px * var(--ts)); color: var(--ink-dim); }
.troop-row.is-transport { border-left: 3px solid var(--gold); padding-left: 6px; }
.caravan-foot { position: sticky; bottom: -12px; background: linear-gradient(transparent, var(--leather) 30%); padding: 14px 0 8px; display: flex; flex-direction: column; gap: 6px; }
.road-btn { margin-bottom: 6px; }
.road-btn img { width: 28px; height: 28px; }
.push-kinds { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.push-kind { min-height: 38px; opacity: .65; }
.push-kind.on { opacity: 1; border-color: var(--gold); }

/* ---- The realm (realm.js): campaign, expeditions, dungeon, wonder, auction, tavern, mentors, seasons ---- */
.rl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.rl-card { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; padding: 10px; min-height: 104px; }
.rl-card img { width: 30px; height: 30px; filter: drop-shadow(0 0 6px rgba(219, 173, 87, .5)); }
.rl-card b { font-family: Cinzel, serif; color: var(--gold); font-size: calc(14px * var(--ts)); }
.rl-card small { color: var(--ink-dim); font-size: calc(12px * var(--ts)); line-height: 1.25; }
.rl-back { margin-top: 10px; }
.rl-season { display: flex; gap: 10px; align-items: center; border-color: var(--season); background: linear-gradient(90deg, color-mix(in srgb, var(--season) 22%, transparent), transparent 70%), #0004; cursor: pointer; }
.rl-season img { width: 40px; height: 40px; flex: none; filter: drop-shadow(0 0 8px var(--season)); }
.rl-season b { color: var(--season); }
.rl-srow { border-left: 3px solid var(--season); }
.rl-srow img { filter: drop-shadow(0 0 5px var(--season)); }
.rl-storm { display: flex; gap: 10px; align-items: center; border-color: #8aa4d6; }
.rl-storm.now { background: linear-gradient(90deg, #4a5f8a66, transparent); }
.rl-chip { position: absolute; left: 8px; top: calc(var(--gp-top) + var(--gp-bar) + 14px + var(--queue-h, 36px)); display: flex; align-items: center; gap: 5px; padding: 4px 10px 4px 6px; min-height: 30px; border-radius: 16px;
  border: 1px solid var(--season); background: #000a; font-size: calc(12px * var(--ts)); color: var(--ink); }
.rl-chip img { width: 20px; height: 20px; filter: drop-shadow(0 0 4px var(--season)); }
.rl-stars { letter-spacing: 1px; color: #5a4a35; font-size: calc(13px * var(--ts)); }
.rl-stars i { font-style: normal; }
.rl-stars i.on { color: #ffd34d; text-shadow: 0 0 6px #ffb800; }
.rl-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.rl-tabs button { min-width: 40px; }
.rl-chapter b { display: block; font-family: Cinzel, serif; color: var(--gold); font-size: calc(17px * var(--ts)); }
.rl-chapter p { margin: 4px 0; }
.rl-path { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.rl-stage { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; min-height: 82px; position: relative; }
.rl-stage .n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: bold; background: #0007; border: 2px solid var(--gold-dark); }
.rl-stage.won .n { border-color: #ffd34d; background: radial-gradient(#6b4a1c, #2a1a0a); }
.rl-stage.boss .n { border-color: #ff6a3a; box-shadow: 0 0 10px #ff6a3a88; }
.rl-stage small { font-size: calc(11px * var(--ts)); line-height: 1.15; text-align: center; }
.rl-stage.locked { opacity: .45; }
.rl-badge { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: calc(20px * var(--ts)); font-weight: bold; margin-right: 10px; flex: none;
  border: 2px solid var(--gold); background: radial-gradient(#6b4a1c, #2a1a0a); }
.rl-badge.boss { border-color: #ff6a3a; }
.rl-odds i { background: linear-gradient(90deg, #4caf50, #ffd34d); }
.rl-chests { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rl-chest { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px; border: 1px solid var(--gold-dark); border-radius: 10px; background: #0005; text-align: center; }
.rl-chest img { width: 34px; height: 34px; opacity: .6; }
.rl-chest.ready { border-color: #ffd34d; box-shadow: 0 0 10px #ffd34d55; }
.rl-chest.ready img { opacity: 1; filter: drop-shadow(0 0 6px #ffd34d); }
.rl-chest.done { opacity: .55; }
.rl-chest small { font-size: calc(11px * var(--ts)); line-height: 1.2; }
.rl-result { text-align: center; font-family: Cinzel, serif; font-size: calc(28px * var(--ts)); margin: 6px 0; }
.rl-bigstars { text-align: center; font-size: calc(46px * var(--ts)); letter-spacing: 6px; color: #4a3d2c; margin-bottom: 8px; }
.rl-bigstars i { font-style: normal; transition: color .2s, text-shadow .2s; }
.rl-bigstars i.on { color: #ffd34d; text-shadow: 0 0 14px #ffb800; }
.rl-face { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; margin-right: 10px; flex: none; border: 2px solid var(--gold-dark); }
.rl-face.barred { filter: grayscale(.6) brightness(.8); }
.rl-cell .row { position: relative; }
.rl-out { display: flex; gap: 8px; align-items: center; border-color: #ffd36b; }
.rl-ruins { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0; }
.rl-ruin { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; border-color: var(--ruin); text-align: center; }
.rl-ruin img { width: 30px; height: 30px; filter: drop-shadow(0 0 6px var(--ruin)); }
.rl-ruin b { font-size: calc(11px * var(--ts)); line-height: 1.15; }
.rl-ruin small { font-size: calc(11px * var(--ts)); }
.rl-ruin.on { box-shadow: 0 0 0 2px var(--ruin) inset, 0 0 12px var(--ruin); }
.rl-ruin.locked { opacity: .5; }
.rl-relics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.rl-relic { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 10px; border: 1px dashed #6b5a40; background: #0005; text-align: center; }
.rl-relic img { width: 28px; height: 28px; opacity: .25; }
.rl-relic small { font-size: calc(10px * var(--ts)); line-height: 1.15; }
.rl-relic .lv { font-size: calc(11px * var(--ts)); color: var(--ink-dim); }
.rl-relic.found { border: 1px solid var(--ruin); box-shadow: 0 0 8px color-mix(in srgb, var(--ruin) 50%, transparent); }
.rl-relic.found img { opacity: 1; filter: drop-shadow(0 0 6px var(--ruin)); }
.rl-relic.found .lv { color: var(--ruin); font-weight: bold; }
.rl-monument { position: relative; height: 150px; margin: 8px 0; border-radius: 12px; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(ellipse at 50% 80%, color-mix(in srgb, var(--w) 45%, transparent), transparent 65%), linear-gradient(#1b2433, #0c0a08); border: 1px solid var(--w); }
.rl-monument img { width: 92px; height: 92px; filter: drop-shadow(0 0 16px var(--w)); }
.rl-monument b { position: absolute; bottom: 8px; font-family: Cinzel, serif; color: var(--w); }
.rl-tiers { position: absolute; left: 10px; top: 10px; bottom: 10px; display: flex; flex-direction: column-reverse; gap: 3px; }
.rl-tiers i { width: 10px; flex: 1; border-radius: 3px; background: #ffffff18; }
.rl-tiers i.on { background: var(--w); box-shadow: 0 0 6px var(--w); }
.rl-give img { width: 22px; height: 22px; }
.rl-give span { min-width: 70px; text-align: right; }
.rl-miles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 6px 0; }
.rl-mile { display: flex; flex-direction: column; gap: 3px; padding: 6px; border-radius: 10px; border: 1px solid var(--gold-dark); background: #0005; text-align: center; }
.rl-mile small { font-size: calc(10px * var(--ts)); line-height: 1.2; color: var(--ink-dim); flex: 1; }
.rl-mile.ready { border-color: #ffd34d; box-shadow: 0 0 8px #ffd34d44; }
.rl-mile.done { opacity: .55; }
.rl-lot img { width: 30px; height: 30px; }
.rl-price { flex: none; text-align: right; margin: 0 8px; display: flex; flex-direction: column; }
.rl-price b { color: #ffd34d; }
.rl-items { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0; }
.rl-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; }
.rl-item img { width: 28px; height: 28px; }
.rl-item small { font-size: calc(10px * var(--ts)); line-height: 1.15; text-align: center; }
.rl-item.on { box-shadow: 0 0 0 2px var(--gold) inset; }
.rl-item .badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: #6b4a1c; color: #fff; font-size: calc(11px * var(--ts)); font-style: normal; display: grid; place-items: center; }
.rl-band.hired { opacity: .6; }
.rl-band .ico { margin-right: 10px; }
.rl-wonder-card { cursor: pointer; border-color: var(--gold); }
.pf-head > .rl-badge { flex: 0 0 46px; width: 46px; }
.rl-card small, .rl-stage small, .rl-ruin small, .rl-ruin b, .rl-relic small, .rl-item small, .rl-chest small, .rl-mile small {
  font-family: Alegreya, Georgia, serif; font-variant: normal; text-transform: none; letter-spacing: 0; font-weight: 400; }
.rl-stage small { font-weight: 700; }

/* ---- The lord (lord.js): corner portrait, lord page, equipment, forge and farming guide ---- */
#who-lord { position: relative; flex: none; width: 46px; height: 46px; min-height: 0; padding: 0; border-radius: 50%;
  border: 2px solid var(--brass); background: #0008; box-shadow: 0 0 0 2px #3b2a1c, 0 2px 8px #000c, inset 0 0 6px #000; overflow: visible; }
#who-lord img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
#who-lord .lv { position: absolute; right: -6px; bottom: -4px; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 10px;
  font: 700 calc(11px * var(--ts))/18px Cinzel, serif; color: #2b1a06; background: linear-gradient(#f3d58a, #c8973c); border: 1px solid #6b4a1c; }
#who-lord .lv:empty { display: none; }
#who { justify-content: flex-start; }
#who-name { margin-left: 2px; }
#who-shield { margin-left: auto; }
.lord-head { display: flex; gap: 14px; align-items: center; }
.lord-pic { position: relative; flex: none; width: 112px; height: 112px; padding: 0; border-radius: 14px; border: 3px solid var(--brass);
  background: #000; box-shadow: 0 0 0 2px #3b2a1c, 0 0 18px #e0b84a44; overflow: hidden; min-height: 0; }
.lord-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lord-cam { position: absolute; right: 4px; bottom: 4px; width: 28px; height: 28px; border-radius: 50%; background: #000b;
  display: grid; place-items: center; font-size: calc(15px * var(--ts)); border: 1px solid var(--brass); }
.lord-id { flex: 1; min-width: 0; }
.lord-id h2 { margin: 0 0 2px; font-size: calc(19px * var(--ts)); overflow-wrap: anywhere; }
.lord-lv { display: flex; gap: 6px; align-items: center; margin: 6px 0 4px; }
.lord-lv-badge { font: 700 calc(13px * var(--ts)) Cinzel, serif; color: var(--gold); }
.lord-power { margin-top: 4px; font-size: calc(15px * var(--ts)); } .lord-power b { color: var(--gold); font-family: Cinzel, serif; }
.lt-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 12px 0 6px; }
.lt-tab { min-height: 36px; padding: 4px 2px; font-size: calc(12px * var(--ts)); border-radius: 8px; border-width: 1px; }
.lt-tab.on { background: linear-gradient(#e0b84a, #9a7428); color: #2b1a06; border-color: #ffe39a; font-weight: 700; }
.lord-bonus { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.lord-bonus div { display: flex; justify-content: space-between; border-bottom: 1px solid #ffffff14; padding: 3px 0; font-size: calc(14px * var(--ts)); }
.lord-bonus b { color: #9fe08a; } .lord-bonus .off b { color: #8a7a64; }
.lord-doll { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 6px; align-items: stretch; margin-top: 6px;
  background: radial-gradient(ellipse at 50% 40%, #e0b84a22, #0000 65%); }
.lord-doll .col { display: flex; flex-direction: column; gap: 6px; }
.lord-slot { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; min-height: 92px; line-height: 1.15;
  background: #0006; border: 2px dashed #85612b; border-radius: 10px; }
.lord-slot img { width: 30px; height: 30px; opacity: .45; } .lord-slot[class*=" t-"] { border-style: solid; } .lord-slot[class*=" t-"] img { opacity: 1; }
.lord-slot small { font-size: calc(11px * var(--ts)); } .lord-slot i { font-size: calc(10px * var(--ts)); font-style: normal; color: #9fe08a; }
.lord-slot:not([class*=" t-"]) i { color: #8a7a64; }
.lord-doll-mid { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; }
.lord-doll-mid img { width: 100%; max-width: 130px; aspect-ratio: 1; object-fit: cover; border-radius: 50% 50% 12px 12px;
  border: 3px solid var(--brass); box-shadow: 0 0 22px #e0b84a55; }
.lord-doll-mid b { font-family: Cinzel, serif; color: var(--gold); } .lord-doll-mid small { color: #b9a88c; font-size: calc(11px * var(--ts)); }
button.mat { background: none; border: 0; min-height: 0; padding: 0; color: inherit; }
.lord-guide .rarity { border-color: currentColor; }
.lord-guide.t-common .rarity { color: #c9c2b0; } .lord-guide.t-rare .rarity { color: #6fb2ff; } .lord-guide.t-epic .rarity { color: #c58cff; } .lord-guide.t-legendary .rarity { color: #ffc94d; }
.lord-have { text-align: center; flex: none; } .lord-have b { display: block; font: 700 calc(18px * var(--ts)) Cinzel, serif; color: var(--gold); } .lord-have small { font-size: calc(10px * var(--ts)); color: #b9a88c; }
.lord-where { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid #ffffff14; }
.lord-pics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.lord-pick { padding: 0; min-height: 0; aspect-ratio: 1; border-radius: 12px; border: 2px solid #5c4329; overflow: hidden; background: #000; }
.lord-pick img { width: 100%; height: 100%; display: block; }
.lord-pick.on { border-color: var(--brass-hi); box-shadow: 0 0 12px #ffe39a88; }
.lord-upload { width: 100%; }
.pf-head .pf-pic { width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--brass); object-fit: cover; flex: none; }
.lord-card { display: flex; gap: 10px; align-items: center; }
.lord-card-pic { width: 64px; height: 64px; border-radius: 10px; border: 2px solid var(--brass); object-fit: cover; }
.lord-worn { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.lord-worn img { width: 30px; height: 30px; padding: 2px; border: 2px solid; border-radius: 6px; background: #0006; }
button.link { background: none; border: 0; box-shadow: none; min-height: 0; padding: 4px 0; color: #b9a88c; text-decoration: underline; font: calc(13px * var(--ts)) Alegreya, serif; text-transform: none; letter-spacing: 0; }

/* Rewarded ads (ads.js): the offers sheet and the practice ad */
.ad-offer .ico { width: 40px; height: 40px; }
.ad-screen { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: radial-gradient(circle at 50% 35%, #3a2614, #0d0805 75%); color: var(--ink, #f3e6c8); }
.ad-top { display: flex; align-items: center; gap: 10px; padding: 12px 14px; padding-top: calc(12px + var(--safe-top, 0px)); }
.ad-tag { font-size: calc(12px * var(--ts)); padding: 2px 8px; border-radius: 6px; background: #0008; border: 1px solid var(--brass, #c9973f); }
.ad-count { flex: 1; text-align: right; font-family: Cinzel, serif; color: var(--brass-hi, #ffe39a); }
.ad-close { width: 40px; height: 40px; min-height: 0; padding: 0; border-radius: 50%; font-size: calc(18px * var(--ts)); opacity: .35; }
.ad-close.ready { opacity: 1; box-shadow: 0 0 0 2px var(--brass-hi, #ffe39a); }
.ad-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; gap: 6px; }
.ad-body img { width: 120px; height: 120px; filter: drop-shadow(0 6px 16px #000c); }
.ad-body h2 { font-family: Cinzel, serif; color: var(--brass-hi, #ffe39a); }
.ad-body p { max-width: 320px; }

/* Language picker: in Settings and above the login form. Each button shows its language in that language. */
/* Language picker: one button, tap to open a scrolling list of every language */
.lang-pick { position: relative; width: 100%; max-width: 320px; }
.lang-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 14px; text-align: left;
  font-family: Alegreya, serif; font-size: calc(17px * var(--ts)); text-transform: none; letter-spacing: 0; }
.lang-btn .lang-caret { margin-left: auto; opacity: .8; }
.lang-list { position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 6px); max-height: min(50vh, 320px);
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 6px;
  background: #241812; border: 2px solid var(--gold); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.6); }
.lang-list.hidden { display: none; }
.lang-opt { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; margin: 0;
  background: none; border: 0; border-radius: 8px; box-shadow: none; color: var(--ink, #f3e3bf); text-align: left;
  font-family: Alegreya, serif; font-size: calc(17px * var(--ts)); text-transform: none; letter-spacing: 0; }
.lang-opt + .lang-opt { border-top: 1px solid rgba(201,162,90,.18); }
.lang-opt.on { color: var(--gold); background: rgba(201,162,90,.12); }
.lang-tick { color: var(--gold); }
.login-lang { display: flex; justify-content: center; margin: 0 0 12px; }

/* Bigger text sizes (Settings > Text size): the row with the lord, chat, settings and Shop buttons has no room to
   grow on a phone, so it stays at the normal size; a long lord name shortens with "…" so the Shop button always
   shows. The bottom tab names stay inside their own tab. */
#who { --ts: 1.1; gap: 5px; }
#who #chat-btn, #who #settings-btn { margin-right: 0; }
#who #who-vip { margin-left: 0; }
html[data-ts="small"] #who { --ts: 1; }
#who-name { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#who > :not(#who-name) { flex-shrink: 0; }
#who-crowns { padding: 2px 8px; }
/* Phones narrower than 400px (iPhone SE, mini, most Androids): tighter spacing so the Shop button always fits, even
   with a big Crown balance. Below 350px the lord's name gives way (it is on the lord page). */
@media (max-width: 400px) {
  #who { gap: 4px; }
  #who #chat-btn, #who #settings-btn { padding: 0 6px; }
  #who-shield { font-size: calc(12px * var(--ts)); white-space: nowrap; }
}
@media (max-width: 350px) {
  #who-name { display: none; }
  #who-lord { width: 40px; height: 40px; }
  #who-vip { padding-left: 5px; padding-right: 5px; }
  #who-crowns { padding: 2px 6px; gap: 3px; }
  #who #chat-btn, #who #settings-btn { padding: 0 4px; }
}
#tabs button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
h3.war-time { color: #ff9a6a; letter-spacing: .5px; }
/* The resource bar, like the row above it, has no room to grow on a phone: it stays at the normal size whatever the
   Text size, and on the narrowest phones (320px) the icons shrink a little so five numbers like "14.1K" still show. */
#res { --ts: 1.1; }
html[data-ts="small"] #res { --ts: 1; }
@media (max-width: 350px) {
  #res { gap: 3px; }
  .res { padding: 2px 3px; gap: 2px; font-size: calc(13px * var(--ts)); }
  .res img { width: 14px; height: 14px; }
}
/* With large text on a narrow phone, each bottom tab keeps to its own seventh of the bar (its name shortens with
   "…" instead of running into the next tab), and the Formation and War beast buttons on the Army page share the row
   instead of pushing the second one off the screen (on a narrow phone, one above the other). */
#tabs { grid-template-columns: repeat(7, minmax(0, 1fr)); }
#tabs button { min-width: 0; overflow: hidden; }
.army-extra { flex-wrap: wrap; }
.fm-mini { flex: 1 1 140px; min-width: 0; }
.fm-mini div { min-width: 0; overflow-wrap: break-word; }
/* On the narrowest phones the tab names get tighter letters so the longest (Alliance, Reports) still fit whole. */
@media (max-width: 350px) { #tabs button span { letter-spacing: -0.02em; font-size: 0.9em; } }

/* Royal decrees in the Crown Shop (offers.js) */
h3.decrees { color: #f2d28a; letter-spacing: .5px; }
.product.decree { background: linear-gradient(#3a2a18, #24180e); }
.product.milestone { border-color: #e0b050; box-shadow: inset 0 0 40px #ffd76a22, 0 0 14px #ffd76a44; }
.charter-steps { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.charter-step { gap: 8px; align-items: center; padding: 4px 8px; border-radius: 8px; background: #0003; }
.charter-step > span:first-child { flex: 1; }
.charter-step.done { opacity: .6; }
.charter-step.ready { background: #3a5a2a66; box-shadow: inset 0 0 0 1px #8fd06a88; }
.charter-step button { flex: none; }
.shop-grid .card.stipend, .shop-grid .card.charter { grid-column: 1 / -1; }
.product.charter .shop-art, .product.milestone .shop-art.keep-art { width: 72px; height: 72px; }
.charter-step > :last-child { min-width: 84px; text-align: right; }
/* The advisor (advisor.js): her portrait at the bottom left of the city, her greeting and her advice. */
.adv-btn { position: absolute; left: 10px; bottom: 76px; width: 58px; height: 58px; padding: 0; border-radius: 50%; overflow: visible;
  border: 2px solid var(--gold); background: #2b1a0c; box-shadow: 0 4px 12px #000b; animation: gp-in .4s ease-out; }
.adv-btn img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.adv-btn .badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; border-radius: 9px; background: #d33; color: #fff;
  font: 700 calc(11px * var(--ts))/18px Inter, sans-serif; font-style: normal; box-shadow: 0 0 0 2px #2b1a0c; animation: gp-pop 1.6s ease-in-out infinite; }
.adv-pic { width: 64px; height: 64px; border-radius: 12px; border: 2px solid var(--gold); object-fit: cover; flex: none; }
.adv-pic.big { width: 168px; height: 168px; border-radius: 18px; display: block; margin: 4px auto 8px; box-shadow: 0 6px 20px #000a; }
.adv-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.adv-head h2 { margin: 0; }
.adv-intro { text-align: center; }
.adv-name { display: flex; flex-direction: column; align-items: center; margin-bottom: 8px; }
.adv-name b { color: var(--gold); font-size: calc(18px * var(--ts)); }
.adv-bubble { position: relative; text-align: left; padding: 10px 12px; border-radius: 12px; background: linear-gradient(#f6e7c7, #e0c99a); color: #3a2614;
  border: 2px solid #8a5a2e; }
.adv-dots { display: flex; justify-content: center; gap: 6px; margin: 4px 0 8px; }
.adv-dots i { width: 8px; height: 8px; border-radius: 4px; background: #fff3; }
.adv-dots i.on { background: var(--gold); }
.adv-intro .btns { justify-content: center; }
.adv-tip { align-items: center; gap: 8px; }
.adv-tip .t { flex: 1; }
.hunt-art { display: block; width: 100%; max-width: 260px; margin: -10px auto -30px; }
