*{box-sizing:border-box}
body{margin:0;font-family:"Yu Gothic",Meiryo,sans-serif;background:#f6f4ec;color:#333}
header{background:#b7e4de;padding:14px 18px;text-align:center;font-weight:800;font-size:22px}
.steps{display:flex;gap:8px;overflow:auto;padding:14px;background:#fff;border-bottom:1px solid #ddd}
.steps button{white-space:nowrap;border:1px solid #ccc;background:#fff;border-radius:999px;padding:10px 14px;font-weight:700;cursor:pointer}
.steps button.active{background:#62aaa2;color:#fff;border-color:#62aaa2}
main{padding:12px;max-width:1760px;margin:auto}
#worksheet{display:grid;grid-template-columns:minmax(620px,1fr) 620px;gap:16px}
#stageWrap{display:flex;align-items:center;justify-content:center;padding:0;background:linear-gradient(#fff,#eef2f5);border-radius:16px;border:1px solid #ddd;min-height:760px;height:calc(100vh - 32px);max-height:900px;overflow:hidden;position:sticky;top:16px;align-self:start}
.stage{position:relative;top:auto;transform:none;transform-origin:center center;margin:auto;display:flex;align-items:center;justify-content:center}
.composite-img{display:block;width:100%;height:auto;object-fit:contain}
.panel{background:#fff;border:1px solid #ddd;border-radius:16px;padding:12px;box-shadow:0 4px 12px #0001}
h1{font-size:24px;margin:0 0 8px}
p{line-height:1.7;margin:0 0 12px;font-size:14px}
.meta{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin:12px 0 14px;
}

.metaTopRow{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:10px;
  width:100%;
}
.metaNameRow{
  width:100%;
}
.meta input{
  width:100%;
  height:36px;
  border:1px solid #ccc;
  border-radius:8px;
  padding:0 10px;
  font-size:14px;
}
.metaNameRow #studentName{
  width:100%;
  min-width:0;
}


.paletteNotice{font-size:12px;color:#666;line-height:1.6;margin:0 0 10px;padding:8px 10px;border-radius:10px;background:#f8f8f8}

.partSelector{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:8px 0 14px}

.partColumnHeading{
  font-size:14px;
  font-weight:800;
  text-align:center;
  padding:6px 8px;
  background:#eef4f5;
  border-radius:8px;
  color:#445;
}

.partButton{border:1px solid #ddd;border-radius:10px;background:#f8fafb;padding:10px 12px;display:flex;align-items:center;justify-content:space-between;gap:10px;cursor:pointer;text-align:left;transition:.15s ease}
.partButton:hover{border-color:#9dbdb9}
.partButton.active{background:#d9efec;border:2px solid #62aaa2;box-shadow:0 0 0 2px rgba(98,170,162,.12)}
.partButton .partName{font-size:14px;font-weight:800}
.partButton .selectedColor{display:flex;align-items:center;gap:8px;font-size:13px;color:#555}
.swatch{width:20px;height:20px;border:1px solid #999;border-radius:4px;display:inline-block;flex:0 0 auto}
.fixedPalette{border:1px solid #ddd;border-radius:12px;background:#fff;padding:10px;margin-top:8px}
.fixedPaletteTitle{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:8px;font-size:13px;font-weight:800}
.fixedPaletteTarget{display:flex;align-items:center;gap:8px;color:#555;font-weight:700}
.paletteGridInline{display:grid;grid-template-columns:repeat(12,1fr);gap:6px;max-height:none;overflow:visible;padding-right:0}
.paletteColor{height:34px;border:2px solid transparent;border-radius:8px;cursor:pointer;display:flex;align-items:flex-end;justify-content:center;padding:3px;color:#222;font-size:10px;font-weight:800;text-shadow:0 1px 0 #fff;background:var(--c)}
.paletteColor.active{border-color:#222;box-shadow:0 0 0 2px #fff inset}
.memo{margin-top:14px}
.memo textarea{width:100%;height:74px;border:1px solid #ccc;border-radius:10px;padding:10px;font-size:14px;resize:vertical}
.pdfBtn{margin-top:14px;background:#6f8ea2;color:#fff;border:0;border-radius:10px;padding:11px 14px;font-size:15px;font-weight:800;cursor:pointer;width:100%}
.status{font-size:12px;color:#666;margin-top:8px;line-height:1.5}
.underConstruction{min-height:360px;width:100%;display:flex;align-items:center;justify-content:center;font-size:28px;font-weight:800;color:#888;background:#fff;border:1px dashed #ccc;border-radius:16px}
#pdfSheet{
  position:fixed;
  left:-99999px;
  top:0;
  width:794px;
  min-height:1123px;
  height:auto;
  overflow:visible;
  box-sizing:border-box;
  background:#fff;
  color:#333;
  padding:28px 40px 32px;
  font-family:"Yu Gothic",Meiryo,sans-serif;
}
.pdf-title{font-size:24px;font-weight:800;text-align:center;margin:0 0 16px}
.pdf-image-wrap{width:100%;text-align:center;margin:0 0 16px}
.pdf-image-wrap img{
  display:block;
  max-width:540px;
  max-height:500px;
  width:auto;
  height:auto;
  margin:0 auto;
  object-fit:contain;
}
.pdf-info{display:grid;grid-template-columns:1fr 1fr 1fr 1.4fr;gap:8px;margin:0 0 14px}
.pdf-info div{border:1px solid #999;padding:9px 10px;font-size:15px;min-height:38px}
.pdf-section-title{font-size:17px;font-weight:800;border-left:6px solid #62aaa2;padding-left:10px;margin:18px 0 10px}
.pdf-color-list{display:grid;grid-template-columns:1fr 1fr;gap:6px 12px;margin-bottom:14px}
.pdf-color-item{display:flex;align-items:center;gap:8px;border:1px solid #bbb;border-radius:6px;padding:7px 8px;font-size:14px}
.pdf-color-chip{width:28px;height:28px;border:1px solid #777;border-radius:4px;flex:0 0 auto}
.pdf-comment{
  border:1px solid #999;
  min-height:86px;
  padding:10px;
  font-size:14px;
  line-height:1.6;
  white-space:pre-wrap;
  box-sizing:border-box;
}
@media (max-width:1200px){#worksheet{grid-template-columns:1fr}#stageWrap{min-height:720px}}
@media (max-width:768px){
  html,body{width:100%;overflow-x:hidden}
  main{width:100%;max-width:none;padding:10px}
  #worksheet{grid-template-columns:1fr;width:100%;max-width:100%;gap:12px}
  #stageWrap,.panel{width:100%;max-width:100%}
  #stageWrap{position:relative;top:auto;height:auto;max-height:none;min-height:420px;overflow:visible}
  .stage{position:relative;top:auto;transform:none}
  .partSelector{grid-template-columns:1fr}.paletteGridInline{grid-template-columns:repeat(6,minmax(0,1fr));max-height:none}
  input,select,textarea,button{max-width:100%}
}


.pdf-meta-right{text-align:right;}
.pdf-meta-left{text-align:left;}
.pdf-gender-columns{display:grid;grid-template-columns:1fr 1fr;gap:18px;margin-bottom:14px;}
.pdf-gender-column{min-width:0;}
.pdf-gender-title{margin-top:18px;}
.pdf-color-list-single{grid-template-columns:1fr;}
