/* סיספיצט המנכלית — soft blush & lavender theme */
:root {
  --bg: #fff4f9;
  --surface: #ffffff;
  --panel: #fdebf4;
  --card2: #fbe3f0;
  --line: #f2c9df;
  --line2: #d9a6c9;
  --text: #4a1d4f;
  --text2: #74467a;
  --muted: #8a5b8e;
  --accent: #c72a7c;
  --accent-2: #e5489a;
  --accent-t: #b83a78;
  --lav: #a77ae6;
  --lav-d: #7a4fb5;
  --plum: #8f4fe0;
  --ok: #1f8a57;
  --bad: #c43c3c;
  --warn: #a8660f;
  --r-lg: 26px;
  --r-md: 22px;
  --r-sm: 14px;
  --shadow: 0 10px 30px -12px rgba(199, 42, 124, .25);
  --shadow-s: 0 4px 14px -6px rgba(122, 79, 181, .25);
  --f-display: 'Suez One', 'Varela Round', serif;
  --f-body: 'Varela Round', system-ui, sans-serif;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--f-body); font-size: 16px; line-height: 1.55; }
a { color: var(--accent-t); }
a:hover { color: var(--accent); }
img, svg { vertical-align: middle; }
.ic { flex-shrink: 0; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0 0 .6em; }
.h1 { font-family: var(--f-display); font-weight: 400; font-size: clamp(28px, 4vw, 40px); margin-bottom: 8px; }
.h2 { font-family: var(--f-display); font-weight: 400; font-size: clamp(24px, 3vw, 34px); margin-bottom: 18px; }
.h3 { font-size: 18px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.muted { color: var(--muted); }
.small, small { font-size: 13.5px; }
.center { text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.up { color: var(--ok); }
.down { color: var(--bad); }
.warn { color: var(--warn); }
.row { display: flex; align-items: center; }
.row.between, .between { justify-content: space-between; }
.gap { gap: 14px; } .gap-s { gap: 8px; } .wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.grad { background: linear-gradient(90deg, var(--accent), var(--lav)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent; font: inherit; font-size: 15px; cursor: pointer; text-decoration: none; transition: transform .15s, box-shadow .2s, background .2s; position: relative; overflow: hidden; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-s); }
.btn-primary:hover { color: #fff; background: #b3216e; box-shadow: var(--shadow); }
.btn-primary::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%); transform: translateX(-120%); transition: transform .6s; }
.btn-primary:hover::after { transform: translateX(120%); }
.btn-ghost { background: var(--surface); border-color: var(--line2); color: var(--text); }
.btn-ghost:hover { background: var(--panel); color: var(--text); }
.btn-danger { background: #fff; border-color: #e7a2a2; color: var(--bad); }
.btn-lg { min-height: 52px; padding: 0 28px; font-size: 17px; }
.btn-s { min-height: 36px; padding: 0 14px; font-size: 14px; }
.icon-btn { width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; transition: background .2s, transform .15s; }
.icon-btn:hover { background: var(--panel); transform: rotate(-6deg); }
.icon-btn .dot { position: absolute; top: 9px; left: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px #fff; animation: pulse 1.6s infinite; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--text); cursor: pointer; text-align: start; }
.link-btn:hover { color: var(--accent); }
input, select, textarea { font: inherit; color: var(--text); background: #fff; border: 1px solid var(--line2); border-radius: 12px; min-height: 42px; padding: 0 12px; max-width: 100%; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible, .icon-btn:focus-visible { outline: 3px solid rgba(199, 42, 124, .35); outline-offset: 2px; }
input[type=number] { width: 80px; }
input[type=range] { accent-color: var(--accent); width: 100%; border: 0; padding: 0; }
.form { display: flex; flex-direction: column; gap: 10px; }
.form label { font-size: 14.5px; color: var(--text2); }
fieldset { border: 0; padding: 0; margin: 8px 0 0; }
legend { font-size: 14.5px; color: var(--text2); margin-bottom: 8px; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; box-shadow: 0 1px 0 rgba(255,255,255,.6) inset; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; background: var(--card2); color: var(--accent-t); font-size: 14px; }
.pill-warn { background: #fdf0dc; color: var(--warn); }
.tag { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--card2); font-size: 13px; color: var(--text2); }
.tag-soft { background: #fff; border: 1px solid var(--line); }
.tag-pink { background: #fcd9ea; color: var(--accent-t); }
.tag-lav { background: #ece2fb; color: var(--lav-d); }
.tag-warn { background: #fdf0dc; color: var(--warn); }
.tag-ok { background: #dcf3e7; color: var(--ok); }
.tag-bad { background: #fbe1e1; color: var(--bad); }
.flash { padding: 12px 16px; border-radius: var(--r-sm); margin: 0 0 14px; background: #fff; border: 1px solid var(--line); animation: slideDown .35s ease; }
.flash-ok { background: #e9f8f0; border-color: #b6e3c9; color: #17603e; }
.flash-bad { background: #fdeaea; border-color: #f0bcbc; color: #8e2a2a; }
.flash-warn { background: #fdf3e2; border-color: #f1d3a3; color: #7a4a0a; }

/* animations */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.35); opacity: .6; } }
@keyframes float { 0% { transform: translateY(110vh) rotate(0deg); opacity: 0; } 10% { opacity: .55; } 90% { opacity: .55; } 100% { transform: translateY(-10vh) rotate(260deg); opacity: 0; } }
@keyframes grow { from { width: 0; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes shimmer { from { background-position: -200% 0; } to { background-position: 200% 0; } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.12); color: var(--accent); } 100% { transform: scale(1); } }
.fade-up { animation: fadeUp .6s cubic-bezier(.2,.7,.2,1) both; animation-delay: var(--d, 0s); }
.bump { animation: bump .5s ease; display: inline-block; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } .petals { display: none; } }

/* floating petals (public pages) */
.petals { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.petals i { position: absolute; bottom: 0; width: 18px; height: 20px; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: #f5b8d5; animation: float 22s linear infinite; }
.petals i:nth-child(2n) { background: #d9c2f5; width: 12px; height: 14px; }
.petals i:nth-child(1) { left: 6%; animation-delay: 0s; } .petals i:nth-child(2) { left: 18%; animation-delay: 4s; animation-duration: 26s; }
.petals i:nth-child(3) { left: 32%; animation-delay: 9s; } .petals i:nth-child(4) { left: 47%; animation-delay: 2s; animation-duration: 30s; }
.petals i:nth-child(5) { left: 61%; animation-delay: 12s; } .petals i:nth-child(6) { left: 74%; animation-delay: 6s; animation-duration: 24s; }
.petals i:nth-child(7) { left: 86%; animation-delay: 15s; } .petals i:nth-child(8) { left: 94%; animation-delay: 8s; animation-duration: 28s; }

/* public layout */
.public > *:not(.petals) { position: relative; z-index: 1; }
.site-head { max-width: 1240px; margin: 0 auto; padding: 18px 20px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-family: var(--f-display); font-size: 24px; }
.brand .ic { color: var(--accent); }
.brand-sm { font-size: 19px; }
.site-nav { display: flex; gap: 22px; flex: 1; }
.site-nav a { color: var(--text2); text-decoration: none; }
.site-nav a:hover { color: var(--accent); }
.site-actions { display: flex; gap: 10px; }
.site-actions form { margin: 0; }
.site-main { max-width: 1240px; margin: 0 auto; padding: 8px 20px 60px; }
.site-foot { max-width: 1240px; margin: 0 auto; padding: 24px 20px; display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); flex-wrap: wrap; gap: 10px; }

.hero { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 44px; align-items: center; padding: 40px 0 30px; }
.hero h1 { font-family: var(--f-display); font-weight: 400; font-size: clamp(40px, 6vw, 66px); line-height: 1.05; margin: 16px 0; }
.lead { font-size: 19px; color: var(--text2); line-height: 1.7; }
.hero-copy .row { margin-top: 22px; flex-wrap: wrap; }
.stats { display: flex; gap: 32px; margin-top: 26px; flex-wrap: wrap; }
.stats b { display: block; font-size: 28px; font-family: var(--f-display); font-weight: 400; }
.stats span { color: var(--muted); font-size: 14px; }
.hero-art { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 34px; padding: 18px; box-shadow: var(--shadow); }
.hero-art canvas { width: 100%; height: auto; display: block; border-radius: 22px; }
.hero-news { position: absolute; inset-inline: 30px; bottom: 30px; display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-radius: 18px; background: rgba(255,255,255,.93); border: 1px solid var(--line2); font-size: 15px; backdrop-filter: blur(6px); }
.hero-news .ic { color: var(--accent); }

/* painted art (assets/img via art()) */
img.art { display: block; width: 100%; height: auto; }
.art-ph { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #fcd9ea, #e6d9fb); color: var(--accent); }
@keyframes kenburns { from { transform: scale(1.04) translate3d(0, 0, 0); } to { transform: scale(1.14) translate3d(-2%, -1.5%, 0); } }
@keyframes revealUp { from { opacity: 0; transform: translateY(26px) scale(.98); } to { opacity: 1; transform: none; } }
.kenburns { animation: kenburns 28s ease-in-out infinite alternate; will-change: transform; }
.js .reveal { opacity: 0; }
.js .reveal.in { animation: revealUp .8s cubic-bezier(.2,.7,.2,1) both; animation-delay: var(--d, 0s); }
.public { overflow-x: clip; }
.public .site-head { z-index: 3; }
/* cinematic hero: full-bleed painting, light scrim on the text side (right in RTL) */
.hero-cine { position: relative; isolation: isolate; min-height: min(76vh, 700px); padding: 60px 0 70px; }
.hero-cine::before { content: ""; position: absolute; inset: -90px calc(50% - 50vw) 0; z-index: -1; pointer-events: none;
  background: linear-gradient(270deg, rgba(255,244,249,.96) 0%, rgba(255,244,249,.84) 30%, rgba(255,244,249,.2) 60%, rgba(255,244,249,0) 78%),
              linear-gradient(0deg, var(--bg) 0%, rgba(255,244,249,0) 20%); }
.hero-bg { position: absolute; inset: -90px calc(50% - 50vw) 0; z-index: -2; overflow: hidden; scale: -1 1; } /* mirrored: the calm sky sits behind the RTL text */
.hero-bg img { width: 100%; height: 100%; object-fit: cover; transform-origin: 30% 45%; }
.hero-cine .hero-copy h1 { text-shadow: 0 2px 24px rgba(255,244,249,.9); }
.hero-cine .hero-art { background: rgba(255,255,255,.5); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); border-color: rgba(255,255,255,.75);
  box-shadow: 0 30px 70px -20px rgba(74,29,79,.45); transform: perspective(1200px) rotateY(-7deg) rotateX(3deg); transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.hero-cine .hero-art:hover { transform: perspective(1200px) rotateY(0) rotateX(0); }
/* feature cards with paintings */
.feature-art { margin: -22px -22px 6px; border-radius: var(--r-lg) var(--r-lg) 14px 14px; overflow: hidden; aspect-ratio: 4 / 3; position: relative; }
.feature-art img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s cubic-bezier(.2,.7,.2,1), filter .5s; }
.feature-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.45) 50%, transparent 65%); transform: translateX(-120%); transition: transform .9s; }
.feature:hover .feature-art img { transform: scale(1.07); filter: saturate(1.15); }
.feature:hover .feature-art::after { transform: translateX(120%); }
.tilt { transition: transform .35s cubic-bezier(.2,.7,.2,1), box-shadow .25s; }
@media (max-width: 860px) {
  .hero-cine { min-height: 0; padding: 30px 0 40px; }
  .hero-cine::before { background: linear-gradient(0deg, rgba(255,244,249,.97) 20%, rgba(255,244,249,.78) 60%, rgba(255,244,249,.4) 100%); }
  .hero-cine .hero-art { transform: none; }
}
@media (prefers-reduced-motion: reduce) { .kenburns { animation: none; } .js .reveal { opacity: 1; } }
.section { padding: 36px 0; }
.section.narrow { max-width: 900px; margin: 0 auto; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.feature { display: flex; flex-direction: column; gap: 8px; transition: transform .25s, box-shadow .25s; }
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.feature-ic { width: 48px; height: 48px; border-radius: 16px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #fcd9ea, #e6d9fb); color: var(--accent); }
.feature h3 { font-size: 19px; }
.feature p, .step p { color: var(--text2); font-size: 15px; margin: 0; }
.step { background: var(--card2); border-color: transparent; }
.step small { color: var(--accent-t); }
.step h3 { margin: 4px 0 6px; font-size: 19px; }
.steps + .center { margin-top: 28px; }

.auth, .create { display: flex; justify-content: center; padding: 30px 0; }
.auth-card { width: 100%; max-width: 440px; }
.create-card { width: 100%; max-width: 720px; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch input, .choice input { position: absolute; opacity: 0; }
.swatch span:first-of-type { display: block; width: 44px; height: 44px; border-radius: 50%; background: var(--sw); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line2); cursor: pointer; transition: transform .15s; }
.swatch input:checked + span { box-shadow: 0 0 0 3px var(--text); transform: scale(1.08); }
.swatch input:focus-visible + span { outline: 3px solid rgba(199,42,124,.35); }
.choices { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.choices-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice { position: relative; }
.choice span { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 10px; border-radius: 16px; border: 1px solid var(--line2); cursor: pointer; text-align: center; transition: background .2s, border-color .2s; min-height: 44px; }
.choices-wide .choice span { align-items: flex-start; text-align: start; }
.choice small { color: var(--muted); }
.choice input:checked + span { background: var(--card2); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.choice input:focus-visible + span { outline: 3px solid rgba(199,42,124,.35); }

.howto .card { margin-bottom: 16px; }
.toc { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 20px 0; }
.prose h2 { font-size: 22px; display: flex; gap: 10px; align-items: center; margin-bottom: 12px; color: var(--accent-t); }
.prose ul { padding-inline-start: 20px; margin: 0 0 .6em; }
.prose li { margin-bottom: 6px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: start; font-weight: 400; color: var(--muted); font-size: 13.5px; padding: 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid #f8e1ee; vertical-align: middle; }
.table tr:hover td { background: #fff9fc; }
.table.compact td, .table.compact th { padding: 6px 8px; }
.dotc { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--cc); margin-inline-end: 8px; vertical-align: middle; }
details.report summary, details summary { cursor: pointer; color: var(--accent-t); }

/* admin */
.kpis { margin-bottom: 18px; }
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi b { font-size: 30px; font-family: var(--f-display); font-weight: 400; }
.cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.cols-rev { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.list-item { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f8e1ee; }
.mini-list { list-style: none; padding: 0; margin: 0 0 12px; font-size: 14px; }
.mini-list li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.mini-list.log { max-height: 340px; overflow: auto; }
.mini-list time { color: var(--muted); font-size: 12.5px; }
.card form + form { margin-top: 10px; }

/* ---------------- game shell ---------------- */
.app { overflow-x: hidden; }
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); min-height: 100vh; }
.topbar { grid-column: 1 / -1; position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 10px 18px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar form { margin: 0; }
.country-chip { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; border-radius: 999px; background: var(--panel); font-weight: 700; white-space: nowrap; }
.country-chip .flag { width: 32px; height: 32px; border-radius: 50%; background: var(--cc); color: #fff; display: flex; align-items: center; justify-content: center; }
.res-bar { display: flex; gap: 8px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.res-bar::-webkit-scrollbar { display: none; }
.res { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 16px; background: var(--panel); min-width: 112px; cursor: help; }
.res .ic { color: var(--accent); }
.res small { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.2; }
.res b { display: block; font-size: 15px; line-height: 1.25; }
.res em { font-style: normal; font-size: 11.5px; color: var(--muted); }
.res em.up { color: var(--ok); } .res em.down { color: var(--bad); }
.sidenav { display: flex; flex-direction: column; gap: 4px; padding: 16px 12px; background: var(--panel); border-inline-start: 1px solid var(--line); position: sticky; top: 65px; height: calc(100vh - 65px); overflow: auto; }
.sidenav a { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 16px; color: var(--text2); text-decoration: none; transition: background .2s, color .2s, transform .15s; min-height: 44px; }
.sidenav a:hover { background: #fff; color: var(--accent); transform: translateX(-3px); }
.sidenav a.on { background: var(--accent); color: #fff; box-shadow: var(--shadow-s); }
.content { padding: 22px; min-width: 0; }
.page-head { margin-bottom: 16px; }

/* drawer, toasts, tooltip */
.drawer { position: fixed; top: 0; bottom: 0; left: 0; width: min(380px, 92vw); background: #fff; z-index: 50; box-shadow: 10px 0 40px -10px rgba(74,29,79,.25); padding: 18px; display: flex; flex-direction: column; animation: drawerIn .3s ease; }
@keyframes drawerIn { from { transform: translateX(-100%); } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.drawer h2 { font-family: var(--f-display); font-weight: 400; }
.notes { list-style: none; padding: 0; margin: 0; overflow: auto; }
.note { padding: 12px 14px; border-radius: 14px; margin-bottom: 8px; background: var(--panel); display: flex; flex-direction: column; gap: 2px; border-inline-start: 4px solid var(--line2); }
.note time { font-size: 12px; color: var(--muted); }
.note-ok { border-color: var(--ok); } .note-bad { border-color: var(--bad); } .note-warn { border-color: var(--warn); } .note-info { border-color: var(--lav); }
.toasts { position: fixed; bottom: 20px; left: 20px; z-index: 60; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 40px)); }
.toast { padding: 14px 18px; border-radius: 18px; background: #fff; border: 1px solid var(--line2); box-shadow: var(--shadow); animation: toastIn .35s cubic-bezier(.2,.8,.2,1.2); font-size: 15px; }
.toast-ok { border-color: #9fd9b9; } .toast-bad { border-color: #eeaaaa; } .toast-warn { border-color: #efc98a; }
.toast.out { opacity: 0; transform: translateY(10px); transition: all .3s; }
.tip { position: fixed; z-index: 70; max-width: 260px; padding: 10px 12px; border-radius: 12px; background: var(--text); color: #fff; font-size: 13.5px; pointer-events: none; animation: fadeUp .2s; }

/* meters & bars */
.meter { margin-bottom: 10px; }
.meter-top { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 4px; }
.bar { height: 10px; border-radius: 999px; background: var(--card2); overflow: hidden; }
.bar.sm { height: 7px; min-width: 70px; }
.bar i { display: block; height: 100%; width: var(--w); border-radius: 999px; animation: grow 1.1s cubic-bezier(.2,.7,.2,1); }
.bar-pink { background: linear-gradient(90deg, #f08cbf, var(--accent)); }
.bar-lav { background: linear-gradient(90deg, #c9b0f2, var(--lav)); }
.bar-plum { background: linear-gradient(90deg, #b99be6, var(--plum)); }
.bar-warn { background: linear-gradient(90deg, #f3c27a, var(--warn)); }
.dl { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0 0 12px; font-size: 15px; }
.dl dt { color: var(--text2); } .dl dd { margin: 0; text-align: end; }
.gauge { --p: 50; width: 150px; height: 150px; margin: 6px auto 12px; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--card2) 0); display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; }
.gauge::before { content: ''; position: absolute; inset: 14px; border-radius: 50%; background: #fff; }
.gauge b, .gauge small { position: relative; } .gauge b { font-size: 30px; font-family: var(--f-display); font-weight: 400; }
.tax { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px dashed var(--line); }

.bgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.bcard { padding: 14px; border-radius: var(--r-md); background: var(--panel); display: flex; flex-direction: column; gap: 6px; transition: transform .2s; }
.bcard:hover { transform: translateY(-2px); }
.bcard.empty { background: #fff; border: 1px dashed var(--line2); }
.bcard .count { min-width: 30px; height: 30px; border-radius: 999px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; padding: 0 8px; }
.bcard.empty .count { background: var(--card2); color: var(--muted); }

.branch { display: flex; flex-direction: column; gap: 6px; }
.branch .big { font-family: var(--f-display); font-weight: 400; font-size: 34px; line-height: 1; }
.branch input { width: 70px; }
.grid4 + .card, .cols + .card { margin-top: 18px; }
.page-head + .grid4 { margin-bottom: 18px; }
.queue { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.queue li { display: flex; justify-content: space-between; padding: 10px 14px; border-radius: 14px; background: linear-gradient(90deg, var(--panel), #fff, var(--panel)); background-size: 200% 100%; animation: shimmer 3s linear infinite; }
.mix { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mix label { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; padding: 6px 10px; background: var(--panel); border-radius: 12px; }
.mix input { width: 64px; min-height: 36px; }
.form + .form { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); }

.interior .card { display: flex; flex-direction: column; gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.case { padding: 14px; border-radius: var(--r-md); background: var(--panel); display: flex; flex-direction: column; gap: 8px; }
.case.ready { background: #fff; border: 1px solid var(--accent-2); box-shadow: var(--shadow-s); animation: fadeUp .5s; }
.big-num b { font-family: var(--f-display); font-weight: 400; font-size: 44px; }
.big-num span { color: var(--muted); margin-inline-start: 8px; }
.plant-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.plant-list li { display: flex; justify-content: space-between; padding: 10px 12px; border-radius: 12px; background: var(--panel); }
.mini-kpis div { padding: 12px; border-radius: 14px; background: var(--panel); }
.mini-kpis small { display: block; color: var(--muted); }
.mini-kpis b { font-size: 22px; }
.tiles-scroll { max-height: 330px; overflow: auto; }
.intel-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
.intel-grid div { padding: 10px; border-radius: 12px; background: var(--panel); }
.intel-grid small { display: block; color: var(--muted); font-size: 12px; }

.battle-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.battle-list a { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 14px; text-decoration: none; color: var(--text); }
.battle-list li.on a, .battle-list a:hover { background: var(--panel); }
.battle-stage { position: relative; border-radius: var(--r-md); overflow: hidden; background: linear-gradient(180deg, #fdeef6, #f3e8fd); margin: 12px 0; }
.battle-stage canvas { width: 100%; height: auto; display: block; }
.replay { position: absolute; bottom: 10px; left: 10px; }
.side-box { padding: 14px; border-radius: var(--r-md); background: var(--panel); border-top: 5px solid var(--cc); }
.side-box b { font-size: 18px; }
.result { font-size: 18px; font-weight: 700; margin-top: 12px; }

/* map */
.map-page { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; height: calc(100vh - 110px); min-height: 520px; }
.map-wrap { position: relative; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); background: #e9f1fb; touch-action: none; }
#map { width: 100%; height: 100%; display: block; cursor: grab; }
#map.dragging { cursor: grabbing; }
.map-ctrl { position: absolute; top: 14px; left: 14px; display: flex; flex-direction: column; gap: 8px; }
.legend { position: absolute; bottom: 14px; right: 14px; display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 10px 14px; border-radius: 16px; background: rgba(255,255,255,.92); font-size: 13px; max-width: calc(100% - 28px); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-inline-end: 6px; vertical-align: -1px; }
.lg-bot { background: #8f4fe0; } .lg-player { background: #f06292; } .lg-rebel { background: repeating-linear-gradient(45deg, #c43c3c 0 3px, #fff 3px 6px); } .lg-rail { background: repeating-linear-gradient(90deg, #4a1d4f 0 3px, transparent 3px 6px); height: 4px !important; }
.map-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(255,244,249,.8); font-size: 18px; color: var(--accent-t); }
.map-side { display: flex; flex-direction: column; gap: 14px; overflow: auto; padding-bottom: 6px; }
.side-card { padding: 18px; }
.side-card .h3 { margin-bottom: 8px; }
.tile-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.tile-swatch { width: 40px; height: 44px; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: var(--sw); flex-shrink: 0; }
.tile-facts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.opt-list { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 12px; }
.opt { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 14px; background: var(--panel); font-size: 14px; }
.opt small { display: block; color: var(--muted); font-size: 12.5px; }
.sub { font-size: 14px; font-weight: 700; color: var(--text2); margin: 12px 0 4px; }
.div-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.div-list li { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 14px; background: var(--panel); }
.div-list small { color: var(--muted); }

/* tutorial */
.tut { position: fixed; z-index: 80; width: min(360px, calc(100vw - 32px)); padding: 20px; border-radius: 22px; background: #fff; border: 2px solid var(--accent); box-shadow: 0 20px 60px -15px rgba(199,42,124,.45); animation: toastIn .4s; }
.tut h3 { font-family: var(--f-display); font-weight: 400; font-size: 22px; margin-bottom: 6px; color: var(--accent-t); }
.tut .row { margin-top: 12px; justify-content: space-between; }
.tut-glow { position: relative; z-index: 79; box-shadow: 0 0 0 4px rgba(199,42,124,.45), 0 0 30px rgba(199,42,124,.4) !important; border-radius: 16px; animation: pulseGlow 1.6s infinite; }
@keyframes pulseGlow { 50% { box-shadow: 0 0 0 8px rgba(199,42,124,.15), 0 0 40px rgba(199,42,124,.3) !important; } }
.tut-dim { position: fixed; inset: 0; background: rgba(74,29,79,.25); z-index: 78; }

/* responsive */
@media (max-width: 1100px) {
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid3 { grid-template-columns: minmax(0, 1fr); }
  .cols, .cols-rev { grid-template-columns: minmax(0, 1fr); }
  .intel-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .map-page { grid-template-columns: minmax(0, 1fr); height: auto; }
  .map-wrap { height: 62vh; }
}
@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); padding-top: 10px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidenav { position: fixed; bottom: 0; top: auto; inset-inline: 0; height: auto; flex-direction: row; overflow-x: auto; z-index: 30; padding: 6px; border: 0; border-top: 1px solid var(--line); background: rgba(253,235,244,.97); }
  .sidenav a { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 10px; min-width: 70px; text-align: center; }
  .sidenav a:hover { transform: none; }
  .content { padding: 14px 16px 96px; }
  .topbar { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .topbar .brand span { display: none; }
  .res-bar { order: 5; flex-basis: 100%; }
  .res { min-width: 100px; }
  .site-nav { order: 3; flex-basis: 100%; }
  .choices { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .choices-wide { grid-template-columns: minmax(0, 1fr); }
  .mix { grid-template-columns: minmax(0, 1fr); }
  .toasts { bottom: 86px; }
}
@media (max-width: 560px) {
  .grid4, .grid2 { grid-template-columns: minmax(0, 1fr); }
  .intel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-head { padding: 14px 16px; }
  .site-main { padding: 8px 16px 40px; }
  .card { padding: 16px; }
  .country-chip span:not(.flag):not(.tag) { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
}
.settings-grid { margin: 18px 0; align-items: start; }
.danger-zone { border-color: #f0bcbc; }
.danger-zone .h3 { color: var(--bad); }
.lbl-s { display: none; }
@media (max-width: 860px) {
  .sidenav .lbl { display: none; }
  .sidenav .lbl-s { display: inline; white-space: nowrap; }
  .legend { font-size: 11px; gap: 4px 10px; padding: 6px 10px; bottom: 8px; right: 8px; }
  .legend i { width: 9px; height: 9px; }
  .map-wrap { height: 58vh; min-height: 360px; }
}
@media (max-width: 860px) { .top-logout { display: none; } }
.section > .card + .card, .section > .card + .grid2, .section > .grid2 + .card { margin-top: 16px; }
.linked { color: var(--warn); font-size: 12.5px; }

/* ---- stage B: politics, dilemmas, newspaper ---- */
.sidenav a { position: relative; }
.badge { font-style: normal; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; margin-inline-start: auto; animation: pulse 2s infinite; }
.sidenav a.on .badge { background: #fff; color: var(--accent); }
@media (max-width: 860px) { .badge { position: absolute; top: 2px; left: 8px; margin: 0; min-width: 16px; height: 16px; font-size: 10px; } }
.dilemmas { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin: 12px 0; }
.dilemma { padding: 22px; border-radius: var(--r-lg); background: linear-gradient(160deg, #fff, #fdeef6 60%, #f3e8fd); border: 1px solid var(--line2); box-shadow: var(--shadow-s); display: flex; flex-direction: column; gap: 8px; transition: transform .25s; }
.dilemma:hover { transform: translateY(-3px) rotate(-.3deg); }
.dilemma h3 { font-family: var(--f-display); font-weight: 400; font-size: 24px; color: var(--accent-t); }
.options { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.option { text-align: start; font: inherit; color: var(--text); background: #fff; border: 1px solid var(--line2); border-radius: 16px; padding: 12px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; transition: border-color .2s, transform .15s, box-shadow .2s; min-height: 44px; }
.option:hover { border-color: var(--accent); transform: translateX(-3px); box-shadow: var(--shadow-s); }
.option:disabled { opacity: .5; }
.fx { display: inline-block; font-size: 12.5px; padding: 2px 8px; border-radius: 999px; background: var(--card2); margin: 2px 0 2px 4px; }
.fx-up { background: #dcf3e7; color: var(--ok); }
.fx-down { background: #fbe1e1; color: var(--bad); }
.empty-state { grid-column: 1 / -1; text-align: center; padding: 30px; color: var(--muted); }
.empty-state .ic { color: var(--ok); }
.brief { border-color: var(--accent-2); }
.paper { max-width: 1100px; margin: 0 auto; background: #fffdf8; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px; box-shadow: var(--shadow); }
.paper-head { text-align: center; border-bottom: 3px double var(--text); padding-bottom: 14px; margin-bottom: 18px; }
.paper-head h1 { font-family: var(--f-display); font-weight: 400; font-size: clamp(34px, 6vw, 56px); letter-spacing: 1px; }
.paper-index { font-size: 14px; color: var(--text2); }
.paper-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.paper-col h2 { font-family: var(--f-display); font-weight: 400; font-size: 24px; border-bottom: 1px solid var(--line2); padding-bottom: 6px; margin-bottom: 10px; color: var(--accent-t); }
.paper-col h2 small { display: block; font-family: var(--f-body); font-size: 12px; color: var(--muted); }
.paper-col article { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px dashed var(--line); }
.paper-col h3 { font-size: 17px; margin-bottom: 4px; }
.paper-col p { font-size: 14.5px; color: var(--text2); margin: 0; }
@media (max-width: 860px) { .paper-cols { grid-template-columns: minmax(0, 1fr); } .paper { padding: 18px; } }

/* ---- stage C: politics ---- */
.pol-top { margin-bottom: 18px; align-items: start; }
.page-head + .grid2, .grid2 + .card, .card + .card { margin-top: 0; }
.content > .card + .card, .content > .grid2 + .card, .content > section + section { margin-top: 18px; }
.cabinet { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.minister { padding: 14px; border-radius: var(--r-md); background: var(--panel); display: flex; flex-direction: column; gap: 8px; }
.minister.vacant { background: #fff; border: 1px dashed var(--line2); }
.mn-name { display: flex; gap: 10px; align-items: center; }
.mn-name small { display: block; color: var(--muted); }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: linear-gradient(135deg, #fcd9ea, #e6d9fb); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.option.cand { padding: 8px 12px; }
.laws { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.law { padding: 14px; border-radius: var(--r-md); background: #fff; border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.law.active { background: #f3fbf6; border-color: #b6e3c9; }
.law-groups { display: flex; flex-wrap: wrap; gap: 2px; }
.election .big-num b { font-size: 34px; }
.grant-card .mix input { width: 110px; }

/* ---- stage D: foreign affairs ---- */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tabs a { padding: 8px 14px; border-radius: 999px; background: var(--panel); text-decoration: none; color: var(--text2); font-size: 14px; }
.tabs a:hover { background: var(--card2); color: var(--accent); }
.incoming { border-color: var(--accent-2); margin-bottom: 18px; }
.content > .cols { margin-top: 18px; }
.chat { max-height: 280px; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: var(--r-md); background: var(--panel); margin: 10px 0; }
.msg { align-self: flex-start; max-width: 85%; padding: 8px 12px; border-radius: 16px 16px 16px 4px; background: #fff; display: flex; flex-direction: column; font-size: 14px; }
.msg.mine { align-self: flex-end; background: #fcd9ea; border-radius: 16px 16px 4px 16px; }
.msg b { font-size: 12px; color: var(--accent-t); }
.msg time { font-size: 11px; color: var(--muted); }
.inbox { margin-top: 12px; max-height: 320px; }
.bank { margin: 10px 0 0; }
.bank-res { padding: 14px; border-radius: var(--r-md); background: var(--panel); display: flex; flex-direction: column; gap: 8px; }
.bank-res .price { font-family: var(--f-display); font-size: 24px; color: var(--accent-t); }
.bank-res input { width: 90px; }
.resolution { padding: 18px; border-radius: var(--r-md); background: linear-gradient(160deg, #fff, #f3e8fd); border: 1px solid var(--line2); margin: 10px 0; }
.resolution h3 { font-family: var(--f-display); font-weight: 400; font-size: 26px; color: var(--lav-d); }
.vote-bar { height: 14px; border-radius: 999px; background: #f6c9c9; overflow: hidden; margin: 10px 0 4px; }
.vote-bar i { display: block; height: 100%; width: var(--w); background: linear-gradient(90deg, #8fd8b0, var(--ok)); animation: grow 1s; }

/* ---- stage E: research, tower, achievements ---- */
.tree { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 12px; }
.branch-col { display: flex; flex-direction: column; gap: 10px; }
.branch-col h3 { font-family: var(--f-display); font-weight: 400; font-size: 20px; color: var(--accent-t); text-align: center; }
.tech { position: relative; padding: 12px; border-radius: var(--r-md); border: 1px solid var(--line); background: #fff; display: flex; flex-direction: column; gap: 6px; }
.tech + .tech::before { content: ''; position: absolute; top: -11px; right: 50%; width: 2px; height: 10px; background: var(--line2); }
.tech-done { background: #f3fbf6; border-color: #b6e3c9; }
.tech-busy { border-color: var(--warn); background: #fffaf0; animation: pulseGlow 2s infinite; }
.tech-ready { border-color: var(--accent-2); box-shadow: var(--shadow-s); }
.tech-locked { opacity: .55; }
.tech small { color: var(--text2); }
.tech .btn { white-space: normal; text-align: center; line-height: 1.3; padding: 6px 10px; }
.tower-wrap { display: flex; gap: 20px; align-items: flex-end; flex-wrap: wrap; }
.tower { display: flex; flex-direction: column; gap: 3px; align-items: center; padding: 10px 0; }
.floor { width: calc(60px + (10 - var(--i)) * 5px); height: 18px; border-radius: 6px 6px 2px 2px; background: #f4e6ee; border: 1px dashed var(--line2); }
.floor.built { background: linear-gradient(90deg, #f08cbf, #b98aff); border: 0; box-shadow: inset 0 -3px 0 rgba(0,0,0,.08), 0 0 12px rgba(229,72,154,.3); animation: fadeUp .5s both; animation-delay: calc((10 - var(--i)) * 0.05s); }
.floor.building { background: repeating-linear-gradient(45deg, #fcd9ea 0 6px, #fff 6px 12px); background-size: 200% 100%; animation: shimmer 2s linear infinite; border: 1px solid var(--accent-2); }
.tower-info { flex: 1; min-width: 220px; }
.achievements { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.ach { padding: 10px; border-radius: 16px; background: #f6f0f4; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; filter: grayscale(1); opacity: .6; }
.ach.got { background: linear-gradient(160deg, #fff, #fcd9ea); filter: none; opacity: 1; box-shadow: var(--shadow-s); }
.ach.got .ic { color: var(--accent); }
.ach small { font-size: 11.5px; color: var(--muted); }
.medal-list { margin: 0 0 8px; padding-inline-start: 22px; }
.medal-list .place-1::marker { color: #c99a00; font-weight: 700; }
@media (max-width: 1100px) { .tree { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .tree { grid-template-columns: minmax(0, 1fr); } }

/* ---- stage F: exchange, profile, avatar, ticker ---- */
.content > .grid3 + .card, .content > .grid2 + .card, .content > .card + .grid2, .content > .grid3 + .cols, .content > .cols + .cols { margin-top: 18px; }
.content > .grid2 { margin-bottom: 18px; align-items: start; }
.price-cell { font-family: var(--f-display); font-size: 19px; color: var(--accent-t); }
.profile-head { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; border-top: 6px solid var(--cc); margin-bottom: 18px; background: linear-gradient(160deg, #fff, #fdeef6); }
.profile-avatar .avatar-svg, .bot-face { border-radius: 50%; box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--cc), var(--shadow); }
.bot-face { width: 110px; height: 110px; background: #ece2fb; color: var(--lav-d); display: flex; align-items: center; justify-content: center; }
.profile-info { flex: 1; min-width: 240px; }
.flag-dot { display: inline-flex; width: 38px; height: 38px; border-radius: 50%; background: var(--cc); color: #fff; align-items: center; justify-content: center; vertical-align: middle; }
.motto { margin: 6px 0 10px; font-family: var(--f-display); font-size: 20px; color: var(--accent-t); }
.timeline { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow: auto; border-inline-start: 2px solid var(--line2); }
.timeline li { position: relative; padding: 6px 14px 10px; font-size: 14px; }
.timeline li::before { content: ''; position: absolute; right: -6px; top: 11px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent-2); }
.timeline time { display: block; font-size: 12px; color: var(--muted); }
.small-ach { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); margin-bottom: 10px; }
.avatar-pick { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.avatar-pick .choice span { padding: 8px 4px; font-size: 13px; }
@media (max-width: 560px) { .avatar-pick { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.ticker { position: absolute; top: 0; inset-inline: 0; display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.88); border-bottom: 1px solid var(--line); font-size: 13.5px; overflow: hidden; height: 30px; z-index: 2; }
.ticker-label { flex-shrink: 0; padding: 0 12px; height: 100%; display: flex; align-items: center; gap: 6px; background: var(--accent); color: #fff; font-weight: 700; }
.ticker-track { overflow: hidden; flex: 1; white-space: nowrap; }
.ticker-track span { display: inline-block; padding-inline-start: 100%; animation: ticker 90s linear infinite; }
@keyframes ticker { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.map-ctrl { top: 44px; }

/* painted art in game cards */
.bcard.has-art { padding: 0 0 14px; overflow: hidden; }
.bcard.has-art > :not(.bcard-art) { margin-inline: 14px; }
.bcard-art { aspect-ratio: 16 / 9; overflow: hidden; position: relative; }
.bcard-art img { width: 100%; height: 100%; object-fit: cover; transition: transform .7s cubic-bezier(.2,.7,.2,1); }
.bcard.has-art:hover .bcard-art img { transform: scale(1.06); }
.bcard.empty .bcard-art img { filter: grayscale(.55) opacity(.75); }
.dilemma.has-art { padding-top: 0; overflow: hidden; }
.dilemma-art { margin: 0 -22px 6px; aspect-ratio: 16 / 9; overflow: hidden; position: relative; }
.dilemma-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, #fdeef6 0%, rgba(253,238,246,0) 45%); }
.dilemma-art img { width: 100%; height: 100%; object-fit: cover; }
@keyframes decide { 0% { transform: none; } 35% { transform: perspective(900px) rotateY(-8deg) scale(1.02); } 100% { transform: perspective(900px) rotateY(90deg) scale(.9); opacity: 0; } }
.dilemma.decided { animation: decide .85s cubic-bezier(.5,0,.6,1) .15s both; pointer-events: none; }
.option.chosen { background: var(--accent); color: #fff; border-color: var(--accent); }
.option.chosen span { color: #fff; }

/* page banners (app shell): painting strip that fades into the page; the page title sits on its lower edge */
.page-banner { position: relative; height: clamp(150px, 22vw, 230px); margin: -22px -22px 0; overflow: hidden; border-radius: 0 0 0 28px; }
.page-banner img { width: 100%; height: 100%; object-fit: cover; object-position: center 40%; }
.page-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, var(--bg) 0%, rgba(255,244,249,.55) 35%, rgba(255,244,249,0) 70%); }
.page-banner + .page-head, .page-banner + .paper { position: relative; margin-top: -64px; z-index: 1; }
.page-banner + .page-head .h1 { text-shadow: 0 2px 18px rgba(255,244,249,.95), 0 0 2px #fff; }
@media (max-width: 860px) { .page-banner { margin: -14px -16px 0; border-radius: 0; } .page-banner + .page-head { margin-top: -48px; } }
/* smooth page-to-page transitions (Chromium); the banner morphs between pages */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vtOut .22s ease both; }
::view-transition-new(root) { animation: vtIn .32s ease both; }
@keyframes vtOut { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vtIn { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { ::view-transition-old(root), ::view-transition-new(root) { animation: none; } }
/* login / register / found-a-country: full-page painting behind the card */
.auth-bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.auth-bg img { width: 100%; height: 100%; object-fit: cover; }
.auth-bg::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(255,244,249,.55) 0%, rgba(255,244,249,.88) 70%); }
body:has(.auth-bg) .petals { z-index: 0; }
.auth-bg ~ section .card { background: rgba(255,255,255,.82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 30px 70px -25px rgba(74,29,79,.45); }
/* unit cards (army), tech tree, tower, medals */
.branch.has-art { padding-top: 0; overflow: hidden; }
.card-art { margin: 0 -22px 8px; aspect-ratio: 16 / 10; overflow: hidden; }
.card-art img { width: 100%; height: 100%; object-fit: cover; transition: transform .7s cubic-bezier(.2,.7,.2,1); }
.branch.has-art:hover .card-art img { transform: scale(1.06); }
img.locked { filter: grayscale(.7) opacity(.7); }
.tech.has-art { padding-top: 0; overflow: hidden; }
.tech-art { margin: 0 -12px 2px; aspect-ratio: 16 / 9; overflow: hidden; }
.tech-art img { width: 100%; height: 100%; object-fit: cover; }
.tech-locked .tech-art img { filter: grayscale(1); }
.tech-done .tech-art { box-shadow: inset 0 -3px 0 #8fd6ad; }
.tower-wrap.has-art .tower { display: none; }
.tower-art { position: relative; width: min(240px, 60vw); flex: none; }
.tower-art img { border-radius: 18px; }
.tower-art .tower-ghost { filter: grayscale(1) opacity(.28); }
.tower-art .tower-built { position: absolute; inset: 0; clip-path: inset(calc((1 - var(--built)) * 100%) 0 0 0); animation: towerRise 1.6s cubic-bezier(.2,.7,.2,1) both; filter: drop-shadow(0 0 14px rgba(229,72,154,.35)); }
@keyframes towerRise { from { clip-path: inset(100% 0 0 0); } }
.ach .medal-img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; box-shadow: 0 4px 14px -4px rgba(74,29,79,.4); }
.ach.got .medal-img { animation: medalShine 4s ease-in-out infinite; }
@keyframes medalShine { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.15) saturate(1.2); } }
.avatar-img { border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px var(--cc, var(--accent)), 0 6px 16px -6px rgba(74,29,79,.45); }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.meter.has-face { display: grid; grid-template-columns: 44px 1fr; column-gap: 10px; align-items: center; }
.meter.has-face .group-face { grid-row: span 2; width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.choice .choice-art { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; margin-bottom: 4px; }
.mini-kpis .kpi-art { position: relative; overflow: hidden; color: #fff; background: #4a1d4f var(--img) center / cover; min-height: 82px; display: flex; flex-direction: column; justify-content: flex-end; }
.mini-kpis .kpi-art::before { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(74,29,79,.82), rgba(74,29,79,.1) 70%); }
.mini-kpis .kpi-art > * { position: relative; color: #fff; }
/* achievement unlocked */
.celebrate { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(74,29,79,.35); backdrop-filter: blur(3px); animation: fadeUp .3s ease both; cursor: pointer; }
.celebrate.out { opacity: 0; transition: opacity .4s; }
.celebrate-card { position: relative; z-index: 1; background: linear-gradient(160deg, #fff, #fcd9ea); border-radius: 28px; padding: 26px 34px; text-align: center; box-shadow: 0 30px 80px -20px rgba(74,29,79,.6); display: flex; flex-direction: column; align-items: center; gap: 4px; animation: popIn .7s cubic-bezier(.2,1.4,.4,1) both; }
.celebrate-card img { width: 150px; height: 150px; border-radius: 50%; object-fit: cover; animation: medalSpin 1.1s cubic-bezier(.2,.8,.2,1) both; box-shadow: 0 0 0 6px #fff, 0 0 40px rgba(229,72,154,.55); }
.celebrate-card small { color: var(--accent-t); margin-top: 10px; }
.celebrate-card b { font-family: var(--f-display); font-weight: 400; font-size: 30px; color: var(--text); }
.celebrate i { position: absolute; top: 50%; left: 50%; width: 14px; height: 16px; background: #f5b8d5; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); animation: burst 1.4s cubic-bezier(.1,.7,.3,1) var(--d) both; }
.celebrate i:nth-child(odd) { background: #d9c2f5; }
@keyframes popIn { from { opacity: 0; transform: scale(.6) translateY(20px); } }
@keyframes medalSpin { from { transform: rotateY(540deg) scale(.4); } }
@keyframes burst { from { transform: rotate(var(--a)) translateY(0) scale(.3); opacity: 1; } to { transform: rotate(var(--a)) translateY(-46vmin) scale(1) rotate(200deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .celebrate i { display: none; } }

/* autopilot page */
.ap-hero { display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: linear-gradient(135deg, #fff 0%, #fdeef6 55%, #efe6fd 100%); }
.ap-hero-main { display: flex; gap: 18px; align-items: flex-start; flex: 1; min-width: 260px; }
.ap-hero-main p { margin: 6px 0; }
.ap-hero-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.ap-cost { color: var(--text2); display: flex; gap: 6px; align-items: center; }
.ap-orb { position: relative; width: 76px; height: 76px; flex: none; border-radius: 50%; display: grid; place-items: center; color: #fff; background: radial-gradient(circle at 35% 30%, #f08cbf, #8f4fe0); box-shadow: 0 10px 30px -8px rgba(143,79,224,.6); }
.ap-orb span { position: absolute; inset: -6px; border-radius: 50%; border: 2px solid rgba(229,72,154,.35); opacity: 0; }
.ap-hero.is-on .ap-orb span { animation: apRing 2.4s ease-out infinite; }
.ap-hero.is-on .ap-orb span + span { animation-delay: 1.2s; }
.ap-hero:not(.is-on) .ap-orb { filter: grayscale(.8); opacity: .7; }
@keyframes apRing { 0% { transform: scale(.85); opacity: .9; } 100% { transform: scale(1.5); opacity: 0; } }
.ap-launch { box-shadow: 0 12px 30px -10px rgba(199,42,124,.7); }
.ap-sec-title { margin-top: 22px; }
.ap-presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.ap-preset { font: inherit; text-align: start; color: var(--text); background: #fff; border: 1px solid var(--line2); border-radius: 18px; padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: transform .2s, border-color .2s, box-shadow .2s; }
.ap-preset:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow-s); }
.ap-preset.on { border-color: var(--accent); background: linear-gradient(160deg, #fff, #fcd9ea); box-shadow: inset 0 0 0 1px var(--accent); }
.ap-preset small { color: var(--text2); line-height: 1.45; }
.ap-view { margin-bottom: 6px; }
.ap-view-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; margin-top: 8px; }
.ap-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ap-grid .card { display: flex; flex-direction: column; gap: 10px; }
.ap-check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.ap-check input { width: 20px; height: 20px; min-height: 0; margin-top: 2px; accent-color: var(--accent); flex: none; }
.ap-check span { display: flex; flex-direction: column; }
.ap-check b { font-weight: 600; }
.ap-check small { color: var(--muted); }
.ap-num { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14.5px; color: var(--text2); }
.ap-num input[type=number] { width: 100px; }
.ap-num select { max-width: 60%; }
.ap-mix { display: grid; gap: 6px; }
.ap-mix label { display: grid; grid-template-columns: 60px 1fr 44px; gap: 8px; align-items: center; font-size: 14px; color: var(--text2); }
.ap-mix output { font-weight: 700; color: var(--accent-t); text-align: end; }
.ap-save { position: sticky; bottom: 12px; display: flex; justify-content: center; margin: 18px 0; z-index: 5; }
.ap-save .btn { box-shadow: 0 14px 30px -12px rgba(74,29,79,.55); }
.ap-log { list-style: none; padding: 0; margin: 0; max-height: 520px; overflow: auto; }
.ap-log li { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: start; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.ap-log li.fail { color: var(--muted); }
.ap-log li.fail .ap-ic { color: var(--warn); }
.ap-log .ap-ic { color: var(--accent); padding-top: 2px; }
.ap-log time { color: var(--muted); font-size: 12px; white-space: nowrap; }
@media (max-width: 860px) {
  .ap-presets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ap-grid, .ap-view-grid { grid-template-columns: minmax(0, 1fr); }
  .ap-hero-actions { width: 100%; }
  .ap-save { bottom: 84px; }
}

/* mobile QA fixes: wide tables scroll inside their card, comfortable touch targets */
.prose, .card { min-width: 0; }
@media (max-width: 860px) {
  :not(.table-wrap) > table.table { display: block; overflow-x: auto; }
  .site-nav a, .toc a { display: inline-block; padding: 8px 2px; }
  .table td a, .rank-name a { display: inline-block; padding: 6px 0; }
  .site-actions .btn, .btn-s { min-height: 38px; }
}
/* card art bleeds exactly to the card edge at every padding */
.card { --pad: 22px; }
.feature-art { margin: calc(-1 * var(--pad)) calc(-1 * var(--pad)) 6px; }
.card-art { margin: 0 calc(-1 * var(--pad)) 8px; }
@media (max-width: 860px) { .card { --pad: 16px; } }
/* long unbroken strings (user agents, emails, ids in logs) must wrap instead of stretching the page */
.mini-list li, .mini-list small, .note span, .ap-log li span, .table td small { overflow-wrap: anywhere; }

/* responsive "card" tables: on phones every row becomes a small card, cells get their column name */
.cc-name { overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
@media (max-width: 600px) {
  .table.stack { display: block; }
  .table.stack thead { display: none; }
  .table.stack tbody { display: grid; gap: 10px; }
  .table.stack tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
  .table.stack tr:hover td { background: none; }
  .table.stack td { padding: 0; border: 0; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .table.stack td:first-child { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 16px; }
  .table.stack td[data-label]::before { content: attr(data-label); font-size: 12px; color: var(--muted); }
  .table.stack td.stack-actions { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .table.stack td:empty { display: none; }
  .stack-rank tr { grid-template-columns: repeat(3, 1fr); }
  .stack-rank td.rank-no { grid-column: auto; font-family: var(--f-display); font-size: 20px; color: var(--accent-t); }
  .stack-rank td.rank-no + td { grid-column: 2 / -1; }
  .stack-rank td:last-child:not([data-label]) { grid-column: 1 / -1; }
  .table-wrap:has(.table.stack) { overflow: visible; }
}
@media (max-width: 600px) {
  .stack-rank td.rank-no { grid-column: 1 / 2; align-self: center; }
  .stack-rank td.rank-no + td { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 16px; }
}
@media (max-width: 600px) {
  .table.stack.stack-rank tr { grid-template-columns: 34px 1fr 1fr; }
  .table.stack.stack-rank td.rank-no { grid-column: 1 / 2; flex-direction: row; align-self: center; font-family: var(--f-display); font-size: 22px; color: var(--accent-t); }
  .table.stack.stack-rank td.rank-no + td { grid-column: 2 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 16px; }
  .table.stack.stack-rank td[data-label] { grid-column: auto; }
  .table.stack.stack-rank td:last-child:not([data-label]) { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .table.stack.stack-rank td:nth-child(3), .table.stack.stack-rank td:nth-child(5) { grid-column: 2; }
  .table.stack.stack-rank td:nth-child(4), .table.stack.stack-rank td:nth-child(6) { grid-column: 3; }
}
