:root {
  font-family: Georgia, "Times New Roman", serif;
  color: #2e2924;
  background: #f5f0e6;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
main { max-width: 720px; margin: 0 auto; padding: 20px; }
body.wide main { max-width: none; }
.sizebar { display: flex; gap: 6px; align-items: center; margin-top: 8px; font: 12px system-ui, sans-serif; }
.sizebar button { padding: 3px 10px; font: inherit; cursor: pointer; }
.sizebar button.active { background: #713e30; color: #fff4df; }
header { margin: 0 0 18px; }
.eyebrow { color: #8d5a39; font: 700 10px/1.2 system-ui, sans-serif; letter-spacing: .16em; }
h1 { margin: 5px 0 3px; color: #582d24; font-size: 25px; }
h2 { margin: 0; color: #582d24; font-size: 17px; }
p { line-height: 1.45; }
.muted, .hint { color: #6b6258; }
.muted { margin: 0; font-size: 13px; }
.hint { margin: 7px 0 12px; font-size: 12px; }
.panel, .player-card, .sheet-row {
  margin-bottom: 12px;
  padding: 15px;
  border: 1px solid #d5c8b3;
  border-radius: 9px;
  background: #fffdf8;
  box-shadow: 0 2px 6px #4c342011;
}
.section-title, .inline-form, .sheet-row, .card-head, .sheet-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.inline-form { align-items: stretch; margin-top: 12px; }
label { display: block; margin-bottom: 5px; font: 600 12px system-ui, sans-serif; }
input {
  width: 100%;
  min-width: 0;
  padding: 10px;
  border: 1px solid #c9bba6;
  border-radius: 6px;
  background: #fff;
  font: 14px system-ui, sans-serif;
}
.inline-form input { flex: 1; }
button {
  border: 0;
  border-radius: 6px;
  padding: 9px 12px;
  cursor: pointer;
  white-space: nowrap;
  font: 600 12px system-ui, sans-serif;
}
button:disabled { opacity: .55; cursor: wait; }
.primary { color: #fffaf1; background: #713e30; }
.primary:hover { background: #5b3026; }
.secondary { color: #453b31; background: #e9dfcf; }
.text-button { margin-top: 10px; padding: 5px 0; color: #713e30; background: transparent; }
.player-card h3 { margin: 0; color: #582d24; font-size: 15px; }
.player-card .code { overflow-wrap: anywhere; font: 12px/1.6 ui-monospace, monospace; }
.card-head { margin-bottom: 8px; }
.card-head h3 { margin: 0; }
.sheet-row { margin: 7px 0 0; padding: 9px; box-shadow: none; }
.sheet-row span { overflow: hidden; text-overflow: ellipsis; font: 13px system-ui, sans-serif; }
.sheet-actions { flex: 0 0 auto; }
.notice {
  margin-top: 10px;
  padding: 10px;
  border-radius: 6px;
  background: #f2e8d2;
  font: 12px/1.5 system-ui, sans-serif;
}
.status { min-height: 18px; margin: 10px 2px; color: #6b2e25; font: 12px system-ui, sans-serif; }
.pdf-frame { position: relative; height: 62vh; min-height: 420px; border: 1px solid #6f5624; background: #0b0806; }
.pdfViewer .annotationLayer .textWidgetAnnotation :is(input, textarea),
.pdfViewer .annotationLayer .choiceWidgetAnnotation select,
.pdfViewer .annotationLayer .buttonWidgetAnnotation:is(.checkBox, .radioButton) input {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none;
  color: #f1e5c6;
}
.pdf-container .pdfViewer .page { box-sizing: content-box; }
.pdfViewer .annotationLayer .textWidgetAnnotation input { text-align: center; }
.pdfViewer .annotationLayer .buttonWidgetAnnotation.checkBox input:checked::before,
.pdfViewer .annotationLayer .buttonWidgetAnnotation.checkBox input:checked::after { background-color: #f3d98b !important; }
.pdfViewer .annotationLayer canvas.annotationContent { filter: none !important; }
.pdfViewer .annotationLayer section:has(:is(input, textarea)[name="charakterbild"]) { display: none !important; }
.image-slot {
  position: absolute; z-index: 10; overflow: hidden; cursor: pointer;
  display: flex; align-items: center; justify-content: center; text-align: center;
  background: #0b0806; border: 1px solid #6f5624; border-radius: 3px;
  color: #c9a24a; font: italic 600 clamp(9px, 1.6vw, 13px) Georgia, serif;
}
.image-slot:hover, .image-slot:focus-visible { outline: 2px solid #f3d98b; }
.image-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.image-slot .image-remove {
  position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; padding: 0;
  border: 0; border-radius: 50%; background: rgba(113, 62, 48, 0.85); color: #fff4df;
  font: 16px/22px system-ui, sans-serif; cursor: pointer; opacity: 0;
}
.image-slot:hover .image-remove, .image-slot:focus-within .image-remove { opacity: 1; }
.pdfViewer .annotationLayer .buttonWidgetAnnotation:is(.checkBox, .radioButton) input {
  margin: 0 !important;
  width: 100% !important;
  height: 100% !important;
}
.pdfViewer .annotationLayer :is(input, textarea, select)[required] { outline: none !important; }
.pdfViewer .annotationLayer .textWidgetAnnotation :is(input, textarea):focus {
  background: rgba(243, 217, 139, 0.1) !important;
  outline: 1px solid #c9a24a;
}
.pdf-container { position: absolute; inset: 0; overflow: auto; background: #0b0806; }
.zoombar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 8px; font: 12px system-ui, sans-serif; }
.zoombar button { padding: 3px 10px; font: inherit; cursor: pointer; }
.zoombar #zoom-level { min-width: 46px; text-align: center; font-weight: 600; }
.pdf-container.pannable, .pdf-container.pannable * { cursor: grab !important; }
body.wide .pdf-frame { height: 75vh; }
footer { margin-top: 18px; color: #776d61; font: 11px/1.4 system-ui, sans-serif; }

/* Dunkles Design */
body.dark { background: #14100c; color: #e8dcc2; color-scheme: dark; }
body.dark h1, body.dark h2, body.dark .player-card h3 { color: #f3d98b; }
body.dark .eyebrow { color: #c9a24a; }
body.dark .muted, body.dark .hint, body.dark footer { color: #a89c86; }
body.dark .status { color: #ff9a8a; }
body.dark .panel, body.dark .player-card, body.dark .sheet-row {
  background: #21170f; border-color: #6f5624; box-shadow: none;
}
body.dark input { background: #0b0806; border-color: #6f5624; color: #f1e5c6; }
body.dark .primary { background: #8a5a2b; color: #fff4df; }
body.dark .primary:hover { background: #a36b33; }
body.dark .secondary, body.dark .sizebar button, body.dark .zoombar button { background: #3a2915; color: #f1e5c6; }
body.dark .sizebar button.active { background: #c9a24a; color: #1a120b; }
body.dark .text-button { color: #f3d98b; background: transparent; }
body.dark .notice { background: #2a1d11; color: #e8dcc2; }
body.dark .pdf-frame { border-color: #6f5624; }
body.dark .sizebar, body.dark .zoombar { color: #e8dcc2; }
.stack { display: grid; gap: 1px; }
.hidden { display: none !important; }
.header-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.header-buttons { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.code-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.code-row strong { flex: 0 0 90px; overflow: hidden; text-overflow: ellipsis; font: 600 13px system-ui, sans-serif; }
.code-row .code-field { flex: 1; font: 11px ui-monospace, monospace; padding: 7px; }
#players-panel .section-title { align-items: flex-start; }
#players-panel .hint { margin: 0; }
body.dark .code-row strong { color: #f3d98b; }
.settings-btn { background: #e9dfcf; color: #453b31; }
.settings-btn[aria-expanded="true"] { background: #713e30; color: #fff4df; }
.settings-panel { margin-top: 10px; padding: 10px 12px; border: 1px solid #d5c8b3; border-radius: 9px; background: #fffdf8; }
.settings-panel .sizebar { margin: 0 0 8px; flex-wrap: wrap; }
.settings-panel .sizebar:last-child { margin-bottom: 0; }
.settings-panel .sizebar button { background: #e9dfcf; color: #453b31; }
body.dark .settings-btn { background: #3a2915; color: #f1e5c6; }
body.dark .settings-btn[aria-expanded="true"] { background: #c9a24a; color: #1a120b; }
body.dark .settings-panel { background: #21170f; border-color: #6f5624; }
body.dark .settings-panel .sizebar button { background: #3a2915; color: #f1e5c6; }
body.dark .settings-panel .sizebar button.active { background: #c9a24a; color: #1a120b; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 460px) {
  main { padding: 14px; }
  .inline-form { flex-direction: column; }
  .inline-form button { width: 100%; }
  .section-title { align-items: flex-start; }
}
