.history-page { width:100%; margin-top:0; }
.history-layout { display:grid; grid-template-columns:250px minmax(0,1fr); gap:0; align-items:start; transition:grid-template-columns .25s ease,gap .25s ease; }
.history-layout.is-collapsed { grid-template-columns:56px minmax(0,1fr); gap:24px; }
.history-sidebar { position:sticky; top:64px; height:calc(100vh - 64px); max-height:none; display:flex; flex-direction:column; padding:24px 16px; overflow:auto; border:0; border-radius:0; background:#202538; color:#fff; box-shadow:10px 0 30px rgba(15,23,42,.1); scrollbar-width:none; }
.history-sidebar::-webkit-scrollbar { width:0; }
.history-sidebar-head { display:flex; align-items:center; gap:8px; }
.history-brand { min-width:0; display:flex; align-items:center; gap:10px; color:#fff; text-decoration:none; }
.history-brand svg { width:42px; height:42px; flex:0 0 42px; padding:4px; border-radius:13px; background:rgba(255,255,255,.1); }
.history-brand span { min-width:0; }
.history-brand small,.history-brand strong { display:block; }
.history-brand small { color:#7dd3c7; font-size:.58rem; font-weight:800; letter-spacing:.12em; text-transform:uppercase; }
.history-brand strong { font-size:.84rem; line-height:1.15; }
.history-collapse { width:30px; height:30px; flex:0 0 30px; margin-left:auto; display:grid; place-items:center; padding:0; border:0; border-radius:50%; background:rgba(255,255,255,.1); color:#fff; cursor:pointer; }
.history-nav { display:grid; gap:5px; margin-top:22px; }
.history-nav a { display:grid; grid-template-columns:28px minmax(0,1fr); align-items:center; gap:7px; min-height:44px; padding:8px; border-radius:12px; color:#d9deeb; text-decoration:none; transition:background .18s ease,color .18s ease,transform .18s ease; }
.history-nav a:hover { background:rgba(255,255,255,.08); color:#fff; transform:translateX(2px); }
.history-nav a.is-active { background:#fff; color:#182031; }
.history-nav a span { color:#5eead4; font-size:.63rem; font-weight:850; letter-spacing:.08em; }
.history-nav a.is-active span { color:#0f766e; }
.history-nav a strong { font-size:.78rem; line-height:1.18; }
.history-back { margin-top:24px; padding:12px 8px 2px; border-top:1px solid rgba(255,255,255,.12); color:#aeb7ca; font-size:.72rem; text-decoration:none; }
.history-layout.is-collapsed .history-sidebar { padding-inline:7px; }
.history-layout.is-collapsed .history-brand span,.history-layout.is-collapsed .history-nav strong,.history-layout.is-collapsed .history-back { display:none; }
.history-layout.is-collapsed .history-brand { justify-content:center; }
.history-layout.is-collapsed .history-brand svg { width:38px; height:38px; flex-basis:38px; }
.history-layout.is-collapsed .history-collapse { position:absolute; right:-13px; top:62px; transform:rotate(180deg); background:#fff; color:#202538; box-shadow:0 6px 16px rgba(15,23,42,.18); }
.history-layout.is-collapsed .history-nav a { grid-template-columns:1fr; justify-items:center; }
.history-content { min-width:0; width:min(1180px,94%); margin:0 auto; padding:24px 0 52px; }
.history-hero { scroll-margin-top:90px; }
.history-section { scroll-margin-top:90px; margin-top:26px; padding:clamp(28px,4vw,48px); border:1px solid rgba(15,23,42,.08); border-radius:30px; background:rgba(255,255,255,.78); box-shadow:0 14px 34px rgba(15,23,42,.055); }
.history-section h2 { margin:7px 0 12px; font-size:clamp(1.8rem,3vw,3rem); letter-spacing:-.045em; }
.history-section > p { max-width:72ch; color:var(--muted-strong); }
.history-section .button { margin-top:16px; }
.history-periods { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); margin-top:24px; border-top:1px solid var(--line); }
.history-periods article { position:relative; padding:25px 22px 22px 0; border-bottom:1px solid var(--line); }
.history-periods article:nth-child(even) { padding-left:22px; border-left:1px solid var(--line); }
.history-periods small { color:#0f766e; font-weight:850; }
.history-periods h3 { margin:4px 0 5px; }
.history-periods p { margin:0; color:var(--muted); font-size:.88rem; }
.history-mobile-toggle { display:none; }
.history-scrim { display:none; }

@media (max-width:900px) {
  .history-page { width:100%; }
  .history-mobile-toggle { display:flex; align-items:center; gap:9px; margin-bottom:14px; padding:10px 14px; border:1px solid var(--line); border-radius:14px; background:#fff; color:var(--text); font-weight:750; box-shadow:var(--shadow-xs); }
  .history-layout,.history-layout.is-collapsed { grid-template-columns:1fr; gap:0; }
  .history-sidebar { position:fixed; z-index:5200; inset:0 auto 0 0; width:min(290px,86vw); height:100vh; max-height:none; border:0; border-radius:0; transform:translateX(-105%); transition:transform .22s ease; }
  .history-sidebar.is-open { transform:translateX(0); }
  .history-collapse { display:none; }
  .history-layout.is-collapsed .history-sidebar { padding:16px 14px; }
  .history-layout.is-collapsed .history-brand span,.history-layout.is-collapsed .history-nav strong,.history-layout.is-collapsed .history-back { display:block; }
  .history-layout.is-collapsed .history-nav a { grid-template-columns:28px minmax(0,1fr); justify-items:stretch; }
  .history-scrim.is-open { position:fixed; z-index:5100; inset:0; display:block; border:0; background:rgba(15,23,42,.38); backdrop-filter:blur(3px); }
}
@media (max-width:620px) {
  .history-periods { grid-template-columns:1fr; }
  .history-periods article:nth-child(even) { padding-left:0; border-left:0; }
}

/* Liña do tempo panorámica */
.timeline-game { grid-template-columns:minmax(0,1fr); grid-template-rows:auto minmax(0,1fr); }
.timeline-bank-panel { border-right:0; border-bottom:1px solid rgba(15,40,52,.12); background:radial-gradient(circle at 12% 15%,rgba(255,255,255,.95),transparent 24%),linear-gradient(110deg,#e8f7f1 0%,#f4fbf8 46%,#edf5f3 100%); padding:.9rem 1.25rem 1rem; }
.timeline-bank-panel .panel-heading { align-items:center; margin-bottom:.65rem; }
.timeline-bank-panel .panel-heading p { margin:0; max-width:none; }
.timeline-bank-panel .term-bank { display:flex; flex-wrap:nowrap; gap:.62rem; overflow-x:auto; overflow-y:hidden; min-height:58px; padding:.18rem .1rem .55rem; scroll-snap-type:x proximity; scrollbar-color:#229a7d rgba(20,75,66,.08); }
.timeline-bank-panel .term-chip { flex:0 0 164px; min-height:48px; margin:0; scroll-snap-align:start; box-shadow:0 5px 14px rgba(16,61,53,.08); }
.timeline-dates-panel { display:flex; min-height:0; padding:0; overflow:hidden; background:#f7faf9; }
.timeline-dates-panel .panel-heading { flex:0 0 auto; padding:.75rem 1.25rem; margin:0; border-bottom:1px solid rgba(15,40,52,.1); background:rgba(255,255,255,.9); }
.timeline-feedback { margin-left:auto; color:#47605c; font-size:.86rem; font-weight:800; text-align:right; }
.timeline-feedback:not(:empty) { display:block; padding:.42rem .72rem; border-radius:999px; background:#eef4f2; }
.timeline-feedback.is-success { color:#0f7548; background:#d9f8e6; }
.timeline-feedback.is-warning { color:#a54c12; background:#fff0dc; }
.timeline-dates-panel .timeline-grid { position:relative; display:block; flex:1 1 auto; min-height:0; padding:0; overflow:auto hidden; cursor:grab; overscroll-behavior-x:contain; touch-action:pan-y; scrollbar-width:auto; scrollbar-color:#2b9c82 #dde9e6; }
.timeline-dates-panel .timeline-grid::-webkit-scrollbar,.timeline-bank-panel .term-bank::-webkit-scrollbar { height:12px; }
.timeline-dates-panel .timeline-grid::-webkit-scrollbar-track,.timeline-bank-panel .term-bank::-webkit-scrollbar-track { background:#dfeae7; border-radius:999px; }
.timeline-dates-panel .timeline-grid::-webkit-scrollbar-thumb,.timeline-bank-panel .term-bank::-webkit-scrollbar-thumb { background:linear-gradient(90deg,#14745f,#35af90); border:3px solid #dfeae7; border-radius:999px; }
.timeline-dates-panel .timeline-grid.is-panning { cursor:grabbing; user-select:none; }
.chronology-board { position:relative; height:100%; min-height:345px; overflow:hidden; background:linear-gradient(rgba(24,92,79,.038) 1px,transparent 1px),linear-gradient(90deg,rgba(24,92,79,.038) 1px,transparent 1px),radial-gradient(circle at 48% 28%,rgba(247,212,104,.12),transparent 31%),linear-gradient(180deg,#fbfdfc 0%,#f2f8f6 100%); background-size:28px 28px,28px 28px,auto,auto; }
.chronology-board::before { content:attr(data-hint); position:absolute; top:111px; left:82px; z-index:1; color:rgba(17,78,67,.45); font-size:.68rem; font-weight:900; letter-spacing:.12em; pointer-events:none; }
.chronology-eras,.chronology-context,.chronology-ticks { position:absolute; inset:0; pointer-events:none; }
.chronology-era { position:absolute; top:20px; height:72px; padding:.74rem .85rem; overflow:hidden; border-right:2px solid rgba(255,255,255,.84); color:#173d37; font-size:.74rem; font-weight:900; line-height:1.1; letter-spacing:.02em; text-transform:uppercase; }
.chronology-era::after { content:""; position:absolute; left:0; right:0; bottom:0; height:5px; background:currentColor; opacity:.3; }
.chronology-era:nth-child(5n + 1) { background:#efe2c9; color:#795527; }
.chronology-era:nth-child(5n + 2) { background:#d9ead8; color:#3b6c45; }
.chronology-era:nth-child(5n + 3) { background:#d7e9ec; color:#246476; }
.chronology-era:nth-child(5n + 4) { background:#e9dff1; color:#705084; }
.chronology-era:nth-child(5n) { background:#f2dfdf; color:#875054; }
.context-event { position:absolute; top:98px; width:140px; transform:translateX(-50%); color:#415653; text-align:center; }
.context-event::after { content:""; display:block; width:1px; height:13px; margin:.25rem auto 0; background:linear-gradient(rgba(44,118,101,.5),transparent); }
.context-event > span { display:grid; place-items:center; width:34px; height:34px; margin:0 auto .22rem; border:1px solid rgba(18,93,77,.16); border-radius:50%; background:rgba(255,255,255,.94); box-shadow:0 7px 18px rgba(22,73,64,.12); font-size:1.08rem; }
.context-event strong,.context-event small,.chronology-era strong,.chronology-era small { display:block; }
.context-event strong { color:#173f37; font-size:.64rem; }
.context-event small { margin-top:.08rem; font-size:.58rem; }
.chronology-era small { margin-top:.22rem; font-size:.62rem; opacity:.8; }
.chronology-axis { position:absolute; top:264px; left:68px; right:68px; height:6px; border-radius:999px; background:linear-gradient(90deg,#a67b43 0%,#298c76 42%,#176e8b 100%); box-shadow:0 2px 0 rgba(255,255,255,.85),0 7px 16px rgba(20,81,69,.14); pointer-events:none; }
.chronology-axis::after { content:""; position:absolute; top:-7px; right:-7px; width:0; height:0; border-top:10px solid transparent; border-bottom:10px solid transparent; border-left:18px solid #176e8b; }
.chronology-tick { position:absolute; top:243px; width:158px; transform:translateX(-50%); text-align:center; }
.chronology-tick i { display:block; width:13px; height:13px; margin:14px auto 8px; border:3px solid #fff; border-radius:50%; background:#1d7f69; box-shadow:0 0 0 2px #1d7f69; }
.chronology-tick span,.chronology-tick strong { display:block; }
.chronology-tick span { color:#6a7e7a; font-size:.64rem; font-weight:900; }
.chronology-tick strong { margin-top:.12rem; color:#163f37; font-size:.78rem; white-space:nowrap; }
.placed-marker { position:absolute; z-index:5; display:flex; align-items:center; justify-content:center; width:156px; min-height:54px; padding:.55rem .72rem; transform:translate(-50%,-50%); border:2px solid #216e60 !important; border-radius:14px !important; background:#fff !important; color:#163f37 !important; box-shadow:0 10px 24px rgba(20,72,63,.16) !important; cursor:grab; font-size:.77rem; font-weight:850; line-height:1.18; text-align:center; user-select:none; transition:border-color 160ms ease,background 160ms ease,box-shadow 160ms ease,transform 160ms ease; }
.placed-marker:hover { z-index:7; transform:translate(-50%,-50%) scale(1.04); box-shadow:0 13px 28px rgba(20,72,63,.22) !important; }
.placed-marker::after { content:""; position:absolute; bottom:-8px; left:calc(50% - 7px); width:12px; height:12px; transform:rotate(45deg); border-right:2px solid inherit; border-bottom:2px solid inherit; background:inherit; }
.placed-marker.is-correct { border-color:#159653 !important; background:#c9f5da !important; color:#0d6439 !important; box-shadow:0 0 0 4px rgba(21,150,83,.16),0 10px 24px rgba(20,72,63,.14) !important; }
.placed-marker.is-wrong { border-color:#dc681f !important; background:#ffe0bd !important; color:#8a3506 !important; box-shadow:0 0 0 4px rgba(220,104,31,.13),0 10px 24px rgba(20,72,63,.14) !important; animation:marker-nudge 280ms ease; }
@keyframes marker-nudge { 0%,100% { margin-left:0; } 35% { margin-left:-7px; } 70% { margin-left:7px; } }
.timeline-topbar .timeline-check { min-height:38px; padding:.55rem 1rem; border:0 !important; border-radius:999px !important; background:#11755f !important; color:#fff !important; box-shadow:0 6px 16px rgba(17,117,95,.2) !important; font-weight:900; }
.timeline-topbar .timeline-check:hover { background:#0c5c4b !important; }
@media (max-width:760px) {
  .timeline-bank-panel { padding-inline:.85rem; max-height:none; }
  .timeline-bank-panel .panel-heading p { display:none; }
  .timeline-bank-panel .term-bank { min-height:58px; }
  .timeline-bank-panel .term-chip { flex-basis:142px; }
  .timeline-dates-panel .panel-heading { padding-inline:.85rem; }
  .timeline-feedback { max-width:50%; font-size:.72rem; }
  .timeline-dates-panel .timeline-grid { overflow:auto hidden; }
  .chronology-board { height:100%; min-height:345px; }
}

/* A mesma franxa vertical en portada, catálogo e actividades */
body:has(> main .history-sidebar) { padding-left:235px; transition:padding-left .24s ease; }
.history-layout,.activity-screen .history-layout { display:block; height:auto; }
.history-page:not(.activity-screen) { padding-top:64px; }
.history-sidebar,.activity-screen .history-sidebar { position:fixed; z-index:4800; inset:0 auto 0 0; width:235px; height:100vh; max-height:none; }
.history-content { width:min(1180px,92%); }
body:has(.history-layout.is-collapsed) { padding-left:58px; }
.history-layout.is-collapsed .history-sidebar { width:58px; }
.timeline-workspace { height:100vh; }
@media (max-width:900px) {
  body:has(> main .history-sidebar),body:has(.history-layout.is-collapsed) { padding-left:0; }
  .history-sidebar,.activity-screen .history-sidebar,.history-layout.is-collapsed .history-sidebar { width:min(290px,86vw); }
  .history-content { width:min(1180px,92%); }
  .timeline-workspace { height:auto; }
}

.activity-catalog { padding-top:34px; }
.activity-catalog-hero { padding:clamp(30px,5vw,62px); border-radius:30px; background:linear-gradient(135deg,#172033,#25434a); color:#fff; box-shadow:0 20px 48px rgba(15,23,42,.16); }
.activity-catalog-hero h1 { margin:5px 0 10px; font-size:clamp(3rem,7vw,6.4rem); line-height:.9; letter-spacing:-.065em; }
.activity-catalog-hero p { max-width:62ch; margin:0; color:#d8e6e7; }
.activity-selector { display:grid; gap:14px; margin-top:24px; }
.activity-selector-card { position:relative; min-height:150px; display:grid; grid-template-columns:56px minmax(0,1fr) auto; align-items:center; gap:18px; padding:24px; border:1px solid rgba(15,23,42,.09); border-radius:24px; background:#fff; color:var(--text); text-decoration:none; box-shadow:0 10px 28px rgba(15,23,42,.055); }
.activity-selector-card.is-available { background:radial-gradient(circle at 88% 10%,rgba(45,212,191,.18),transparent 30%),#fff; transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease; }
.activity-selector-card.is-available:hover { transform:translateY(-3px); border-color:rgba(15,118,110,.24); box-shadow:0 18px 38px rgba(15,23,42,.1); }
.activity-selector-number { display:grid; place-items:center; width:52px; height:52px; border-radius:16px; background:#ccfbf1; color:#0f766e; font-size:.85rem; font-weight:900; }
.activity-selector-card small { color:#0f766e; font-size:.67rem; font-weight:850; letter-spacing:.09em; text-transform:uppercase; }
.activity-selector-card h2 { margin:4px 0 5px; font-size:clamp(1.35rem,2.5vw,2.15rem); letter-spacing:-.04em; }
.activity-selector-card p { margin:0; color:var(--muted); }
.activity-selector-arrow { display:grid; place-items:center; width:48px; height:48px; border-radius:50%; background:#202538; color:#fff; font-size:1.25rem; }
.activity-selector-card.is-pending { opacity:.58; background:#f5f7f7; }
@media (max-width:620px) {
  .activity-selector-card { grid-template-columns:46px minmax(0,1fr); padding:18px; }
  .activity-selector-number { width:44px; height:44px; }
  .activity-selector-arrow { display:none; }
}

.activities-header { padding:clamp(28px,5vw,58px); border-radius:32px; background:linear-gradient(135deg,#172033,#243a42); color:#fff; box-shadow:0 20px 48px rgba(15,23,42,.16); }
.activities-header h1 { margin:6px 0 10px; font-size:clamp(2.8rem,6vw,5.7rem); letter-spacing:-.06em; line-height:.94; }
.activities-header > p { max-width:62ch; margin:0; color:#d6e1e6; }
.activity-jump { display:flex; flex-wrap:wrap; gap:8px; margin-top:24px; }
.activity-jump a { display:flex; align-items:center; gap:8px; padding:9px 13px; border:1px solid rgba(255,255,255,.15); border-radius:999px; color:#72e1d1; font-size:.72rem; font-weight:850; text-decoration:none; }
.activity-jump a span { color:#fff; }
.activity-card { scroll-margin-top:88px; margin-top:28px; padding:clamp(22px,3.5vw,42px); border:1px solid rgba(15,23,42,.09); border-radius:30px; background:rgba(255,255,255,.86); box-shadow:0 15px 38px rgba(15,23,42,.06); }
.activity-heading > div { display:flex; align-items:center; gap:12px; }
.activity-number { display:grid; place-items:center; width:38px; height:38px; flex:0 0 38px; border-radius:12px; background:#ccfbf1; color:#0f766e; font-size:.72rem; font-weight:900; }
.activity-heading h2 { margin:0; font-size:clamp(1.45rem,2.6vw,2.4rem); letter-spacing:-.04em; }
.activity-heading > p { max-width:75ch; margin:12px 0 0; color:var(--muted-strong); }
.activity-toolbar { display:flex; align-items:center; gap:12px; margin-top:26px; padding-top:18px; border-top:1px solid var(--line); }
.activity-toolbar strong { margin-right:auto; }
.activity-toolbar button,.writing-footer button { padding:7px 11px; border:1px solid var(--line); border-radius:10px; background:#fff; color:var(--muted-strong); font:inherit; font-size:.76rem; font-weight:750; cursor:pointer; }
.activity-progress { color:#0f766e; font-size:.77rem; font-weight:850; }
.drag-help { margin:8px 0 0; color:var(--muted); font-size:.76rem; }
.term-bank { display:flex; flex-wrap:wrap; gap:7px; min-height:60px; margin-top:14px; padding:13px; border:1px dashed rgba(15,118,110,.3); border-radius:18px; background:#f3fbf9; }
.term-chip { padding:8px 11px; border:1px solid rgba(15,118,110,.2); border-radius:10px; background:#fff; color:#26333b; font:inherit; font-size:.76rem; font-weight:720; cursor:grab; box-shadow:0 3px 9px rgba(15,23,42,.05); }
.term-chip:hover,.term-chip.is-selected { border-color:#14b8a6; background:#ccfbf1; color:#115e59; transform:translateY(-1px); }
.term-chip.is-used { display:none; }
.timeline-table-wrap { margin-top:20px; overflow-x:auto; border:1px solid var(--line); border-radius:18px; }
.timeline-table { width:100%; min-width:930px; border-collapse:collapse; font-size:.76rem; }
.timeline-table th { padding:11px 9px; background:#202538; color:#fff; text-align:left; }
.timeline-table th:nth-child(1),.timeline-table th:nth-child(4),.timeline-table td:nth-child(1),.timeline-table td:nth-child(4) { width:42px; text-align:center; }
.timeline-table th:nth-child(2),.timeline-table th:nth-child(5),.timeline-table td:nth-child(2),.timeline-table td:nth-child(5) { width:120px; white-space:nowrap; }
.timeline-table td { padding:7px; border-top:1px solid var(--line); border-right:1px solid var(--line); }
.timeline-table tr:nth-child(even) td { background:rgba(248,250,252,.75); }
.drop-slot { width:100%; min-height:38px; padding:7px 9px; border:1px dashed #aab5be; border-radius:9px; background:#fff; color:#7b8790; font:inherit; font-size:.72rem; text-align:left; cursor:pointer; }
.drop-slot.is-over { border-color:#14b8a6; background:#ecfdf5; }
.drop-slot.is-correct { border-style:solid; border-color:#22c55e; background:#dcfce7; color:#166534; font-weight:800; }
.drop-slot.is-wrong,.era-drop.is-wrong { animation:wrong-shake .28s ease; border-color:#ef4444; background:#fef2f2; }
.activity-complete { margin:18px 0 0; padding:12px 15px; border-radius:12px; background:#dcfce7; color:#166534; font-weight:850; }
.era-bank { margin-bottom:18px; }
.era-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.era-drop { min-height:140px; padding:16px; border:1px dashed #9aa7b0; border-radius:17px; background:#f8fafc; }
.era-drop.is-over { border-color:#14b8a6; background:#ecfdf5; }
.era-drop h3 { margin:0 0 4px; font-size:1rem; }
.era-drop > p { margin:0; color:var(--muted); font-size:.73rem; }
.era-accepted { display:flex; flex-wrap:wrap; gap:6px; margin-top:12px; }
.era-answer { padding:6px 8px; border-radius:8px; background:#dcfce7; color:#166534; font-size:.7rem; font-weight:800; }
.writing-list { display:grid; gap:10px; margin-top:24px; }
.writing-list label { display:grid; grid-template-columns:minmax(0,1fr) minmax(180px,32%); align-items:center; gap:16px; padding:14px 0; border-bottom:1px solid var(--line); }
.writing-list label span { line-height:1.45; }
.writing-list input { width:100%; padding:11px 13px; border:1px solid #b8c0c7; border-radius:11px; background:#fff; font:inherit; outline:none; transition:border-color .18s ease,background .18s ease,box-shadow .18s ease; }
.writing-list input:focus { border-color:#14b8a6; box-shadow:0 0 0 3px rgba(20,184,166,.12); }
.writing-list input.is-correct { border-color:#22c55e; background:#dcfce7; color:#166534; font-weight:800; }
.writing-list input.is-wrong { border-color:#ef4444; background:#fef2f2; }
.writing-footer { display:flex; justify-content:flex-end; align-items:center; gap:12px; margin-top:16px; }
@keyframes wrong-shake { 25%{transform:translateX(-3px)} 75%{transform:translateX(3px)} }
@media (max-width:720px) {
  .activity-card { padding:20px 16px; border-radius:22px; }
  .era-grid { grid-template-columns:1fr; }
  .writing-list label { grid-template-columns:1fr; gap:8px; }
  .activity-toolbar { flex-wrap:wrap; }
}
@media (prefers-reduced-motion:reduce) { .drop-slot.is-wrong,.era-drop.is-wrong { animation:none; } }

/* Actividade cronolóxica a pantalla completa */
body.history-activity-fullscreen { overflow:hidden; background:#eef3f2; }
body.history-activity-fullscreen > .navbar,
body.history-activity-fullscreen > footer { display:none !important; }
.activity-screen { height:100vh; overflow:hidden; }
.activity-screen .history-layout { height:100vh; grid-template-columns:235px minmax(0,1fr); }
.activity-screen .history-sidebar { top:0; height:100vh; }
.timeline-workspace { min-width:0; height:100vh; display:grid; grid-template-rows:auto minmax(0,1fr); overflow:hidden; }
.timeline-workspace-head { display:flex; align-items:center; justify-content:space-between; gap:28px; padding:20px clamp(22px,3vw,46px); border-bottom:1px solid rgba(15,23,42,.09); background:rgba(255,255,255,.94); }
.timeline-workspace-head h1 { margin:3px 0 4px; font-size:clamp(1.8rem,3vw,3rem); line-height:1; letter-spacing:-.05em; }
.timeline-workspace-head p { max-width:64ch; margin:0; color:var(--muted); font-size:.83rem; }
.timeline-actions { display:flex; align-items:center; gap:12px; flex:0 0 auto; }
.timeline-actions .activity-progress { display:grid; place-items:center; min-width:72px; padding:11px 14px; border-radius:14px; background:#ccfbf1; color:#0f766e; font-size:.9rem; }
.timeline-actions button { padding:11px 15px; border:1px solid var(--line); border-radius:13px; background:#fff; color:var(--text); font:inherit; font-size:.78rem; font-weight:800; cursor:pointer; }
.timeline-game { min-height:0; display:grid; grid-template-columns:minmax(240px,300px) minmax(0,1fr); gap:0; overflow:hidden; }
.timeline-bank-panel,.timeline-dates-panel { min-height:0; display:flex; flex-direction:column; }
.timeline-bank-panel { border-right:1px solid rgba(15,23,42,.09); background:#f8fbfa; }
.timeline-dates-panel { background:#edf3f2; }
.timeline-panel-title { display:flex; align-items:center; gap:10px; padding:15px 18px; border-bottom:1px solid rgba(15,23,42,.08); background:rgba(255,255,255,.7); }
.timeline-panel-title > span { display:grid; place-items:center; width:32px; height:32px; border-radius:10px; background:#ccfbf1; color:#0f766e; }
.timeline-panel-title strong,.timeline-panel-title small { display:block; }
.timeline-panel-title strong { font-size:.82rem; }
.timeline-panel-title small { margin-top:1px; color:var(--muted); font-size:.66rem; }
.timeline-bank-panel .term-bank { align-content:flex-start; flex:1; min-height:0; margin:0; padding:14px; overflow:auto; border:0; border-radius:0; background:transparent; }
.timeline-bank-panel .term-chip { flex:1 1 118px; min-height:42px; display:grid; place-items:center; text-align:center; border-color:rgba(15,118,110,.17); background:#fff; }
body.site-subpage .timeline-bank-panel .term-chip { border:1px solid rgba(15,118,110,.18) !important; border-radius:12px !important; background:#fff !important; color:#26333b !important; box-shadow:0 3px 10px rgba(15,23,42,.055) !important; }
body.site-subpage .timeline-bank-panel .term-chip:hover,
body.site-subpage .timeline-bank-panel .term-chip.is-selected { border-color:#14b8a6 !important; background:#ccfbf1 !important; color:#115e59 !important; }
.timeline-dates-panel .timeline-grid { flex:1; min-height:0; display:grid; grid-template-columns:repeat(3,minmax(210px,1fr)); gap:10px; align-content:start; padding:14px; overflow:auto; }
.timeline-date-card { position:relative; min-width:0; display:grid; grid-template-columns:36px minmax(0,1fr); grid-template-rows:auto auto; gap:5px 10px; padding:11px; border:1px solid rgba(15,23,42,.09); border-radius:15px; background:#fff; box-shadow:0 5px 16px rgba(15,23,42,.045); }
.timeline-date-number { grid-row:1 / span 2; display:grid; place-items:center; width:34px; height:34px; align-self:center; border-radius:10px; background:#e8edef; color:#52606a; font-size:.7rem; font-weight:900; }
.timeline-date-label { color:#17252a; font-size:.8rem; font-weight:850; letter-spacing:-.01em; }
.timeline-date-card .drop-slot { min-height:35px; padding:6px 9px; white-space:normal; }
body.site-subpage .timeline-date-card .drop-slot { min-height:35px !important; padding:6px 9px !important; border:1px dashed #aab5be !important; border-radius:9px !important; background:#f8fafc !important; color:#748089 !important; box-shadow:none !important; }
body.site-subpage .timeline-date-card .drop-slot.is-over { border-color:#14b8a6 !important; background:#ecfdf5 !important; }
body.site-subpage .timeline-date-card .drop-slot.is-correct { border-style:solid !important; border-color:#22c55e !important; background:#dcfce7 !important; color:#166534 !important; font-weight:850 !important; }
body.site-subpage .timeline-date-card .drop-slot.is-wrong { border-color:#ef4444 !important; background:#fef2f2 !important; }
.timeline-date-card:has(.drop-slot.is-correct) { border-color:#4ade80; background:linear-gradient(135deg,#f0fdf4,#dcfce7); box-shadow:0 7px 18px rgba(34,197,94,.12); }
.timeline-date-card:has(.drop-slot.is-correct) .timeline-date-number { background:#22c55e; color:#fff; }
.timeline-dates-panel .activity-complete { flex:0 0 auto; margin:0 14px 14px; }

@media (max-width:1180px) {
  .timeline-dates-panel .timeline-grid { grid-template-columns:repeat(2,minmax(210px,1fr)); }
}
@media (max-width:900px) {
  body.history-activity-fullscreen { overflow:auto; }
  .activity-screen,.activity-screen .history-layout,.timeline-workspace { height:auto; min-height:100vh; overflow:visible; }
  .activity-screen .history-layout { grid-template-columns:1fr; }
  .activity-screen .history-mobile-toggle { position:fixed; z-index:5000; top:10px; left:10px; margin:0; background:#202538; color:#fff; border-color:transparent; }
  .timeline-workspace-head { padding:68px 18px 18px; align-items:flex-end; }
  .timeline-game { grid-template-columns:1fr; overflow:visible; }
  .timeline-bank-panel { max-height:310px; border-right:0; border-bottom:1px solid var(--line); }
  .timeline-bank-panel .term-bank { min-height:180px; }
  .timeline-dates-panel .timeline-grid { overflow:visible; }
}
@media (max-width:620px) {
  .timeline-workspace-head { display:block; }
  .timeline-actions { margin-top:14px; }
  .timeline-dates-panel .timeline-grid { grid-template-columns:1fr; padding:10px; }
  .timeline-date-card { border-radius:13px; }
}

/* Overrides finais da actividade panorámica (despois dos estilos herdados). */
.timeline-game { grid-template-columns:minmax(0,1fr); grid-template-rows:auto minmax(0,1fr); }
.timeline-bank-panel { max-height:none; border-right:0; border-bottom:1px solid rgba(15,40,52,.12); padding:.9rem 1.25rem 1rem; }
.timeline-bank-panel .term-bank { display:flex; flex-wrap:nowrap; grid-template-columns:none; min-height:58px; overflow-x:auto; overflow-y:hidden; }
.timeline-bank-panel .term-chip { flex:0 0 164px; }
.timeline-dates-panel { display:flex; padding:0; overflow:hidden; }
.timeline-dates-panel .timeline-grid { position:relative; display:block; flex:1 1 auto; min-height:0; padding:0; overflow:auto hidden; }
@media (max-width:900px) {
  body.history-activity-fullscreen { overflow:hidden; }
  .activity-screen,.activity-screen .history-layout,.timeline-workspace { height:100vh; min-height:0; overflow:hidden; }
  .timeline-game { overflow:hidden; }
  .timeline-bank-panel { max-height:none; }
  .timeline-bank-panel .term-bank { min-height:58px; }
  .timeline-dates-panel .timeline-grid { overflow:auto hidden; }
}
@media (max-width:620px) {
  .timeline-dates-panel .timeline-grid { display:block; padding:0; }
}

/* Panel completo de fichas ilustradas e destinos de solta visibles. */
.timeline-workspace-head { padding:14px clamp(20px,2.5vw,38px); }
.timeline-workspace-head h1 { font-size:clamp(1.75rem,2.5vw,2.55rem); }
.timeline-workspace-head p { font-size:.78rem; }
.timeline-bank-panel { padding:.62rem .9rem .72rem; }
.timeline-bank-panel .panel-heading { display:none; }
.timeline-bank-panel > .timeline-panel-title { display:none; }
.timeline-bank-panel .term-bank {
  display:grid;
  grid-auto-flow:column;
  grid-template-rows:repeat(3,60px);
  grid-auto-columns:minmax(104px,1fr);
  gap:6px;
  min-height:192px;
  padding:0;
  overflow-x:auto;
  overflow-y:hidden;
}
body.site-subpage .timeline-bank-panel .term-chip {
  width:100%;
  min-width:0;
  min-height:60px;
  display:grid;
  grid-template-columns:30px minmax(0,1fr);
  align-items:center;
  gap:6px;
  padding:5px 7px !important;
  border-color:rgba(22,105,89,.15) !important;
  border-radius:13px !important;
  background:linear-gradient(145deg,#fff,#f6fbf9) !important;
  box-shadow:0 4px 12px rgba(15,70,60,.07) !important;
  text-align:left;
}
body.site-subpage .timeline-bank-panel .term-chip > span {
  display:grid;
  place-items:center;
  width:29px;
  height:29px;
  border:1px solid rgba(22,105,89,.12);
  border-radius:50%;
  background:#e7f7f2;
  box-shadow:inset 0 1px 0 #fff;
  font-size:1rem;
}
body.site-subpage .timeline-bank-panel .term-chip > strong {
  min-width:0;
  font-size:.65rem;
  font-weight:850;
  line-height:1.1;
  overflow-wrap:anywhere;
}
body.site-subpage .timeline-bank-panel .term-chip:hover,
body.site-subpage .timeline-bank-panel .term-chip.is-selected {
  transform:translateY(-2px);
  border-color:#18a78b !important;
  background:linear-gradient(145deg,#d6fff4,#ecfff9) !important;
  box-shadow:0 7px 16px rgba(16,132,106,.14) !important;
}
.chronology-axis { top:235px; }
.chronology-tick { top:214px; }
.chronology-drop-zone {
  position:absolute;
  z-index:2;
  top:287px;
  display:grid;
  grid-template-columns:32px minmax(0,1fr);
  grid-template-rows:auto auto;
  align-items:center;
  column-gap:7px;
  width:156px;
  min-height:62px;
  padding:7px 9px;
  transform:translateX(-50%);
  border:2px dashed #75a99d;
  border-radius:14px;
  background:repeating-linear-gradient(135deg,rgba(255,255,255,.86) 0,rgba(255,255,255,.86) 8px,rgba(226,242,237,.82) 8px,rgba(226,242,237,.82) 16px);
  color:#42655e;
  box-shadow:inset 0 0 0 3px rgba(255,255,255,.6);
  pointer-events:none;
  transition:transform .16s ease,border-color .16s ease,background .16s ease,box-shadow .16s ease;
}
.chronology-drop-zone > span {
  grid-row:1 / span 2;
  display:grid;
  place-items:center;
  width:31px;
  height:31px;
  border-radius:50%;
  background:#dceee9;
  color:#187a65;
  font-size:1.15rem;
  font-weight:900;
}
.chronology-drop-zone strong,.chronology-drop-zone small { display:block; }
.chronology-drop-zone strong { align-self:end; font-size:.68rem; font-weight:900; line-height:1; }
.chronology-drop-zone small { align-self:start; margin-top:3px; color:#71847f; font-size:.58rem; font-weight:750; }
.chronology-drop-zone.is-over {
  transform:translateX(-50%) scale(1.08);
  border-style:solid;
  border-color:#10a681;
  background:#d9fff3;
  box-shadow:0 0 0 5px rgba(16,166,129,.14),0 10px 24px rgba(16,100,82,.16);
}
.chronology-drop-zone.is-occupied {
  border-color:transparent;
  background:transparent;
  box-shadow:none;
}
.chronology-drop-zone.is-occupied > * { opacity:0; }
.chronology-drop-zone.is-partial { opacity:.38; }
.placed-marker {
  min-height:62px;
  display:grid;
  grid-template-columns:36px minmax(0,1fr);
  gap:7px;
  padding:7px 9px;
}
.placed-marker > span {
  display:grid;
  place-items:center;
  width:35px;
  height:35px;
  border-radius:50%;
  background:#e0f4ee;
  font-size:1.15rem;
}
.placed-marker > strong { font-size:.7rem; line-height:1.08; }
@media (max-width:900px) {
  .timeline-workspace-head { padding:62px 14px 10px; }
  .timeline-bank-panel { padding:.5rem .65rem .6rem; }
  .timeline-bank-panel .term-bank { grid-auto-columns:104px; min-height:192px; }
}

/* Cabeceira mínima e fichas colocadas co aspecto dos fitos históricos. */
.timeline-workspace-head { min-height:72px; padding:12px clamp(20px,2.5vw,38px); }
.timeline-workspace-head h1 { margin:0; font-size:clamp(1.65rem,2.35vw,2.35rem); }
.chronology-board::before { display:none; }
body.site-subpage .placed-marker {
  width:140px;
  min-height:66px !important;
  display:grid;
  grid-template-columns:1fr;
  grid-template-rows:36px auto;
  justify-items:center;
  gap:4px;
  padding:0 !important;
  border:0 !important;
  border-radius:0 !important;
  background:transparent !important;
  color:#173f37 !important;
  box-shadow:none !important;
  transform:translate(-50%,-50%) !important;
}
body.site-subpage .placed-marker::after { display:none; }
body.site-subpage .placed-marker > span {
  display:grid;
  place-items:center;
  width:34px;
  height:34px;
  border:1px solid rgba(18,93,77,.16);
  border-radius:50%;
  background:rgba(255,255,255,.96);
  box-shadow:0 7px 18px rgba(22,73,64,.14);
  font-size:1.08rem;
}
body.site-subpage .placed-marker > strong {
  max-width:132px;
  color:#173f37;
  font-size:.64rem;
  font-weight:850;
  line-height:1.08;
  text-align:center;
}
body.site-subpage .placed-marker:hover {
  transform:translate(-50%,-50%) scale(1.06) !important;
  background:transparent !important;
  box-shadow:none !important;
}
body.site-subpage .placed-marker.is-correct,
body.site-subpage .placed-marker.is-wrong {
  border:0 !important;
  background:transparent !important;
  box-shadow:none !important;
}
body.site-subpage .placed-marker.is-correct > span {
  border-color:#159653;
  background:#c9f5da;
  box-shadow:0 0 0 4px rgba(21,150,83,.16),0 7px 18px rgba(22,73,64,.14);
}
body.site-subpage .placed-marker.is-correct > strong { color:#0d6439; }
body.site-subpage .placed-marker.is-wrong > span {
  border-color:#dc681f;
  background:#ffe0bd;
  box-shadow:0 0 0 4px rgba(220,104,31,.13),0 7px 18px rgba(22,73,64,.14);
}
body.site-subpage .placed-marker.is-wrong > strong { color:#8a3506; }
.timeline-drag-preview {
  position:fixed;
  z-index:99999;
  top:-200px;
  left:-200px;
  width:140px;
  display:grid;
  grid-template-rows:36px auto;
  justify-items:center;
  gap:4px;
  color:#173f37;
  text-align:center;
  pointer-events:none;
}
.timeline-drag-preview > span {
  display:grid;
  place-items:center;
  width:34px;
  height:34px;
  border:1px solid rgba(18,93,77,.16);
  border-radius:50%;
  background:#fff;
  box-shadow:0 7px 18px rgba(22,73,64,.18);
  font-size:1.08rem;
}
.timeline-drag-preview > strong { max-width:132px; font-size:.64rem; line-height:1.08; }
@media (max-width:900px) {
  .timeline-workspace-head { min-height:68px; padding:56px 14px 9px; }
  .timeline-workspace-head h1 { font-size:1.55rem; }
  .timeline-actions { gap:7px; }
}

/* Lixeiro aumento de escala no lenzo, mantendo os 190 px entre fitos. */
.context-event { width:150px; }
.context-event > span { width:40px; height:40px; font-size:1.28rem; }
.context-event strong { font-size:.69rem; line-height:1.08; }
.context-event small { margin-top:.12rem; font-size:.61rem; }
.chronology-tick span { font-size:.68rem; }
.chronology-tick strong { font-size:.82rem; }
.chronology-drop-zone strong { font-size:.72rem; }
.chronology-drop-zone small { font-size:.61rem; }
body.site-subpage .placed-marker {
  width:150px;
  min-height:76px !important;
  grid-template-rows:42px auto;
  gap:5px;
}
body.site-subpage .placed-marker > span {
  width:40px;
  height:40px;
  font-size:1.28rem;
}
body.site-subpage .placed-marker > strong {
  max-width:144px;
  font-size:.7rem;
  line-height:1.1;
}
.timeline-drag-preview { width:150px; grid-template-rows:42px auto; gap:5px; }
.timeline-drag-preview > span { width:40px; height:40px; font-size:1.28rem; }
.timeline-drag-preview > strong { max-width:144px; font-size:.7rem; line-height:1.1; }

/* Banco limpo e axudas individuais da actividade cronolóxica. */
.timeline-bank-panel .term-chip[hidden] { display:none !important; }
.chronology-board { min-height:430px; }
.chronology-solution {
  position:absolute;
  z-index:8;
  top:360px;
  width:170px;
  display:grid;
  justify-items:center;
  gap:5px;
  transform:translateX(-50%);
  text-align:center;
}
.chronology-solution-toggle {
  min-height:28px;
  padding:5px 9px;
  border:1px solid #b9c8c4;
  border-radius:7px;
  background:rgba(255,255,255,.94);
  color:#425d57;
  box-shadow:0 3px 9px rgba(22,63,55,.07);
  font:inherit;
  font-size:.58rem;
  font-weight:850;
  cursor:pointer;
}
.chronology-solution-toggle:hover { border-color:#4d8175; background:#eef8f5; }
.chronology-solution-text {
  max-width:170px;
  padding:6px 8px;
  border-left:3px solid #317b6a;
  background:#fff;
  color:#233d37;
  box-shadow:0 5px 14px rgba(20,61,53,.1);
  font-size:.62rem;
  font-weight:800;
  line-height:1.2;
}
