html:has(#relay-class-board-root),
body:has(#relay-class-board-root){
  min-height:100%;
  margin:0;
}
body:has(#relay-class-board-root){
  background:
    linear-gradient(rgba(255,255,255,.58),rgba(255,255,255,.58)),
    url('relay-strategy-board.webp') center center/100% 100% no-repeat fixed;
}


:host{
  --main:#1e3a5f;
  --main-2:#2d5a8f;
  --accent:#d4af37;
  --bg:#f6f8fb;
  --panel:#ffffff;
  --line:#d9e1ea;
  --text:#2c3e50;
  --muted:#718096;
  --boy:#dcecff;
  --boy-text:#24486d;
  --girl:#ffe1ec;
  --girl-text:#6f3a50;
  --unknown:#eef2f6;
  --unknown-text:#536273;
  --danger:#b42318;
  --gap:5px;
  --card-font:17px;
  --num-size:28px;
}
*{box-sizing:border-box}
:host{display:block;min-height:100vh;height:100dvh;}
:host{
  margin:0;
  overflow:hidden;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans JP",sans-serif;
  background:var(--bg);
  color:var(--text);
}
button,input,textarea{font:inherit}
button{cursor:pointer}
button:focus-visible,input:focus-visible,textarea:focus-visible{
  outline:3px solid rgba(212,175,55,.45);
  outline-offset:2px;
}
.app{
  width:100%;
  height:100%;
  margin:0;
  padding:8px;
  position:relative;
}
.classbar{
  flex:0 0 44px;
  display:flex;
  align-items:center;
  gap:6px;
  overflow-x:auto;
  overflow-y:hidden;
  padding:0 1px;
  scrollbar-width:none;
}
.classbar::-webkit-scrollbar{display:none}
.classbar-wrap{
  flex:0 0 44px;
  display:flex;
  align-items:center;
  gap:6px;
  min-width:0;
}
.classbar{
  flex:1 1 auto;
  min-width:0;
}
.settings-mini{
  flex:0 0 40px;
  width:40px;
  height:38px;
  border:2px solid var(--line);
  border-radius:10px;
  background:#fff;
  color:var(--main);
  font-size:20px;
  font-weight:900;
  line-height:1;
}

.tab,.add-class{
  flex:0 0 auto;
  min-height:38px;
  border-radius:10px;
  padding:6px 14px;
  font-weight:900;
  white-space:nowrap;
}
.tab{
  border:2px solid var(--line);
  background:#fff;
  color:var(--main);
}
.tab.active{
  border-color:var(--main);
  background:var(--main);
  color:#fff;
  box-shadow:inset 0 -3px 0 var(--accent);
}
.add-class{
  width:42px;
  padding:0;
  border:2px dashed #9aabc0;
  background:#fff;
  color:var(--main);
  font-size:22px;
  line-height:1;
}
.board-shell{
  width:100%;
  height:100%;
  min-height:0;
  background:
    linear-gradient(rgba(255,255,255,.58),rgba(255,255,255,.58)),
    url('relay-strategy-board.webp') center center/100% 100% no-repeat;
  border:1px solid var(--line);
  border-radius:14px;
  padding:18px 20px;
  overflow:hidden;
}
.board{
  height:100%;
  min-height:0;
  display:grid;
  grid-template-columns:repeat(4,minmax(190px,260px));
  justify-content:center;
  align-content:center;
  gap:16px 18px;
}
.column{
  min-width:0;
  min-height:0;
  display:grid;
  grid-template-rows:repeat(var(--rows),minmax(54px,1fr));
  gap:10px;
}
.slot{
  min-height:0;
  border:1px solid transparent;
  border-radius:12px;
  background:transparent;
  display:flex;
  align-items:center;
  transition:.12s ease;
  overflow:visible;
  position:relative;
}
.slot.drag-over{
  border:2px solid var(--accent);
  background:#fff8d9;
}
.slot.insert-before::before,
.slot.insert-after::after{
  content:"";
  position:absolute;
  left:2px;
  right:2px;
  z-index:20;
  height:5px;
  border-radius:999px;
  background:#d4af37;
  box-shadow:0 0 0 2px rgba(255,255,255,.95);
  pointer-events:none;
}
.slot.insert-before::before{top:-6px}
.slot.insert-after::after{bottom:-6px}

.person{
  width:100%;
  height:100%;
  min-width:0;
  min-height:54px;
  border:0;
  border-radius:14px;
  padding:0 14px;
  display:flex;
  align-items:center;
  gap:9px;
  font-weight:900;
  font-size:24px;
  text-align:left;
  user-select:none;
  touch-action:manipulation;
  box-shadow:0 2px 6px rgba(30,58,95,.10);
}
.person.boy{background:var(--boy);color:var(--boy-text)}
.person.girl{background:var(--girl);color:var(--girl-text)}
.person.unknown{background:var(--unknown);color:var(--unknown-text)}
.person[aria-pressed="true"]{
  outline:3px solid var(--accent);
  outline-offset:-3px;
}
.person.dragging{opacity:.4}
.num{
  flex:0 0 28px;
  width:28px;
  height:28px;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:rgba(255,255,255,.82);
  color:inherit;
  font-size:13px;
  font-weight:900;
}
.name{
  min-width:0;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
}
.empty-slot{
  width:100%;
  height:100%;
  min-height:54px;
  border:2px dashed #cbd5e1;
  border-radius:12px;
  background:#f8fafc;
  color:#a0aec0;
  display:flex;
  align-items:center;
  gap:9px;
  padding:0 12px;
  font-weight:800;
}
.empty-line{
  flex:1;
  border-top:1px solid #d7dee8;
}
.empty-state{
  height:100%;
  display:grid;
  place-items:center;
  text-align:center;
  color:var(--muted);
  font-weight:800;
}
.empty-state button{margin-top:10px}

.modal-bg{
  position:fixed;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  padding:16px;
  background:rgba(15,30,58,.45);
  z-index:50;
}
.modal-bg.open{display:flex}
.modal{
  width:min(520px,100%);
  max-height:92vh;
  overflow:auto;
  background:#fff;
  border-radius:18px;
  padding:18px;
  box-shadow:0 24px 70px rgba(0,0,0,.25);
}
.modal h2{margin:0 0 12px;color:var(--main)}
.field{margin-top:12px}
.field label{
  display:block;
  margin-bottom:6px;
  color:var(--main);
  font-weight:900;
}
.input,.textarea{
  width:100%;
  border:2px solid var(--line);
  border-radius:12px;
  background:#fff;
  color:var(--text);
  padding:10px 12px;
  font-size:16px;
}
.input{min-height:46px}
.textarea{min-height:250px;resize:vertical;line-height:1.6}
.note{
  margin:7px 0 0;
  color:var(--muted);
  font-size:13px;
}
.actions{
  margin-top:14px;
  display:flex;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:wrap;
}
.btn{
  min-height:44px;
  border-radius:11px;
  padding:9px 15px;
  font-weight:900;
}
.btn-main{border:0;background:var(--accent);color:#0f1e3a}
.btn-outline{border:2px solid var(--main);background:#fff;color:var(--main)}
.btn-danger{border:2px solid #efb6b0;background:#fff;color:var(--danger)}
.danger-zone{
  margin-top:18px;
  padding-top:14px;
  border-top:1px solid var(--line);
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
@media(max-width:900px) and (min-width:641px){
  .person{font-size:23px}

  :host{overflow-y:auto}
  .app{height:auto;min-height:100%}
  .board-shell{overflow:visible}
  .board{grid-template-columns:repeat(2,minmax(0,1fr));height:auto}
  .column{display:flex;flex-direction:column;gap:9px}
  .slot{min-height:54px}
  .person,.empty-slot{min-height:48px}
}
@media(max-width:640px){
  :host{overflow-y:auto}
  .app{height:auto;min-height:100%;padding:5px;gap:4px}
  .classbar-wrap{flex-basis:40px}
  .settings-mini{width:36px;height:34px;flex-basis:36px;font-size:18px}
  .classbar{flex-basis:auto}
  .tab,.add-class{min-height:34px}
  .board-shell{padding:5px}
  .column{gap:10px}
  .person,.empty-slot{padding:0 6px;gap:5px}
  .person,.empty-slot{width:100%}
  .name{font-size:21px}
  .num{font-size:11px}
}

.toolbox{
  position:fixed;
  top:14px;
  right:14px;
  z-index:40;
  width:250px;
  background:#fff;
  border:1px solid var(--line);
  border-radius:14px;
  box-shadow:0 10px 28px rgba(30,58,95,.18);
  overflow:hidden;
}
.toolbox-head{
  min-height:46px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding:7px 8px 7px 12px;
  background:var(--main);
  color:#fff;
}
.toolbox-title{font-size:16px;font-weight:900;white-space:nowrap}
.toolbox-min{
  width:34px;height:32px;border:0;border-radius:9px;background:#fff;
  color:var(--main);font-size:20px;line-height:1;font-weight:900
}
.toolbox-body{padding:10px}
.toolbox.minimized .toolbox-body{display:none}
.toolbox.minimized{width:170px}
.toolbox-label{margin-bottom:6px;color:var(--main);font-size:12px;font-weight:900}
.toolbox-tabs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
.toolbox-tabs .tab{
  width:100%;min-height:40px;padding:6px 8px;border:2px solid var(--line);
  border-radius:10px;background:#fff;color:var(--main);font-weight:900;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap
}
.toolbox-tabs .tab.active{
  border-color:var(--main);background:var(--main);color:#fff;
  box-shadow:inset 0 -3px 0 var(--accent)
}
.toolbox-actions{margin-top:10px;display:grid;grid-template-columns:1fr 1fr;gap:6px}
.toolbox-btn{
  min-height:42px;border:2px solid var(--line);border-radius:10px;
  background:#fff;color:var(--main);font-weight:900
}
.toolbox-btn.primary{border-color:var(--main);background:var(--main);color:#fff}
@media(max-width:700px){
  .toolbox{top:8px;right:8px;width:220px}
  .toolbox.minimized{width:150px}
  .toolbox-tabs{grid-template-columns:1fr}
  .board-shell{padding:6px}
}


.view-label{margin-top:10px}
.view-switch{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:6px;
}
.view-switch-btn{
  min-height:40px;
  border:2px solid var(--line);
  border-radius:10px;
  background:#fff;
  color:var(--main);
  font-weight:900;
}
.view-switch-btn.active{
  border-color:var(--main);
  background:var(--main);
  color:#fff;
  box-shadow:inset 0 -3px 0 var(--accent);
}
.board.odd-even{
  grid-template-columns:repeat(2,minmax(260px,420px)) !important;
  justify-content:center;
  align-content:center;
  gap:18px 40px;
}
.board.odd-even .column{
  gap:8px;
}
.board.odd-even .person{
  font-size:22px;
  min-height:50px;
}
.board.odd-even .num{
  flex-basis:20px;
  width:20px;
  height:20px;
}


@media(max-width:1100px) and (min-width:701px){
  .board{
    grid-template-columns:repeat(3,minmax(190px,250px));
    gap:12px 14px;
  }
  .person{font-size:21px}
  .board.odd-even{
    grid-template-columns:repeat(2,minmax(240px,360px)) !important;
    gap:14px 20px;
  }
}
@media(max-width:700px){
  :host{overflow-y:auto}
  .app{height:auto;min-height:100%}
  .board-shell{height:auto;min-height:calc(100vh - 16px);padding:72px 10px 12px}
  .board{
    height:auto;
    grid-template-columns:repeat(2,minmax(140px,1fr));
    align-content:start;
    gap:10px;
  }
  .column{
    display:flex;
    flex-direction:column;
    gap:8px;
  }
  .person,.empty-slot{min-height:52px}
  .person{font-size:18px;padding:0 9px;gap:6px}
  .num{flex-basis:24px;width:24px;height:24px;font-size:11px}
  .board.odd-even{
    grid-template-columns:repeat(2,minmax(140px,1fr)) !important;
    gap:10px;
    align-content:start;
  }
  .board.odd-even .person{font-size:18px}
}


.runner-mark{
  margin-left:auto;
  flex:0 0 34px;
  width:34px;
  height:34px;
  border-radius:10px;
  display:grid;
  place-items:center;
  background:rgba(255,255,255,.72);
  color:inherit;
}
.runner-mark svg{
  width:22px;
  height:22px;
  display:block;
}
.runner-mark.start{
  outline:2px solid rgba(30,58,95,.10);
}
.runner-mark.anchor{
  outline:2px solid rgba(212,175,55,.35);
}


.empty-slot{
  position:relative;
}
.empty-delete{
  position:absolute;
  top:50%;
  right:8px;
  transform:translateY(-50%);
  width:30px;
  height:30px;
  border:0;
  border-radius:9px;
  background:#eef2f6;
  color:#718096;
  font-size:18px;
  font-weight:900;
  line-height:1;
  display:grid;
  place-items:center;
}
.empty-delete:hover{
  background:#e2e8f0;
  color:#1e3a5f;
}

