:root{--gap:12px;--card-bg:#fff;--card-border:#ddd}
body{font-family:system-ui,Segoe UI,Roboto,Helvetica,Arial,sans-serif;background:#f6f7f9;margin:0;padding:24px}
.wrapper{max-width:1200px;margin:0 auto}
h1{margin:0 0 16px}

/* Dashboard map */
.dashboard-map{position:relative;max-width:1400px;margin:0 auto}
.dashboard-map img{width:100%;display:block;border-radius:6px}
.hotspot{position:absolute;background:transparent;border:none;cursor:pointer}
.hotspot:focus{outline:2px solid #49a}

/* Example absolute positions (percent-based). Adjust as needed to match the real image. */
.hs-1{top:6%;left:4%;width:12%;height:18%}
.hs-2{top:6%;left:18%;width:12%;height:18%}
.hs-3{top:6%;left:32%;width:12%;height:18%}
.hs-4{top:6%;left:46%;width:12%;height:18%}
.hs-5{top:6%;left:60%;width:12%;height:18%}
.hs-6{top:6%;left:74%;width:12%;height:18%}
.hs-7{top:6%;left:88%;width:8%;height:18%}
.hs-8{top:36%;left:4%;width:12%;height:18%}
.hs-9{top:36%;left:18%;width:12%;height:18%}
.hs-10{top:36%;left:32%;width:12%;height:18%}
.hs-11{top:36%;left:46%;width:12%;height:18%}
.hs-12{top:36%;left:60%;width:12%;height:18%}
.hs-13{top:36%;left:74%;width:12%;height:18%}
.hs-14{top:36%;left:88%;width:8%;height:18%}
.hs-15{top:66%;left:4%;width:20%;height:28%}
.hs-16{top:66%;left:28%;width:20%;height:28%}
.hs-17{top:66%;left:56%;width:20%;height:28%}

#detail { /* use id selector to target the aside */}
.detail{position:fixed;right:24px;top:80px;width:420px;background:#fff;border:1px solid #ccc;padding:16px;border-radius:6px;box-shadow:0 6px 20px rgba(0,0,0,0.08);overflow:auto;max-height:calc(100vh - 96px);-webkit-overflow-scrolling:touch}
.detail.hidden{display:none}

/* When detail panel is open, prevent body from scrolling */
body.detail-open{overflow:hidden;height:100vh}
.back{display:inline-block;margin-bottom:8px}
#diagnosis{width:100%}

/* Scenario grid styles */
.scenario-grid-section{max-width:1200px;margin:28px auto}
.scenario-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:1rem;padding:1rem;align-items:stretch}
.sd-card{display:flex;flex-direction:column;background:#fff;border:1px solid rgba(0,0,0,0.06);border-radius:12px;overflow:hidden;transition:transform .15s ease,box-shadow .15s ease;box-shadow:0 4px 14px rgba(12,20,30,0.06);padding:1rem}
.sd-card:focus{outline:3px solid #3aa;outline-offset:2px}
.sd-card:hover{transform:translateY(-6px);box-shadow:0 18px 36px rgba(10,20,40,0.12);border-color:rgba(58,170,200,0.12)}
.sd-card__media{width:100%;overflow:hidden}
.sd-card-img{width:100%;height:140px;object-fit:cover;background:#eef;display:block}
.sd-card-body{padding:12px;flex:1 1 auto;display:flex;flex-direction:column}
.sd-card-title{margin:0 0 6px;font-size:1rem}
.sd-card-meta{font-size:0.85rem;color:#666;margin-bottom:8px}
.sd-card-text{margin-top:auto;color:#555;font-size:0.9rem}
.sd-card-footer{padding:12px;border-top:1px solid rgba(0,0,0,0.03);display:flex;justify-content:flex-end}

@media (max-width:768px){
	.sd-card{padding:0.75rem}
	.scenario-grid, #scenarioGrid{grid-template-columns:1fr;gap:0.75rem;padding:0.75rem}
		.sd-card-img{height:120px}
}

/* Normalize image heights and reduce on mobile */
.sd-card__media,
.sd-card-img{
	max-height:160px;
	object-fit:cover;
}

@media (max-width:768px){
	.sd-card__media,
	.sd-card-img{
		max-height:110px;
	}
}

/* Mobile friendly detail: full-width sheet */
@media (max-width:768px){
	.detail{left:0;right:0;top:0;bottom:0;width:100%;height:100vh;border-radius:0;padding:1rem;box-shadow:none;max-height:none}
	.detail #backBtn{position:sticky;top:0;z-index:10;background:transparent;padding:12px 0;margin:-12px 0 8px;border:none;text-align:left}
	.detail h2{margin-top:8px}
}

/* Make all cards equal height by letting grid items stretch */
.scenario-grid > * { display:flex; }

.visually-hidden{position:absolute!important;height:1px;width:1px;overflow:hidden;clip:rect(1px,1px,1px,1px);white-space:nowrap}

/* Filters bar */
.page-subtitle{color:#444;margin:8px 0 16px}
.filters{display:flex;flex-wrap:wrap;gap:12px;align-items:center;margin-bottom:16px}
.filter-item{display:flex;flex-direction:column}
.filter-label{font-size:0.85rem;color:#444;margin-bottom:6px}
.filter-input{padding:8px;border-radius:6px;border:1px solid rgba(0,0,0,0.08);min-width:160px}
.filter-count{margin-left:auto;color:#333;font-weight:600}
.filter-actions{display:flex;align-items:flex-end}
.empty-state{padding:36px;text-align:center;color:var(--muted);background:#fff;border:1px dashed rgba(0,0,0,0.04);border-radius:8px}

/* Loading skeletons for cards */
.sd-skeleton-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:1rem;padding:1rem}
.sd-skeleton-card{background:#fff;border-radius:12px;padding:12px;box-shadow:0 2px 6px rgba(0,0,0,0.03);display:flex;flex-direction:column;gap:8px}
.sd-skeleton-media{height:120px;background:linear-gradient(90deg,#f0f0f0,#e8e8e8,#f0f0f0);background-size:200% 100%;animation:shimmer 1.2s linear infinite}
.sd-skeleton-line{height:12px;background:#f0f0f0;border-radius:6px}
.sd-skeleton-line.short{width:40%}

@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}

@media (max-width:768px){
	.sd-skeleton-media{height:90px}
	.sd-skeleton-grid{grid-template-columns:1fr;gap:0.75rem;padding:0.75rem}
}

@media (max-width:600px){
	.filters{flex-direction:column;align-items:stretch}
	.filter-count{margin-left:0}
	.filter-actions{align-items:stretch}
}

.progress-controls{max-width:1200px;margin:6px auto 18px;display:flex;align-items:center;gap:12px}
.progress-summary{font-weight:700;color:#333}
.progress-actions{margin-left:auto;display:flex;gap:8px}
.sd-badge{display:inline-block;padding:6px 8px;border-radius:6px;margin-right:8px;font-size:0.85rem}
.sd-badge.badge--status{background:#eef;border:1px solid rgba(0,0,0,0.05)}
.sd-badge:contains('completed'){background:#e6ffed}

.dashboard-card {
  margin: 24px 0;
  padding: 18px;
  border: 1px solid #d9e2ec;
  border-radius: 12px;
  background: #fff;
}

.analytics-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.analytics-table th,
.analytics-table td {
  border: 1px solid #d9e2ec;
  padding: 8px;
  text-align: left;
}

.analytics-table th {
  background: #f5f7fa;
}


.transcript-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.transcript-grid > div {
  border: 1px solid #d9e2ec;
  border-radius: 10px;
  padding: 12px;
  background: #f8fafc;
}


.recommendation-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.recommendation-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  border: 1px solid #d9e2ec;
  border-radius: 12px;
  padding: 14px;
  background: #f8fafc;
}

.recommendation-link {
  white-space: nowrap;
  text-decoration: none;
  border-radius: 8px;
  padding: 8px 12px;
  background: #111827;
  color: #fff;
}


.student-hero {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 18px;
  margin-bottom: 24px;
}

.student-welcome {
  background: linear-gradient(135deg, var(--tm-primary), var(--tm-primary-2));
  color: #fff;
  border-radius: var(--tm-radius-lg);
  padding: 28px;
  box-shadow: var(--tm-shadow);
}

.student-welcome h1 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.student-welcome p {
  margin: 0;
  color: #dbeafe;
  font-size: 1.05rem;
}

.student-quick-actions {
  display: grid;
  gap: 12px;
}

.student-progress-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.student-progress-card {
  background: var(--tm-surface);
  border: 1px solid var(--tm-border);
  border-radius: var(--tm-radius);
  padding: 18px;
  box-shadow: var(--tm-shadow-soft);
}

.student-progress-card span {
  display: block;
  color: var(--tm-muted);
  font-weight: 700;
  font-size: 0.85rem;
}

.student-progress-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.7rem;
}

.student-dashboard-section {
  margin-top: 26px;
}

.student-panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.student-coach {
  border-left: 5px solid var(--tm-accent);
}

@media (max-width: 900px) {
  .student-hero,
  .student-panel-grid {
    grid-template-columns: 1fr;
  }

  .student-progress-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .student-progress-grid {
    grid-template-columns: 1fr;
  }
}

.scenario-grid {
  gap: 18px;
}

.scenario-card,
.sd-card {
  border: 1px solid var(--tm-border);
  border-radius: var(--tm-radius);
  box-shadow: var(--tm-shadow-soft);
  background: var(--tm-surface);
  overflow: hidden;
}

.scenario-card:hover,
.sd-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--tm-shadow);
}

.sd-card-body,
.scenario-card-body {
  padding: 14px;
}

.sd-card-footer,
.scenario-card-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--tm-border);
  background: var(--tm-surface-2);
}




.tm-detail-panel {
  background: var(--tm-surface);
  border: 1px solid var(--tm-border);
  border-radius: var(--tm-radius-lg);
  box-shadow: var(--tm-shadow);
}

.tm-detail-panel h2 {
  color: var(--tm-text);
  margin-top: 8px;
}

.tm-detail-panel p,
.tm-detail-panel li,
.tm-detail-panel div {
  color: var(--tm-text);
}

.tm-detail-panel #dtcs,
.tm-detail-panel #diagnosticData {
  background: var(--tm-surface-2);
  border: 1px solid var(--tm-border);
  border-radius: var(--tm-radius);
  padding: 12px;
  margin-top: 12px;
}


/* Compact scenario browser */
.scenario-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.tm-scenario-v2-card {
  min-height: 0;
}

.tm-scenario-v2-card__media {
  aspect-ratio: 16 / 9;
  max-height: 160px;
  overflow: hidden;
}

.tm-scenario-v2-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tm-scenario-v2-card-body {
  padding: 1rem;
}

.tm-scenario-v2-card-text {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

@media print {
  .dashboard-map,
  .tm-filter-toolbar,
  .progress-controls {
    display: none !important;
  }

  .scenario-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .tm-scenario-v2-card {
    break-inside: avoid;
  }
}
