/* Picture Round Creator */
#pr-app {
  display: grid;
  grid-template-columns: 300px 1fr;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #e8eef5;
  color: #1a2a3a;
  font-family: 'Inter', system-ui, sans-serif;
}
#pr-sidebar {
  background: #f7f9fc;
  border-right: 1px solid #d5dee9;
  overflow-y: auto;
  min-height: 0;
  padding: 16px 18px 12px;
  display: flex;
  flex-direction: column;
}
#pr-sidebar .btn-back {
  margin-bottom: 12px;
  border-color: #d5dee9;
  color: #5a6f86;
  background: #fff;
}
#pr-sidebar .brand h1 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f2a4a;
}
#pr-sidebar .tagline {
  font-size: 0.78rem;
  color: #5a6f86;
  margin-bottom: 18px;
}
#pr-sidebar .panel { margin-bottom: 20px; }
#pr-sidebar .panel h2 {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #3b5a7a;
  margin-bottom: 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid #d5dee9;
}
#pr-sidebar label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: #5a6f86;
  margin: 8px 0 3px;
}
#pr-sidebar input[type="text"],
#pr-sidebar select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d5dee9;
  border-radius: 7px;
  font-size: 0.88rem;
  background: #fff;
}
#pr-sidebar .checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.85rem;
  color: #1a2a3a;
  cursor: pointer;
}
#pr-sidebar .hint {
  font-size: 0.75rem;
  color: #5a6f86;
  margin: 8px 0;
}
#pr-sidebar .actions {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  padding-bottom: 16px;
  background: #f7f9fc;
  border-top: 1px solid #d5dee9;
  position: static;
}
#pr-sidebar .btn {
  padding: 11px 14px;
  border: none;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}
#pr-sidebar .btn.primary { background: #ea580c; color: #fff; }
#pr-sidebar .btn.success { background: #16a34a; color: #fff; }
#pr-sidebar .btn.secondary {
  background: #e8eef5;
  color: #1e3a5f;
  border: 1px solid #d5dee9;
}

#pr-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #c5d0de;
}
.pr-drop {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  position: relative;
}
.pr-drop.dragover {
  outline: 3px dashed #ea580c;
  outline-offset: -10px;
  background: #dbe4ee;
}
.pr-drop-hint {
  position: absolute;
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%);
  background: rgba(255,255,255,0.92);
  border: 2px dashed #94a3b8;
  border-radius: 12px;
  padding: 18px 22px;
  font-weight: 600;
  color: #475569;
  pointer-events: none;
}
.pr-drop-hint.hidden { display: none; }

.pr-sheet {
  background: #fff;
  box-shadow: 0 12px 40px rgba(15,30,60,0.18);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pr-sheet.portrait { width: min(560px, 92%); min-height: calc(560px * 297 / 210); height: auto; }
.pr-sheet.landscape { width: min(780px, 96%); min-height: calc(780px * 210 / 297); height: auto; }

.pr-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 14px 16px 12px;
}
.pr-head {
  text-align: center;
  margin-bottom: 10px;
  flex-shrink: 0;
}
.pr-head h1 {
  font-family: 'Space Grotesk', Inter, sans-serif;
  font-size: 1.55rem;
  font-weight: 700;
  color: #9a3412;
  letter-spacing: -0.02em;
}
.pr-head p {
  font-size: 0.82rem;
  color: #7c2d12;
  margin-top: 2px;
}
.pr-grid {
  flex: 1;
  display: grid;
  gap: 10px 12px;
  min-height: 0;
  align-content: stretch;
}
.pr-cell {
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}
.pr-photo {
  flex: 1;
  min-height: 0;
  border: 1.5px solid #c4b5a5;
  border-radius: 6px;
  overflow: hidden;
  background: #f8f5f0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pr-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  display: block;
  cursor: move;
  touch-action: none;
}
.pr-num {
  position: absolute;
  left: 6px;
  top: 6px;
  background: #9a3412;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pr-line {
  margin-top: 5px;
  height: 16px;
  border-bottom: 1.5px solid #9a3412;
  flex-shrink: 0;
}
.pr-remove {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  line-height: 1;
}
.pr-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 0.9rem;
  text-align: center;
}

@media print {
  body * { visibility: hidden !important; }
  #view-picture-round, #view-picture-round * { visibility: visible !important; }
  #pr-sidebar, .preview-toolbar, .pr-drop-hint, .pr-remove, .btn-back { display: none !important; }
  #pr-app { display: block !important; }
  #pr-main { position: absolute; left: 0; top: 0; width: 100%; height: 100%; background: #fff; }
  .pr-drop { padding: 0; overflow: visible; }
  .pr-sheet { box-shadow: none; width: 100% !important; height: 100% !important; aspect-ratio: auto; }
}


@page {
  size: A4;
  margin: 0;
}

.pr-ans-h { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: #9a3412; margin: 12px 0 6px; }
.pr-ans-row { display: flex; gap: 6px; align-items: center; margin-bottom: 5px; font-size: 0.8rem; }
.pr-ans-row span { width: 22px; color: #9a3412; font-weight: 700; }
.pr-ans-row input { flex: 1; padding: 5px 7px; border: 1px solid #e7d5c4; border-radius: 5px; }
.pr-ans-list { display: flex; flex-direction: column; gap: 8px; padding: 4px 6px; }
.pr-ans-item { display: flex; align-items: flex-end; gap: 8px; min-height: 28px; }
.pr-ans-item .n { width: 28px; font-weight: 800; color: #9a3412; }
.pr-ans-item .line { flex: 1; border-bottom: 1.5px solid #9a3412; min-height: 22px; font-size: 0.95rem; }

.pr-sheet[hidden],
#prAnswersSheet[hidden] {
  display: none !important;
}

.pr-cell { cursor: grab; }
.pr-cell.dragging { opacity: 0.45; cursor: grabbing; }
.pr-cell.drag-over { outline: 2px dashed #ea580c; outline-offset: 2px; }

.pr-grip {
  position: absolute;
  left: 6px;
  bottom: 26px;
  z-index: 5;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 4px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  cursor: grab;
  font-size: 12px;
  line-height: 1;
}
.pr-grip:active { cursor: grabbing; }

.pr-photo img.panning { cursor: grabbing; }
