:root{
  --bg0:#05070c; --bg1:#070d16;
  --stroke:rgba(255,255,255,.10);
  --text:rgba(255,255,255,.92);
  --muted:rgba(255,255,255,.55);
  --ok: rgba(80, 190, 120, .22);
  --ng: rgba(255, 120, 160, .18);
  --btn: rgba(255,255,255,.10);
  --btn2: rgba(255,255,255,.14);
  --shadow: 0 14px 50px rgba(0,0,0,.45);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; color:var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  background: radial-gradient(1200px 700px at 20% -10%, rgba(0,170,255,.18), transparent 60%),
              radial-gradient(900px 600px at 90% 20%, rgba(255,0,120,.14), transparent 55%),
              linear-gradient(180deg, var(--bg0), var(--bg1));
}

.app{height:100%; display:flex; flex-direction:column; padding:14px; gap:12px}

.topbar{
  display:flex; align-items:center; justify-content:space-between;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.04);
  border-radius:16px; padding:12px 14px;
  box-shadow: var(--shadow);
}

.brand .title{font-size:18px; font-weight:700}
.brand .sub{font-size:12px; color:var(--muted); margin-top:2px}

.auth{display:flex; align-items:center; gap:10px}
.me{font-size:12px; color:var(--muted); max-width:320px; text-overflow:ellipsis; overflow:hidden; white-space:nowrap}

.btn{
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.06);
  color:var(--text);
  padding:10px 12px;
  border-radius:14px;
  cursor:pointer;
}
.btn:hover{background: rgba(255,255,255,.10)}
.btn.primary{background: rgba(0,170,255,.20); border-color: rgba(0,170,255,.28)}
.btn.ghost{background: transparent}

.tradebar{
  display:flex; gap:12px; align-items:center;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.03);
  border-radius:16px; padding:10px 10px;
}
.tradeButtons{display:flex; gap:8px; flex-wrap:wrap}
.tradeBtn{
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.06);
  color:var(--text);
  padding:10px 12px;
  border-radius:14px;
  cursor:pointer;
  display:flex; gap:8px; align-items:center;
}
.tradeBtn .p{font-size:12px; color:var(--muted)}
.tradeBtn.active{background: rgba(0,170,255,.18); border-color: rgba(0,170,255,.28)}
.tradeMeta{margin-left:auto; display:flex; gap:14px; align-items:baseline}
.tradeTitle{font-weight:700}
.tradePercent{font-size:26px; font-weight:800}

.main{
  flex:1;
  display:grid;
  grid-template-columns: 1.2fr 1fr;
  gap:12px;
  min-height:0;
}

.panel{
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.03);
  border-radius:16px;
  box-shadow: var(--shadow);
  min-height:0;
  display:flex;
  flex-direction:column;
}

.panelHeader{padding:12px 14px; border-bottom:1px solid var(--stroke)}
.panelTitle{font-weight:800}
.panelHint{font-size:12px; color:var(--muted); margin-top:4px}

.left .photoViewer{padding:10px 12px}
.photoStage{
  height:320px;
  border:1px dashed rgba(255,255,255,.18);
  background: rgba(0,0,0,.18);
  border-radius:14px;
  display:flex; align-items:center; justify-content:center;
  overflow:hidden;
}
.photoStage img{max-width:100%; max-height:100%; display:block}
.photoEmpty{color:var(--muted); font-size:13px}

.unassignedHeader{padding:8px 14px; border-top:1px solid var(--stroke); border-bottom:1px solid var(--stroke)}

.thumbList{
  padding:10px 12px;
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap:10px;
  overflow:auto;
}
.thumb{
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.04);
  border-radius:14px;
  padding:10px;
  cursor:pointer;
  position:relative;
}
.thumb:hover{background: rgba(255,255,255,.07)}
.thumb .name{font-size:11px; color:var(--muted); line-height:1.2; height:2.4em; overflow:hidden}
.thumb .pick{
  position:absolute; top:8px; right:8px;
  width:18px; height:18px; border-radius:8px;
  border:1px solid rgba(255,255,255,.30);
  background: rgba(0,0,0,.25);
}
.thumb.picked{outline:2px solid rgba(0,170,255,.45)}
.thumb.picked .pick{background: rgba(0,170,255,.55)}

.right .tableWrap{padding:10px 12px; overflow:auto; flex:1}
.tbl{width:100%; border-collapse:separate; border-spacing:0; font-size:13px}
.tbl thead th{
  position:sticky; top:0;
  background: rgba(0,0,0,.35);
  border-bottom:1px solid var(--stroke);
  padding:10px 10px;
  text-align:left;
}
.tbl tbody td{padding:10px 10px; border-bottom:1px solid rgba(255,255,255,.06)}
.tbl tbody tr{cursor:pointer}
.tbl tbody tr.done{background: var(--ok)}
.tbl tbody tr.notdone{background: var(--ng)}
.colStatus{width:110px}

.bottomArea{border-top:1px solid var(--stroke); padding:12px 12px}
.bottomRow{display:flex; gap:10px; align-items:end; flex-wrap:wrap}
.selectBlock{min-width:260px}
.label{font-size:12px; color:var(--muted); margin-bottom:6px}
.select,.input,.textarea{
  width:100%;
  background: rgba(0,0,0,.25);
  border:1px solid var(--stroke);
  color:var(--text);
  border-radius:14px;
  padding:10px 12px;
}
.textarea{min-height:84px; resize:vertical}
.pickedCount{padding:10px 12px; border:1px solid var(--stroke); border-radius:14px; background: rgba(255,255,255,.04)}

