/* Visual theme only. Application behavior and storage remain in index.html. */
@import url('https://fonts.googleapis.com/css2?family=Zen+Kaku+Gothic+New:wght@500;700;900&display=swap');
:root{--bg:#141414;--panel:#101010;--card:#202020;--line:#414141;--text:#f7f7f2;--muted:#bcbcbc;--accent:#f0eb00;--accentbg:#373600}
body{background:repeating-linear-gradient(135deg,#171717 0 3px,#141414 3px 7px);font-family:'Zen Kaku Gothic New',sans-serif;font-weight:500}
button,input,select,textarea{font-family:inherit;font-style:normal}
button{border-width:2px;border-radius:24px;font-weight:900;background:#101010}
button:hover{border-color:var(--accent)}
main{max-width:1180px}
.headerDecor{background:#0a0a0a;border:3px solid #383838;border-radius:24px;padding:22px;margin-bottom:18px}
.headerDecor h1{font-family:inherit;font-size:clamp(21px,2.6vw,30px);font-weight:900;font-style:normal;letter-spacing:.035em;line-height:1.65;color:#080808;-webkit-text-fill-color:#080808;-webkit-text-stroke:0;text-shadow:-1px -1px 0 #fff,0 -1px 0 #fff,1px -1px 0 #fff,-1px 0 0 #fff,1px 0 0 #fff,-1px 1px 0 #fff,0 1px 0 #fff,1px 1px 0 #fff;overflow-wrap:anywhere}
h1::after{display:none}
.descriptionToggle{color:var(--text);text-shadow:none}
.toolbar{gap:8px;padding:10px;background:#0a0a0a;border:3px solid #383838;border-radius:24px}
.toolbar button{font-size:13px}
.team{background:#202020;border:2px solid #414141;border-radius:20px}
.team.active{border-color:var(--accent);box-shadow:none}
.team.active .teamhead b{color:var(--accent)}
.teamhead b{font-weight:900}
.teamhead b,.teamCost{font-size:15px;line-height:1.2}
.slot,.bangbooSlot{background:repeating-linear-gradient(135deg,#191919 0 2px,#151515 2px 5px);border-radius:12px}
.slot img,.bangbooSlot img,.char img{background:#303030}
.char{background:#101010;border:2px solid #414141;border-radius:16px}
.char .initial{background:#303030}
.char .conv{background:#292929;border-color:#505050;border-radius:20px;font-weight:700}
.modeTabs{gap:0;background:#202020;border:2px solid #414141;border-radius:30px;width:fit-content;padding:3px}
.modeTabs button{min-width:125px;border-color:transparent;background:transparent}
.modeTabs button.active{background:var(--accent);color:#080808;border-color:var(--accent)}
input,select{border:2px solid #414141;border-radius:24px;background:#101010}
.groupLabel{background:#0a0a0a;border-radius:20px;padding:10px 14px;font-size:15px;color:var(--muted);flex-wrap:wrap;gap:8px}
.groupCost,.teamCost,.allCost{color:var(--muted)}
.groupCost{font-size:15px}
.allCost{font-size:15px;color:var(--accent)}
.modalbox{border:3px solid #414141;border-radius:24px;background:#171717}
.modalbox h2{font-weight:900}
@media(max-width:560px){.headerDecor{padding:10px}.headerDecor h1{font-size:22px}.toolbar{padding:9px}.toolbar button{font-size:12px;padding:8px 10px}.groupLabel{padding:8px 10px}.groupCost,.allCost{white-space:normal}.filters input[type=search],.bangbooControls .filters input[type=search]{min-width:0;width:100%;flex:1 1 100%}.filters select{min-width:0;max-width:100%}.formgrid input,.formgrid select{min-width:0}.descriptionToggle{margin-left:0}}

/* Restore only the graphic title area. */
.headerDecor{position:relative;isolation:isolate;padding:56px 30px 30px;border:3px solid #555;border-radius:30px 30px 10px 30px;background:linear-gradient(115deg,#090909 0 65%,#252525 65% 82%,#101010 82%);box-shadow:7px 7px 0 #050505,inset 0 0 0 5px #151515;border-bottom:3px solid #555}
.headerDecor::before{content:'ZENLESS ZONE ZERO / TEAM BUILDER';position:absolute;top:15px;left:28px;max-width:calc(100% - 56px);font-size:11px;font-weight:900;letter-spacing:.17em;color:#090909;background:var(--accent);padding:5px 14px;border-radius:4px;transform:rotate(-2deg);pointer-events:none}
.headerDecor::after{content:'';position:absolute;right:24px;bottom:5px;width:1.8em;height:1em;font-size:100px;background:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20210%20100%22%3E%3Cpath%20fill%3D%22%23fff%22%20fill-opacity%3D%22.0392156863%22%20d%3D%22M0%2015h70v16l-47%2038h47v16h-70V69l47-38H0Z%20M70%2015h70v16l-47%2038h47v16h-70V69l47-38H70Z%20M140%2015h70v16l-47%2038h47v16h-70V69l47-38H140Z%22%2F%3E%3C%2Fsvg%3E") center/100% 100% no-repeat;z-index:-1;pointer-events:none;transform:skew(-12deg)}
.headerDecor h1{display:block;width:fit-content;max-width:100%;font-size:clamp(23px,3.25vw,38px);line-height:1.5;margin:0 0 18px;padding:0 0 0 17px;border-left:7px solid var(--accent);text-shadow:-1px -1px 0 #fff,0 -1px 0 #fff,1px -1px 0 #fff,-1px 0 0 #fff,1px 0 0 #fff,-1px 1px 0 #fff,0 1px 0 #fff,1px 1px 0 #fff,3px 4px 0 #000}
.descriptionToggle{margin:0;background:#222;border-color:#606060;padding:7px 18px;box-shadow:3px 3px 0 #000}
.descriptionText{background:#101010;border-left:3px solid var(--accent);padding:14px 18px;margin-top:10px;border-radius:0 14px 14px 0}

@media(max-width:560px){.headerDecor{padding:20px 17px 22px;border-radius:22px 22px 8px 22px}.headerDecor::before{position:static;display:table;max-width:100%;margin:0 0 10px;font-size:10px;line-height:1.6;letter-spacing:.05em;padding:5px 8px;transform:none;overflow-wrap:anywhere}.headerDecor::after{font-size:75px;right:15px}.headerDecor h1{font-size:24px;padding-left:11px;border-left-width:5px;letter-spacing:.025em}.descriptionText{padding:10px}}

/* Title-frame corrections: remove right-side graphics; symmetric corners on every device */
.headerDecor{
  position:relative;
  isolation:isolate;
  overflow:hidden;
  padding:24px 24px 24px;
  margin-bottom:18px;
  border:3px solid #555;
  border-radius:28px;
  background:
    linear-gradient(115deg,rgba(255,255,255,.05) 0 19%,transparent 19% 100%),
    linear-gradient(115deg,transparent 0 27%,rgba(0,0,0,.30) 27% 48%,transparent 48% 100%),
    repeating-linear-gradient(135deg,rgba(255,255,255,.045) 0 2px,transparent 2px 8px),
    linear-gradient(115deg,#0a0a0a 0%,#1b1b1d 38%,#101113 60%,#090909 100%);
  box-shadow:7px 7px 0 #050505,inset 0 0 0 5px #151515;
  font-family:'Noto Sans JP','Noto Sans CJK JP',system-ui,sans-serif;
}
.headerDecor::before{
  content:"ZENLESS ZONE ZERO / TEAM BUILDER";
  position:absolute;
  display:block;
  top:20px;left:22px;right:auto;bottom:auto;
  width:auto;height:auto;max-width:calc(100% - 44px);
  margin:0;padding:8px 28px 8px 18px;
  font-size:11px;font-weight:900;line-height:1.4;letter-spacing:.14em;
  color:#080808;
  background:#f0eb00;
  border:0;border-radius:0;
  clip-path:polygon(0 0,100% 0,calc(100% - 14px) 100%,0 100%);
  transform:none;pointer-events:none;z-index:1;
}
/* Explicitly neutralize the older background logo pseudo-element. */
.headerDecor::after{content:none;display:none;background:none}
.headerDecor h1{
  position:relative;z-index:1;
  display:block;width:fit-content;max-width:100%;
  margin:46px 0 20px;padding:0 0 0 15px;
  border-left:6px solid #f0eb00;
  font-family:inherit;font-size:clamp(23px,3.1vw,38px);font-weight:900;
  font-style:normal;line-height:1.45;letter-spacing:.03em;overflow-wrap:anywhere;
  color:#080808;-webkit-text-fill-color:#080808;-webkit-text-stroke:0;
  text-shadow:-1px -1px 0 #fff,0 -1px 0 #fff,1px -1px 0 #fff,-1px 0 0 #fff,1px 0 0 #fff,-1px 1px 0 #fff,0 1px 0 #fff,1px 1px 0 #fff,3px 4px 0 #000;
}
.headerDecor .descriptionToggle{
  position:relative;z-index:1;margin:0;padding:7px 18px;
  background:linear-gradient(180deg,#2a2a2a,#171717);
  border:2px solid #5d5d5d;border-radius:999px;
  color:#f7f7f2;box-shadow:3px 3px 0 #000;
}
.headerDecor .descriptionText{
  position:relative;z-index:1;margin-top:10px;padding:14px 18px;
  background:rgba(10,10,10,.92);border-left:3px solid #f0eb00;
  border-radius:0 14px 14px 0;
  color:#bcbcbc;font-size:14px;line-height:1.7;
}
@media(max-width:560px){
  .headerDecor{padding:20px 10px 20px;border-radius:22px}
  .headerDecor::before{
    position:absolute;display:block;
    top:10px;left:10px;right:auto;bottom:auto;
    width:auto;height:auto;max-width:calc(100% - 20px);
    margin:0;padding:7px 20px 7px 14px;
    font-size:10px;letter-spacing:.08em;line-height:1.4;
    transform:none;
  }
  .headerDecor::after{content:none;display:none}
  .headerDecor h1{margin:44px 0 20px;padding-left:11px;border-left-width:5px;font-size:24px;line-height:1.4}
  .headerDecor .descriptionText{padding:10px 14px}
}

/* Unified 10px spacing below title — all device widths.
   Zero margins prevent doubled gaps; compact controls retain fit-safe padding. */
:root{--section-space:10px}
.headerDecor{margin-bottom:var(--section-space)}
main > .toolbar{
  gap:var(--section-space);
  padding:var(--section-space);
  margin-bottom:var(--section-space);
}
main > .toolbar .groupControls{gap:var(--section-space)}
main > .teams{
  gap:var(--section-space);
  margin-bottom:var(--section-space);
}
main > .teams .team{
  padding:var(--section-space);
}
main > .teams .teamhead{margin-bottom:var(--section-space)}
main > .teams .teamContents{gap:var(--section-space)}
main > .teams .slots{gap:var(--section-space)}
main > .teams .groupLabel{
  margin:0;
  padding:var(--section-space);
  gap:var(--section-space);
}
main > .teams .groupLabel:not(:first-child){margin-top:0}
main > .modeTabs{
  margin-bottom:var(--section-space);
}
/* Keep the two tabs joined as one segmented control. */
main > .agentControls .filters,
main > .bangbooControls .filters{
  gap:var(--section-space);
  margin-bottom:var(--section-space);
}
main > .agentControls.hide,
main > .bangbooControls:not(.show){display:none}
main > .count{margin:0 0 var(--section-space)}
main > .count:empty{margin:0}
main > .chars{gap:3px}
main > .status{margin-top:var(--section-space)}
/* Do not enlarge fixed-size character images, drag targets, or modal controls. */
@media(max-width:560px){
  main > .toolbar{gap:var(--section-space);padding:var(--section-space)}
  main > .teams{gap:var(--section-space)}
  main > .teams .slots{gap:var(--section-space)}
  main > .chars{gap:3px}
}

/* Toolbar button spacing: 10px on all devices; all other spacing unchanged. */
main > .toolbar{gap:5px}
main > .toolbar .groupControls{gap:5px}

/* Expanded agent frames with compact spacing and a smaller Bangboo slot. */
:root{--team-slot-space:5px}
main > .teams .team{padding:var(--team-slot-space)}
main > .teams .teamhead{margin:0 0 var(--team-slot-space);padding:var(--team-slot-space)}
main > .teams .teamContents{
  display:grid;
  grid-template-columns:minmax(0,1fr) 70px;
  align-items:end;
  gap:var(--team-slot-space);
}
main > .teams .teamContents:has(> .bangbooWrap[style*="display:none"]){
  grid-template-columns:minmax(0,1fr);
  gap:0;
}
main > .teams .slots{gap:var(--team-slot-space)}
main > .teams .bangbooWrap{
  width:70px;
  height:70px;
  min-width:70px;
  flex:none;
  align-self:end;
}
main > .teams .bangbooSlot{
  width:70px;
  height:70px;
  min-height:70px;
  border:2px solid var(--line);
}
main > .teams .slot.empty,
main > .teams .bangbooSlot.empty{
  border:2px dashed #606060;
  border-radius:12px;
}
main > .teams .slot.empty:hover,
main > .teams .bangbooSlot.empty:hover{
  border-style:solid;
  border-color:var(--accent);
}
main > .teams .slot.drag-over,
main > .teams .bangbooSlot.drag-over{border-style:solid}

/* Selected unit outlines keep the normal border width and shape. */
main > .teams .team.active.agent-selected .slot,
main > .teams .team.active.bangboo-selected .bangbooSlot,
main > .teams .slot:active{
  border-style:solid;
}
main > .teams .team.active.agent-selected .slot,
main > .teams .team.active.bangboo-selected .bangbooSlot{
  border-color:var(--accent);
  box-shadow:none;
}
main > .teams .slot,
main > .teams .bangbooSlot{-webkit-tap-highlight-color:transparent}

/* Keep character slots uniform and reserve one line for fitted unit names. */
main > .teams .slot{
  height:105px;
  min-height:105px;
}
main > .teams .slot strong,
main > .teams .bangbooSlot strong{
  display:block;
  width:100%;
  max-width:100%;
  white-space:nowrap;
  line-height:1.15;
}
@media(max-width:560px){
  main > .teams .slot{
    height:95px;
    min-height:95px;
  }
}

/* All groups share the same label layout; Total stays at the far right. */
main > .teams .groupLabel{display:flex;flex-wrap:nowrap;align-items:center;column-gap:4px}
main > .teams .groupLabel .allCost{margin-left:auto;text-align:right;white-space:nowrap}

/* Unify live Group, Team, and all cost labels. */
main > .teams .groupLabel,
main > .teams .groupLabel > span,
main > .teams .teamhead b,
main > .teams .teamhead .teamCost{
  font-size:17px!important;
  line-height:1.2;
}

/* Match team-label white throughout the team summary; keep only Total accented. */
main > .teams .groupLabel,
main > .teams .groupLabel .groupCost,
main > .teams .teamhead b,
main > .teams .teamhead .teamCost,
main > .teams .team.active .teamhead b{color:#fff}
main > .teams .groupLabel .allCost{color:var(--accent)}
main > .chars .char strong{
  display:block;
  width:100%;
  max-width:100%;
  white-space:nowrap;
  overflow:hidden;
  line-height:1.2;
}

/* Empty slots never show an isolated press highlight; touch scrolling stays native. */
main > .teams .slot,
main > .teams .bangbooSlot{touch-action:none}
main > .teams .slot:not(.empty):active{border-style:solid}
main > .teams .slot.empty:active,
main > .teams .bangbooSlot.empty:active{
  border:2px dashed #606060;
  box-shadow:none;
}
@media(hover:none){
  main > .teams .slot.empty:not(.drag-over):hover,
  main > .teams .bangbooSlot.empty:not(.drag-over):hover{
    border:2px dashed #606060;
    box-shadow:none;
  }
}


/* Circular move controls and clear team-swap cue. */
main > .teams .groupLabel.firstGroup{position:relative;margin-top:43px;padding-top:var(--section-space)}
main > .teams .moveActions{position:absolute;top:-43px;left:var(--section-space);display:flex;gap:var(--section-space)}
main > .teams .moveActions button{
  width:53px;height:33px;min-width:53px;min-height:33px;padding:0;
  display:inline-flex;align-items:center;justify-content:center;line-height:1;
  background:transparent;color:#d9371d;border:0;border-radius:0;box-shadow:none;
}
main > .teams .moveActions svg{display:block;width:70px;height:48px;min-width:70px;flex-shrink:0;overflow:visible;fill:none;stroke:currentColor}
main > .teams .moveActions .arrowOutline{stroke-width:6;stroke-linecap:round;stroke-linejoin:round}
main > .teams .moveActions .arrowGlyph{stroke-width:10;stroke-linecap:butt;stroke-linejoin:round}
main > .teams .moveActions .arrowHead{fill:currentColor;stroke:none}
main > .teams #redoMove svg{transform:scaleX(-1)}
main > .teams .moveActions button:disabled{opacity:.4;cursor:default}
@keyframes teamSwapPulse{
  0%,100%{border-color:#ffe058}
  50%{border-color:#555}
}
main > .teams .team.swap-source{
  outline:none;box-shadow:none;
  animation:teamSwapPulse .9s steps(1,end) infinite
}
@media(prefers-reduced-motion:reduce){
  main > .teams .team.swap-source{animation:teamSwapPulse 1.4s steps(1,end) infinite}
}


/* A larger on-screen preview; export dimensions stay unchanged. */
#groupImageModal{padding:6px}
#groupImageModal .modalbox{
  width:min(1280px,100%);
  max-width:1280px;
  max-height:calc(100vh - 12px);
  max-height:calc(100dvh - 12px);
  overflow:auto;
  padding:10px;
}
#groupImagePreview{height:auto;max-height:none}
#groupImageModal .modalActions{flex-wrap:wrap}

/* Easier-to-tap constellation settings without widening character cards. */
main > .chars .char .conv{
  width:100%;
  max-width:96px;
  min-height:38px;
  padding:7px 4px;
  font-size:12px;
  line-height:1.2;
  white-space:nowrap;
}

/* Tutorial uses the same header buttons and opens only on request. */
.headerActions{position:relative;z-index:1;display:flex;align-items:center;flex-wrap:wrap;gap:10px}
.headerDecor .headerActions .descriptionToggle{display:inline-flex;align-items:center;justify-content:center;margin:0}
#tutorialVideoModal .tutorialVideoBox{width:min(1100px,100%);max-width:1100px}
#tutorialVideo{display:block;width:100%;max-height:72vh;max-height:72dvh;background:#000;border-radius:8px;object-fit:contain}
@media(max-width:560px){.headerActions{gap:6px}.headerDecor .headerActions .descriptionToggle{font-size:11px;padding:7px 10px}}


/* Keep long constellation and weapon labels inside one line. */
.slot .meta2,.char .meta2{display:block;width:100%;max-width:100%;min-width:0;white-space:nowrap!important;overflow-wrap:normal;word-break:normal;flex-shrink:0}
main > .teams .slot .meta2{font-size:14px!important;font-weight:900}
main > .chars .char .meta2{font-size:13px!important;font-weight:900}

/* Smooth outlined title at any zoom level. */
.headerDecor h1{color:#080808;-webkit-text-fill-color:#080808;-webkit-text-stroke:2px #fff;paint-order:stroke fill;text-shadow:none}
