/* REBUILD-04 X: exact W card visual rules, scoped to X only. */
#group-x .rebuild02-card{
  min-height:592px;position:relative;appearance:none;-webkit-appearance:none;
  padding:0;margin:0;border-radius:0;overflow:visible;font:inherit;line-height:inherit;
  justify-content:flex-start;align-items:stretch;gap:0;text-align:left;cursor:pointer;
  border-color:rgba(199,230,201,.16);background:#14291e;color:#fff;
}
#group-x .rebuild02-visual{
  box-sizing:border-box;display:block;position:relative;flex:0 0 385px;height:385px;
  overflow:hidden;background:radial-gradient(ellipse at 54% 32%,rgba(145,187,147,.26),transparent 38%),linear-gradient(130deg,#254c35,#101e18 65%);
}
#group-x .rebuild02-visual img{
  display:block;position:absolute;inset:0;z-index:1;width:100%;height:100%;max-width:none;
  object-fit:cover;object-position:50% 0%;
}
#group-x .rebuild02-visual::before{
  content:"";position:absolute;inset:0;z-index:2;pointer-events:none;
  background:repeating-linear-gradient(0deg,transparent 0,transparent 8px,rgba(235,255,237,.02) 9px,transparent 10px),linear-gradient(0deg,rgba(1,10,6,.43),transparent 54%);
}
#group-x .rebuild02-description{
  box-sizing:border-box;display:flex;flex:1 0 auto;flex-direction:column;min-width:0;min-height:205px;
  padding:25px 27px 23px;background:#14291e;color:#fff;
}
#group-x .rebuild02-kicker{font:700 10px 'DM Sans',sans-serif;color:#9abca0;letter-spacing:.18em;}
#group-x .rebuild02-name{display:block;margin-top:12px;font:700 22px/1.35 'Noto Sans JP',sans-serif;}
#group-x .rebuild02-person{font-size:inherit;}
#group-x .rebuild02-role{display:inline-block;margin-left:.24em;white-space:nowrap;font-size:.59em;font-weight:600;}
#group-x .rebuild02-program{display:block;margin-top:7px;color:#e1eee3;font:600 11px/1.45 'Noto Sans JP',sans-serif;overflow-wrap:anywhere;}
#group-x .rebuild02-program small{display:block;margin-bottom:2px;color:#9abca0;font:700 9px/1.25 'Noto Sans JP',sans-serif;letter-spacing:.05em;}
#group-x .rebuild02-sub{display:block;margin-top:6px;color:#a6b7aa;font:400 11px/1.45 'Noto Sans JP',sans-serif;overflow-wrap:anywhere;}
#group-x .rebuild02-more{
  display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:auto;
  padding-top:15px;border-top:1px solid rgba(209,232,210,.16);
  color:#cbdfce;font:700 11px/1.2 'DM Sans',sans-serif;letter-spacing:.12em;
}
#group-x .rebuild02-arrow-icon{display:block;flex:0 0 18px;width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}
#group-x .rebuild02-card:focus-visible{outline:4px solid #ffe292;outline-offset:-8px;}

/* Current approved portrait framing, without the separate REAL-07 iPad portrait fix. */
#group-x .rebuild02-card[data-coach="3"] .rebuild02-visual img{object-position:40% 50%;height:106%;top:-6%;}
#group-x .rebuild02-card[data-coach="4"] .rebuild02-visual img{object-position:50% 19%;}
#group-x .rebuild02-card[data-coach="5"] .rebuild02-visual img{width:120%;height:120%;left:-10%;top:-15%;object-position:50% 50%;}

@media(max-width:1100px){
  #group-x .rebuild02-card{min-height:532px;}
  #group-x .rebuild02-visual{flex-basis:325px;height:325px;}
}
@media(max-width:900px){
  #group-x .rebuild02-card{min-height:507px;}
  #group-x .rebuild02-visual{flex-basis:300px;height:300px;}
}
@media(max-width:767px){
  #group-x .rebuild02-card[data-coach="5"] .rebuild02-visual img{top:-8%;}
}
@media(max-width:760px){
  #group-x .rebuild02-card[data-coach="3"] .rebuild02-visual img{top:-3%;}
}

/* The controls are siblings of the rail; they never change card or rail geometry. */
#group-x .rebuild04-controls{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  margin-top:11px;color:#c2d8ca;font-size:12px;font-weight:700;letter-spacing:.12em;
}
#group-x .rebuild04-position{font-variant-numeric:tabular-nums;}
#group-x .rebuild04-buttons{display:flex;gap:8px;}
#group-x .rebuild04-arrow{
  width:44px;height:42px;cursor:pointer;background:transparent;
  border:1px solid rgba(189,224,196,.48);color:#e3f0e7;font-size:20px;
}
#group-x .rebuild04-arrow:focus-visible{outline:2px solid #cae0ce;outline-offset:3px;}
#group-x .rebuild04-arrow:disabled{opacity:.4;cursor:default;}

