/*!
 * Flag Master Web — Responsive Multi-Screen Layout, Mobile Web & AdSense Zero-CLS Stylesheet
 * Optimizes the Royal Atlas UI across Mobile Portrait/Landscape, Tablet, Laptop & Wide Desktop.
 */

:root {
  --wf-vvh: 100dvh;
  --wf-ad-rail-width: 168px;
}

html,
body {
  min-height: 100dvh;
  min-height: var(--wf-vvh, 100dvh);
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

html {
  background-color: var(--bg, #F6EEDC);
}

html:not([data-wf-ready="1"]) body {
  opacity: 0;
}

html[data-wf-ready="1"] body {
  opacity: 1;
  transition: opacity 0.08s ease-out;
}

img,
canvas,
.flag-frame,
.study-region-card,
.fm-mode {
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  user-select: none;
}

#hud-points,
#hud-conquest,
#charge-modal,
#pro-modal,
#level-modal,
#levelup-modal,
#home-progress,
.home-progress-row,
#results-xp,
#passport-btn,
#achievements-btn,
#usage-btn,
#passport-screen,
#achievements-screen,
#usage-screen,
#drawer-tag,
#home-pro-btn,
#home-pro-mini,
#settings-pro-btn,
#settings-restore-btn,
#charge-pro-btn,
#charge-restore-btn,
#pro-btn,
#menu-rate-btn,
.setting-row--danger,
.corner.cost,
.stage-card-cost {
  display: none !important;
}

.stats-ribbon {
  display: flex !important;
  justify-content: center !important;
  margin-bottom: 10px;
}
.stats-ribbon > #hud-dailyflag {
  width: 100%;
  max-width: 360px;
}

.froute-result-xp,
.amem-result-xp {
  display: inline-block;
  margin: 10px auto 6px !important;
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(246, 227, 186, 0.35) 0%, rgba(200, 157, 84, 0.22) 100%);
  border: 1px solid rgba(200, 157, 84, 0.55);
  color: var(--gold-strong, #9d6f22) !important;
  font-weight: 700 !important;
  font-size: 0.92rem !important;
  letter-spacing: -0.01em;
}
[data-theme="dark"] .froute-result-xp,
[data-theme="dark"] .amem-result-xp {
  background: linear-gradient(135deg, rgba(229, 185, 104, 0.24) 0%, rgba(200, 157, 84, 0.14) 100%);
  border-color: rgba(229, 185, 104, 0.5);
  color: #f6e3ba !important;
}

.tabbar {
  height: calc(68px + env(safe-area-inset-bottom, 0px)) !important;
  padding: 6px max(12px, calc((100vw - 640px) / 2)) calc(6px + env(safe-area-inset-bottom, 0px)) !important;
  background: rgba(20, 38, 59, 0.97) !important;
  backdrop-filter: blur(20px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(160%) !important;
  border-top: 2px solid #c89d54 !important;
  box-shadow: 0 -8px 28px rgba(8, 16, 28, 0.32) !important;
  gap: 6px !important;
  z-index: 95 !important;
}

.tabbar-btn {
  position: relative;
  color: rgba(246, 241, 227, 0.78) !important;
  border-radius: 14px !important;
  margin: 2px 0 !important;
  padding: 6px 4px !important;
  gap: 4px !important;
  transition: transform 0.16s ease, background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease !important;
}

.tabbar-btn:hover {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.09) !important;
}

.tabbar-ic {
  width: 23px !important;
  height: 23px !important;
  opacity: 0.92 !important;
  transition: transform 0.16s ease, opacity 0.16s ease !important;
}

.tabbar-ic svg {
  width: 23px !important;
  height: 23px !important;
  stroke-width: 2.1px !important;
}

.tabbar-l {
  font-size: 12.5px !important;
  font-weight: 700 !important;
  letter-spacing: 0.01em !important;
  line-height: 1.15 !important;
}

.tabbar-btn.is-active {
  color: #14263b !important;
  background: linear-gradient(135deg, #f6e3ba 0%, #e5b968 100%) !important;
  box-shadow: 0 4px 14px rgba(200, 157, 84, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.65) !important;
  transform: translateY(-1px);
}

.tabbar-btn.is-active .tabbar-ic {
  opacity: 1 !important;
  transform: scale(1.08);
}

.tabbar-btn.is-active .tabbar-l {
  font-weight: 800 !important;
  color: #14263b !important;
}

.tabbar-btn.is-active::after {
  display: none !important;
}

.wf-ad-slot {
  position: relative;
  width: 100%;
  margin: 22px auto 12px;
  padding: 18px 10px 10px;
  border-radius: 14px;
  background: var(--card, rgba(255, 255, 255, 0.65));
  border: 1px solid var(--line, rgba(16, 28, 48, 0.12));
  box-shadow: 0 2px 10px rgba(10, 20, 40, 0.04);
  box-sizing: border-box;
  overflow: hidden;
  transition: opacity 0.2s ease;
}

.wf-ads-disabled .wf-ad-slot,
.wf-ad-slot[hidden],
.wf-ad-slot.wf-ad-blocked {
  display: none !important;
}

.wf-ad-badge {
  position: absolute;
  top: 4px;
  left: 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted, #6a7280);
  opacity: 0.78;
  pointer-events: none;
  line-height: 1.2;
}

.wf-ad-inner {
  width: 100%;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#ad-slot-results {
  margin-top: 24px;
  margin-bottom: 16px;
}

#ad-slot-results .wf-ad-inner {
  min-height: 100px;
}

html.wf-ad-cooldown .wf-ad-slot,
html.wf-ad-cooldown ins.adsbygoogle,
html.wf-ad-cooldown .wf-ad-slot iframe {
  pointer-events: none !important;
  opacity: 0.6 !important;
}

.wf-ad-rail {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: var(--wf-ad-rail-width);
  min-height: 600px;
  margin: 0;
  padding: 20px 6px 8px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.wf-ad-rail .wf-ad-inner {
  min-height: 580px;
}

#ad-rail-left {
  left: max(14px, calc((100vw - 1020px) / 2 - var(--wf-ad-rail-width) - 18px));
}

#ad-rail-right {
  right: max(14px, calc((100vw - 1020px) / 2 - var(--wf-ad-rail-width) - 18px));
}

