/* Structure & behaviour only. Visual design lives in css/themes/*.css
   NOTE: don't put backdrop-filter/filter/transform on .f-modal in a theme - it breaks the mobile bottom sheet (position: fixed). */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

.f-overlay { position: fixed; inset: 0; display: none; justify-content: center; z-index: 1000; overflow: auto; }
.f-overlay.is-open { display: flex; }
.f-modal { position: relative; width: 100%; margin: auto; }
.f-close { position: absolute; }

.f-chips { display: flex; flex-wrap: wrap; }
.f-chip { cursor: pointer; }

.f-dd { position: relative; }
.f-dd-btn { display: flex; align-items: center; width: 100%; cursor: pointer; text-align: start; }
.f-dd-btn:disabled { cursor: not-allowed; }
.f-dd-val { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-ico:empty { display: none; }
.f-dd-panel { position: absolute; top: 100%; left: 0; right: 0; z-index: 5; display: none; flex-direction: column; max-height: 320px; }
.f-dd.is-open .f-dd-panel { display: flex; }
.f-dd-head { display: none; }
.f-search { width: 100%; }
.f-dd-list { margin: 0; padding: 0; list-style: none; overflow: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.f-dd-opt { display: flex; align-items: center; cursor: pointer; }
.f-dd-opt[hidden] { display: none; }

/* phones: the country list becomes a bottom sheet */
@media (max-width: 520px) {
  .f-dd.is-open::before { content: ''; position: fixed; inset: 0; z-index: 4; background: rgba(0, 0, 0, .55); }
  .f-dd-panel { position: fixed; top: auto; left: 0; right: 0; bottom: 0; max-height: 75vh; max-height: 75dvh; }
  .f-dd-head { display: block; }
}

.f-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.f-fld { display: block; }
.f-input { width: 100%; }
.f-dd-opt.f-dd-none { display: flex; }
.f-tg { cursor: pointer; }
.f-tg:disabled { pointer-events: none; }

/* Shared look of all components, driven by CSS variables. A design = variables + layout + art (design.css). */
:root {
  --tg-text: #fff; --tg-muted: #a9c0e4; --tg-accent: #2f9bff; --tg-gold: #f5b942; --tg-err: #ff9b9b; --tg-close: #dce9ff;
  --tg-page-bg: #0b1a3a; --tg-overlay: rgba(2, 8, 20, .75);
  --tg-card-bg: #0a1c40; --tg-card-blur: none; --tg-card-border: 1px solid rgba(80, 170, 255, .6);
  --tg-card-shadow: 0 0 34px rgba(47, 155, 255, .4); --tg-radius: 20px; --tg-max-w: 620px; --tg-pad: 30px 34px 24px;
  --tg-field-bg: rgba(30, 80, 170, .26); --tg-field-line: rgba(110, 170, 255, .4); --tg-field-text: #fff;
  --tg-panel-bg: rgba(8, 28, 76, .96); --tg-panel-hover: rgba(47, 155, 255, .22); --tg-panel-active: rgba(47, 155, 255, .35);
  --tg-btn-bg: linear-gradient(180deg, #55b2ff 0%, #2a85f5 45%, #1a63de 100%); --tg-btn-text: #fff;
  --tg-btn-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 8px 28px rgba(47, 155, 255, .5);
  --tg-btn-off-bg: rgba(40, 62, 105, .8); --tg-btn-off-text: #7f95bd;
  --tg-note-bg: rgba(47, 155, 255, .1); --tg-note-line: rgba(110, 170, 255, .4); --tg-note-text: #cfe0ff; --tg-note-strong: #fff;
  --tg-feat-text: #e6efff; --tg-feat-icon: var(--tg-accent);
  --tg-ok-bg: rgba(40, 190, 110, .14); --tg-ok-line: rgba(70, 210, 130, .5); --tg-ok-icon: #4fe08f;
  --tg-title-size: 28px; --tg-title-align: center; --tg-art-display: none;
}


.f-overlay { background: var(--tg-overlay); padding: 16px; z-index: 10000; font: 16px/1.4 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
.f-overlay p, .f-overlay h2, .f-overlay h3 { color: inherit; }
.f-overlay .f-sub, .f-overlay .f-lead-sub, .f-overlay .f-note { color: var(--tg-muted); }
.f-overlay .f-note { color: var(--tg-note-text); }
.f-modal { max-width: var(--tg-max-w); padding: var(--tg-pad); border-radius: var(--tg-radius); isolation: isolate; color: var(--tg-text);
           border: var(--tg-card-border); box-shadow: var(--tg-card-shadow); animation: f-pop .2s ease-out; }
.f-modal::before { content: ''; position: absolute; inset: 0; z-index: -2; border-radius: inherit; background: var(--tg-card-bg);
                   backdrop-filter: var(--tg-card-blur); -webkit-backdrop-filter: var(--tg-card-blur); }
@keyframes f-pop { from { opacity: 0; transform: translateY(10px); } }

.f-art { display: var(--tg-art-display); position: absolute; z-index: -1; pointer-events: none; }
.f-content { position: relative; display: flex; flex-direction: column; }
.f-logo { display: none; font-weight: 900; font-style: italic; font-size: 26px; letter-spacing: .5px; }

.f-close { top: 14px; right: 16px; z-index: 3; width: 34px; height: 34px; border: 0; background: none; color: var(--tg-close);
           font-size: 30px; font-weight: 200; line-height: 1; cursor: pointer; border-radius: 50%; }
.f-close:hover { background: rgba(128, 128, 128, .2); }
.f-title { margin: 0; text-align: var(--tg-title-align); font-size: var(--tg-title-size); font-weight: 800; letter-spacing: .2px; }
.f-accent { color: var(--tg-accent); }
.f-sub { margin: 6px 0 24px; text-align: var(--tg-title-align); color: var(--tg-muted); font-size: 16px; }

.f-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.f-label { display: block; margin-bottom: 8px; font-size: 14px; color: var(--tg-muted); }

.f-dd-btn { gap: 12px; height: 54px; padding: 0 16px; font: inherit; font-size: 16px; font-weight: 500; color: var(--tg-field-text);
            background: var(--tg-field-bg); border: 1px solid var(--tg-field-line); border-radius: 12px; transition: border-color .15s; }
.f-dd-btn:hover, .f-dd.is-open .f-dd-btn { border-color: var(--tg-accent); }
.f-dd:not(.has-value) .f-dd-val { color: var(--tg-muted); }
.f-ico { display: flex; width: 26px; height: 26px; align-items: center; justify-content: center; color: var(--tg-field-text); opacity: .85; }
.f-ico svg { width: 24px; height: 24px; }
.f-flag { display: inline-flex; width: 26px; height: 22px; flex: 0 0 26px; align-items: center; justify-content: center; overflow: hidden; font-family: "Segoe UI Emoji", "Apple Color Emoji", sans-serif; font-size: 22px; line-height: 1; }
.f-chev { width: 12px; height: 8px; color: var(--tg-field-text); opacity: .8; transition: transform .15s; }
.f-dd.is-open .f-chev { transform: rotate(180deg); }

.f-dd-panel { margin-top: 6px; color: var(--tg-field-text); background: var(--tg-panel-bg); border: 1px solid var(--tg-field-line);
              border-radius: 12px; box-shadow: 0 14px 34px rgba(0, 0, 0, .35); overflow: hidden; }
.f-dd-head { flex: none; padding: 18px 16px 10px; font-size: 18px; font-weight: 600; text-align: center; }
.f-search { flex: none; height: 52px; margin: 8px 10px; width: auto; padding: 0 16px 0 46px; font: inherit; font-size: 17px; /* 16px+ stops iOS zoom */
            color: var(--tg-field-text); border: 1px solid var(--tg-field-line); border-radius: 12px; outline: none; -webkit-appearance: none; appearance: none;
            background: var(--tg-field-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%238a9bb8' stroke-width='2'%3E%3Ccircle cx='9' cy='9' r='6'/%3E%3Cpath d='M14 14l4 4'/%3E%3C/svg%3E") no-repeat 16px center; }
.f-search:focus { border-color: var(--tg-accent); }
.f-search::placeholder { color: var(--tg-muted); }
.f-dd-opt { gap: 12px; min-height: 48px; padding: 10px 16px; }
.f-dd-opt:hover { background: var(--tg-panel-hover); }
.f-dd-opt.is-active { background: var(--tg-panel-active); font-weight: 600; }
.f-dd-none { color: var(--tg-muted); }

/* lead form ("country not in the list") */
.f-lead-title { margin: 22px 0 4px; text-align: center; font-size: 20px; font-weight: 700; }
.f-lead-sub { margin: 0 0 16px; text-align: center; color: var(--tg-muted); font-size: 15px; }
.f-lead-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.f-input { height: 52px; padding: 0 14px; font: inherit; font-size: 16px; color: var(--tg-field-text); background: var(--tg-field-bg);
           border: 1px solid var(--tg-field-line); border-radius: 12px; outline: none; transition: border-color .15s; }
.f-input:focus { border-color: var(--tg-accent); }
.f-input::placeholder { color: var(--tg-muted); opacity: .7; }
.f-lead-msg { min-height: 20px; margin: 10px 0 0; font-size: 14px; text-align: center; }
.f-lead-msg[data-state=error] { color: var(--tg-err); }
.f-lead-btn { margin-top: 6px; }
.f-thanks { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 26px; padding: 22px 16px;
            text-align: center; font-size: 18px; font-weight: 600; background: var(--tg-ok-bg); border: 1px solid var(--tg-ok-line); border-radius: 14px; }
.f-thanks svg { width: 44px; height: 44px; color: var(--tg-ok-icon); }
.f-thanks p { margin: 0; }

.f-tg { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; height: 58px; margin-top: 22px;
        font: inherit; font-size: 19px; font-weight: 600; color: var(--tg-btn-text); border: 0; border-radius: 14px;
        background: var(--tg-btn-bg); box-shadow: var(--tg-btn-shadow); transition: filter .15s, transform .1s; }
.f-tg:hover:not(:disabled) { filter: brightness(1.08); }
.f-tg:active:not(:disabled) { transform: translateY(1px); }
.f-tg:disabled { background: var(--tg-btn-off-bg); color: var(--tg-btn-off-text); box-shadow: none; }
.f-tg-icon { width: 24px; height: 24px; fill: currentColor; }

.f-feats { display: flex; justify-content: space-around; gap: 8px; margin: 22px 0 0; padding: 0; list-style: none; color: var(--tg-feat-text); font-size: 14px; }
.f-feats li { display: flex; align-items: center; gap: 8px; }
.f-feats svg { width: 18px; height: 18px; color: var(--tg-feat-icon); flex: none; }

.f-note { display: flex; gap: 10px; align-items: flex-start; margin: 22px 0 0; padding: 13px 16px; font-size: 14px; line-height: 1.45;
          color: var(--tg-note-text); background: var(--tg-note-bg); border: 1px solid var(--tg-note-line); border-radius: 12px; }
.f-note svg { flex: none; width: 20px; height: 20px; margin-top: 1px; color: var(--tg-accent); }
.f-note b { color: var(--tg-note-strong); }

[dir=rtl] .f-search { padding: 0 46px 0 16px; background-position: calc(100% - 16px) center; }
[dir=rtl] .f-close { right: auto; left: 16px; }
[dir=rtl] .f-title, [dir=rtl] .f-sub { text-align: var(--tg-title-align); }

/* phones: full-screen, stacked; art becomes a banner on top */
@media (max-width: 520px) {
  .f-overlay { padding: 0; }
  .f-modal { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; max-width: none; padding: 0 20px 24px;
             border: 0; border-radius: 0; box-shadow: none; }
  .f-art { position: relative !important; inset: auto !important; width: calc(100% + 40px) !important; height: 150px !important;
           margin: 0 -20px 18px !important; border-radius: 0 !important; -webkit-mask-image: none !important; mask-image: none !important; }
  .f-content { flex: 1; padding: 0 !important; }
  .f-modal:not(.f-has-art) .f-content { padding-top: 56px !important; }
  .f-title { font-size: 25px; }
  .f-sub { margin-bottom: 28px; }
  .f-row { grid-template-columns: 1fr; gap: 22px; }
  .f-lead-grid { grid-template-columns: 1fr; }
  .f-tg { margin-top: 30px; }
  .f-feats { flex-direction: column; align-items: center; gap: 12px; margin-bottom: 26px; }
  .f-note { margin-top: auto; }
}

/* shared variables of the light designs (prepended to their design.css) */
:root {
  --tg-text: #0f1b3d; --tg-muted: #6a7a99; --tg-accent: #1e7cf2; --tg-close: #6a7a99;
  --tg-page-bg: #dfe8f6; --tg-overlay: rgba(15, 27, 61, .55);
  --tg-card-bg: linear-gradient(135deg, #ffffff 55%, #eaf2ff); --tg-card-border: 1px solid rgba(30, 124, 242, .25);
  --tg-card-shadow: 0 18px 50px rgba(15, 40, 100, .28);
  --tg-field-bg: #fff; --tg-field-line: #d3dcee; --tg-field-text: #1b2a4a;
  --tg-panel-bg: #fff; --tg-panel-hover: #eef4ff; --tg-panel-active: #dbe9ff;
  --tg-btn-bg: linear-gradient(180deg, #3f95ff, #1b6ee6); --tg-btn-shadow: 0 8px 20px rgba(30, 124, 242, .38);
  --tg-btn-off-bg: #e3e9f4; --tg-btn-off-text: #9aa8c4;
  --tg-note-bg: #eef5ff; --tg-note-line: #cfe0fb; --tg-note-text: #3b4d73; --tg-note-strong: #0f1b3d;
  --tg-feat-text: #3b4d73; --tg-feat-icon: #1e7cf2;
  --tg-ok-bg: #e8f8ef; --tg-ok-line: #9ad9b4; --tg-ok-icon: #1fa35c; --tg-err: #d93a3a;
}

/* 04 — warm sand / terracotta */
:root { --tg-text:#5b2818; --tg-muted:#8b5e4b; --tg-accent:#bb583b; --tg-page-bg:#e5d6c6; --tg-card-bg:linear-gradient(130deg,#fff2e5,#efceb0); --tg-card-border:1px solid #dfbfa9; --tg-card-shadow:0 24px 65px #723e2f30; --tg-field-bg:#fffaf4a8; --tg-field-line:#d8bca8; --tg-field-text:#522a1d; --tg-panel-bg:#fff8ef; --tg-panel-hover:#f9e5d4; --tg-panel-active:#efceb9; --tg-btn-bg:#bd593e; --tg-btn-shadow:0 10px 22px #a4482f35; --tg-note-bg:#f9e8d8; --tg-note-line:#dec0aa; --tg-note-text:#754d3b; --tg-note-strong:#5b2818; --tg-feat-text:#6c402f; --tg-feat-icon:#ba593d; --tg-max-w:625px; --tg-pad:40px 42px 28px; --tg-radius:18px; --tg-title-align:left; --tg-title-size:42px; --tg-art-display:block; }
.f-art { top:18px; right:20px; width:150px; height:148px; border-radius:65% 35% 50% 45%; background:linear-gradient(145deg,#df9369,#c26346); opacity:.65; transform:rotate(-22deg); }
.f-content::before { content:'CREATE YOURS'; color:#8d412d; font-size:11px; letter-spacing:.2em; font-weight:700; margin-bottom:15px; }
.f-title { max-width:400px; font:500 42px/1.02 Georgia,serif; letter-spacing:-.035em; }
.f-accent { color:inherit; }
.f-sub { max-width:410px; margin:16px 0 28px; }
.f-row { grid-template-columns:1fr; gap:14px; }
.f-dd-btn,.f-input { border-radius:9px; }
.f-tg { border-radius:50px; }
.f-feats { border-top:1px solid #d7baa6; padding-top:16px; }
@media(max-width:520px){ .f-art{display:none!important} .f-title{font-size:35px} }
@media(max-width:520px){ .f-content{padding-top:56px!important} }
