:root {
    --paper: #fbfaf6;
    --warm: #fff8ea;
    --cream: #fffdf8;
    --wood: #8a5f3d;
    --gold: #c79c48;
    --gold-strong: #b88424;
    --clay: #b76e4c;
    --leaf: #486b57;
    --sage: #d9e2d1;
    --ink: #26302b;
    --muted: #6c746d;
    --mist: rgba(255, 255, 255, 0.78);
    --glass: rgba(255, 255, 255, 0.68);
    --line: rgba(38, 48, 43, 0.14);
    --shadow: 0 18px 46px rgba(44, 35, 26, 0.14);
    --shadow-soft: 0 12px 28px rgba(44, 35, 26, 0.1);
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    font-family: Tahoma, Arial, sans-serif;
    color: var(--ink);
    background: var(--paper);
}

button,
input,
select {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

[hidden] {
    display: none !important;
}

.viewer-shell {
    position: fixed;
    inset: 0;
    width: 100vw;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    touch-action: none;
    background:
        radial-gradient(circle at 18% 18%, rgba(217, 226, 209, 0.62), transparent 28%),
        radial-gradient(circle at 82% 12%, rgba(199, 156, 72, 0.3), transparent 24%),
        linear-gradient(142deg, #fffdf8 0%, #f5ead6 46%, #d9bf98 100%);
}

.viewer-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(72, 107, 87, 0.08) 0 1px, transparent 1px 78px),
        linear-gradient(0deg, rgba(138, 95, 61, 0.06) 0 1px, transparent 1px 78px),
        linear-gradient(180deg, rgba(255, 255, 255, 0.56), transparent 34%);
    z-index: 0;
}

.viewer-shell::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 6%;
    width: min(58vw, 760px);
    height: min(18vw, 190px);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(64, 45, 27, 0.2), rgba(64, 45, 27, 0.06) 48%, transparent 72%);
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 1;
}

#viewerCanvas {
    position: relative;
    width: 100%;
    height: 100%;
    display: block;
    outline: none;
    touch-action: none;
    z-index: 2;
}

.intro-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    pointer-events: none;
    z-index: 30;
}

.intro-overlay p {
    max-width: min(780px, calc(100vw - 36px));
    margin: 0;
    padding: 20px 26px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 8px;
    background: rgba(255, 253, 248, 0.72);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
    color: var(--ink);
    font-size: clamp(1.35rem, 3vw, 2.7rem);
    font-weight: 800;
    line-height: 1.45;
    text-align: center;
    animation: introText 900ms ease both;
}

.intro-overlay.is-done {
    opacity: 0;
    transition: opacity 420ms ease;
}

.topbar {
    position: absolute;
    top: max(14px, env(safe-area-inset-top));
    left: 18px;
    right: 18px;
    min-height: 62px;
    display: grid;
    grid-template-columns: auto minmax(220px, 430px) auto;
    gap: 12px;
    align-items: center;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    background: var(--mist);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow-soft);
    z-index: 22;
}

.brand {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    min-width: 0;
    color: var(--leaf);
    font-weight: 800;
    white-space: nowrap;
}

.brand-mark {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--leaf));
    box-shadow: 0 0 0 6px rgba(199, 156, 72, 0.13);
}

.search-box {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: center;
    min-width: 0;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
}

.search-box span {
    color: var(--wood);
    font-size: 0.9rem;
    font-weight: 700;
}

.search-box input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ink);
}

.toolbar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
}

.mobile-only {
    display: none !important;
}

.icon-button,
.control-button,
.small-button,
.close-button,
.primary-button,
.secondary-button {
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    transition: transform 180ms ease, background 180ms ease, color 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.icon-button,
.control-button,
.small-button,
.close-button {
    background: rgba(255, 255, 255, 0.92);
    color: var(--leaf);
    box-shadow: 0 8px 18px rgba(44, 35, 26, 0.08);
}

.icon-button {
    width: 44px;
    padding: 0;
    font-size: 1.15rem;
}

.control-button {
    padding: 0 14px;
    white-space: nowrap;
    font-weight: 800;
}

.control-button:hover,
.icon-button:hover,
.small-button:hover,
.close-button:hover,
.primary-button:hover,
.secondary-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(44, 35, 26, 0.12);
}

