/* size-match.css — Size Match: resize a country to true scale */

.sm-page {
    --sm-accent: #4f46e5;
    --sm-accent-strong: #4338ca;
    --sm-accent-soft: rgba(79, 70, 229, 0.1);
    --sm-ref: #2563eb;
    --sm-target: #ef4444;
    --sm-stage-top: #eef2ff;
    --sm-stage-bottom: #e0e7ff;
    --sm-grid: rgba(30, 41, 99, 0.07);
    --sm-label-bg: rgba(255, 255, 255, 0.92);
    --sm-ghost: rgba(15, 23, 42, 0.55);
    --sm-ground-top: #cbd5f5;
    --sm-ground-bottom: #b4c0ec;
    --sm-ground-line: rgba(30, 41, 99, 0.35);
}
[data-theme="dark"] .sm-page {
    --sm-accent: #818cf8;
    --sm-accent-strong: #6366f1;
    --sm-accent-soft: rgba(129, 140, 248, 0.14);
    --sm-ref: #3b82f6;
    --sm-target: #f87171;
    --sm-stage-top: #0b1226;
    --sm-stage-bottom: #111c3a;
    --sm-grid: rgba(148, 163, 255, 0.08);
    --sm-label-bg: rgba(8, 13, 30, 0.88);
    --sm-ghost: rgba(226, 232, 240, 0.7);
    --sm-ground-top: #1c2748;
    --sm-ground-bottom: #0d1430;
    --sm-ground-line: rgba(226, 232, 240, 0.3);
}

.sm-page .study-main { display: flex; flex-direction: column; }
.sm-page [hidden] { display: none !important; }

.sm-screen { display: none; flex: 1; min-height: 0; }
.sm-screen--active { display: flex; flex-direction: column; }

/* ── Shared ─────────────────────────────────────────── */
.sm-menu, .sm-summary, .sm-locked {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 20px 18px 56px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.sm-game {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 14px 18px 40px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sm-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-secondary, #475569);
    padding: 60px 20px;
}
.sm-spinner {
    width: 34px; height: 34px;
    border-radius: 50%;
    border: 3px solid var(--border-glass, rgba(0,0,0,0.08));
    border-top-color: var(--sm-accent);
    animation: sm-spin 0.9s linear infinite;
}
@keyframes sm-spin { to { transform: rotate(360deg); } }

.sm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 12px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
    line-height: 1.2;
}
.sm-btn:active { transform: scale(0.98); }
.sm-btn--primary {
    background: linear-gradient(135deg, #6366f1, #4338ca);
    color: #fff;
    box-shadow: 0 6px 16px rgba(67, 56, 202, 0.3);
}
.sm-btn--primary:hover { box-shadow: 0 8px 22px rgba(67, 56, 202, 0.4); }
.sm-btn--ghost {
    background: var(--bg-surface, #fff);
    border-color: var(--border-glass, rgba(0,0,0,0.08));
    color: var(--text-primary, #0f172a);
}
.sm-btn--ghost:hover { border-color: var(--sm-accent); }
.sm-btn--large { padding: 14px 26px; font-size: 1rem; }
.sm-btn:focus-visible, .sm-chip:focus-visible, .sm-diff:focus-visible, .sm-tab:focus-visible,
.sm-round-btn:focus-visible, .sm-stage:focus-visible {
    outline: 2px solid var(--sm-accent);
    outline-offset: 2px;
}

.sm-card {
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-glass, rgba(0,0,0,0.06));
    border-radius: 16px;
    padding: 18px;
}
.sm-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading, 'Poppins', sans-serif);
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
    margin: 0 0 10px;
}
.sm-section-title i { color: var(--sm-accent); font-size: 1.2rem; }

.sm-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--sm-accent-soft);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--text-primary, #0f172a);
    font-size: 0.9rem;
    line-height: 1.45;
}
.sm-banner i { color: var(--sm-accent); font-size: 1.15rem; flex-shrink: 0; margin-top: 1px; }

.sm-shape { stroke-width: 1.2; stroke-linejoin: round; }
.sm-shape--ref { fill: var(--sm-ref); stroke: var(--sm-ref); }
.sm-shape--target { fill: var(--sm-target); stroke: var(--sm-target); }