/* X uses the W dialog layout and copy; these ID rules preserve its visual details. */
#rebuild04-dialog-close{flex:0 0 39px;width:39px;height:39px;border:1px solid #c1d1c6;border-radius:50%;background:transparent;color:#1d4630;font-size:16px;cursor:pointer;}
#rebuild04-dialog-close:focus-visible{outline:3px solid #37714a;outline-offset:3px;}
#rebuild04-dialog-title{font-size:clamp(26px,3vw,39px);letter-spacing:-.05em;line-height:1.35;margin:22px 0 16px;}
#rebuild04-dialog-history,#rebuild04-dialog-message{white-space:pre-line;}
#rebuild04-dialog-photo[data-coach="3"]{object-position:30% 50%;}
#rebuild04-dialog-photo[data-coach="4"]{object-position:50% 16%;}
#rebuild04-dialog-photo[data-coach="5"]{object-position:50% 50%;}
@media(min-width:601px) and (max-width:860px){#rebuild04-dialog-photo[data-coach="5"]{transform:translateY(4%) scale(1.85);transform-origin:50% 50%;}}
@media(min-width:861px) and (max-width:1100px){#rebuild04-dialog-photo[data-coach="5"]{transform:translateY(3%) scale(1.55);transform-origin:50% 50%;}}
@media(min-width:1101px){#rebuild04-dialog-photo[data-coach="5"]{object-position:50% 45%;transform:translateY(-6%) scale(1.20);transform-origin:50% 50%;}}
@media(max-width:600px){
  #rebuild04-dialog-photo[data-coach="4"]{object-position:50% 0%;}
  #rebuild04-dialog-photo[data-coach="5"]{object-position:50% 33%;}
}



/* ERI R7 — HUMAN-approved head/chin crop from the full 2048x1920 source.
   Second image is painted on the ERI card only. Original first IMG remains
   unchanged for the existing card->modal image lookup. No distortion/fill/fade. */
#group-x .rebuild02-card[data-coach="3"] .rebuild02-visual img:not(.eri-r7-card-crop){opacity:0;}
#group-x .rebuild02-card[data-coach="3"] .rebuild02-visual img.eri-r7-card-crop{
  inset:0;width:100%;height:100%;left:0;top:0;
  object-fit:cover;object-position:50% 50%;opacity:1;
}

/* R7 card copy/hover refinement: R4's concise card copy is reinstated in
   index.html. Preserve the DIAG-16-R2 native swipe/rail and modal behavior.
   Animation is desktop-hover only; touch scrolling and reduced motion are untouched. */
@media (hover:hover) and (pointer:fine) {
  /* The 7px hover lift must have top clearance inside the native scroll rail. */
  #group-x .diag-simple-rail { padding-top:10px; }
  #group-x .rebuild02-card {
    transition:transform .28s,border-color .28s,box-shadow .28s;
  }
  #group-x .rebuild02-card:hover {
    transform:translateY(-7px);
    border-color:rgba(180,222,186,.6);
    box-shadow:0 28px 70px rgba(0,0,0,.23);
  }
}
@media (prefers-reduced-motion:reduce) {
  #group-x .rebuild02-card { transition:none; }
  #group-x .rebuild02-card:hover { transform:none; }
}

/* ERI profile modal: iPad portrait framing adjustment, review candidate.
   Move the existing image LEFT by approximately half a head width (about 47px
   in a 1024px iPad portrait viewport). This affects ONLY coach 3 in the
   REBUILD-04 dialog: cards, photo pixels, other coaches and JS are unchanged. */
@media (min-width:601px) and (max-width:1100px) and (orientation:portrait){
  #rebuild04-dialog-photo[data-coach="3"]{object-position:43% 50%;}
}

/* Mobile photo-only QA: match the head-top/chin spacing of RYUSEI TOKIDA.
   ERI R7 approved source and genuine sponsor logo unchanged. All transforms
   are uniform CSS scaling; no stretch, synthetic fill or fade. */
@media (max-width:600px) and (orientation:portrait){
  /* ERI card: reveal natural top margin; chin follows TOKIDA's height. */
  #group-x .rebuild02-card[data-coach="3"] .rebuild02-visual img.eri-r7-card-crop{
    object-position:50% 0%;
  }
  /* ERICK card: place hairline below top, then scale uniformly around it. */
  #group-x .rebuild02-card[data-coach="4"] .rebuild02-visual img{
    object-position:50% 0%;
    transform:scale(1.10);
    transform-origin:50% 24px;
  }
  /* ERI profile dialog: bring the face closer and retain natural headroom.
     Center-origin scaling keeps the image covering the full dialog photo box. */
  #rebuild04-dialog-photo[data-coach="3"]{
    object-position:30% 0%;
    transform:translateY(18px) scale(1.40);
    transform-origin:25% 50%;
  }
}
/* ERICK dialog: additional headroom on phone landscape only. */
@media (min-width:601px) and (max-width:950px) and (max-height:500px) and (orientation:landscape){
  #rebuild04-dialog-photo[data-coach="4"]{object-position:50% 0%;}
}

/* ERICK card name: keep each katakana name segment intact at narrow widths.
   The full name remains on one line when it fits; no font-size or card changes. */
#group-x .rebuild02-card[data-coach="4"] .erick-name-chunk{
  display:inline-block;
  white-space:nowrap;
  font:inherit;
}
