/* #84 WiK Codex — Research page. Existing V2 header + EXACT T10 node/dialog CSS reused. Never use CSS gap. */
/* Raven-compatible header/intro layout. Shared CSS owns all dimensions.
 * research-intro uses database-intro + database-page-title + database-page-text.
 * CSS order: styles, site-ui, buildings, t10-roadmap, v2-subpage-header,
 * v2-shared-header, research. Do not override shared header/intro geometry. */
.research-page { --font-ui:"Noto Sans JP","Hiragino Kaku Gothic ProN","Yu Gothic",sans-serif; --font-brand:"Marcellus",Georgia,serif; --type-hero:1.5625rem; --type-body:.8125rem; --type-meta:.6875rem; }
html:lang(en) .research-page,html:lang(es) .research-page { --font-ui:"Inter",Arial,sans-serif; }
html:lang(ru) .research-page { --font-ui:"PT Sans",Arial,sans-serif; }
.research-page .research-main { position:relative; z-index:1; margin-top:0; padding-top:0; padding-bottom:32px; }

.research-categories { margin-top: 10px; margin-bottom: 20px; }
.research-heading { display:flex; align-items:center; justify-content:space-between; padding: 10px 2px 13px; border-bottom: 1px solid rgba(255,255,255,.13); }
.research-heading h2 { margin:0; color:#f2f2f2; font-size:14px; font-weight:730; }
.research-heading > span { color:#d6aa4f; font-size:10px; white-space:nowrap; }
.research-note { margin: 10px 1px; color:rgba(242,242,242,.5); font-size:10px; line-height:1.65; }
.research-category-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); margin: -5px; }
.research-category { min-width:0; min-height:102px; margin:5px; padding:10px 4px 8px; display:flex; align-items:center; justify-content:center; flex-direction:column; border:1px solid rgba(255,255,255,.19); border-radius:11px; background:linear-gradient(145deg,rgba(255,255,255,.08),rgba(255,255,255,.015)),#151716; color:#eee; cursor:pointer; font:inherit; }
.research-category[aria-pressed="true"] { border-color:#d6aa4f; background:linear-gradient(135deg,rgba(214,170,79,.13),#101718); box-shadow: inset 0 0 0 1px rgba(214,170,79,.16); }
.research-category:focus-visible { outline:2px solid #f3d27a; outline-offset:2px; }
.research-category-number { display:flex; width:41px; height:43px; flex:0 0 auto; align-items:center; justify-content:center; color:#d7af60; border:1px solid rgba(214,170,79,.17); border-radius:9px; background:rgba(214,170,79,.035); font-variant-numeric:tabular-nums; font-size:17px; font-weight:650; }
.research-category-name { margin-top:8px; max-width:100%; font-size:clamp(9px,2.65vw,12px); font-weight:700; text-align:center; line-height:1.24; overflow-wrap:anywhere; }
.research-flow-panel { margin-top:6px; scroll-margin-top:12px; }
.research-flow-panel .t10-panel-head { justify-content:space-between; }
.research-flow-count { margin-left:8px; color:#aabdd0; font-size:10px; white-space:nowrap; }
.research-missing-image { display:flex; position:relative; z-index:1; width:70%; height:70%; align-items:center; justify-content:center; color:#b5c6d7; text-align:center; font-size:13px; font-weight:720; line-height:1.3; }
.research-no-pos { padding:10px 13px 14px; background:rgba(5,10,21,.72); border-top:1px solid rgba(214,170,79,.19); }
.research-unplaced { padding:13px; border-top:1px solid rgba(214,170,79,.19); }
.research-unplaced h3 { margin:0 0 9px; color:#cbd7e5; font-size:12px; }
.research-unplaced-list { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); margin:-4px; }
.research-unplaced-list button { min-width:0; margin:4px; min-height:58px; padding:5px; font:inherit; color:#fff; background:#13253a; border:1px solid #37516e; border-radius:7px; font-size:11px; overflow-wrap:anywhere; }
.research-source { margin-top:20px; padding:12px; border:1px solid rgba(255,255,255,.11); border-radius:10px; background:rgba(10,12,12,.75); }
.research-source h2 { margin:0; font-size:12px; color:#e8cb8b; }
.research-source p { margin:8px 0 0; line-height:1.65; font-size:10px; color:rgba(242,242,242,.65); }
.research-time { display:flex; align-items:center; justify-content:space-between; border-top:1px solid #37516e; margin:8px 0 12px; padding-top:10px; color:#bdcfde; font-size:11px; }
.research-time strong { color:#fff; font-variant-numeric:tabular-nums; font-size:12px; }
.research-special-notice { margin:8px 1px 0; color:#e6bf76; font-size:10px; line-height:1.6; }
.research-page .t10-cost-table tr.is-selected td { background: #172a40; }
.research-page .t10-dialog .t10-resource-number { font-variant-numeric:tabular-nums; }
@media(max-width:355px){.research-category{min-height:97px;padding:7px 2px;}.research-category-name{font-size:9px}.research-heading h2{font-size:13px}}
@media(prefers-reduced-motion:reduce){.research-category{transition:none}}

/* Official research category images supplied by user; original PNG 200x240, transparent.
 * 17 branch cards plus the elite troop T10 link, independent of the node icon atlas.
 */
.research-category-icon { display:block; width:50px; height:60px; max-width:80%; flex:0 0 auto; object-fit:contain; filter:drop-shadow(0 2px 4px rgba(0,0,0,.35)); }
.research-category-name { margin-top:6px; }
.research-category-link { text-decoration:none; }
.research-category-link:hover, .research-category-link:focus-visible { border-color:#d6aa4f; }
@media(max-width:355px){.research-category-icon{width:44px;height:53px;}}

/* Scroll-only research: Alliance Duel (9), Caravan Transport (10). No CSS gap. */
.research-page .t10-resource-grid.research-scroll-only { display: grid; grid-template-columns: minmax(0, 1fr); }
.research-page .t10-resource-grid.research-scroll-only .t10-resource-card { padding: 1em .8em; text-align: center; }
.research-page .t10-resource-grid.research-scroll-only .t10-resource-card-head { justify-content: center; }
.research-page .t10-resource-grid.research-scroll-only .t10-resource-number { font-size: clamp(1.7rem, 7vw, 2.2rem); }
.research-page .t10-cost-table.research-scroll-table .t10-col-level { width: 32%; }
.research-page .t10-cost-table.research-scroll-table .t10-col-resource { width: 68%; }
.research-page .t10-cost-table.research-scroll-table th,
.research-page .t10-cost-table.research-scroll-table td { padding: .58em .75em; font-size: clamp(.7rem, 3vw, .88rem); }

/* Three-resource nodes: compact 3-column layout; still use T10 styling and no gap. */
.research-page .t10-resource-grid.research-regular-only { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); }
.research-page .t10-resource-grid.research-regular-only .t10-resource-card {min-width:0;padding:.6em .3em;}
.research-page .t10-resource-grid.research-regular-only .t10-resource-number {font-size:clamp(.86rem,3.7vw,1.35rem);letter-spacing:-.025em;}
.research-page .t10-resource-grid.research-regular-only .t10-resource-exact {font-size:clamp(.58rem,2.1vw,.82rem);white-space:nowrap;}
.research-page .t10-resource-grid.research-regular-only .t10-resource-card-head {font-size:clamp(.61rem,2.3vw,.79rem);}

/* Research category cards: identical frosted-glass shell to buildings.css .building-card.
   Reuse .building-grid / .building-cell / .building-card rather than reimplementing glass.
   No CSS gap property. */
.research-page .research-category-grid.building-grid { margin:0; }
.research-page .research-category.building-card { min-height:125px; height:100%; margin:0; padding:9px 4px 10px; border:0; border-radius:var(--build-radius,14px); background:linear-gradient(145deg,rgba(255,255,255,.065) 0%,rgba(255,255,255,.024) 48%,rgba(18,21,21,.22) 100%),rgba(48,47,43,.42); -webkit-backdrop-filter:blur(15px) saturate(118%); backdrop-filter:blur(15px) saturate(118%); box-shadow:0 .9rem 1.9rem rgba(0,0,0,.28); font:inherit; color:var(--build-text,#f2f2f2); }
.research-page .research-category.building-card:hover { box-shadow:0 1.1rem 2rem rgba(0,0,0,.36); }
.research-page .research-category.building-card[aria-pressed="true"] { box-shadow:0 .9rem 1.9rem rgba(0,0,0,.28); }
.research-page .research-category.building-card > img.research-category-icon { flex:0 0 76px; width:76px; height:76px; max-width:100%; margin:0 auto 6px; padding:0; object-fit:contain; object-position:center; filter:none; }
.research-page .research-category.building-card > .research-category-name.building-card-name { display:flex; align-items:center; justify-content:center; width:100%; min-height:24px; margin:0; padding:0; color:var(--build-text,#f2f2f2); font-size:11px; font-weight:500; line-height:1.3; letter-spacing:-.01em; }
/* Full-screen tree modal, following the buildings calculator mobile dialog idiom. */
.research-tree-dialog { width:100%; max-width:100%; height:100dvh; max-height:100dvh; margin:auto; padding:0; border:0; border-radius:0; overflow:hidden; background:#101112; color:#f2f2f2; font-family:var(--font-ui); }
.research-tree-dialog::backdrop { background:rgba(0,0,0,.8); }
.research-tree-dialog-inner { display:flex; flex-direction:column; width:100%; height:100%; max-height:100%; }
.research-tree-sticky { position:relative; z-index:2; flex:0 0 auto; padding:calc(12px + env(safe-area-inset-top,0px)) 16px 12px; border-bottom:1px solid rgba(255,255,255,.13); background:rgba(16,17,18,.97); }
.research-tree-topline { display:flex; align-items:center; justify-content:space-between; }
.research-tree-topline strong { min-width:0; color:#d6aa4f; font-size:14px; font-weight:600; }
.research-tree-close { display:flex; flex:0 0 44px; align-items:center; justify-content:center; width:44px; height:44px; margin-left:12px; padding:0; border:1px solid rgba(255,255,255,.14); border-radius:50%; background:#242424; color:#fff; font:inherit; font-size:26px; cursor:pointer; }
.research-tree-close:focus-visible { outline:2px solid #f3d27a; outline-offset:2px; }
.research-tree-instruction { margin:6px 0 0; color:#c8c8c4; font-size:11px; line-height:1.5; }
.research-tree-body { flex:1 1 auto; min-height:0; width:100%; overflow-x:hidden; overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; padding:12px 10px calc(24px + env(safe-area-inset-bottom,0px)); }
.research-tree-body .research-flow-panel { width:100%; max-width:660px; margin:0 auto; }
.research-tree-body .t10-node { min-height:128px; }
/* Shared V2 background and Hero are owned by wik-background.css and wik-hero.css. */

/* ロシア語：研究ページ全体の文字間隔を統一 */
html[lang="ru"] body.research-page .research-main,
html[lang="ru"] body.research-page .research-main *,
html[lang="ru"] body.research-page .research-tree-dialog,
html[lang="ru"] body.research-page .research-tree-dialog *,
html[lang="ru"] body.research-page #researchDialog,
html[lang="ru"] body.research-page #researchDialog * {
  letter-spacing: 0;
}

@media(max-width:359px){.research-page .research-category.building-card{min-height:116px;padding:7px 3px 9px;}.research-page .research-category.building-card > img.research-category-icon{flex-basis:64px;width:64px;height:64px;}.research-page .research-category.building-card > .research-category-name.building-card-name{font-size:10px;}}
@media(min-width:700px){.research-tree-dialog{width:650px;max-width:calc(100vw - 32px);height:min(92dvh,900px);max-height:92dvh;border:1px solid #4d4332;border-radius:18px;}}
