/* Synthèse view: sleep macrostructure donut on the left, metric badges on the right
   ("À suivre" first, then within reference or without reference). */

#player .fwrap {
  height: 100%;
  display: grid;
  grid-template-columns: clamp(190px, 23vw, 340px) minmax(0, 1fr);
  gap: clamp(12px, 1.6vw, 22px);
  min-height: 0;
}

/* macrostructure donut: the ring takes whatever height is left above the legend */
#player .macro {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1.4vh, 14px);
  min-height: 0;
  min-width: 0;
  border: 1px solid var(--line);
  padding: clamp(10px, 1.8vh, 16px) clamp(12px, 1.3vw, 18px);
  background: var(--ground);
  container-type: inline-size;
}
#player .macro:hover {
  background: var(--panel);
}
#player .macro:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
#player .macro .donut {
  flex: 1;
  min-height: 0;
  position: relative;
  display: block;
}
#player .macro svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: 250px;
  margin: auto;
  overflow: visible;
}
#player .macro .seg-arc {
  transition: opacity 0.14s ease;
}
#player .macro .lg {
  display: grid;
  gap: clamp(2px, 0.8vh, 8px);
  flex: none;
}
#player .macro .li {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 10px;
}
#player .macro .li i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}
#player .macro .li .nm {
  font-size: 14px;
  color: var(--ink);
}
#player .macro .li .pc {
  font-family: var(--cond);
  font-weight: 600;
  font-size: clamp(17px, 2.6vh, 22px);
  line-height: 1;
}
#player .macro .li .mn {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink2);
  margin-left: 8px;
}
#player .macro .nt {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink3t);
  flex: none;
}
@container (max-width:250px) {
  #player .macro .li .mn {
    display: none;
  }
  #player .macro .dh {
    letter-spacing: 0.1em;
  }
}

/* badges: severity colour on the top and bottom bars and on the value only */
#player .cw {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1.2vh, 10px);
  min-height: 0;
  min-width: 0;
}
#player .cgh {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex: none;
  min-width: 0;
}
#player .cgh .dh {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
#player .cgh .n {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink3t);
  white-space: nowrap;
}
#player .crow {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: clamp(8px, 1.3vw, 18px);
  min-height: 0;
}
#player .crow.big {
  flex: 1.45;
}
#player .crow.small {
  flex: 1;
}
/* each badge sizes its value to its own width (cqw) and to the window height (vh), whichever is smaller */
#player .cu {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 0;
  min-width: 0;
  gap: clamp(2px, 0.6vh, 6px);
  text-align: center;
  container-type: inline-size;
}
#player .cu:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
#player .chipb {
  --bar: var(--info-bar);
  --fg: var(--ink);
  width: 100%;
  flex: 1;
  min-height: 0;
  border-radius: 6px;
  background: var(--ground);
  border: 1px solid var(--line);
  border-top: 7px solid var(--bar);
  border-bottom: 7px solid var(--bar);
  display: grid;
  place-items: center;
  transition: background 0.14s ease;
  position: relative;
}
#player .cu:hover .chipb {
  background: var(--panel);
}
#player .tone-good .chipb {
  --bar: var(--good);
}
#player .tone-watch .chipb {
  --bar: var(--watch);
  --fg: var(--watch);
}
#player .tone-concern .chipb {
  --bar: var(--concern);
  --fg: var(--concern);
}
#player .tone-severe .chipb {
  --bar: var(--severe);
  --fg: color-mix(in srgb, var(--severe) 75%, var(--lift));
}
#player .cv {
  font-family: var(--cond);
  font-weight: 600;
  line-height: 1;
  color: var(--fg);
  white-space: nowrap;
  letter-spacing: 0.005em;
}
#player .cv .u {
  color: inherit;
  opacity: 0.72;
  font-size: 0.3em;
  margin-left: 4px;
}
#player .cv .arr {
  font-size: 0.5em;
  margin-right: 4px;
  vertical-align: 0.3em;
}
#player .cn {
  font-size: 14.5px;
  color: var(--ink);
  font-weight: 500;
  line-height: 1.2;
  max-width: 100%;
}
#player .cs {
  font-size: 12.5px;
  color: var(--ink2);
  line-height: 1.2;
  max-width: 100%;
  text-wrap: balance;
}
#player .big .cv {
  font-size: clamp(22px, min(22cqw, 7.4vh), 78px);
}
#player .small .cv {
  font-size: clamp(18px, min(20cqw, 5vh), 52px);
}
#player .small .cn {
  font-size: 13.5px;
}
@container (max-width:150px) {
  #player .cn {
    font-size: 12.5px;
  }
  #player .cs {
    font-size: 11px;
  }
}