.tour-button.is-running,
.control-button.is-active {
    background: var(--leaf);
    color: #fff;
}

.search-panel {
    position: absolute;
    top: 92px;
    left: 18px;
    width: min(390px, calc(100vw - 36px));
    max-height: min(520px, calc(100vh - 130px));
    overflow: auto;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    background: var(--mist);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 180ms ease, transform 180ms ease;
    z-index: 25;
}

.search-panel.is-open {
    opacity: 1;
    transform: translateY(0);
}

.panel-title,
.sheet-title {
    margin-bottom: 10px;
    font-weight: 800;
}

.search-results {
    display: grid;
    gap: 8px;
}

.result-item,
.tool-row {
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 10px;
    align-items: center;
    width: 100%;
    min-height: 58px;
    padding: 10px;
    text-align: start;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.86);
    color: var(--ink);
    cursor: pointer;
}

.result-item:hover,
.tool-row:hover,
.tool-row.is-active {
    border-color: rgba(72, 107, 87, 0.34);
    background: #fff;
}

.result-item b,
.tool-row b {
    display: grid;
    place-items: center;
    width: 31px;
    height: 31px;
    border-radius: 50%;
    background: var(--gold);
    color: #fff;
    font-size: 0.86rem;
}

.tool-row.is-active b {
    background: var(--leaf);
}

.result-item span,
.tool-row span {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.result-item strong,
.tool-row strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-item small,
.tool-row small,
.empty-state span {
    color: var(--muted);
    font-size: 0.84rem;
}

.empty-state {
    display: grid;
    gap: 6px;
    padding: 18px;
    border: 1px dashed rgba(72, 107, 87, 0.28);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.58);
    text-align: center;
}

.tools-sidebar {
    position: absolute;
    left: 18px;
    top: 104px;
    bottom: 18px;
    width: 264px;
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 12px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.66);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.62);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow-soft);
    z-index: 16;
}

.sidebar-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: end;
}

.sidebar-head span {
    color: var(--leaf);
    font-weight: 900;
}

.sidebar-head small {
    color: var(--muted);
}

.tools-list {
    display: grid;
    align-content: start;
    gap: 8px;
    min-height: 0;
    overflow: auto;
    padding-inline-end: 2px;
}

.hotspot-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 12;
}

.hotspot-layer.is-hidden .hotspot {
    display: none;
}

.hotspot {
    --x: 50%;
    --y: 50%;
    --scale: 1;
    position: absolute;
    top: var(--y);
    left: var(--x);
    width: 42px;
    height: 42px;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-strong));
    color: #fff;
    font-weight: 900;
    font-size: 0.98rem;
    cursor: pointer;
    pointer-events: auto;
    opacity: 0;
    box-shadow: 0 10px 26px rgba(80, 55, 28, 0.28);
    transform: translate(-50%, -50%) scale(var(--scale));
    transform-origin: center;
    transition: opacity 280ms ease var(--delay), background 160ms ease, box-shadow 160ms ease, transform 180ms ease;
}

.hotspot.is-visible {
    opacity: 1;
}

.hotspot span {
    position: relative;
    z-index: 2;
}

.hotspot::before {
    content: "";
    position: absolute;
    inset: -8px;
    border-radius: inherit;
    border: 2px solid rgba(199, 156, 72, 0.34);
    animation: pulse 2.1s ease-out infinite;
}

.hotspot::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    max-width: 210px;
    padding: 7px 10px;
    border-radius: 7px;
    background: rgba(38, 48, 43, 0.94);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.4;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-50%) translateY(4px);
    pointer-events: none;
    transition: opacity 160ms ease, transform 160ms ease;
}