.modalOverlay{
  position:fixed; inset:0;
  background: rgba(0,0,0,.62);
  display:flex; align-items:center; justify-content:center;
  padding:18px;
  z-index:50;
}
.modalOverlay.hidden{display:none}
.modal{
  width:min(920px, 100%);
  background: rgba(10,14,24,.98);
  border:1px solid rgba(255,255,255,.14);
  border-radius:18px;
  box-shadow: var(--shadow);
  overflow:hidden;
}
.modalWide{width:min(1180px, 100%)}
.modalTop{display:flex; align-items:center; justify-content:space-between; padding:12px 14px; border-bottom:1px solid var(--stroke)}
.modalTitle{font-weight:900}
.modalBody{padding:12px 14px}
.modalBottom{padding:12px 14px; border-top:1px solid var(--stroke); display:flex; justify-content:flex-end}

.formGrid{
  display:grid;
  grid-template-columns: 140px 1fr;
  gap:10px 12px;
  align-items:center;
}
.fLabel{color:var(--muted); font-size:12px}

.photosBlock{margin-top:14px}
.photosTitle{font-weight:800; margin-bottom:8px}
.photosList{display:flex; flex-direction:column; gap:8px; max-height:220px; overflow:auto}
.photoRow{
  display:flex; gap:10px; align-items:center;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  border-radius:14px;
  padding:10px 12px;
}
.photoRow .meta{flex:1; min-width:0}
.photoRow .meta .n{font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.photoRow .meta .s{font-size:11px; color:var(--muted)}
.photoRow .rm{min-width:40px; text-align:center}

/* ---- thumbnails in modal ---- */
.thumbGrid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:10px;
  padding:6px 2px;
}
.thumbItem{
  position:relative;
  border:1px solid rgba(255,255,255,.10);
  border-radius:12px;
  overflow:hidden;
  cursor:pointer;
  background: rgba(255,255,255,.04);
}
.thumbImg{
  width:100%;
  height:110px;
  object-fit:cover;
  display:block;
}
.thumbCap{
  font-size:11px;
  color: rgba(255,255,255,.75);
  padding:6px 8px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.thumbRm{
  position:absolute;
  top:6px;
  right:6px;
  width:28px;
  height:28px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.18);
  background: rgba(0,0,0,.45);
  color:#fff;
  cursor:pointer;
}

/* ---- lightbox ---- */
.lightbox.hidden{ display:none; }
.lightbox{
  position:fixed;
  inset:0;
  z-index:9999;
}
.lightboxBackdrop{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,.65);
}
.lightboxBody{
  position:absolute;
  inset: 24px;
  display:flex;
  flex-direction:column;
  border-radius:16px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(10,12,18,.92);
}
.lightboxTop{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:10px 12px;
  border-bottom:1px solid rgba(255,255,255,.10);
}
.lightboxTitle{
  font-size:12px;
  color: rgba(255,255,255,.85);
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
  margin-right:10px;
}
.lightboxClose{
  width:34px;
  height:34px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.18);
  background: rgba(0,0,0,.35);
  color:#fff;
  cursor:pointer;
}
.lightboxImg{
  width:100%;
  height:100%;
  object-fit:contain;
  background: rgba(0,0,0,.15);
}

/* =========================
   LEFT: Unassigned thumbnails (3 columns)
========================= */

.leftHead{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
  padding:10px 12px 0;
}

.pickedMini{
  font-size:12px;
  color:rgba(255,255,255,.65);
  border:1px solid rgba(255,255,255,.12);
  padding:6px 10px;
  border-radius:999px;
  background:rgba(255,255,255,.04);
  white-space:nowrap;
}

.unassignedGrid{
  flex:1;
  overflow:auto;
  padding:12px;
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:14px;
  align-content: start;
}

.thumbCard{
  position:relative;
  border:1px solid rgba(255,255,255,.12);
  border-radius:14px;
  overflow:hidden;
  background:rgba(255,255,255,.03);
  width: 100%;
  height: 0;
  padding-bottom: 100%; /* 幅の100%の高さを確保 */
}

.thumbCard img{
  position: absolute;
  top: 0;
  left: 0;
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

.thumbCard .meta{
  position:absolute;
  left:0; right:0; bottom:0;
  padding:6px 8px;
  font-size:11px;
  color:rgba(255,255,255,.92);
  background:linear-gradient(to top, rgba(0,0,0,.72), rgba(0,0,0,0));
  pointer-events:none;
}

.thumbCard .pick{
  position:absolute;
  top:6px;
  right:6px;
  width:30px;
  height:30px;
  border-radius:12px;
  display:grid;
  place-items:center;
  background:rgba(0,0,0,.45);
  border:1px solid rgba(255,255,255,.25);
  cursor:pointer;
  user-select:none;
}

.thumbCard .pick::before{ content:"☐"; font-size:16px; line-height:1; }
.thumbCard.picked{
  outline:2px solid rgba(140,210,255,.95);
  box-shadow:0 0 0 5px rgba(140,210,255,.18);
}
.thumbCard.picked .pick::before{ content:"☑"; }

@media (max-width: 1100px){
  .unassignedGrid{ grid-template-columns:repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px){
  .unassignedGrid{ grid-template-columns:repeat(3, minmax(0, 1fr)); } /* スマホは3列の方が“写真一覧感”出る */
}

/* =========================
   Progress Bar Modal
========================= */
.modalProgress{
  width: min(480px, 90%);
  padding: 24px;
}

.progressTitle{
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  text-align: center;
  color: var(--text);
}

.progressBar{
  width: 100%;
  height: 32px;
  background: rgba(0,0,0,.35);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 16px;
}

.progressFill{
  height: 100%;
  background: linear-gradient(90deg, rgba(0,170,255,.85), rgba(0,210,255,.95));
  border-radius: 999px;
  width: 0%;
  transition: width 0.3s ease;
}

.progressText{
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}
