:root {
  --ha-m-bg: #0b1a2b;
  --ha-m-bg2: #081423;
  --ha-m-panel: #101f33;
  --ha-m-line: rgba(255, 255, 255, 0.12);
  --ha-m-text: #f4f7fb;
  --ha-m-muted: #9aabbf;
  --ha-m-gold: #f5c400;
  --ha-m-gold-dim: rgba(245, 196, 0, 0.22);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ha-m-text);
  background:
    radial-gradient(1100px 520px at 12% -8%, rgba(245, 196, 0, 0.08), transparent 55%),
    radial-gradient(900px 480px at 92% 0%, rgba(19, 44, 74, 0.85), transparent 52%),
    linear-gradient(180deg, var(--ha-m-bg) 0%, var(--ha-m-bg2) 50%);
}

a { color: var(--ha-m-gold); text-decoration: none; }
a:hover { text-decoration: underline; }

.ha-m-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--ha-m-line);
  background: rgba(8, 20, 35, 0.72);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.ha-m-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.ha-m-brand:hover { text-decoration: none; color: var(--ha-m-gold); }
.ha-m-brand img {
  height: 40px;
  width: 40px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.ha-m-nav { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; font-size: 14px; }
.ha-m-nav-cta {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #d4af37, var(--ha-m-gold));
  color: #1a1200 !important;
  font-weight: 800;
  text-decoration: none !important;
}
.ha-m-nav-cta:hover { filter: brightness(1.05); }
.ha-m-nav-logout {
  color: var(--ha-m-muted) !important;
  font-weight: 650;
  text-decoration: none !important;
}
.ha-m-nav-logout:hover { color: var(--ha-m-text) !important; }

.ha-m-card-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
}
.ha-m-card-wrap .ha-m-card { flex: 1; }
.ha-m-card__edit {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(8, 20, 35, 0.88);
  border: 1px solid var(--ha-m-gold-dim);
  color: var(--ha-m-gold);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none !important;
}
.ha-m-card__edit:hover {
  background: rgba(245, 196, 0, 0.18);
}

.ha-m-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.ha-m-hero-copy h1 {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 800;
}
.ha-m-hero-copy p {
  margin: 0 0 10px;
  color: var(--ha-m-muted);
  max-width: none;
  width: 100%;
  line-height: 1.5;
}
.ha-m-hero-copy p:last-child {
  margin-bottom: 22px;
}

.ha-m-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.ha-m-card {
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, var(--ha-m-panel), #0c1829);
  border: 1px solid var(--ha-m-line);
  border-radius: 14px;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.ha-m-card:hover {
  border-color: var(--ha-m-gold-dim);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}

.ha-m-card__thumb {
  aspect-ratio: 16 / 10;
  background: #071018;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.ha-m-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ha-m-card__thumb-fallback {
  color: var(--ha-m-muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ha-m-card__body { padding: 12px 14px 16px; }
.ha-m-card__title {
  margin: 0 0 4px;
  font-size: 1.02rem;
  font-weight: 800;
}
.ha-m-card__meta {
  margin: 0;
  font-size: 12px;
  color: var(--ha-m-muted);
}

.ha-m-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--ha-m-muted);
  border: 1px dashed var(--ha-m-line);
  border-radius: 14px;
}

/* Fiche modèle */
.ha-m-model {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.ha-m-stage {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.ha-m-viewer-shell {
  background: #000;
  border: 1px solid var(--ha-m-line);
  border-radius: 14px;
  overflow: hidden;
  min-height: min(68vh, 720px);
  height: min(68vh, 720px);
}
.ha-m-viewer-shell iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #000;
}

.ha-m-side {
  background: linear-gradient(160deg, var(--ha-m-panel), #0c1829);
  border: 1px solid var(--ha-m-line);
  border-radius: 14px;
  padding: 18px 16px;
}
.ha-m-side h1 {
  margin: 0 0 8px;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.25;
}
.ha-m-side .ha-m-author {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--ha-m-muted);
}
.ha-m-side .ha-m-author strong { color: var(--ha-m-text); font-weight: 800; }
.ha-m-desc {
  margin: 0;
  padding: 16px 18px;
  background: #fff;
  color: #1c2430;
  border: 1px solid #e4e8ee;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.ha-m-meta {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--ha-m-line);
  background: rgba(0, 0, 0, 0.22);
  display: grid;
  gap: 8px;
}
.ha-m-meta > div {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 8px;
  align-items: baseline;
  font-size: 13px;
}
.ha-m-meta dt {
  margin: 0;
  color: var(--ha-m-muted);
  font-weight: 600;
}
.ha-m-meta dd {
  margin: 0;
  font-weight: 700;
  color: var(--ha-m-text);
  font-variant-numeric: tabular-nums;
}
.ha-m-meta-sub {
  color: var(--ha-m-muted);
  font-weight: 500;
  font-size: 12px;
}
.ha-m-actions { display: flex; flex-direction: column; gap: 8px; }
.ha-m-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--ha-m-line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ha-m-text);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
}
.ha-m-btn:hover { border-color: var(--ha-m-gold-dim); color: var(--ha-m-gold); text-decoration: none; }
.ha-m-btn--primary {
  background: linear-gradient(135deg, #d4af37, var(--ha-m-gold));
  color: #1a1200;
  border-color: transparent;
}
.ha-m-btn--primary:hover { color: #1a1200; filter: brightness(1.05); }
.ha-m-share-ok { font-size: 12px; color: #86efac; min-height: 1.2em; }

@media (max-width: 900px) {
  .ha-m-model { grid-template-columns: 1fr; }
  .ha-m-viewer-shell {
    min-height: 52vh;
    height: 52vh;
  }
}
