/* Loaded after page styles: shared phone/tablet layout, desktop geometry stays intact. */
.mobile-menu { display: none; }
.talent-touch-dialog {
    position: fixed; inset: 0; width: min(480px, calc(100vw - 24px)); max-width: none;
    max-height: calc(100dvh - 24px); margin: auto; padding: 0;
    border: 1px solid var(--accent-dark); border-radius: 10px;
    color: var(--text-primary); background: var(--bg-primary); box-shadow: var(--shadow);
}
.talent-touch-dialog[open] { display: flex; flex-direction: column; }
.talent-touch-dialog::backdrop { background: rgba(0, 0, 0, .65); }
.talent-touch-details { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px; }
.talent-touch-details :is(.talent-skill-tooltip, .talent-next-level-tooltip) {
    position: static; width: 100%; max-width: none; max-height: none; min-height: 0;
    overflow: visible; pointer-events: auto; font-size: 14px; line-height: 1.5;
}
.talent-touch-details :is(.talent-skill-tooltip-heading strong, .talent-next-level-tooltip-heading strong) { font-size: 16px; }
.talent-touch-details :is(.talent-skill-tooltip-heading span, .talent-next-level-tooltip-title) { font-size: 14px; }
.talent-touch-details .talent-next-level-tooltip { margin-top: 12px; }
.talent-touch-actions { flex-shrink: 0; display: grid; grid-template-columns: 1fr 1fr 1.5fr; gap: 10px; padding: 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
.talent-touch-actions button { min-height: 48px; font-size: 18px; }
.talent-touch-actions button:disabled { opacity: .4; }
:where(a, button, input, select, textarea, summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

@media (max-width: 1100px) {
    html { scrollbar-gutter: auto; scroll-padding-top: 76px; }
    body { background-attachment: scroll; }
    body .header { padding: 0 12px; }
    body .header .header-inner { position: relative; min-height: 56px; height: auto; flex-direction: row; flex-wrap: wrap; gap: 8px; padding: 6px 0; }
    body .header .header-logo {
        position: absolute; left: 50%; top: 50%; z-index: 1;
        transform: translate(-50%, -50%);
    }
    body .header .header-logo-text { display: none; }
    body .header .header-logo::before {
        content: ''; display: block; width: 40px; height: 40px;
        background: url('/template/images/favicon.png?v=b96fe96e2d80') center / contain no-repeat;
    }
    body .header .nav { display: flex; }
    body .header .nav a { margin: 0 !important; }
    body .header .has-mobile-menu > .nav { display: none; }
    body .main-wrapper { width: 100%; max-width: 760px; grid-template-columns: minmax(0, 1fr); padding: 16px 12px 28px; gap: 20px; }
    body .sidebar { display: none; }
    body .content { order: 1; width: 100%; min-width: 0; height: auto; gap: 16px; }
    .content > .social-badges, .content > .wumpus-badge,
    .hero > .social-badges, .hero > .wumpus-badge {
        position: static;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px;
        align-self: center;
    }
    .social-badges a { display: grid; place-items: center; min-width: 44px; min-height: 44px; }
    body .social-badges img { display: block; width: 40px; height: 40px; max-width: 40px; object-fit: contain; }
    .mobile-menu { display: block; margin-left: auto; }
    .mobile-menu > summary {
        display: flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px;
        padding: 10px; border: 0; border-radius: 0;
        color: transparent; font-size: 0; background: transparent; cursor: pointer; list-style: none;
    }
    .mobile-menu > summary::after {
        content: ''; display: block; width: 24px; height: 24px;
        background: url('/template/images/menu.png?v=777491e98de1') center / contain no-repeat;
    }
    .mobile-menu > summary::-webkit-details-marker { display: none; }
    .mobile-menu-panel {
        position: absolute; top: 100%; right: 12px; width: min(360px, calc(100vw - 24px));
        max-height: calc(100dvh - 80px); overflow-y: auto; overscroll-behavior: contain;
        padding: 10px; border: 1px solid var(--border); border-radius: 0 0 8px 8px;
        background: var(--bg-secondary); box-shadow: var(--shadow);
    }
    .mobile-menu-panel > a { display: flex; align-items: center; min-height: 44px; padding: 8px 12px; border-radius: 5px; color: var(--text-primary); }
    .mobile-menu-panel > a[aria-current], .mobile-menu-panel > a:hover { color: var(--accent); background: var(--bg-hover); }
    .mobile-menu-panel > .mobile-menu-account-card { margin: 10px 0; }
    .mobile-menu-panel > .mobile-menu-account-card .card-body { padding: 12px; }
    .mobile-menu-languages { display: flex; gap: 10px; padding: 10px 12px 4px; }
    .mobile-menu-languages button { flex: 1; }
    body .tips-hero, body .footer { display: none; }
    body .hero { padding: 22px 18px; overflow: hidden; }
    body .hero.monsters-hero, body .hero.quests-hero { padding: 0; }
    body .hero .hero-content { padding: 22px 18px; }
    body .hero-title, body .talent-title { font-size: 1.4rem; overflow-wrap: anywhere; }
    body .breadcrumb { flex-wrap: wrap; min-width: 0; }
    body .news-feed-card { height: auto; min-height: 0; flex: 0 1 auto; }
    body .news-feed { display: flex; flex-direction: column; }
    body .news-feed .news-item { min-width: 0; padding: 14px 16px; }
    body .news-feed .news-title { white-space: normal; }
    body .news-feed .news-excerpt { -webkit-line-clamp: 3; }
    body .news-comments-sort { flex-wrap: wrap; min-width: 0; }
    body .news-comments-toolbar, body .news-comments-header { flex-wrap: wrap; }
    body .news-feed-card .pagination:empty { display: none; }
    body .pagination { flex-wrap: wrap; padding: 12px; }
    body :is(button, .btn, .reset-build, .quest-back, .quest-reset, .quest-clear, .rating-button) { min-height: 44px; }
    body :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea) { min-width: 0; max-width: 100%; font-size: 16px; }
    body :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select) { min-height: 44px; }
    body :is(.quest-pagination button, .pagination a, .pagination span) { min-width: 44px; min-height: 44px; }
    .login-links { flex-wrap: wrap; gap: 4px 12px; }
    .login-links a, .footer-links a { display: inline-flex; align-items: center; min-height: 44px; }
    body .footer-links { gap: 8px 16px; }
    body .liveinternet-counter { position: static !important; transform: none !important; margin-top: 12px; }
    .content img { max-width: 100%; height: auto; }
    .content :is(p, h1, h2, h3, li) { overflow-wrap: anywhere; }
    .content pre { max-width: 100%; overflow-x: auto; }
    .mobile-table-scroll { max-width: 100%; overflow-x: auto; }
    .mobile-table-scroll:focus-visible { outline: 2px solid var(--accent); }
    body .quest-detail-header { flex-wrap: wrap; }
    body .quest-row-title { display: flex; align-items: center; min-height: 44px; }
    body .dungeon-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 10px; }
    body .quest-filters label { min-width: 0; }
    body .quest-row-place, body .quest-row-type { white-space: normal; }
    body .talent-card-body { padding: 16px 12px; }
    body .talent-editor { display: flex; flex-direction: column; gap: 18px; }
    body .editor-heading { order: 0; }
    body .build-settings { order: 1; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    body .build-settings .build-community { grid-column: 1 / -1; }
    body .talent-group[aria-labelledby="skills-heading"] { order: 2; }
    body .talent-group[aria-labelledby="genes-heading"] { order: 3; margin-top: 0; }
    body .talent-note { order: 4; }
    body .talent-group { min-width: 0; max-width: 100%; }
    body .talent-tree-scroll { overflow-x: auto; padding-bottom: 12px; }
    body .talent-tree { --talent-node-size: 44px; --talent-tree-gap: 6px; --talent-tree-padding: 8px; }
    body .talent-tree#skill-nodes, body .talent-tree#gene-nodes { min-width: calc(var(--talent-tree-columns, 7) * 50px + 12px); }
    body .talent-tree#skill-nodes { min-height: 530px; aspect-ratio: auto; }
    body .talent-tree#gene-nodes { height: 220px; }
    body .talent-tree#gene-nodes.has-five-gene-rows { height: 270px; }
    body .talent-node-action { display: none; }
    body .talent-node-level { font-size: 11px; }
    body .level-picker-options { width: 96px; }
    body .legacy-calculator-jobs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; height: auto; white-space: normal; }
    body .legacy-calculator-class { width: auto; height: auto; background: var(--bg-primary) !important; border: 1px solid var(--border); border-radius: 6px; }
    body .legacy-specializations { display: flex; flex-direction: column; gap: 4px; width: auto; height: auto; padding: 6px; }
    body .legacy-calculator-class:hover .legacy-specializations, body .legacy-calculator-class:focus-within .legacy-specializations { display: flex; }
    body .legacy-job { position: static; display: flex; align-items: center; gap: 8px; width: 100%; height: auto; min-height: 52px; margin: 0; padding: 6px; color: var(--text-primary); font-size: 14px; text-align: left; overflow-wrap: anywhere; }
    body .legacy-job img { flex: 0 0 36px; width: 36px; height: 36px; }
    body .legacy-job::after { content: attr(title); }
    body .mobile-profession-toggle { display: flex; width: 100%; margin-top: 12px; }
    body .legacy-calculator.is-mobile-collapsed { display: none; }
}

.mobile-profession-toggle { display: none; }

@media (max-width: 380px) {
    body .legacy-calculator-jobs, body .build-settings { grid-template-columns: 1fr; }
}
@media (hover: none), (pointer: coarse) {
    .cursor-glow { display: none !important; }
    .talent-node-action { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}