.hotspot:hover,
.hotspot:focus-visible {
    --scale: 1.08;
    background: linear-gradient(135deg, var(--leaf), #2f5141);
}

.hotspot:hover::after,
.hotspot:focus-visible::after,
.hotspot.is-active::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.hotspot.is-active {
    --scale: 1.2;
    z-index: 3;
    background: linear-gradient(135deg, var(--leaf), #2f5141);
    box-shadow: 0 14px 34px rgba(47, 81, 65, 0.34);
}

.hotspot.is-muted {
    opacity: 0.34;
}

.quiz-active .hotspot {
    box-shadow: 0 0 0 5px rgba(199, 156, 72, 0.12), 0 10px 26px rgba(80, 55, 28, 0.28);
}

.info-card {
    position: absolute;
    top: 104px;
    right: 18px;
    width: min(390px, calc(100vw - 36px));
    max-height: calc(100vh - 124px);
    overflow: auto;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateX(18px);
    transition: opacity 240ms ease, transform 240ms ease;
    z-index: 28;
}

.info-card.is-open {
    opacity: 1;
    transform: translateX(0);
}

.info-card.is-closing {
    opacity: 0;
    transform: translateX(18px);
}

.info-card::before {
    content: "";
    display: block;
    width: 52px;
    height: 4px;
    margin-bottom: 14px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--gold), var(--leaf));
}

.close-button {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 42px;
    min-height: 42px;
    padding: 0;
    font-size: 1.45rem;
}

.close-button.compact {
    top: 10px;
    right: auto;
    left: 10px;
    width: 34px;
    min-height: 34px;
}

.tool-category {
    display: inline-flex;
    margin: 0 0 8px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(72, 107, 87, 0.12);
    color: var(--leaf);
    font-size: 0.82rem;
    font-weight: 900;
}

.tool-age {
    margin: 0 0 12px;
    color: var(--wood);
    font-weight: 800;
}

.tool-description {
    margin-bottom: 16px;
}

.info-card h1 {
    margin: 0 48px 10px 0;
    font-size: 1.55rem;
    line-height: 1.35;
}

.info-card p,
.info-card dd {
    line-height: 1.8;
}

.info-card dl {
    margin: 16px 0 18px;
}

.info-card dt {
    margin-bottom: 6px;
    color: var(--leaf);
    font-weight: 900;
}

.info-card dd {
    margin: 0;
}

.card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.card-actions .whatsapp-button {
    grid-column: 1 / -1;
}

.primary-button,
.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 0 14px;
    text-decoration: none;
    font-weight: 900;
    text-align: center;
}

.primary-button {
    background: var(--leaf);
    color: #fff;
}

.secondary-button {
    background: #fff;
    color: var(--leaf);
}

.whatsapp-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 0;
    padding: 0 14px;
    border: 1px solid rgba(32, 118, 77, 0.26);
    border-radius: 8px;
    background: #20764d;
    color: #fff;
    font-weight: 900;
    text-align: center;
    text-decoration: none;
    box-shadow: 0 8px 18px rgba(32, 118, 77, 0.16);
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.whatsapp-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(32, 118, 77, 0.2);
}

.lead-form {
    display: grid;
    gap: 10px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.lead-form strong {
    color: var(--leaf);
}

.lead-form input,
.lead-form select {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.94);
    color: var(--ink);
    outline: 0;
}

.lead-form input:focus,
.lead-form select:focus {
    border-color: rgba(72, 107, 87, 0.46);
    box-shadow: 0 0 0 3px rgba(72, 107, 87, 0.1);
}

.lead-form button:disabled {
    opacity: 0.62;
    cursor: progress;
}

.lead-feedback {
    min-height: 22px;
    margin: 0;
    color: var(--wood);
    font-size: 0.9rem;
    font-weight: 800;
}

.floating-cta {
    position: absolute;
    left: 50%;
    bottom: max(18px, env(safe-area-inset-bottom));
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    width: min(680px, calc(100vw - 36px));
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow-soft);
    transform: translateX(-50%);
    z-index: 24;
}

.floating-cta a {
    flex: 1 1 0;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border-radius: 8px;
    color: var(--leaf);
    background: #fff;
    font-weight: 900;
    text-align: center;
    text-decoration: none;
}

