/* ==========================================
   ダイラインテンプレート（A式）画面
   ========================================== */
* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  color: #1a2332;
  background: #eef2f6;
  font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

button, input, select {
  font-family: inherit;
  font-size: 14px;
}

.navbar {
  background: #0a2540;
  color: #fff;
  border-bottom: 4px solid #ea580c;
}

.navbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.brand {
  color: #fff;
  font-weight: bold;
  font-size: 16px;
}

.lang-link {
  color: #fbd38d;
  font-size: 13px;
  font-weight: bold;
  text-decoration: none;
  margin-left: auto;
}
.lang-link:hover { text-decoration: underline; }

.line-switch {
  display: inline-flex;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 6px;
  overflow: hidden;
}

.line-btn {
  margin: 0;
  padding: 6px 12px;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  line-height: 1.3;
}

.line-btn + .line-btn {
  border-left: 1px solid rgba(255, 255, 255, 0.45);
}

.line-btn[aria-pressed="true"] {
  background: #fff;
  color: #0a2540;
  font-weight: bold;
}

.nav-note {
  color: #d6e0ea;
  font-size: 12px;
}

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 20px 40px;
}

.lead {
  background: #fff;
  border: 1px solid #d5dee8;
  border-left: 4px solid #0055ea;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.lead h1 {
  margin: 0 0 6px;
  font-size: 20px;
  color: #0a2540;
}

.lead p { margin: 0; }

