.dynasty-timeline-page {
  background:
    radial-gradient(circle at top left, rgba(38, 92, 126, 0.1), transparent 28%),
    radial-gradient(circle at top right, rgba(178, 124, 54, 0.1), transparent 26%),
    linear-gradient(180deg, #f8f4ea 0%, #f1eadf 56%, #e8dece 100%);
}

.dynasty-timeline-page .hero-copy,
.dynasty-timeline-page .controls-panel,
.dynasty-timeline-page .panel,
.work-panel {
  background: rgba(255, 252, 247, 0.95);
  border-color: rgba(147, 128, 96, 0.16);
  box-shadow: 0 16px 34px rgba(48, 43, 34, 0.08);
}

.dynasty-timeline-page .hero h1,
.dynasty-timeline-page .panel-head h2,
.work-panel h2 {
  font-family: "EB Garamond", Georgia, serif;
}

.dynasty-test-hero {
  align-items: start;
  margin-bottom: 18px;
}

.dynasty-test-hero .hero-copy {
  padding: 24px 34px;
}

.dynasty-test-hero h1 {
  max-width: none;
  font-size: clamp(2.6rem, 4vw, 4.2rem);
  line-height: 0.94;
}

.dynasty-test-hero .hero-text {
  max-width: 70ch;
  margin-top: 12px;
}

.dynasty-test-controls {
  justify-content: flex-start;
  gap: 12px;
  padding: 24px 26px;
}

.dynasty-test-controls .result-message,
.dynasty-test-controls .timeline-legend {
  display: none;
}

.phase-pill {
  width: fit-content;
  padding: 7px 12px;
  border-radius: 999px;
  color: #173f5f;
  background: #e1edf4;
  border: 1px solid rgba(37, 88, 124, 0.2);
  font-size: 0.84rem;
  font-weight: 800;
}

.timeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.legend-sample {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.88rem;
  font-weight: 800;
}

.legend-sample-period {
  color: #173f5f;
  background: linear-gradient(180deg, #dcecf4, #b8d1e1);
  border-color: rgba(37, 88, 124, 0.2);
}

.legend-sample-event {
  color: #6b4217;
  background: linear-gradient(180deg, #f5e0bd, #e7bd81);
  border-color: rgba(157, 106, 40, 0.22);
}

.legend-sample-bonus {
  color: #4f4b44;
  background: linear-gradient(180deg, #ece8df, #d7d0c2);
  border-color: rgba(103, 95, 82, 0.2);
}

.timeline-panel,
.source-panel,
.bonus-panel,
.phase-two-layout {
  margin-top: 22px;
}

.phase-instruction {
  max-width: 80ch;
  margin: 8px 0 0;
  color: #5f584d;
  font-weight: 600;
}

.active-question {
  margin: 18px 0 12px;
  padding: 12px 16px;
  border-radius: 14px;
  color: #173f5f;
  background: rgba(220, 236, 244, 0.72);
  border: 1px solid rgba(37, 88, 124, 0.16);
  font-weight: 800;
}

.timeline-scroll {
  overflow-x: auto;
  padding: 10px 2px 14px;
  scrollbar-color: rgba(99, 112, 112, 0.42) transparent;
}

.timeline-stage {
  min-width: 1120px;
  display: grid;
  grid-template-rows: 22px auto;
  gap: 12px;
  padding: 12px 8px 6px;
}

.axis-line {
  position: relative;
  min-height: 22px;
}

.axis-line::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 2px;
  right: 2px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, #7b8f9a, #2d5c79 48%, #8a713f);
}

.axis-line::after {
  content: "";
  position: absolute;
  top: 5px;
  right: 0;
  width: 13px;
  height: 13px;
  border-top: 3px solid #8a713f;
  border-right: 3px solid #8a713f;
  transform: rotate(45deg);
}

.timeline-track {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.timeline-segment {
  position: relative;
  min-width: 108px;
  min-height: 142px;
  display: grid;
  grid-template-rows: auto minmax(76px, auto);
  gap: 9px;
  padding: 10px;
  border-radius: 16px;
  border: 1px dashed rgba(147, 128, 96, 0.34);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.48), rgba(247, 242, 234, 0.88));
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.timeline-segment.short {
  flex: 0.75;
}

.timeline-segment.medium {
  flex: 1.15;
}

.timeline-segment.medium-long {
  flex: 1.45;
}

.timeline-segment.very-long {
  flex: 2.2;
}

.timeline-segment.active {
  border-color: rgba(37, 88, 124, 0.54);
  background: linear-gradient(180deg, rgba(231, 243, 249, 0.98), rgba(244, 247, 248, 0.98));
  box-shadow: 0 0 0 3px rgba(37, 88, 124, 0.12);
}

.timeline-panel.phase-two .timeline-segment {
  min-height: 124px;
  opacity: 0.86;
}

.timeline-panel.phase-two .timeline-segment.active {
  opacity: 1;
  border-color: rgba(30, 83, 121, 0.58);
  background: linear-gradient(180deg, rgba(225, 239, 247, 0.98), rgba(247, 250, 251, 0.98));
  box-shadow: 0 0 0 3px rgba(30, 83, 121, 0.13), 0 14px 28px rgba(48, 43, 34, 0.08);
}

.timeline-panel.phase-two .timeline-segment[data-state="active"]::before {
  content: "Teď doplň";
  position: absolute;
  top: -13px;
  left: 10px;
  z-index: 1;
  padding: 4px 9px;
  border-radius: 999px;
  color: #173f5f;
  background: #dcecf4;
  border: 1px solid rgba(37, 88, 124, 0.22);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.timeline-panel.phase-two .timeline-segment[data-state="locked"] {
  border-color: rgba(147, 128, 96, 0.22);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(247, 242, 234, 0.78));
}

.timeline-segment.completed {
  opacity: 0.96;
  border-color: rgba(47, 125, 85, 0.22);
  background: linear-gradient(180deg, rgba(247, 252, 249, 0.98), rgba(241, 248, 244, 0.94));
}

.timeline-segment.completed::after {
  content: "hotovo ✓";
  position: absolute;
  top: 14px;
  right: 14px;
  min-height: 0;
  width: 8px;
  height: 8px;
  padding: 0;
  border-radius: 999px;
  overflow: hidden;
  color: transparent;
  background: rgba(47, 125, 85, 0.52);
  border: 0;
  font-size: 0;
}

.timeline-segment.completed::after {
  content: "";
}

.timeline-segment.drag-over,
.phase-dropzone.drag-over,
.token-bank.drag-over {
  border-color: rgba(37, 88, 124, 0.48);
  transform: translateY(-1px);
}

.timeline-segment.filled {
  border-style: solid;
  border-color: rgba(37, 88, 124, 0.22);
}

.timeline-segment.wrong,
.phase-dropzone.wrong {
  border-color: rgba(185, 71, 58, 0.46);
  box-shadow: 0 0 0 3px rgba(185, 71, 58, 0.1);
}

.segment-date {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 10px;
  color: #6a5e4d;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(147, 128, 96, 0.14);
  font-size: 0.8rem;
  font-weight: 800;
  text-align: center;
}

.period-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 76px;
}

.phase-two-layout.is-hidden,
.bonus-panel.is-hidden {
  display: none;
}

.work-panel {
  padding: 22px;
  border: 1px solid rgba(147, 128, 96, 0.16);
  border-radius: 18px;
}

.work-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.work-panel h2 {
  margin: 0;
  color: #173f5f;
  font-size: clamp(1.6rem, 3vw, 2.15rem);
}

.work-dates {
  margin: 4px 0 0;
  color: #6a5e4d;
  font-weight: 800;
}

.work-progress {
  min-width: 64px;
  padding: 8px 12px;
  border-radius: 999px;
  color: #6a5e4d;
  background: rgba(238, 232, 221, 0.78);
  border: 1px solid rgba(147, 128, 96, 0.14);
  text-align: center;
  font-weight: 800;
}

.work-instruction,
.work-note {
  max-width: 74ch;
  color: #5f584d;
  font-weight: 600;
}

.work-note {
  min-height: 1.3em;
  margin: 14px 0 0;
  color: #7b6140;
  font-size: 0.93rem;
}

.work-drop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.work-drop-card {
  display: grid;
  gap: 8px;
}

.work-drop-label {
  color: #725d3d;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.phase-dropzone {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border-radius: 14px;
  border: 1px dashed rgba(157, 106, 40, 0.36);
  background: rgba(255, 248, 236, 0.7);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.phase-dropzone::before {
  content: "Přetáhni kartičku sem";
  color: rgba(104, 75, 39, 0.5);
  font-size: 0.88rem;
  font-weight: 800;
}

.phase-dropzone.filled::before {
  content: "";
}

.token-bank {
  min-height: 132px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  border: 1px dashed rgba(147, 128, 96, 0.28);
  background: rgba(255, 255, 255, 0.36);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.timeline-token {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  cursor: grab;
  touch-action: none;
  user-select: none;
  box-shadow: 0 11px 22px rgba(48, 43, 34, 0.1);
  transition: transform 0.18s ease, box-shadow 0.18s ease, outline-color 0.18s ease;
}

.timeline-token:hover {
  transform: translateY(-1px);
  box-shadow: 0 15px 28px rgba(48, 43, 34, 0.13);
}

.timeline-token:active {
  cursor: grabbing;
}

.timeline-token[data-type="period"] {
  width: min(100%, 250px);
  min-height: 54px;
  padding: 10px 18px;
  border-radius: 999px;
  color: #163f5f;
  background: linear-gradient(180deg, #dcecf4, #b5cedf);
  border-color: rgba(37, 88, 124, 0.22);
}

.period-slot .timeline-token[data-type="period"] {
  width: 100%;
  min-height: 70px;
  border-radius: 14px;
}

.timeline-panel.phase-two .period-slot .timeline-token[data-type="period"] {
  min-height: 58px;
  padding: 9px 12px;
  font-size: 0.95rem;
  box-shadow: none;
}

.token-date {
  display: block;
  margin-top: 4px;
  font-size: 0.76rem;
  font-weight: 700;
  opacity: 0.82;
}

.timeline-token[data-type="milestone"] {
  width: min(100%, 226px);
  min-height: 46px;
  padding: 9px 12px;
  border-radius: 12px;
  color: #694017;
  background: linear-gradient(180deg, #f5e0bd, #e8be82);
  border-color: rgba(157, 106, 40, 0.24);
  font-size: 0.84rem;
}

.phase-dropzone .timeline-token[data-type="milestone"] {
  width: 100%;
  min-height: 58px;
}

.timeline-token.correct,
.timeline-segment.correct,
.phase-dropzone.correct {
  outline: 2px solid rgba(47, 125, 85, 0.22);
  border-color: rgba(47, 125, 85, 0.4);
  background-color: rgba(235, 246, 239, 0.68);
}

.timeline-token.incorrect,
.timeline-segment.incorrect,
.phase-dropzone.incorrect {
  outline: 2px solid rgba(185, 71, 58, 0.18);
  border-color: rgba(185, 71, 58, 0.38);
}

.bonus-panel {
  border-color: rgba(103, 95, 82, 0.2);
}

.bonus-question {
  margin: 0 0 8px;
  color: #504a40;
  font-weight: 800;
}

.bonus-note {
  margin: 0 0 14px;
  color: #70685d;
  font-size: 0.92rem;
  font-weight: 600;
}

.bonus-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.bonus-option {
  min-height: 42px;
  padding: 9px 13px;
  border-radius: 999px;
  border: 1px solid rgba(103, 95, 82, 0.22);
  color: #4f4b44;
  background: linear-gradient(180deg, #ece8df, #d7d0c2);
  font-weight: 800;
  cursor: pointer;
}

.bonus-option.correct {
  border-color: rgba(47, 125, 85, 0.42);
  box-shadow: 0 0 0 3px rgba(47, 125, 85, 0.14);
}

.bonus-option.incorrect {
  border-color: rgba(185, 71, 58, 0.44);
  box-shadow: 0 0 0 3px rgba(185, 71, 58, 0.12);
}

@media (max-width: 900px) {
  .work-drop-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .timeline-stage {
    min-width: 980px;
  }

  .timeline-segment {
    min-width: 96px;
    padding: 8px;
  }

  .work-panel {
    padding: 18px;
  }

  .work-panel-head {
    flex-direction: column;
  }

  .timeline-token[data-type="milestone"] {
    font-size: 0.78rem;
  }
}
