/* ============================================================
   Country Counter — travel-map tool (Pro)
   Scoped under .cc-app / #cc- ids. Theme-aware (the app-shell
   body carries data-theme; dark is the default). Pinned between
   the fixed app-header (54px) and bottom app-nav (64px); a
   fullscreen toggle adds .is-fullscreen to fill the viewport
   (body.dtc-app-shell-fs then hides the chrome).
   ============================================================ */

.cc-app {
    /* dark defaults */
    --cc-ocean: #0d1522;
    --cc-ocean-2: #0a1119;
    --cc-land: #22303f;
    --cc-land-line: #33455a;
    --cc-land-hover: #33475d;
    --cc-visited: #2ba8ff;
    --cc-visited-hover: #6fc4ff;
    --cc-home: #0b3a5c;
    --cc-arc: #ff7a45;
    --cc-arc-glow: rgba(255,122,69,.55);
    --cc-flash: #ffd54a;
    --cc-panel: #141c28;
    --cc-panel-2: #1a2432;
    --cc-line: #263344;
    --cc-ink: #eaf1f8;
    --cc-ink-soft: #9fb0c2;
    --cc-chip: rgba(43,168,255,.16);
    --cc-shadow: 0 8px 30px rgba(0,0,0,.35);

    position: fixed;
    left: 0; right: 0;
    top: calc(54px + env(safe-area-inset-top, 0px));
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    display: flex;
    overflow: hidden;
    background: radial-gradient(120% 90% at 50% -10%, var(--cc-ocean), var(--cc-ocean-2) 70%);
    color: var(--cc-ink);
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
body[data-theme="light"] .cc-app {
    --cc-ocean: #eef6fd;
    --cc-ocean-2: #dcecf9;
    --cc-land: #dbe6ef;
    --cc-land-line: #c3d2df;
    --cc-land-hover: #c1d2e0;
    --cc-home: #0f2a43;
    --cc-panel: #ffffff;
    --cc-panel-2: #f6f9fc;
    --cc-line: #e7edf3;
    --cc-ink: #0f2233;
    --cc-ink-soft: #5b6b7a;
    --cc-shadow: 0 8px 30px rgba(15,34,51,.10);
}

/* fullscreen — chrome hidden by body.dtc-app-shell-fs, we fill the viewport */
.cc-app.is-fullscreen { top: 0; bottom: 0; z-index: 950; }

/* ---------------- map stage ---------------- */
.cc-stage { position: relative; flex: 1; min-width: 0; overflow: hidden; }
#ccMap { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#ccMap:active { cursor: grabbing; }
.cc-sphere { fill: var(--cc-ocean); }
.cc-country { fill: var(--cc-land); stroke: var(--cc-land-line); stroke-width: .4px; transition: fill .5s ease; }
.cc-country.is-visited { fill: var(--cc-visited); }
.cc-country.is-home { fill: var(--cc-home); }
.cc-country.is-flash { fill: var(--cc-flash) !important; }
.cc-country:hover { fill: var(--cc-land-hover); }
.cc-country.is-visited:hover { fill: var(--cc-visited-hover); }
.cc-arc { fill: none; stroke: var(--cc-arc); stroke-width: 1.6px; stroke-linecap: round;
    filter: drop-shadow(0 0 3px var(--cc-arc-glow)); }
.cc-arc-dot { fill: #fff; stroke: var(--cc-arc); stroke-width: 2px; }

/* stat hero */
.cc-hero { position: absolute; top: 12px; left: 12px; z-index: 20; display: flex; gap: 10px;
    flex-wrap: wrap; max-width: calc(100% - 24px); pointer-events: none; }
.cc-stat { pointer-events: auto; background: color-mix(in srgb, var(--cc-panel) 82%, transparent);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    border: 1px solid var(--cc-line); border-radius: 15px; padding: 9px 14px; box-shadow: var(--cc-shadow); }
.cc-stat.is-big { padding: 11px 18px; }
.cc-stat__num { font-family: Fraunces, Georgia, serif; font-weight: 700; line-height: .95; font-size: 24px; }
.cc-stat.is-big .cc-stat__num { font-size: 50px;
    background: linear-gradient(135deg, #0b6fd6, var(--cc-visited));
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.cc-stat__lbl { font-size: 10px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
    color: var(--cc-ink-soft); margin-top: 3px; }
.cc-stat__sub { font-size: 11px; color: var(--cc-ink-soft); margin-top: 1px; }

/* search + tools */
.cc-search { position: absolute; top: 12px; right: 12px; z-index: 25; display: flex; align-items: center;
    gap: 8px; background: color-mix(in srgb, var(--cc-panel) 92%, transparent); border: 1px solid var(--cc-line);
    border-radius: 999px; padding: 8px 14px; box-shadow: var(--cc-shadow); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.cc-search i { opacity: .5; font-size: 13px; }
.cc-search input { border: 0; outline: 0; background: transparent; color: var(--cc-ink); font: inherit; font-size: 13px; width: 150px; }
.cc-search input::placeholder { color: var(--cc-ink-soft); }

.cc-tools { position: absolute; right: 12px; bottom: 12px; z-index: 20; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.cc-tool { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--cc-line);
    background: color-mix(in srgb, var(--cc-panel) 90%, transparent); color: var(--cc-ink);
    box-shadow: var(--cc-shadow); font-size: 16px; cursor: pointer; display: grid; place-items: center; }
.cc-tool:hover { border-color: var(--cc-visited); color: var(--cc-visited); }
.cc-tool.is-play { width: auto; padding: 0 15px; gap: 7px; font-size: 13px; font-weight: 700;
    color: #04263f; background: var(--cc-visited); border-color: var(--cc-visited); }
.cc-tool.is-play:hover { color: #04263f; filter: brightness(1.05); }

.cc-tlbar { position: absolute; left: 0; top: 0; height: 3px; width: 0; z-index: 30;
    background: var(--cc-arc); box-shadow: 0 0 8px var(--cc-arc); transition: width .2s linear; }
.cc-nowlabel { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); z-index: 30;
    background: #0d1522; color: #fff; padding: 6px 16px; border-radius: 999px; font-family: Fraunces, serif;
    font-weight: 600; font-size: 15px; opacity: 0; transition: opacity .3s; box-shadow: var(--cc-shadow); white-space: nowrap; }
.cc-tip { position: absolute; z-index: 40; pointer-events: none; background: #0d1522; color: #fff;
    padding: 7px 11px; border-radius: 9px; font-size: 12px; box-shadow: var(--cc-shadow); opacity: 0;
    transition: opacity .12s; max-width: 220px; }
.cc-tip b { color: #8ad0ff; }
.cc-tip .cc-tip__sub { opacity: .75; font-size: 11px; margin-top: 2px; }

/* ---------------- side panel ---------------- */
.cc-side { width: min(40%, 400px); flex: 0 0 auto; background: var(--cc-panel);
    border-left: 1px solid var(--cc-line); display: flex; flex-direction: column; min-height: 0; }
.cc-tabs { display: flex; gap: 4px; padding: 10px 12px 0; border-bottom: 1px solid var(--cc-line); }
.cc-tab { border: 0; background: transparent; padding: 9px 12px; font: inherit; font-weight: 700; font-size: 13px;
    color: var(--cc-ink-soft); cursor: pointer; border-bottom: 2.5px solid transparent; margin-bottom: -1px; }
.cc-tab.is-on { color: var(--cc-visited); border-color: var(--cc-visited); }
.cc-panes { flex: 1; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; }
.cc-pane { display: none; padding: 12px; }
.cc-pane.is-on { display: block; }

.cc-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.cc-tbl th { text-align: left; font-size: 10px; letter-spacing: .5px; text-transform: uppercase; color: var(--cc-ink-soft);
    font-weight: 700; padding: 6px 8px; position: sticky; top: 0; background: var(--cc-panel); border-bottom: 1px solid var(--cc-line); }
.cc-tbl td { padding: 9px 8px; border-bottom: 1px solid var(--cc-line); vertical-align: top; }
.cc-tbl tr { cursor: pointer; }
.cc-tbl tr:hover td { background: var(--cc-panel-2); }
.cc-flag { margin-right: 7px; }
.cc-co { font-weight: 700; }
.cc-city { color: var(--cc-ink-soft); font-size: 11.5px; }
.cc-when { color: var(--cc-ink-soft); font-size: 11.5px; white-space: nowrap; }
.cc-tag { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
    background: var(--cc-chip); color: var(--cc-visited); }
.cc-tag[data-p="work"] { background: rgba(242,153,74,.16); color: #f2994a; }
.cc-tag[data-p="family"] { background: rgba(30,185,128,.16); color: #1eb980; }
.cc-rowdel { border: 0; background: transparent; color: var(--cc-ink-soft); cursor: pointer; font-size: 13px; padding: 2px 4px; }
.cc-rowdel:hover { color: #ef4444; }
.cc-empty { text-align: center; color: var(--cc-ink-soft); padding: 26px 12px; font-size: 13px; }

.cc-addbtn { display: inline-flex; align-items: center; gap: 7px; border: 0; background: var(--cc-visited); color: #04263f;
    font: inherit; font-weight: 700; font-size: 13px; border-radius: 10px; padding: 10px 15px; cursor: pointer; width: 100%;
    justify-content: center; margin-bottom: 12px; }
.cc-addbtn:hover { filter: brightness(1.05); }

.cc-note { position: absolute; bottom: 12px; left: 12px; z-index: 20; font-size: 11px; color: var(--cc-ink-soft);
    background: color-mix(in srgb, var(--cc-panel) 82%, transparent); padding: 5px 10px; border-radius: 8px; border: 1px solid var(--cc-line); }

/* chat + import placeholders (wired in later phases) */
.cc-soon { text-align: center; color: var(--cc-ink-soft); font-size: 12.5px; padding: 22px 14px; line-height: 1.55; }
.cc-soon .cc-soon__ic { font-size: 24px; display: block; margin-bottom: 8px; }

/* assistant chat */
.cc-pane#cc-pane-chat { padding: 0; }
.cc-pane#cc-pane-chat.is-on { display: flex; flex-direction: column; height: 100%; }
.cc-chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.cc-chat__log { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; -webkit-overflow-scrolling: touch; }
.cc-msg { max-width: 88%; padding: 9px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.45; }
.cc-msg.is-bot { background: var(--cc-panel-2); border: 1px solid var(--cc-line); align-self: flex-start; border-bottom-left-radius: 5px; }
.cc-msg.is-me { background: var(--cc-visited); color: #04263f; align-self: flex-end; border-bottom-right-radius: 5px; font-weight: 500; }
.cc-msg.is-bot b { color: var(--cc-visited); }
.cc-chat__chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 10px; }
.cc-chip { font-size: 11.5px; border: 1px solid var(--cc-line); background: var(--cc-panel); color: var(--cc-ink-soft);
    border-radius: 999px; padding: 6px 11px; cursor: pointer; }
.cc-chip:hover { border-color: var(--cc-visited); color: var(--cc-visited); }
.cc-chat__in { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--cc-line); background: var(--cc-panel); }
.cc-chat__in input { flex: 1; border: 1px solid var(--cc-line); border-radius: 999px; padding: 11px 16px; font: inherit;
    font-size: 14px; outline: 0; background: var(--cc-panel-2); color: var(--cc-ink); }
.cc-chat__in input:focus { border-color: var(--cc-visited); }
.cc-chat__in button { border: 0; background: var(--cc-visited); color: #04263f; border-radius: 999px; width: 44px;
    font-size: 18px; font-weight: 800; cursor: pointer; }
.cc-chat__in button:disabled { opacity: .5; cursor: default; }

/* import */
.cc-import { padding: 4px 2px; }
.cc-import__lead { font-size: 12.5px; color: var(--cc-ink-soft); margin: 0 0 10px; line-height: 1.5; }
.cc-import__ta { width: 100%; min-height: 120px; resize: vertical; border: 1px solid var(--cc-line); border-radius: 12px;
    padding: 11px 13px; font: inherit; font-size: 13px; background: var(--cc-panel-2); color: var(--cc-ink); outline: 0; margin-bottom: 10px; }
.cc-import__ta:focus { border-color: var(--cc-visited); }
.cc-import__file { display: block; border: 1.5px dashed var(--cc-line); border-radius: 12px; padding: 12px; text-align: center;
    color: var(--cc-ink-soft); font-size: 12.5px; cursor: pointer; margin-bottom: 12px; }
.cc-import__file:hover { border-color: var(--cc-visited); }
.cc-import__file input { display: none; }
.cc-import__out { font-size: 12.5px; color: var(--cc-ink-soft); margin-top: 10px; line-height: 1.5; }
.cc-import__out.is-ok { color: var(--cc-visited); font-weight: 600; }
.cc-import__hint { font-size: 11px; color: var(--cc-ink-soft); opacity: .8; margin: 14px 0 0; }

/* ---------------- portrait giant total ---------------- */
.cc-portrait-total { display: none; }

/* ---------------- add / edit modal ---------------- */
.cc-modal { position: fixed; inset: 0; z-index: 9950; display: none; align-items: center; justify-content: center;
    background: rgba(4,10,18,.6); padding: 16px; }
.cc-modal.is-open { display: flex; }
.cc-modal__card { width: min(460px, 100%); max-height: 90dvh; overflow: auto; background: var(--cc-panel);
    border: 1px solid var(--cc-line); border-radius: 18px; box-shadow: var(--cc-shadow); padding: 18px; }
.cc-modal__title { font-family: Fraunces, serif; font-weight: 700; font-size: 20px; margin: 0 0 14px; }
.cc-field { margin-bottom: 12px; }
.cc-field label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
    color: var(--cc-ink-soft); margin-bottom: 5px; }
.cc-field input, .cc-field select, .cc-field textarea { width: 100%; border: 1px solid var(--cc-line); border-radius: 10px;
    padding: 10px 12px; font: inherit; font-size: 14px; background: var(--cc-panel-2); color: var(--cc-ink); outline: 0; }
.cc-field input:focus, .cc-field select:focus, .cc-field textarea:focus { border-color: var(--cc-visited); }
.cc-field textarea { resize: vertical; min-height: 54px; }
.cc-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cc-modal__actions { display: flex; gap: 8px; margin-top: 6px; }
.cc-btn { flex: 1; border: 1px solid var(--cc-line); background: var(--cc-panel-2); color: var(--cc-ink);
    font: inherit; font-weight: 700; font-size: 14px; border-radius: 10px; padding: 11px; cursor: pointer; }
.cc-btn.is-primary { background: var(--cc-visited); color: #04263f; border-color: var(--cc-visited); }
.cc-btn:hover { filter: brightness(1.05); }

/* ============ RESPONSIVE ============ */
/* Desktop / landscape: map is the star, side panel on the right (default above). */
@media (max-width: 860px) {
    .cc-side { width: min(48%, 340px); }
    .cc-stat.is-big .cc-stat__num { font-size: 40px; }
}

/* MOBILE PORTRAIT: giant total + table is the star; map collapses to a band. */
@media (max-width: 820px) and (orientation: portrait) {
    .cc-app { flex-direction: column; }
    .cc-portrait-total { display: flex; flex-direction: column; align-items: center; justify-content: center;
        padding: 16px 12px 12px; background: linear-gradient(160deg, var(--cc-panel), var(--cc-ocean));
        border-bottom: 1px solid var(--cc-line); order: 1; }
    .cc-portrait-total .cc-pt__num { font-family: Fraunces, serif; font-size: 68px; font-weight: 700; line-height: .9;
        background: linear-gradient(135deg, #0b6fd6, var(--cc-visited)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
    .cc-portrait-total .cc-pt__lbl { font-weight: 700; letter-spacing: .6px; text-transform: uppercase; font-size: 12px; color: var(--cc-ink-soft); margin-top: 4px; }
    .cc-portrait-total .cc-pt__mini { display: flex; gap: 16px; margin-top: 12px; }
    .cc-portrait-total .cc-pt__mini div { text-align: center; }
    .cc-portrait-total .cc-pt__mini b { display: block; font-family: Fraunces, serif; font-size: 20px; }
    .cc-portrait-total .cc-pt__mini span { font-size: 9.5px; text-transform: uppercase; letter-spacing: .3px; color: var(--cc-ink-soft); font-weight: 700; }
    .cc-stage { flex: 0 0 32vh; order: 2; }
    .cc-side { width: 100%; order: 3; border-left: 0; border-top: 1px solid var(--cc-line); }
    .cc-hero { display: none; }
    .cc-search input { width: 96px; }
}

/* MOBILE LANDSCAPE: map + animation dominate; side is a slim drawer. */
@media (max-height: 560px) and (orientation: landscape) {
    .cc-side { width: min(42%, 320px); }
    .cc-stat { padding: 6px 10px; }
    .cc-stat.is-big .cc-stat__num { font-size: 30px; }
    .cc-stat__num { font-size: 18px; }
    .cc-portrait-total { display: none; }
}

/* ============ DEMO MODE (embedded on a marketing page) ============ */
.cc-app.cc-demo-mode { position: relative; top: auto; bottom: auto; left: auto; right: auto;
    height: min(86vh, 880px); }
.cc-progate__ic { font-size: 42px; text-align: center; margin-bottom: 8px; }
.cc-progate .cc-modal__title { text-align: center; }
.cc-progate__msg { font-size: 14px; color: var(--cc-ink-soft); line-height: 1.55; margin: 0 0 16px; text-align: center; }

.cc-demobar { background: linear-gradient(120deg, #0b6fd6, #2ba8ff); color: #fff; padding: 24px 16px; }
.cc-demobar__inner { max-width: 1000px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.cc-demobar__eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; opacity: .85; }
.cc-demobar__title { font-family: Fraunces, Georgia, serif; font-weight: 700; font-size: clamp(20px, 3vw, 28px); }
.cc-demobar__cta { background: #fff; color: #0b6fd6; font-weight: 800; font-size: 15px; padding: 12px 24px;
    border-radius: 999px; text-decoration: none; white-space: nowrap; }
.cc-demobar__cta:hover { filter: brightness(1.04); }

/* ============ BOOT SPLASH ============ */
.cc-boot {
    position: fixed; inset: 0; z-index: 10000;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: clamp(22px, 5vh, 48px);
    background: radial-gradient(120% 90% at 50% 32%, #133a66, #0a1119 72%);
    padding: 24px;
    animation: cc-boot-in .4s ease both;
}
.cc-boot.is-exiting { animation: cc-boot-out .6s cubic-bezier(.4, 0, .2, 1) forwards; pointer-events: none; }
.cc-boot.is-gone { display: none !important; }

.cc-boot__art { position: relative; width: min(64vmin, 440px); aspect-ratio: 1; display: grid; place-items: center;
    animation: cc-sw-in .7s cubic-bezier(.2, .8, .2, 1) both; }
.cc-boot__img { width: 82%; height: 82%; object-fit: contain; filter: drop-shadow(0 20px 46px rgba(11, 111, 214, .45));
    animation: cc-float 3.4s ease-in-out infinite; }
.cc-boot__ring { position: absolute; inset: 0; border-radius: 50%; border: 5px solid rgba(108, 198, 255, .18);
    border-top-color: #6cc6ff; animation: cc-spin 1.15s linear infinite; }

.cc-boot__hello { text-align: center; }
.cc-boot__line { opacity: 0; font-family: Fraunces, Georgia, serif; color: #eaf4ff;
    font-size: clamp(16px, 3.4vw, 24px); font-weight: 600; margin-top: 6px;
    animation: cc-line-in .55s cubic-bezier(.2, .8, .2, 1) forwards; }
.cc-boot__line--hi { font-size: clamp(32px, 7vw, 56px); font-weight: 700; margin-top: 0; animation-delay: .25s;
    background: linear-gradient(120deg, #bfe4ff, #6cc6ff); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.cc-boot__line:nth-child(2) { animation-delay: .75s; }
.cc-boot__line--sub { font-family: Inter, system-ui, sans-serif; font-weight: 500; font-size: 13px;
    color: #8fb3d6; letter-spacing: .3px; margin-top: 12px; animation-delay: 1.25s; }

@keyframes cc-boot-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes cc-boot-out { to { opacity: 0; transform: scale(1.08); } }
@keyframes cc-sw-in { from { opacity: 0; transform: scale(.82); } to { opacity: 1; transform: scale(1); } }
@keyframes cc-spin { to { transform: rotate(360deg); } }
@keyframes cc-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes cc-line-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ============ STRIKING ENTRANCE (after the splash lifts) ============ */
.cc-app.cc-enter .cc-stage { animation: cc-enter-stage .7s ease both; }
.cc-app.cc-enter .cc-side { animation: cc-enter-side .62s cubic-bezier(.2, .85, .25, 1) both; }
.cc-app.cc-enter .cc-hero .cc-stat { animation: cc-enter-pop .5s cubic-bezier(.2, .8, .2, 1) both; }
.cc-app.cc-enter .cc-hero .cc-stat:nth-child(1) { animation-delay: .18s; }
.cc-app.cc-enter .cc-hero .cc-stat:nth-child(2) { animation-delay: .28s; }
.cc-app.cc-enter .cc-hero .cc-stat:nth-child(3) { animation-delay: .38s; }
.cc-app.cc-enter .cc-hero .cc-stat:nth-child(4) { animation-delay: .48s; }
.cc-app.cc-enter .cc-portrait-total { animation: cc-enter-pop .5s cubic-bezier(.2, .8, .2, 1) both; }

@keyframes cc-enter-stage { from { opacity: 0; transform: scale(1.04); } to { opacity: 1; transform: none; } }
@keyframes cc-enter-side { from { opacity: 0; transform: translateX(46px); } to { opacity: 1; transform: none; } }
@keyframes cc-enter-pop { from { opacity: 0; transform: translateY(18px) scale(.95); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
    .cc-boot__art, .cc-boot__img, .cc-boot__ring, .cc-boot__line,
    .cc-app.cc-enter .cc-stage, .cc-app.cc-enter .cc-side,
    .cc-app.cc-enter .cc-hero .cc-stat, .cc-app.cc-enter .cc-portrait-total {
        animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    }
    .cc-boot__line { opacity: 1; }
}