.title-link {
  color: #0055ea;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.title-link:hover { color: #ea580c; }

.ref-page { min-height: 100vh; }

.ref-label {
  margin: 0 0 4px;
  color: #ea580c;
  font-size: 12px;
  font-weight: bold;
}

.code-note h1 {
  margin: 0 0 8px;
  font-size: 18px;
  color: #0a2540;
}

.code-note {
  background: #fff;
  border: 1px solid #d5dee8;
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 13px;
}

.code-note h2 {
  margin: 0 0 8px;
  font-size: 15px;
  color: #0a2540;
}

.code-note dl {
  display: grid;
  grid-template-columns: 7.5em 1fr;
  gap: 4px 10px;
  margin: 0;
}

.code-note dt { color: #64748b; }
.code-note dd { margin: 0; }
.code-note p { margin: 8px 0 0; color: #334155; }

.layout {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.panel, .stage, .assist {
  background: #fff;
  border: 1px solid #d5dee8;
  border-radius: 6px;
}

.panel { padding: 14px; }

.step {
  margin: 0 0 16px;
  padding: 0 0 14px;
  border-bottom: 1px solid #e6edf4;
}

.step h2 {
  margin: 0 0 8px;
  font-size: 15px;
  color: #0a2540;
}

.step summary {
  cursor: pointer;
}

.step summary h2 {
  display: inline;
  margin: 0;
}

.type-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.type-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: 1px solid #d5dee8;
  border-radius: 6px;
  padding: 6px 4px 8px;
  background: #fff;
  cursor: pointer;
  text-align: center;
}

.type-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.type-card:has(input:checked) {
  border-color: #0055ea;
  box-shadow: inset 0 0 0 1px #0055ea;
  background: #f5f8ff;
}

.type-card:focus-within {
  outline: 2px solid #0055ea;
  outline-offset: 1px;
}

.type-card svg {
  width: 100%;
  height: auto;
}

.type-name {
  font-weight: bold;
  font-size: 13px;
  color: #0a2540;
}

.type-code {
  font-size: 11px;
  color: #64748b;
  line-height: 1.3;
}

.subhead {
  margin: 12px 0 8px;
  font-size: 14px;
  color: #0a2540;
}

.carton-size-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 148px;
  gap: 12px;
  align-items: center;
}

.carton-fig {
  margin: 0;
}

.carton-fig svg {
  width: 100%;
  height: auto;
  display: block;
}

.mode-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 2.5em;
  row-gap: 6px;
  margin-bottom: 8px;
}

.mode-row label {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}

.check-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.fields.carton-fields {
  grid-template-columns: 1fr;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  color: #334155;
}

.field input:not([type="radio"]), .field select, .table-input {
  border: 1px solid #b7c3d0;
  border-radius: 4px;
  padding: 6px 8px;
  background: #fff;
  color: #1a2332;
}

.field input:not([type="radio"]):focus, .field select:focus, .table-input:focus {
  outline: 2px solid #0055ea;
  border-color: #0055ea;
}

/* 3. 寸法の書き換え: 自動欄は灰色、入力欄は白 */
.field input.is-ro {
  background: #eef2f6;
  color: #475569;
  cursor: default;
}
.field input.is-edit:not([readonly]) {
  background: #fff;
  border-color: #0055ea;
}
.field input.is-edit[readonly] {
  background: #f1f5f9;
  color: #94a3b8;
}

/* 3. フォーカス中の記号に対応する図上マーク */
#drawing .sym-mark-fill {
  fill: rgba(234, 88, 12, 0.22);
  stroke: #ea580c;
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
#drawing .sym-mark-arc {
  fill: none;
  stroke: #ea580c;
  stroke-width: 2.4;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
#drawing .sym-mark-label {
  fill: #c2410c;
  font-weight: 700;
  pointer-events: none;
}
#drawing #sym-highlight {
  animation: sym-mark-pulse 1.2s ease-in-out infinite;
}
@keyframes sym-mark-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.span-2 { grid-column: 1 / -1; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

button {
  border: 1px solid #0a2540;
  background: #0a2540;
  color: #fff;
  border-radius: 4px;
  padding: 7px 12px;
  cursor: pointer;
}

button:hover { background: #16365a; }

button.secondary {
  background: #fff;
  color: #0a2540;
}

button.secondary:hover { background: #f3f7fb; }

button.warn {
  background: #fff;
  color: #9a3412;
  border-color: #ea580c;
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

.proposals {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.proposal {
  text-align: left;
  background: #fff;
  color: #1a2332;
  border: 1px solid #b7c3d0;
  border-radius: 6px;
  padding: 8px 10px;
}

.proposal:hover { background: #f5f9ff; }

.proposal.selected {
  border-color: #0055ea;
  box-shadow: inset 3px 0 0 #0055ea;
  background: #f3f7ff;
}

.proposal strong { display: block; color: #0a2540; }

.proposal .tag {
  display: inline-block;
  background: #ea580c;
  color: #fff;
  font-size: 11px;
  border-radius: 10px;
  padding: 0 6px;
  margin-right: 4px;
}

.hint, .formula, .readout {
  font-size: 12px;
  color: #334155;
  background: #f8fafc;
  border-radius: 4px;
  padding: 8px;
}

.formula { margin-top: 8px; white-space: pre-wrap; }

.readout dl {
  display: grid;
  grid-template-columns: 9.5em 1fr;
  gap: 2px 8px;
  margin: 0;
}

.readout dt { color: #64748b; }
.readout dd { margin: 0; }

.swap-note {
  margin-top: 8px;
  padding: 8px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: 4px;
  font-size: 12px;
}

.view-col {
  position: sticky;
  top: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: calc(100vh - 20px);
}

.stage {
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}

.stage-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.stage-head h2 { margin: 0; font-size: 15px; color: #0a2540; }

.legend { font-size: 12px; color: #334155; }

.legend .cut { color: #111111; font-weight: bold; }
.legend .crease { color: #0055ea; font-weight: bold; }

.zoom-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 8px;
}

.handoff { position: relative; }

.handoff-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 5;
  min-width: 11em;
  background: #fff;
  border: 1px solid #d5dee8;
  border-radius: 6px;
  box-shadow: 0 6px 16px rgba(10, 37, 64, 0.12);
  padding: 4px;
}

.handoff-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  color: #0a2540;
  border: none;
  border-radius: 4px;
}

.handoff-menu button:hover { background: #f3f7fb; }

.canvas-wrap {
  overflow: auto;
  background:
    linear-gradient(#e7eef5 1px, transparent 1px),
    linear-gradient(90deg, #e7eef5 1px, transparent 1px);
  background-size: 20px 20px;
  background-color: #f8fafc;
  border: 1px solid #d5dee8;
  min-height: 0;
  flex: 1 1 auto;
}

#drawing {
  display: block;
  margin: 12px;
}

.assist { padding: 12px; flex: 0 0 auto; }

.assist h2 { margin: 0 0 6px; font-size: 15px; color: #0a2540; }

.assist p { margin: 0 0 6px; }

.assist ul { margin: 0; padding-left: 1.2em; }

.table-wrap { overflow-x: auto; }

.paper-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.paper-table th, .paper-table td {
  border-bottom: 1px solid #e6edf4;
  padding: 4px;
  vertical-align: middle;
}

.paper-table th { text-align: left; color: #64748b; font-weight: normal; }

.table-input { width: 100%; min-width: 4.5em; }

.bounds {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.empty {
  color: #64748b;
  font-size: 13px;
  padding: 28px 8px;
  text-align: center;
}

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .view-col { position: static; height: auto; }
  .canvas-wrap { min-height: 420px; flex: none; }
  .navbar-inner { flex-direction: column; align-items: flex-start; }
}

@media print {
  body { background: #fff; }
  .zoom-row, .assist, .handoff-menu { display: none !important; }
  .page { max-width: none; padding: 0; }
  .layout { display: block; }
  .view-col { position: static; height: auto; display: block; }
  .stage { position: static; }
  .canvas-wrap { max-height: none; overflow: visible; border: none; background: #fff; }
  #drawing { margin: 0; width: 100% !important; height: auto !important; }
}

/* 展開図だけ。未選択のときは、これまでの展開図印刷と同じ。 */
@media print {
  body:not([data-print="page"]) .navbar,
  body:not([data-print="page"]) .lead,
  body:not([data-print="page"]) .panel,
  body:not([data-print="page"]) .stage-head { display: none !important; }
  body:not([data-print="page"]) .stage { border: none; position: static; padding: 0; }
}