.floating-cta a:first-child {
    background: var(--leaf);
    color: #fff;
}

.exit-popup {
    position: absolute;
    inset: 0;
    z-index: 60;
    pointer-events: none;
}

.exit-popup.is-open {
    pointer-events: auto;
}

.exit-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(20, 24, 21, 0.34);
    opacity: 0;
    transition: opacity 220ms ease;
}

.exit-popup.is-open .exit-backdrop {
    opacity: 1;
}

.exit-card {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(430px, calc(100vw - 36px));
    padding: 28px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translate(-50%, -46%) scale(0.98);
    transition: opacity 220ms ease, transform 220ms ease;
}

.exit-popup.is-open .exit-card {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.exit-card h2 {
    margin: 0 44px 10px 0;
    font-size: 1.35rem;
    line-height: 1.45;
}

.exit-card p {
    margin: 0 0 18px;
    color: var(--muted);
    line-height: 1.8;
}

.quiz-panel {
    position: absolute;
    right: 18px;
    bottom: 18px;
    width: min(430px, calc(100vw - 36px));
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 16px 58px 16px 16px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.84);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
    z-index: 27;
}

.quiz-panel small {
    display: block;
    margin-bottom: 5px;
    color: var(--wood);
    font-weight: 800;
}

.quiz-panel strong {
    display: block;
    font-size: 1.08rem;
}

.quiz-panel p {
    margin: 6px 0 0;
    color: var(--muted);
}

.quiz-panel p.is-correct {
    color: #20764d;
    font-weight: 900;
}

.quiz-panel p.is-wrong {
    color: #a64033;
    font-weight: 900;
}

.small-button {
    padding: 0 12px;
    font-weight: 800;
}

.mobile-sheet {
    position: absolute;
    inset: 0;
    z-index: 35;
    pointer-events: none;
}

.mobile-sheet.is-open {
    pointer-events: auto;
}

.sheet-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(20, 24, 21, 0.28);
    opacity: 0;
    transition: opacity 220ms ease;
}

.mobile-sheet.is-open .sheet-backdrop {
    opacity: 1;
}

.sheet-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 72vh;
    display: grid;
    grid-template-rows: auto auto 1fr;
    gap: 10px;
    padding: 12px 14px calc(18px + env(safe-area-inset-bottom));
    border-radius: 8px 8px 0 0;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 -16px 34px rgba(44, 35, 26, 0.18);
    transform: translateY(100%);
    transition: transform 240ms ease;
}

.mobile-sheet.is-open .sheet-panel {
    transform: translateY(0);
}

.sheet-handle {
    justify-self: center;
    width: 48px;
    height: 4px;
    border-radius: 999px;
    background: rgba(38, 48, 43, 0.22);
}

.toast {
    position: absolute;
    left: 50%;
    bottom: 28px;
    max-width: min(420px, calc(100vw - 36px));
    padding: 12px 18px;
    border-radius: 999px;
    background: rgba(38, 48, 43, 0.92);
    color: #fff;
    font-weight: 900;
    text-align: center;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translate(-50%, 10px);
    transition: opacity 200ms ease, transform 200ms ease;
    z-index: 42;
}

.toast.is-open {
    opacity: 1;
    transform: translate(-50%, 0);
}

.loader {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(251, 250, 246, 0.78);
    backdrop-filter: blur(14px);
    opacity: 1;
    transition: opacity 580ms ease, visibility 580ms ease;
    z-index: 50;
}

.loader.is-complete {
    opacity: 0;
    visibility: hidden;
}

.loader-card,
.model-error {
    width: min(360px, calc(100vw - 36px));
    padding: 22px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
    text-align: center;
    box-shadow: var(--shadow);
}

.loader-card p {
    margin: 10px 0 14px;
    font-weight: 800;
}

.progress-track {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(72, 107, 87, 0.16);
}

.progress-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--gold), var(--leaf));
    transition: width 180ms ease;
}

#loaderPercent {
    display: block;
    margin-top: 10px;
    color: var(--leaf);
}