@media (max-width: 1359px) {
  .wf-ad-rail {
    display: none !important;
  }
}

@media (min-width: 1640px) {
  :root {
    --wf-ad-rail-width: 240px;
  }
}

.wf-editorial {
  margin: 28px auto 18px;
  padding: 24px 20px;
  border-radius: 18px;
  background: var(--card, rgba(255, 253, 246, 0.88));
  border: 1px solid var(--line, rgba(28, 63, 94, 0.14));
  box-shadow: 0 6px 24px rgba(12, 24, 42, 0.06);
  color: var(--ink, #173b58);
  line-height: 1.72;
  text-align: left;
}

.wf-editorial-header {
  border-bottom: 1px solid var(--line, rgba(28, 63, 94, 0.12));
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.wf-editorial-eyebrow {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-strong, #9d6f22);
}

.wf-editorial-title {
  margin: 0 0 10px;
  font-size: clamp(1.18rem, 2.4vw, 1.45rem);
  font-weight: 800;
  line-height: 1.35;
  color: var(--ink, #14263b);
}

.wf-editorial-lead {
  margin: 0;
  font-size: 0.93rem;
  color: var(--muted, #47586b);
}

.wf-editorial-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.wf-editorial-card {
  padding: 16px 16px 14px;
  border-radius: 14px;
  background: rgba(200, 157, 84, 0.06);
  border: 1px solid rgba(200, 157, 84, 0.22);
}

.wf-editorial-card h3,
.wf-editorial-wide h3,
.wf-editorial-faq h3 {
  margin: 0 0 8px;
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--ink, #14263b);
}

.wf-editorial-card p {
  margin: 0 0 8px;
  font-size: 0.87rem;
  color: var(--muted, #47586b);
}

.wf-editorial-card p:last-child {
  margin-bottom: 0;
}

.wf-editorial-wide {
  padding: 18px 16px;
  border-radius: 14px;
  background: rgba(23, 59, 88, 0.04);
  border: 1px solid var(--line, rgba(28, 63, 94, 0.12));
  margin-bottom: 20px;
}

.wf-editorial-steps {
  margin: 10px 0 0;
  display: grid;
  gap: 12px;
}

.wf-step-item dt {
  margin: 0 0 4px;
}

.wf-inline-nav {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--gold-strong, #9d6f22);
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.wf-inline-nav:hover {
  opacity: 0.85;
}

.wf-step-item dd {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted, #47586b);
}

.wf-editorial-faq {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wf-faq-item {
  border-radius: 12px;
  border: 1px solid var(--line, rgba(28, 63, 94, 0.14));
  background: var(--bg, rgba(255, 255, 255, 0.5));
  padding: 10px 14px;
}

.wf-faq-item summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink, #14263b);
  list-style: none;
}

.wf-faq-item p {
  margin: 8px 0 2px;
  font-size: 0.86rem;
  color: var(--muted, #47586b);
}

.wf-site-footer {
  margin: 12px auto 28px;
  padding: 18px 16px;
  border-radius: 16px;
  background: rgba(20, 38, 59, 0.06);
  border: 1px solid var(--line, rgba(28, 63, 94, 0.14));
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--muted, #526273);
}

.wf-footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 10px;
  margin-bottom: 10px;
}

.wf-footer-link {
  appearance: none;
  background: none;
  border: none;
  padding: 2px 4px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink, #173b58);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.wf-footer-link:hover {
  color: var(--gold-strong, #9d6f22);
}

.wf-footer-disclosure {
  margin: 0 auto 8px;
  max-width: 720px;
  font-size: 0.76rem;
}

.wf-footer-disclosure a,
.wf-footer-copy a {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
}

.wf-footer-copy {
  margin: 0;
  font-size: 0.75rem;
  opacity: 0.88;
}

.wf-adblock-fallback {
  width: 100%;
  box-sizing: border-box;
  padding: 14px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(246, 227, 186, 0.25) 0%, rgba(20, 38, 59, 0.05) 100%);
  border: 1px dashed rgba(200, 157, 84, 0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
}

.wf-adblock-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--ink, #14263b);
}

.wf-adblock-desc {
  margin: 0;
  max-width: 580px;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--muted, #47586b);
}

.wf-adblock-btn {
  margin-top: 4px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(200, 157, 84, 0.65);
  background: linear-gradient(135deg, #f6e3ba 0%, #e5b968 100%);
  color: #14263b;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.wf-adblock-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(200, 157, 84, 0.35);
}

.wf-lang-select {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line, rgba(28, 63, 94, 0.24));
  background: var(--card, #fffdf6);
  color: var(--text, var(--ink, #14263b));
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  max-width: 195px;
}

.drawer-lang-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 10px;
  border-radius: 12px;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--text);
}

.drawer-lang-head {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  cursor: pointer;
}

.wf-drawer-lang-select {
  padding: 6px 10px;
  font-size: 0.84rem;
  max-width: 138px;
  flex-shrink: 0;
}

.wf-editorial-toprow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.wf-share-site-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid rgba(200, 157, 84, 0.45);
  background: rgba(200, 157, 84, 0.12);
  color: var(--ink, var(--text));
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.14s ease, background 0.14s ease;
}

.wf-share-site-btn:hover {
  background: rgba(200, 157, 84, 0.24);
  transform: translateY(-1px);
}

.wf-seo-directory {
  margin-top: 14px;
}

.wf-directory-body {
  padding: 10px 4px 4px;
}

.wf-directory-desc {
  margin: 0 0 10px;
  font-size: 0.84rem;
  color: var(--muted);
}

.wf-country-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 2px;
}

.wf-country-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line, rgba(28, 63, 94, 0.16));
  background: var(--card, #fffdf6);
  color: var(--text, #14263b);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.14s ease, transform 0.14s ease;
}

.wf-country-chip:hover {
  border-color: #c89d54;
  transform: translateY(-1px);
}

.wf-lang-seo-nav {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line, rgba(28, 63, 94, 0.16));
  font-size: 0.8rem;
  line-height: 1.8;
  color: var(--muted);
}

.wf-lang-seo-nav a {
  color: var(--navy, #1c3f5e);
  font-weight: 700;
  text-decoration: none;
}

html[data-theme="dark"] .wf-lang-seo-nav a {
  color: #f3c663;
}

.wf-app-banner {
  margin: 22px auto 0;
  padding: 20px 22px;
  border-radius: 18px;
  background: linear-gradient(135deg, #10243a 0%, #1c3f5e 60%, #16324c 100%);
  border: 1.5px solid rgba(226, 176, 74, 0.55);
  box-shadow: 0 12px 28px rgba(10, 22, 38, 0.18);
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.wf-app-banner-info {
  flex: 1 1 320px;
  min-width: 0;
}

.wf-app-banner-eyebrow {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #f3c663;
  margin-bottom: 4px;
}

.wf-app-banner-title {
  margin: 0 0 6px;
  font-size: 1.08rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.35;
}

.wf-app-banner-desc {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.55;
  color: rgba(241, 245, 249, 0.86);
}

.wf-app-banner-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.wf-store-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border-radius: 12px;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.wf-store-btn--ios {
  background: linear-gradient(135deg, #f6d365 0%, #c89d54 100%);
  color: #0f2338;
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 6px 16px rgba(200, 157, 84, 0.35);
}

.wf-store-btn--ios:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(200, 157, 84, 0.48);
}

.wf-store-btn--android {
  background: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  border: 1px solid rgba(243, 198, 99, 0.4);
}

.wf-store-btn--android.is-coming-soon {
  opacity: 0.88;
  cursor: default;
}

.wf-store-text {
  display: flex;
  flex-direction: column;
  line-height: 1.18;
  text-align: start;
}

.wf-store-text small {
  font-size: 0.66rem;
  font-weight: 700;
  opacity: 0.85;
}

.wf-store-text strong {
  font-size: 0.92rem;
  font-weight: 800;
}

.drawer-app-store-box {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
}

.drawer-store-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.14s ease;
}

.drawer-store-btn--ios {
  background: linear-gradient(135deg, #142b44 0%, #1c3f5e 100%);
  color: #fde68a;
  border: 1.5px solid rgba(226, 176, 74, 0.65);
  box-shadow: 0 8px 18px -6px rgba(20, 43, 68, 0.45);
}

.drawer-store-btn--android {
  background: rgba(28, 63, 94, 0.08);
  color: var(--muted);
  border: 1px dashed var(--line, rgba(28, 63, 94, 0.25));
  font-size: 13px;
  font-weight: 700;
}

html[data-theme="dark"] .drawer-store-btn--android {
  background: rgba(255, 255, 255, 0.05);
}

@media (max-width: 374px) {
  .app-shell {
    padding-left: 10px;
    padding-right: 10px;
  }
  .stats-ribbon {
    gap: 6px;
  }
  .ribbon-cell {
    padding: 8px 6px;
  }
  .wf-ad-slot {
    margin-top: 16px;
    padding: 16px 6px 8px;
  }
}

@media (max-width: 640px) {
  #home-screen,
  #study-regions-screen .study-page,
  #practice-screen .practice-panel,
  #mania-screen .mania-panel,
  #crest-screen .panel {
    padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .tabbar {
    padding-bottom: max(8px, env(safe-area-inset-bottom, 8px));
  }
}

@media (max-height: 560px) and (orientation: landscape) {
  .wf-ad-slot {
    margin: 12px auto 8px;
    padding: 14px 8px 6px;
  }
  .wf-ad-inner {
    min-height: 60px;
  }
  .quiz-panel .flag-frame--quiz {
    max-height: 36dvh;
  }
}

@media (min-width: 641px) {
  .app-shell {
    max-width: 920px;
    margin-left: auto;
    margin-right: auto;
  }

  .wf-ad-slot {
    max-width: 728px;
  }
}

.study-list,
#study-list,
#mania-list,
#crest-list,
#favorites-list {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 235px), 1fr)) !important;
  width: 100%;
  box-sizing: border-box;
  margin-inline-end: 0 !important;
  padding-inline-end: 6px !important;
}

.study-row {
  min-width: 0;
  box-sizing: border-box;
  grid-template-columns: 74px minmax(0, 1fr) auto !important;
  gap: 12px !important;
  padding: 12px 14px !important;
}

.study-row > * {
  min-width: 0;
  overflow-wrap: break-word;
}

@media (hover: hover) and (pointer: fine) {
  .fm-mode:hover,
  .study-region-card:hover,
  .atlas-study-cta:hover,
  .options-grid button:hover:not(:disabled) {
    transform: translateY(-2px);
    transition: transform 0.16s ease, box-shadow 0.16s ease;
  }

  
  ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }
  ::-webkit-scrollbar-track {
    background: transparent;
  }
  ::-webkit-scrollbar-thumb {
    background: rgba(150, 140, 120, 0.35);
    border-radius: 999px;
  }
  ::-webkit-scrollbar-thumb:hover {
    background: rgba(150, 140, 120, 0.55);
  }
}
