/* Medrese stays inside the existing Köy window and its mobile bottom sheet. Domain layout only. */
#panel.research-wide { width: min(940px, calc(100vw - 32px)); }
.research-panel { color: var(--ink); }
.research-summary { display: flex; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
#panel .research-summary h3 { margin: 0 0 var(--space-2); }
.research-summary h3 small { font-size: var(--text-xs); font-weight: normal; font-family: var(--font-body); }
.research-summary span, .research-help { font-size: var(--text-sm); }
.research-scholars { display: flex; gap: var(--space-2); align-items: center; }
.research-help { line-height: 1.6; }
.research-queue summary { font-size: var(--text-sm); line-height: 1.7; }
.research-queue ol { padding-left: var(--space-5); }
.research-queue li { padding: var(--space-1) 0; }
.research-queue span, .research-queue small { display: block; font-size: var(--text-xs); line-height: 1.5; }
.research-tree { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: var(--space-3); }
.research-branch > ol { list-style: none; padding: 0; margin: 0; }
#panel .research-branch > h4 { text-align: center; margin: var(--space-4) 0 var(--space-3); }
.research-node { position: relative; margin-bottom: var(--space-5); overflow-wrap: anywhere; }
/* Each connector joins a node to its sole prerequisite immediately above it. */
.research-node + .research-node::before { content: ''; position: absolute; height: 25px; width: 2px; background: var(--border); left: calc(50% - 1px); top: -27px; }
.research-node + .research-node::after { content: ''; position: absolute; border: 5px solid transparent; border-top-color: var(--border); left: calc(50% - 5px); top: -9px; }
#panel .research-node h5 { margin: var(--space-2) 0; }
.research-node p { font-size: var(--text-sm); line-height: 1.5; margin: var(--space-2) 0; }
.research-node small { display: block; font-size: var(--text-xs); line-height: 1.5; }
.research-node-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-1); font-size: var(--text-xs); }
#panel .research-node.done { background: var(--success-surface); border-color: var(--good); }
#panel .research-node.active { background: var(--warning-surface); border: 2px solid var(--even); }
#panel .research-node.queued { border-color: var(--even); }
#panel .research-node.locked { background: var(--surface-disabled); }
#panel .research-node.open { border-color: var(--good); }
.research-cost { margin: var(--space-2) 0; }
.research-node button { width: 100%; }
.research-reason, .research-dependency { margin-top: var(--space-2); color: var(--muted); }
@media (max-width: 760px), (pointer: coarse) and (max-width: 1100px), (max-height: 500px) and (max-width: 1100px) {
  #panel.research-wide { width: auto; }
  .research-scholars { width: 100%; justify-content: space-between; }
}