/* ── Menu ───────────────────────────────────────────── */
.sm-hero {
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 22px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--sm-stage-top), var(--sm-stage-bottom));
    border: 1px solid var(--border-glass, rgba(0,0,0,0.06));
}
.sm-hero__art { flex: 0 0 42%; max-width: 300px; }
.sm-hero__art svg { display: block; width: 100%; height: auto; max-height: 150px; overflow: visible; }
.sm-hero__art .sm-shape { stroke-width: 4; }
.sm-hero__copy { min-width: 0; }
.sm-hero__eyebrow {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sm-accent);
}
.sm-hero h1 {
    font-family: var(--font-heading, 'Poppins', sans-serif);
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.15;
    color: var(--text-primary, #0f172a);
    margin: 2px 0 0;
}
.sm-hero p { color: var(--text-secondary, #475569); margin: 8px 0 0; line-height: 1.45; }

.sm-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.sm-stat {
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-glass, rgba(0,0,0,0.06));
    border-radius: 14px;
    padding: 12px 10px;
    text-align: center;
}
.sm-stat__value {
    font-family: var(--font-heading, 'Poppins', sans-serif);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--sm-accent);
}
.sm-stat__label { font-size: 0.78rem; color: var(--text-muted, #64748b); margin-top: 2px; }

.sm-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.sm-tab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--border-glass, rgba(0,0,0,0.1));
    background: var(--bg-surface, #fff);
    color: var(--text-primary, #0f172a);
    font: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    text-align: left;
}
.sm-tab i { font-size: 1.35rem; color: var(--sm-accent); }
.sm-tab small { margin-left: auto; font-weight: 500; font-size: 0.8rem; color: var(--text-muted, #64748b); }
.sm-tab:hover { border-color: var(--sm-accent); }
.sm-tab.is-active { border-color: var(--sm-accent); background: var(--sm-accent-soft); box-shadow: inset 0 0 0 1px var(--sm-accent); }

.sm-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.sm-chip {
    padding: 9px 16px;
    border-radius: 999px;
    border: 1px solid var(--border-glass, rgba(0,0,0,0.1));
    background: var(--bg-surface, #fff);
    color: var(--text-primary, #0f172a);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
}
.sm-chip:hover { border-color: var(--sm-accent); }
.sm-chip.is-active { background: var(--sm-accent-strong); border-color: var(--sm-accent-strong); color: #fff; }

.sm-diffs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.sm-diff {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--border-glass, rgba(0,0,0,0.1));
    background: var(--bg-surface, #fff);
    color: var(--text-primary, #0f172a);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.sm-diff strong { font-size: 0.95rem; }
.sm-diff small { font-size: 0.78rem; color: var(--text-muted, #64748b); line-height: 1.3; }
.sm-diff:hover { border-color: var(--sm-accent); }
.sm-diff.is-active { border-color: var(--sm-accent); background: var(--sm-accent-soft); box-shadow: inset 0 0 0 1px var(--sm-accent); }

.sm-start { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; margin-top: 18px; }
.sm-start__meta { font-size: 0.85rem; color: var(--text-muted, #64748b); }

.sm-how {
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-glass, rgba(0,0,0,0.06));
    border-radius: 16px;
    padding: 4px 18px;
}
.sm-how summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-primary, #0f172a);
    list-style: none;
}
.sm-how summary::-webkit-details-marker { display: none; }
.sm-how summary i:first-child { color: var(--sm-accent); font-size: 1.2rem; }
.sm-how summary i:last-child { margin-left: auto; transition: transform 0.2s ease; }
.sm-how[open] summary i:last-child { transform: rotate(180deg); }
.sm-how ol { margin: 0 0 14px; padding-left: 20px; color: var(--text-secondary, #475569); line-height: 1.55; font-size: 0.92rem; }
.sm-how li + li { margin-top: 4px; }

/* The menu is a small scale-testing desk; the game stage keeps its own palette. */
.sm-menu {
    --sm-desk-navy: #12293c;
    --sm-desk-teal: #22b7aa;
    --sm-desk-coral: #fa705d;
    max-width: 1020px;
    gap: 16px;
}
.sm-menu .sm-banner { padding: 9px 13px; border-radius: 9px; font-size: 0.82rem; }
.sm-menu .sm-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    gap: 24px;
    min-height: 270px;
    padding: 26px 30px;
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid #315168;
    background: radial-gradient(circle at 100% 0, rgba(73, 150, 168, 0.28), transparent 52%),
        linear-gradient(130deg, #102639, #1d4053);
    box-shadow: 0 15px 34px rgba(24, 57, 75, 0.15);
}
.sm-menu .sm-hero::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: var(--sm-desk-teal);
}
.sm-menu .sm-hero__copy { position: relative; z-index: 1; }
.sm-menu .sm-hero__eyebrow { color: #83e7da; letter-spacing: 0.19em; }
.sm-menu .sm-hero h1 {
    color: #fff;
    font-size: clamp(2.1rem, 4vw, 3.25rem);
    line-height: 1.05;
    margin-top: 10px;
}
.sm-menu .sm-hero p { color: #c8dbe5; font-size: 1.02rem; line-height: 1.55; max-width: 32ch; margin-top: 15px; }
.sm-menu .sm-hero__stage {
    position: relative;
    z-index: 1;
    min-width: 0;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 16px 18px 12px;
    border: 1px solid rgba(146, 211, 224, 0.3);
    border-radius: 10px;
    background-color: rgba(5, 27, 43, 0.46);
    background-image: linear-gradient(rgba(152, 212, 223, 0.085) 1px, transparent 1px),
        linear-gradient(90deg, rgba(152, 212, 223, 0.085) 1px, transparent 1px);
    background-size: 24px 24px;
    box-shadow: inset 0 0 25px rgba(5, 19, 31, 0.22);
}
.sm-menu .sm-hero__art { flex: 1 1 auto; display: grid; align-items: end; width: 100%; max-width: none; min-height: 120px; }
.sm-menu .sm-hero__art svg { width: 100%; max-height: 154px; filter: drop-shadow(0 4px 4px rgba(4, 15, 29, 0.28)); }
.sm-menu .sm-hero__art .sm-shape { stroke-width: 2; }
.sm-menu .sm-hero__art .sm-shape--ref { fill: #55b9ec; stroke: #91d9f6; }
.sm-menu .sm-hero__art .sm-shape--target { fill: var(--sm-desk-coral); stroke: #ffaf9c; }
.sm-menu .sm-hero__labels {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: #b9d7e3;
    font-size: 0.69rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 6px;
}
.sm-menu .sm-hero__labels span:last-child { color: #ffad9d; }
.sm-menu .sm-hero__ruler {
    display: block;
    height: 12px;
    margin-top: 13px;
    border-top: 1px solid rgba(173, 226, 230, 0.5);
    background: repeating-linear-gradient(90deg, rgba(173, 226, 230, 0.5) 0 1px, transparent 1px 18px) left top / 100% 6px no-repeat;
}
.sm-menu .sm-stats {
    gap: 0;
    padding: 5px;
    border: 1px solid rgba(32, 91, 111, 0.15);
    border-radius: 12px;
    background: var(--bg-surface, #fff);
    box-shadow: 0 6px 18px rgba(36, 75, 93, 0.05);
}
.sm-menu .sm-stat { border: 0; border-radius: 0; padding: 10px 8px; }
.sm-menu .sm-stat + .sm-stat { border-left: 1px solid rgba(32, 91, 111, 0.13); }
.sm-menu .sm-stat__value { color: #126e79; font-size: 1.35rem; line-height: 1.25; }
.sm-menu .sm-card,
.sm-menu .sm-library-link,
.sm-menu .sm-how {
    border-radius: 13px;
    border-color: rgba(32, 91, 111, 0.16);
    box-shadow: 0 6px 18px rgba(36, 75, 93, 0.05);
}
.sm-menu .sm-menu__setup { padding: 24px; }
.sm-menu .sm-section-title { font-size: 1rem; margin-bottom: 12px; }
.sm-menu .sm-section-title i { color: #147f83; }
.sm-menu .sm-tabs,
.sm-menu .sm-chips { margin-bottom: 22px; }
.sm-menu .sm-tab,
.sm-menu .sm-diff { border-radius: 9px; min-height: 68px; }
.sm-menu .sm-tab i { color: #16899a; }
.sm-menu .sm-tab.is-active,
.sm-menu .sm-diff.is-active {
    border-color: #198c91;
    background: rgba(34, 183, 170, 0.09);
    box-shadow: inset 0 0 0 1px #198c91;
}
.sm-menu .sm-chip.is-active { background: #126e79; border-color: #126e79; }
.sm-menu .sm-start {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 18px;
    align-items: center;
    padding-top: 21px;
    border-top: 1px solid rgba(32, 91, 111, 0.13);
}
.sm-menu .sm-start .sm-btn--primary {
    border-radius: 9px;
    padding: 15px 26px;
    background: linear-gradient(135deg, #159e94, #086f82);
    box-shadow: 0 7px 19px rgba(9, 112, 126, 0.24);
}
.sm-menu .sm-start .sm-btn--primary:hover { box-shadow: 0 9px 24px rgba(9, 112, 126, 0.36); }
.sm-menu .sm-library-link {
    position: relative;
    overflow: hidden;
    padding: 20px 22px;
    border-left: 4px solid #148f91;
    background-image: linear-gradient(90deg, rgba(34, 183, 170, 0.09), transparent 55%);
}
.sm-menu .sm-library-link__preview {
    position: relative;
    flex: 0 0 86px;
    height: 62px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 7px;
    background: #194355;
    color: #a5e6ec;
}
.sm-menu .sm-library-link__preview i { font-size: 1.7rem; }
.sm-menu .sm-library-link__preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sm-menu .sm-library-link > i:last-child { color: #117d84; }
.sm-menu .sm-library-link strong { font-size: 1.05rem; }
[data-theme="dark"] .sm-menu .sm-stats,
[data-theme="dark"] .sm-menu .sm-card,
[data-theme="dark"] .sm-menu .sm-library-link,
[data-theme="dark"] .sm-menu .sm-how { background-color: #1a3040; border-color: rgba(155, 205, 218, 0.2); }
[data-theme="dark"] .sm-menu .sm-stat__value,
[data-theme="dark"] .sm-menu .sm-section-title i,
[data-theme="dark"] .sm-menu .sm-tab i,
[data-theme="dark"] .sm-menu .sm-library-link > i { color: #6edbd1; }
[data-theme="dark"] .sm-menu .sm-tab.is-active,
[data-theme="dark"] .sm-menu .sm-diff.is-active { background: rgba(74, 202, 189, 0.18); border-color: #6edbd1; box-shadow: inset 0 0 0 1px #6edbd1; }
[data-theme="dark"] .sm-menu .sm-stat__label,
[data-theme="dark"] .sm-menu .sm-tab small,
[data-theme="dark"] .sm-menu .sm-diff small,
[data-theme="dark"] .sm-menu .sm-start__meta,
[data-theme="dark"] .sm-menu .sm-library-link small { color: #b8ced9; }
@media (max-width: 760px) {
    .sm-menu .sm-hero { grid-template-columns: 1fr; gap: 22px; text-align: left; }
    .sm-menu .sm-hero__stage { min-height: 195px; }
    .sm-menu .sm-hero p { max-width: 55ch; }
}
@media (max-width: 640px) {
    .sm-menu .sm-hero { padding: 22px 20px; }
    .sm-menu .sm-hero__art { width: 100%; }
    .sm-menu .sm-hero__stage { padding: 12px 14px; }
    .sm-menu .sm-stats { gap: 0; }
    .sm-menu .sm-stat__value { font-size: 1.15rem; }
    .sm-menu .sm-stat__label { font-size: 0.68rem; }
    .sm-menu .sm-menu__setup { padding: 19px; }
    .sm-menu .sm-start { grid-template-columns: 1fr; }
    .sm-menu .sm-start .sm-btn { width: 100%; }
}

/* ── Game ───────────────────────────────────────────── */
.sm-hud { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sm-hud__menu { padding: 8px 14px; font-size: 0.88rem; }
.sm-hud__round { font-weight: 700; color: var(--text-primary, #0f172a); margin-left: auto; }
.sm-hud__score {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-heading, 'Poppins', sans-serif);
    font-weight: 700;
    color: #d97706;
    min-width: 58px;
    justify-content: flex-end;
}
.sm-dots { display: inline-flex; gap: 5px; }
.sm-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border-glass, rgba(0,0,0,0.12)); box-shadow: inset 0 0 0 1px rgba(100, 116, 139, 0.35); }
.sm-dot--current { box-shadow: 0 0 0 2px var(--sm-accent); }
.sm-dot--perfect, .sm-dot--great { background: #16a34a; }
.sm-dot--close { background: #eab308; }
.sm-dot--off { background: #f97316; }
.sm-dot--far { background: #dc2626; }

.sm-stage {
    position: relative;
    height: clamp(320px, 58vh, 600px);
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--border-glass, rgba(0,0,0,0.08));
    background:
        linear-gradient(var(--sm-grid) 1px, transparent 1px) 0 0 / 48px 48px,
        linear-gradient(90deg, var(--sm-grid) 1px, transparent 1px) 0 0 / 48px 48px,
        linear-gradient(180deg, var(--sm-stage-top), var(--sm-stage-bottom));
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}
.sm-stage__svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sm-stage[data-phase="guess"] { cursor: nesw-resize; }
.sm-stage[data-phase="guess"].is-over-ref { cursor: grab; }
.sm-stage[data-phase="guess"].is-grabbing { cursor: grabbing; }

.sm-ground, .sm-ground-line { display: none; }
.sm-stage--ground .sm-ground { display: block; fill: var(--sm-ground-top); }
.sm-stage--ground .sm-ground-line { display: block; stroke: var(--sm-ground-line); stroke-width: 1.4; }

.sm-frame { fill: transparent; stroke: var(--sm-target); stroke-width: 1.4; stroke-dasharray: 6 5; opacity: 0.75; }
.sm-handle circle { fill: var(--sm-target); stroke: #fff; stroke-width: 2; }
.sm-handle path { fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sm-stage:not([data-phase="guess"]) .sm-frame,
.sm-stage:not([data-phase="guess"]) .sm-handle { display: none; }

.sm-ghost { pointer-events: none; }
.sm-ghost path { fill: var(--sm-ghost); fill-opacity: 0.1; stroke: var(--sm-ghost); stroke-width: 1.5; stroke-dasharray: 5 4; stroke-linejoin: round; }
.sm-stage[data-phase="guess"] .sm-ghost { display: none; }

.sm-label {
    position: absolute;
    transform: translate(-50%, -100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 6px 12px 7px;
    border-radius: 10px;
    background: var(--sm-label-bg);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12);
    pointer-events: none;
    white-space: nowrap;
    max-width: calc(100% - 12px);
    text-align: center;
    line-height: 1.25;
}
.sm-label__tag { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.sm-label strong { font-family: var(--font-heading, 'Poppins', sans-serif); font-size: 0.98rem; color: var(--text-primary, #0f172a); overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.sm-label__area { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary, #475569); }
.sm-label--ref .sm-label__tag { color: var(--sm-ref); }
.sm-label--target .sm-label__tag { color: var(--sm-target); }

.sm-scalebar, .sm-legend {
    position: absolute;
    bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-radius: 8px;
    background: var(--sm-label-bg);
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-secondary, #475569);
    pointer-events: none;
}
.sm-scalebar { left: 12px; }
.sm-scalebar span { display: block; height: 6px; border: 2px solid currentColor; border-top: 0; box-sizing: border-box; }
.sm-scalebar em { font-style: normal; }
.sm-legend { right: 12px; }
.sm-legend__ghost { width: 18px; height: 12px; border: 1.5px dashed var(--sm-ghost); border-radius: 3px; }
.sm-stage[data-phase="guess"] .sm-scalebar,
.sm-stage[data-phase="guess"] .sm-legend { display: none; }

.sm-hint {
    position: absolute;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    width: max-content;
    max-width: calc(100% - 24px);
    margin: 0;
    padding: 8px 14px;
    border-radius: 12px;
    background: var(--sm-label-bg);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12);
    color: var(--text-primary, #0f172a);
    font-size: 0.82rem;
    line-height: 1.4;
    text-align: center;
    pointer-events: none;
}

.sm-controls { display: flex; align-items: center; gap: 12px; }
.sm-round-btn {
    flex: 0 0 auto;
    width: 48px; height: 48px;
    border-radius: 14px;
    border: 1px solid var(--border-glass, rgba(0,0,0,0.1));
    background: var(--bg-surface, #fff);
    color: var(--text-primary, #0f172a);
    font-size: 1.15rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}
.sm-icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.sm-round-btn:hover { border-color: var(--sm-target); color: var(--sm-target); }
.sm-round-btn:active { transform: scale(0.95); }
.sm-round-btn--move:hover { border-color: var(--sm-ref); color: var(--sm-ref); }
.sm-round-btn--move.is-active { background: var(--sm-ref); border-color: var(--sm-ref); color: #fff; }
.sm-round-btn--move.is-reset { border-color: var(--sm-ref); color: var(--sm-ref); }
.sm-controls__lock { flex: 0 0 auto; min-width: 170px; padding: 14px 22px; margin-left: auto; }

.sm-keys { margin: 0; text-align: center; font-size: 0.8rem; color: var(--text-muted, #64748b); }

.sm-result {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-glass, rgba(0,0,0,0.06));
    animation: sm-rise 0.3s ease both;
}
@keyframes sm-rise { from { opacity: 0; transform: translateY(8px); } }
.sm-result__score {
    flex: 0 0 auto;
    min-width: 84px;
    padding: 8px 12px;
    border-radius: 14px;
    text-align: center;
    color: #fff;
    background: #64748b;
    font-family: var(--font-heading, 'Poppins', sans-serif);
    line-height: 1.1;
}
.sm-result__score strong { display: block; font-size: 1.7rem; font-weight: 800; }
.sm-result__score small { font-size: 0.72rem; opacity: 0.85; }
.sm-result__score--perfect, .sm-result__score--great { background: #16a34a; }
.sm-result__score--close { background: #ca8a04; }
.sm-result__score--off { background: #ea580c; }
.sm-result__score--far { background: #dc2626; }
.sm-result__copy { flex: 1 1 auto; min-width: 0; }
.sm-result__copy h2 { margin: 0; font-family: var(--font-heading, 'Poppins', sans-serif); font-size: 1.1rem; color: var(--text-primary, #0f172a); }
.sm-result__copy p { margin: 3px 0 0; font-size: 0.92rem; color: var(--text-secondary, #475569); line-height: 1.4; }
.sm-result__fact { font-weight: 600; color: var(--text-primary, #0f172a) !important; }
.sm-result__fact i { color: var(--sm-accent); margin-right: 2px; }
.sm-result__next { flex: 0 0 auto; }

/* ── Summary ────────────────────────────────────────── */
.sm-summary__hero {
    text-align: center;
    padding: 26px 18px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--sm-stage-top), var(--sm-stage-bottom));
    border: 1px solid var(--border-glass, rgba(0,0,0,0.06));
}
.sm-summary__trophy { font-size: 2.6rem; color: #d97706; }
.sm-summary__hero h2 { margin: 2px 0 0; font-family: var(--font-heading, 'Poppins', sans-serif); font-size: 1.3rem; color: var(--text-primary, #0f172a); }
.sm-summary__score { font-family: var(--font-heading, 'Poppins', sans-serif); font-size: 3rem; font-weight: 800; color: var(--sm-accent); line-height: 1.15; }
.sm-summary__score small { font-size: 1.1rem; font-weight: 600; color: var(--text-muted, #64748b); margin-left: 6px; }
.sm-summary__grade { font-size: 0.9rem; color: var(--text-secondary, #475569); }
.sm-summary__best {
    display: inline-block;
    margin-top: 10px;
    padding: 5px 14px;
    border-radius: 999px;
    background: rgba(22, 163, 74, 0.14);
    color: #15803d;
    font-weight: 700;
    font-size: 0.85rem;
}
[data-theme="dark"] .sm-summary__best { color: #4ade80; }

.sm-summary__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sm-summary__row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 14px;
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-glass, rgba(0,0,0,0.06));
}
.sm-summary__index {
    flex: 0 0 auto;
    width: 28px; height: 28px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.82rem;
    background: var(--sm-accent-soft);
    color: var(--sm-accent);
}
.sm-summary__row > div { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.sm-summary__row strong { font-size: 0.93rem; color: var(--text-primary, #0f172a); }
.sm-summary__row strong em { font-style: normal; color: var(--text-muted, #64748b); margin: 0 2px; }
.sm-summary__row div span { font-size: 0.8rem; color: var(--text-muted, #64748b); }
.sm-summary__points { flex: 0 0 auto; font-family: var(--font-heading, 'Poppins', sans-serif); font-weight: 700; font-size: 1.05rem; color: #64748b; }
.sm-summary__points--perfect, .sm-summary__points--great { color: #16a34a; }
.sm-summary__points--close { color: #ca8a04; }
.sm-summary__points--off { color: #ea580c; }
.sm-summary__points--far { color: #dc2626; }
.sm-summary__actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* ── Locked ─────────────────────────────────────────── */
.sm-locked { flex: 1; justify-content: center; }
.sm-locked__card {
    text-align: center;
    padding: 32px 22px;
    border-radius: 20px;
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-glass, rgba(0,0,0,0.06));
}
.sm-locked__card > i { font-size: 2.8rem; color: var(--sm-accent); }
.sm-locked__card h2 { margin: 6px 0 0; font-family: var(--font-heading, 'Poppins', sans-serif); color: var(--text-primary, #0f172a); }
.sm-locked__card p { margin: 8px auto 0; max-width: 46ch; color: var(--text-secondary, #475569); line-height: 1.5; }
.sm-locked__actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }

/* ── Small screens ──────────────────────────────────── */
@media (max-width: 640px) {
    .sm-menu, .sm-summary, .sm-locked { padding: 14px 14px 48px; gap: 14px; }
    .sm-game { padding: 10px 12px 32px; gap: 10px; scroll-margin-bottom: 96px; }
    .sm-result__next { scroll-margin-bottom: 120px; }
    .sm-hero { flex-direction: column; text-align: center; padding: 18px; gap: 14px; }
    .sm-hero__art { flex: none; width: 70%; }
    .sm-hero h1 { font-size: 1.7rem; }
    .sm-diffs { grid-template-columns: 1fr; }
    .sm-diff { flex-direction: row; align-items: baseline; gap: 8px; }
    .sm-start .sm-btn { width: 100%; }
    .sm-hud { gap: 8px; }
    .sm-hud__menu span { display: none; }
    .sm-hud__round { font-size: 0.9rem; }
    .sm-dot { width: 7px; height: 7px; }
    .sm-dots { gap: 4px; }
    .sm-stage { height: clamp(340px, 56vh, 520px); border-radius: 14px; }
    .sm-label { padding: 5px 9px 6px; }
    .sm-label strong { font-size: 0.88rem; }
    .sm-controls { gap: 10px; }
    .sm-controls__lock { flex: 1 1 auto; min-width: 0; margin-left: 0; }
    .sm-hint { font-size: 0.76rem; padding: 7px 10px; }
    .sm-keys { display: none; }
    .sm-result { flex-wrap: wrap; gap: 12px; }
    .sm-result__copy { flex-basis: calc(100% - 100px); }
    .sm-result__next { width: 100%; }
}

/* While a round is on screen, the Geobek launcher would sit on the Lock in row. */
@media (max-width: 768px) {
    body.sm-playing .geobek-launcher { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    .sm-result, .sm-spinner { animation: none; }
}

/* ── Fact cards after a reveal ──────────────────────── */
.sm-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; animation: sm-rise 0.3s ease 0.08s both; }
.sm-info-card {
    display: flex;
    align-items: stretch;
    gap: 14px;
    padding: 10px;
    border-radius: 16px;
    border: 1px solid var(--border-glass, rgba(0,0,0,0.06));
    border-left: 4px solid var(--sm-ref);
    background: var(--bg-surface, #fff);
    color: var(--text-primary, #0f172a);
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    min-width: 0;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.sm-info-card--target { border-left-color: var(--sm-target); }
.sm-info-card:hover { box-shadow: 0 8px 22px rgba(15, 23, 42, 0.12); transform: translateY(-1px); }
.sm-info-card:focus-visible, .lp-tile:focus-visible, .sm-library-link:focus-visible,
.lp__back:focus-visible, .lp__close:focus-visible, .lp__step:focus-visible, .lp__link:focus-visible {
    outline: 2px solid var(--sm-accent);
    outline-offset: 2px;
}
.sm-info-card__photo {
    flex: 0 0 112px;
    height: 112px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--sm-stage-bottom);
    display: block;
}
.sm-info-card__photo img { width: 100%; height: 100%; object-fit: cover; display: block; object-position: 50% 22%; }
.sm-info-card__photo--flag { display: flex; align-items: center; justify-content: center; padding: 12px; }
.sm-info-card__photo--flag img { height: auto; max-height: 100%; object-fit: contain; border-radius: 4px; box-shadow: 0 1px 6px rgba(15, 23, 42, 0.25); }
.sm-info-card__photo--shape svg, .lp-tile__photo--shape svg { width: 100%; height: 100%; display: block; }
.sm-info-card__photo--shape path, .lp-tile__photo--shape path, .lp__photo--shape path { fill: var(--sm-ref); }
.sm-info-card__body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; justify-content: center; }
.sm-info-card__body strong { font-family: var(--font-heading, 'Poppins', sans-serif); font-size: 1rem; line-height: 1.25; }
.sm-info-card__place { display: flex; align-items: center; gap: 6px; font-size: 0.84rem; color: var(--text-secondary, #475569); }
.sm-info-card__facts { display: flex; flex-direction: column; gap: 1px; font-size: 0.82rem; color: var(--text-secondary, #475569); }
.sm-info-card__facts span { display: flex; align-items: center; gap: 6px; }
.sm-info-card__facts i { color: var(--sm-accent); }
.sm-info-card__more { margin-top: 3px; font-size: 0.8rem; font-weight: 600; color: var(--sm-accent); display: inline-flex; align-items: center; gap: 5px; }
.lp-flag { width: 20px; height: auto; border-radius: 2px; box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.12); flex: 0 0 auto; }

/* ── Library ────────────────────────────────────────── */
.sm-library-link {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px solid var(--border-glass, rgba(0,0,0,0.06));
    background: var(--bg-surface, #fff);
    color: var(--text-primary, #0f172a);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.sm-library-link:hover { border-color: var(--sm-accent); }
.sm-library-link > i:first-child { font-size: 1.7rem; color: var(--sm-accent); }
.sm-library-link > i:last-child { margin-left: auto; color: var(--sm-accent); }
.sm-library-link span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sm-library-link small { font-size: 0.84rem; color: var(--text-muted, #64748b); }

.sm-library { width: 100%; max-width: 1080px; margin: 0 auto; padding: 18px 18px 56px; display: flex; flex-direction: column; gap: 14px; }
.sm-library__head { display: flex; align-items: flex-start; gap: 14px; }
.sm-library__head h1 { margin: 0; font-family: var(--font-heading, 'Poppins', sans-serif); font-size: 1.5rem; color: var(--text-primary, #0f172a); }
.sm-library__head p { margin: 2px 0 0; font-size: 0.9rem; color: var(--text-secondary, #475569); }
.sm-library__chips { margin-bottom: 0; }
.sm-library__chips small { opacity: 0.7; margin-left: 2px; }
.lp-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.lp-tile {
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-glass, rgba(0,0,0,0.06));
    background: var(--bg-surface, #fff);
    color: var(--text-primary, #0f172a);
    font: inherit;
    text-align: left;
    padding: 0;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.lp-tile:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14); }
.lp-tile__photo { display: block; aspect-ratio: 4 / 3; background: var(--sm-stage-bottom); overflow: hidden; }
.lp-tile__photo img { width: 100%; height: 100%; object-fit: cover; display: block; object-position: 50% 22%; }
.lp-tile__body { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px 12px; min-width: 0; }
.lp-tile__body strong { font-family: var(--font-heading, 'Poppins', sans-serif); font-size: 0.95rem; line-height: 1.25; }
.lp-tile__body span { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-secondary, #475569); }
.lp-tile__meta { font-weight: 600; color: var(--sm-accent) !important; }

/* ── Landmark profile overlay ───────────────────────── */
body.lp-open { overflow: hidden; }
.lp {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    background: var(--bg-dark, #f8fafc);
    color: var(--text-primary, #0f172a);
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.22s ease, transform 0.22s ease;
}
.lp.is-open { opacity: 1; transform: none; }
.lp[hidden] { display: none !important; }
.lp__topbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    padding-top: max(10px, env(safe-area-inset-top));
    border-bottom: 1px solid transparent;
    background: var(--bg-dark, #f8fafc);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.lp__topbar.is-scrolled { border-bottom-color: var(--border-glass, rgba(0,0,0,0.08)); box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08); }
.lp__topbar-name { flex: 1 1 auto; min-width: 0; font-family: var(--font-heading, 'Poppins', sans-serif); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0; transition: opacity 0.2s ease; }
.lp__topbar.is-scrolled .lp__topbar-name { opacity: 1; }
.lp__back, .lp__close {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-glass, rgba(0,0,0,0.1));
    background: var(--bg-surface, #fff);
    color: var(--text-primary, #0f172a);
    font: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
}
.lp__close { padding: 9px 11px; }
.lp__back:hover, .lp__close:hover { border-color: var(--sm-accent); }
.lp__scroll { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.lp__content { width: 100%; max-width: 1080px; margin: 0 auto; padding: 8px 18px 64px; display: flex; flex-direction: column; gap: 16px; }

.lp__hero {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 22px;
    padding: 18px;
    border-radius: 22px;
    background: linear-gradient(140deg, var(--sm-stage-top), var(--sm-stage-bottom));
    border: 1px solid var(--border-glass, rgba(0,0,0,0.06));
    align-items: center;
}
.lp__photo { margin: 0; min-width: 0; }
/* Tall landmarks come as portrait photos: show the whole picture instead of cropping it. */
.lp__photo img { display: block; width: auto; height: auto; max-width: 100%; max-height: 520px; margin: 0 auto; border-radius: 16px; background: var(--sm-stage-bottom); }
.lp__credit { text-align: center; }
.lp__photo--shape svg { display: block; width: 100%; max-height: 360px; }
.lp__credit { margin-top: 6px; font-size: 0.72rem; line-height: 1.4; color: var(--text-muted, #64748b); overflow-wrap: anywhere; }
.lp__credit a, .lp__sources a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.lp__hero-copy { min-width: 0; }
.lp__eyebrow { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--sm-accent); }
.lp__name { margin: 4px 0 0; font-family: var(--font-heading, 'Poppins', sans-serif); font-size: 2.1rem; font-weight: 800; line-height: 1.12; color: var(--text-primary, #0f172a); overflow-wrap: anywhere; }
.lp__hero-sub { margin-top: 2px; font-size: 0.95rem; color: var(--text-muted, #64748b); }
.lp__place { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 1rem; font-weight: 500; color: var(--text-secondary, #475569); }
.lp__place .lp-flag { width: 26px; }
.lp__badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.lp__badge { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: var(--bg-surface, #fff); border: 1px solid var(--border-glass, rgba(0,0,0,0.08)); color: var(--text-secondary, #475569); }
.lp__badge--unesco { color: #0369a1; border-color: rgba(3, 105, 161, 0.3); background: rgba(3, 105, 161, 0.08); }
[data-theme="dark"] .lp__badge--unesco { color: #7dd3fc; }
.lp__quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-top: 16px; }
.lp__quick-item { padding: 10px 12px; border-radius: 14px; background: var(--bg-surface, #fff); border: 1px solid var(--border-glass, rgba(0,0,0,0.06)); display: flex; flex-direction: column; gap: 1px; }
.lp__quick-value { font-family: var(--font-heading, 'Poppins', sans-serif); font-weight: 700; font-size: 1.05rem; color: var(--sm-accent); line-height: 1.25; }
.lp__quick-label { font-size: 0.74rem; color: var(--text-muted, #64748b); }

.lp__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.lp__col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.lp__card { min-width: 0; padding: 18px; border-radius: 18px; background: var(--bg-surface, #fff); border: 1px solid var(--border-glass, rgba(0,0,0,0.06)); }
.lp__card-title { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-family: var(--font-heading, 'Poppins', sans-serif); font-size: 1.02rem; font-weight: 700; color: var(--text-primary, #0f172a); }
.lp__card-title i { color: var(--sm-accent); font-size: 1.15rem; }
.lp__text { margin: 0; font-size: 0.98rem; line-height: 1.65; color: var(--text-secondary, #475569); }
.lp__text--muted { color: var(--text-muted, #64748b); }
.lp__figures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.lp__figure { min-width: 0; padding: 9px 12px; border-radius: 12px; background: var(--sm-accent-soft); display: flex; flex-direction: column; gap: 1px; }
.lp__figure--wide { grid-column: 1 / -1; }
.lp__figure-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em; color: var(--text-muted, #64748b); }
.lp__figure-value { font-size: 0.93rem; font-weight: 600; color: var(--text-primary, #0f172a); line-height: 1.35; overflow-wrap: anywhere; }
.lp__facts { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.lp__facts li { position: relative; padding-left: 22px; font-size: 0.95rem; line-height: 1.55; color: var(--text-secondary, #475569); }
.lp__facts li::before { content: ''; position: absolute; left: 4px; top: 0.62em; width: 8px; height: 8px; border-radius: 50%; background: var(--sm-accent); }

.lp__scale svg { display: block; width: 100%; height: auto; max-height: 300px; overflow: visible; }
.lp__scale-ground { stroke: var(--sm-ground-line); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.lp__scale-item path { fill: var(--sm-ref); opacity: 0.55; transition: opacity 0.12s ease; }
.lp__scale-item.is-current path { fill: var(--sm-target); opacity: 1; }
.lp__scale-item[data-landmark] { cursor: pointer; }
.lp__scale-item[data-landmark]:hover path, .lp__scale-item[data-landmark]:focus path { opacity: 1; }
.lp__scale-item:focus { outline: none; }
.lp__scale-labels { position: relative; height: 3.4em; margin-top: 6px; }
.lp__scale-label { position: absolute; top: 0; transform: translateX(-50%); width: 19%; min-width: 64px; display: flex; flex-direction: column; align-items: center; text-align: center; font-size: 0.7rem; line-height: 1.25; color: var(--text-muted, #64748b); }
.lp__scale-label strong { font-weight: 600; color: var(--text-secondary, #475569); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lp__scale-label.is-current strong { color: var(--sm-target); }
.lp__hint { margin: 8px 0 0; font-size: 0.78rem; color: var(--text-muted, #64748b); }

.lp__where { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 1rem; font-weight: 500; color: var(--text-primary, #0f172a); }
.lp__where .lp-flag { width: 30px; }
.lp__link { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border: 0; border-radius: 12px; background: var(--sm-accent-soft); color: var(--sm-accent); font: inherit; font-weight: 600; font-size: 0.9rem; text-align: left; text-decoration: none; cursor: pointer; }
.lp__link:hover { box-shadow: inset 0 0 0 1px var(--sm-accent); }
.lp__sources { margin: 0; padding-left: 18px; font-size: 0.88rem; line-height: 1.7; color: var(--text-secondary, #475569); }

.lp__steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.lp__step { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--border-glass, rgba(0,0,0,0.06)); background: var(--bg-surface, #fff); color: var(--text-primary, #0f172a); font: inherit; text-align: left; cursor: pointer; }
.lp__step:hover { border-color: var(--sm-accent); }
.lp__step i { color: var(--sm-accent); font-size: 1.1rem; flex: 0 0 auto; }
.lp__step span { display: flex; flex-direction: column; min-width: 0; }
.lp__step small { font-size: 0.72rem; color: var(--text-muted, #64748b); }
.lp__step strong { font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp__step em { font-style: normal; font-size: 0.8rem; color: var(--sm-accent); font-weight: 600; }
.lp__step--next { flex-direction: row-reverse; text-align: right; }
.lp__step--next span { align-items: flex-end; }

/* Modern profiles: an architecture-journal layout with blueprint details. */
.lp--modern {
    --lp-modern-accent: #62d4d0;
    --lp-modern-accent-ink: #0a7776;
    --text-primary: #172b3a;
    --text-secondary: #405769;
    --text-muted: #687f8e;
    --bg-dark: #e7eff3;
    --bg-surface: #fafdff;
    --border-glass: rgba(58, 96, 119, 0.17);
    --sm-accent: var(--lp-modern-accent-ink);
    --sm-accent-soft: rgba(58, 145, 155, 0.1);
    --sm-ref: #6694aa;
    --sm-target: #0e8585;
    --sm-ground-line: rgba(42, 91, 110, 0.3);
    background: var(--bg-dark);
}
.lp--modern[data-landmark="london-eye"] {
    --lp-modern-accent: #77c9fb;
    --lp-modern-accent-ink: #146eaa;
}
.lp--modern[data-landmark="burj-khalifa"] {
    --lp-modern-accent: #f3c77c;
    --lp-modern-accent-ink: #8e6120;
}
.lp--modern .lp__scroll {
    background-color: var(--bg-dark);
    background-image: linear-gradient(rgba(51, 102, 130, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(51, 102, 130, 0.045) 1px, transparent 1px);
    background-size: 32px 32px;
}
.lp--modern .lp__content { padding-top: 20px; gap: 20px; }
.lp--modern .lp__topbar {
    background: #11263a;
    color: #e8f3fa;
    border-bottom-color: rgba(175, 220, 234, 0.18);
}
.lp--modern .lp__topbar.is-scrolled { box-shadow: 0 5px 20px rgba(15, 35, 51, 0.2); }
.lp--modern .lp__back,
.lp--modern .lp__close {
    background: #1d384f;
    border-color: rgba(167, 210, 229, 0.3);
    color: #f5fbff;
    border-radius: 8px;
}
.lp--modern .lp__back:hover,
.lp--modern .lp__close:hover { border-color: var(--lp-modern-accent); background: #294961; }
.lp--modern .lp__hero {
    position: relative;
    overflow: hidden;
    padding: 28px;
    gap: 28px;
    border: 1px solid #345368;
    border-radius: 18px;
    background-color: #142c40;
    background-image: radial-gradient(circle at 85% 10%, rgba(90, 148, 168, 0.26), transparent 42%),
        linear-gradient(rgba(177, 220, 230, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(177, 220, 230, 0.045) 1px, transparent 1px),
        linear-gradient(135deg, #10273a, #213e52);
    background-size: auto, 28px 28px, 28px 28px, auto;
    box-shadow: 0 16px 36px rgba(28, 61, 80, 0.16);
}
.lp--modern .lp__hero::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: var(--lp-modern-accent);
}
.lp--modern .lp__photo,
.lp--modern .lp__hero-copy { position: relative; }
.lp--modern .lp__photo img {
    border-radius: 9px;
    border: 1px solid rgba(177, 220, 230, 0.25);
    box-shadow: 0 12px 25px rgba(2, 15, 25, 0.28);
}
.lp--modern .lp__photo--shape path { fill: var(--lp-modern-accent); }
.lp--modern .lp__credit { color: #b9cfda; }
.lp--modern .lp__eyebrow { color: var(--lp-modern-accent); letter-spacing: 0.19em; }
.lp--modern .lp__name {
    color: #f9fcff;
    font-size: clamp(2rem, 3.4vw, 2.8rem);
    font-weight: 700;
    line-height: 1.12;
    margin-top: 10px;
}
.lp--modern .lp__hero-sub,
.lp--modern .lp__place { color: #d1e0e9; }
.lp--modern .lp__badge {
    background: rgba(215, 236, 246, 0.1);
    border-color: rgba(202, 230, 242, 0.3);
    color: #ecf8ff;
    border-radius: 5px;
}
.lp--modern .lp__badge--unesco { color: #f5dda5; border-color: rgba(243, 199, 124, 0.45); }
.lp--modern .lp__quick { gap: 10px; margin-top: 22px; }
.lp--modern .lp__quick-item {
    border-radius: 5px;
    padding: 13px 14px;
    background: rgba(226, 243, 250, 0.08);
    border: 1px solid rgba(198, 229, 241, 0.23);
    border-top: 2px solid var(--lp-modern-accent);
}
.lp--modern .lp__quick-value { color: var(--lp-modern-accent); font-size: 1.16rem; }
.lp--modern .lp__quick-label { color: #b4cbd7; }
.lp--modern .lp__card {
    position: relative;
    overflow: hidden;
    background: var(--bg-surface);
    border: 1px solid rgba(59, 102, 126, 0.18);
    border-radius: 12px;
    padding: 22px;
    box-shadow: 0 7px 20px rgba(37, 72, 92, 0.06);
}
.lp--modern .lp__card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 22px;
    width: 55px;
    height: 3px;
    background: var(--lp-modern-accent-ink);
}
.lp--modern .lp__card-title {
    padding-bottom: 11px;
    border-bottom: 1px solid rgba(59, 102, 126, 0.15);
    font-size: 1.1rem;
}
.lp--modern .lp__card-title i { color: var(--lp-modern-accent-ink); }
.lp--modern .lp__text,
.lp--modern .lp__facts li { line-height: 1.72; }
.lp--modern .lp__figure {
    border-radius: 5px;
    background: #edf5f8;
    border: 1px solid rgba(61, 112, 138, 0.12);
    border-left: 3px solid var(--lp-modern-accent-ink);
    padding: 11px 13px;
}
.lp--modern .lp__figure-label { text-transform: uppercase; font-size: 0.68rem; letter-spacing: 0.055em; }
.lp--modern .lp__figure-value { font-size: 0.96rem; line-height: 1.45; }
.lp--modern .lp__facts li::before { border-radius: 2px; transform: rotate(45deg); }
.lp--modern .lp__link,
.lp--modern .lp__step { border-radius: 7px; }
.lp--modern :is(button, a, [tabindex]):focus-visible {
    outline: 3px solid var(--lp-modern-accent);
    outline-offset: 3px;
}
/* The modern layout keeps its contrast when the surrounding app uses dark mode. */
[data-theme="dark"] .lp--modern {
    --bg-dark: #101d29;
    --bg-surface: #1b3040;
    --text-primary: #f0f7fa;
    --text-secondary: #d2e1e9;
    --text-muted: #aac2cf;
    --sm-accent: var(--lp-modern-accent);
    --sm-accent-soft: rgba(148, 203, 217, 0.14);
    --sm-ref: #83adc1;
    --sm-target: var(--lp-modern-accent);
}
[data-theme="dark"] .lp--modern .lp__card { border-color: rgba(169, 212, 228, 0.19); }
[data-theme="dark"] .lp--modern .lp__card-title i { color: var(--lp-modern-accent); }
[data-theme="dark"] .lp--modern .lp__card::before { background: var(--lp-modern-accent); }
[data-theme="dark"] .lp--modern .lp__figure { background: #233c4d; border-color: rgba(169, 212, 228, 0.14); border-left-color: var(--lp-modern-accent); }
[data-theme="dark"] .lp--modern .lp__badge--unesco { color: #f5dda5; }
@media (max-width: 640px) {
    .lp--modern .lp__hero { padding: 18px; gap: 18px; }
    .lp--modern .lp__content { padding-top: 12px; }
    .lp--modern .lp__card { padding: 18px; }
}

/* Historic profiles: warm paper and book typography, scoped to the overlay.
   Local serif faces also cover Uzbek letters without a separate font download. */
.lp--historic {
    --text-primary: #3e291b;
    --text-secondary: #513c29;
    --text-muted: #71583d;
    --bg-dark: #e5d3b2;
    --bg-surface: #fbefd5;
    --border-glass: rgba(116, 77, 34, 0.25);
    --sm-accent: #805026;
    --sm-accent-soft: rgba(139, 93, 40, 0.09);
    --sm-ref: #93734a;
    --sm-target: #8b3e29;
    --sm-stage-bottom: #eddbb8;
    --sm-ground-line: rgba(116, 77, 34, 0.4);
    --font-heading: 'Palatino Linotype', 'Book Antiqua', Palatino, Georgia, serif;
    background: var(--bg-dark);
}
.lp--historic .lp__scroll {
    background-image: radial-gradient(ellipse at 50% 0, #f5e8ce 0, transparent 75%),
        url('../images/games/parchment-grain.svg');
}
.lp--historic .lp__content { padding-top: 20px; gap: 22px; }
.lp--historic .lp__topbar {
    background: #eee0c5;
    border-bottom-color: var(--border-glass);
}
.lp--historic .lp__topbar-name { font-size: 1.15rem; }
.lp--historic .lp__hero,
.lp--historic .lp__card {
    position: relative;
    border: 1px solid rgba(134, 89, 37, 0.38);
    border-radius: 5px 9px 6px 8px / 9px 5px 10px 5px;
    background-color: #fbefd5;
    background-image: url('../images/games/parchment-grain.svg'),
        radial-gradient(ellipse at 0 0, rgba(169, 107, 38, 0.22), transparent 48%),
        radial-gradient(ellipse at 100% 100%, rgba(164, 99, 34, 0.19), transparent 48%),
        linear-gradient(90deg, rgba(171, 106, 36, 0.13), transparent 5%, transparent 95%, rgba(171, 106, 36, 0.16));
    box-shadow: inset 0 0 22px rgba(153, 93, 33, 0.18),
        inset 0 0 3px rgba(121, 73, 26, 0.4), 0 5px 14px rgba(81, 52, 25, 0.1);
    padding: 24px;
}
.lp--historic .lp__hero::before,
.lp--historic .lp__card::before {
    content: '';
    position: absolute;
    inset: 7px;
    border: 1px solid rgba(143, 98, 46, 0.16);
    border-radius: 2px;
    pointer-events: none;
}
.lp--historic .lp__name { font-weight: 700; font-size: clamp(2rem, 4vw, 3rem); }
.lp--historic .lp__card-title {
    font-size: 1.35rem;
    font-style: italic;
    font-weight: 700;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(143, 98, 46, 0.22);
}
.lp--historic .lp__text,
.lp--historic .lp__facts li {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.06rem;
    line-height: 1.8;
}
.lp--historic .lp__facts { gap: 14px; }
.lp--historic .lp__facts li::before {
    width: 5px;
    height: 5px;
    top: 0.8em;
    border-radius: 0;
    transform: rotate(45deg);
}
.lp--historic .lp__figure,
.lp--historic .lp__quick-item {
    border-radius: 3px;
    background: rgba(139, 93, 40, 0.07);
    border: 1px solid rgba(143, 98, 46, 0.12);
}
.lp--historic .lp__figure-value {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1rem;
    line-height: 1.5;
}
.lp--historic .lp__badge { border-radius: 4px; background: rgba(255, 248, 226, 0.6); }
.lp--historic .lp__badge--unesco { color: #665222; border-color: rgba(117, 93, 36, 0.35); }
.lp--historic .lp__photo img { border-radius: 3px; box-shadow: 0 2px 8px rgba(81, 52, 25, 0.18); }
.lp--historic .lp__link,
.lp--historic .lp__step,
.lp--historic .lp__back,
.lp--historic .lp__close { border-radius: 5px; }
.lp--historic :is(button, a, [tabindex]):focus-visible {
    outline: 3px solid var(--sm-accent);
    outline-offset: 3px;
}
/* Keep parchment readable and less bright when the surrounding app is dark. */
[data-theme="dark"] .lp--historic { --bg-dark: #30271e; }
[data-theme="dark"] .lp--historic .lp__topbar { background: #dfccaa; }
[data-theme="dark"] .lp--historic .lp__scroll {
    background-image: url('../images/games/parchment-grain.svg');
}
[data-theme="dark"] .lp--historic .lp__hero,
[data-theme="dark"] .lp--historic .lp__card { background-color: #e5d0a9; }
@media (max-width: 640px) {
    .lp--historic .lp__hero,
    .lp--historic .lp__card { padding: 20px; }
    .lp--historic .lp__content { padding-top: 12px; }
}

@media (max-width: 860px) {
    .lp__hero { grid-template-columns: 1fr; gap: 14px; padding: 14px; }
    .lp__photo img { max-height: 380px; }
    .lp__name { font-size: 1.7rem; }
    .lp__grid { display: flex; flex-direction: column; align-items: stretch; }
    .lp__col { display: contents; }
}
@media (max-width: 640px) {
    .sm-cards { grid-template-columns: 1fr; gap: 10px; }
    .sm-info-card__photo { flex-basis: 92px; height: 92px; }
    .sm-library { padding: 12px 12px 48px; }
    .sm-library__head h1 { font-size: 1.25rem; }
    .lp-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .lp__content { padding: 4px 12px 96px; gap: 12px; }
    .lp__back span { display: none; }
    .lp__card { padding: 14px; }
    .lp__figures { grid-template-columns: 1fr; }
    .lp__scale-label { font-size: 0.62rem; }
}
@media (max-width: 768px) {
    body.lp-open .geobek-launcher { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
    .lp, .sm-cards { transition: none; animation: none; }
}