.spinner {
    width: 38px;
    height: 38px;
    margin: 0 auto;
    border: 3px solid rgba(72, 107, 87, 0.2);
    border-top-color: var(--leaf);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.model-error {
    position: absolute;
    left: 50%;
    bottom: 32px;
    transform: translateX(-50%);
    z-index: 51;
}

.details-page {
    min-height: 100vh;
    overflow: auto;
    padding: 32px 18px;
}

.details-layout {
    width: min(860px, 100%);
    margin: auto;
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.details-layout img {
    width: 100%;
    max-height: 430px;
    object-fit: cover;
    border-radius: 8px;
}

.back-link {
    display: inline-block;
    margin-bottom: 18px;
    color: var(--leaf);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0% {
        opacity: 0.52;
        transform: scale(0.82);
    }
    100% {
        opacity: 0;
        transform: scale(1.46);
    }
}

@keyframes introText {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 1180px) {
    .topbar {
        grid-template-columns: 1fr minmax(180px, 360px);
    }

    .toolbar-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    .tools-sidebar {
        width: 232px;
    }
}

@media (max-width: 900px) {
    .topbar {
        left: 10px;
        right: 10px;
        grid-template-columns: 1fr;
        gap: 9px;
        min-height: 0;
        padding: 9px;
    }

    .brand {
        white-space: normal;
    }

    .toolbar-actions {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .control-button {
        padding: 0 11px;
        font-size: 0.86rem;
    }

    .mobile-only {
        display: inline-flex !important;
    }

    .tools-sidebar {
        display: none;
    }

    .search-panel {
        top: 188px;
        left: 10px;
        right: 10px;
        width: auto;
        max-height: 34vh;
    }

    .hotspot {
        width: 52px;
        height: 52px;
        font-size: 1.06rem;
    }

    .hotspot::after {
        bottom: calc(100% + 8px);
        max-width: 170px;
        white-space: normal;
    }

    .info-card {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-height: 66vh;
        padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
        border-radius: 8px 8px 0 0;
        transform: translateY(32px);
    }

    .info-card.is-open {
        transform: translateY(0);
    }

    .info-card.is-closing {
        transform: translateY(32px);
    }

    .info-card h1 {
        margin-top: 2px;
        font-size: 1.32rem;
    }

    .card-actions {
        position: sticky;
        bottom: calc(-18px - env(safe-area-inset-bottom));
        grid-template-columns: 1fr;
        margin: 16px -18px calc(-18px - env(safe-area-inset-bottom));
        padding: 12px 18px calc(14px + env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, 0.96);
        border-top: 1px solid var(--line);
        backdrop-filter: blur(14px);
        z-index: 2;
    }

    .floating-cta {
        left: 10px;
        right: 10px;
        bottom: max(10px, env(safe-area-inset-bottom));
        width: auto;
        transform: none;
        overflow-x: auto;
        justify-content: flex-start;
    }

    .floating-cta a {
        flex: 0 0 auto;
        min-width: 138px;
        font-size: 0.86rem;
    }

    .quiz-panel {
        left: 10px;
        right: 10px;
        bottom: max(10px, env(safe-area-inset-bottom));
        width: auto;
        grid-template-columns: 1fr;
        padding: 14px 48px 14px 14px;
    }

    .toast {
        bottom: 18px;
    }

    .viewer-shell.has-info .quiz-panel {
        display: none;
    }

    .viewer-shell.has-info .floating-cta {
        display: none;
    }
}

@media (max-width: 520px) {
    .topbar {
        top: max(8px, env(safe-area-inset-top));
        left: 8px;
        right: 8px;
    }

    .search-box {
        height: 42px;
    }

    .icon-button,
    .control-button {
        min-height: 40px;
    }

    .icon-button {
        width: 40px;
    }

    .search-panel {
        top: 184px;
        left: 8px;
        right: 8px;
    }

    .intro-overlay p {
        padding: 16px 18px;
    }

    .result-item,
    .tool-row {
        min-height: 54px;
    }
}
