* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, sans-serif;
  background: #1b1d22;
  color: #e8e8ec;
}
.hidden { display: none !important; }

.overlay-screen {
  position: fixed; inset: 0;
  background: rgba(10,10,14,0.9);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.login-box {
  background: #25262e;
  padding: 28px 32px;
  border-radius: 10px;
  width: 360px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.login-box h1, .login-box h2 { margin-top: 0; color: #ffcf6b; }
.login-box label { display: block; margin: 10px 0 4px; font-size: 13px; color: #aab; }
.login-box input[type=text], .login-box input[type=number], .login-box input[type=password], .login-box input:not([type]) {
  width: 100%; padding: 8px; border-radius: 6px; border: 1px solid #3a3c46;
  background: #1b1d22; color: #fff; box-sizing: border-box;
}
.login-error { color: #fa5252; font-size: 13px; margin: 6px 0 0; }
.login-box input[type=color] { width: 44px; height: 34px; padding: 2px; border-radius: 6px; border: 1px solid #3a3c46; background: #1b1d22; cursor: pointer; flex-shrink: 0; }
.login-box select {
  width: 100%; padding: 8px; border-radius: 6px; border: 1px solid #3a3c46;
  background: #1b1d22; color: #fff; box-sizing: border-box;
}
.color-row { display: flex; align-items: center; gap: 8px; }
.color-row input[type=color] { width: 44px !important; }
.hex-input { flex: 1; font-family: monospace; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }

button {
  background: #4c6ef5; color: #fff; border: none; border-radius: 6px;
  padding: 9px 14px; cursor: pointer; font-size: 14px; margin-top: 12px;
}
button:hover { background: #5c7cfa; }
button.danger, .danger-btn { background: #e03131; }
button.danger:hover, .danger-btn:hover { background: #f03e3e; }
#ho-show { background: #2f9e44; }
#ho-show:hover { background: #37b24d; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }

#app { display: flex; flex-direction: column; height: 100vh; }
#top-bar {
  background: #20212a; padding: 8px 16px; display: flex; align-items: center;
  gap: 16px; border-bottom: 1px solid #333540; flex-wrap: wrap;
}
#session-label { font-weight: bold; color: #ffcf6b; }
#gm-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#zoom-controls { display: flex; align-items: center; gap: 4px; margin-left: auto; }
#zoom-controls button { font-size: 14px; padding: 2px 8px; margin: 0; line-height: 1; }
#zoom-label { font-size: 12px; color: #aaa; min-width: 38px; text-align: center; }
#gm-tools button, #gm-tools .file-btn { margin-top: 0; font-size: 12px; padding: 6px 10px; }

#layer-switcher { display: flex; align-items: center; gap: 4px; border-left: 1px solid #3a3d4a; padding-left: 10px; }
.layer-btn { margin: 0 !important; padding: 4px 9px !important; font-size: 11px !important; border: 1px solid #444; background: #1b1d22; color: #888; border-radius: 4px; cursor: pointer; }
.layer-btn.active { border-color: #4dabf7; color: #4dabf7; background: rgba(77,171,247,0.1); }
.layer-btn:hover:not(.active) { border-color: #666; color: #ccc; }

.map-btn-wrap { position: relative; }

/* ---------- Szenen-Panel ---------- */
#scenes-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 300;
  background: #1a1c24; border: 1px solid #3a3c46; border-radius: 8px;
  padding: 8px; min-width: 300px;
  display: flex; flex-direction: column; gap: 5px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.6);
}
.scene-row {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 6px; border-radius: 6px; background: #22243a;
}
.scene-row.scene-active { background: #2a2d4a; outline: 1px solid #4477ff44; }
.scene-name-input {
  flex: 1; background: transparent; border: none; border-bottom: 1px solid transparent;
  color: #d0d4e8; font-size: 13px; padding: 2px 4px; border-radius: 3px; min-width: 0;
}
.scene-name-input:hover { border-bottom-color: #555; }
.scene-name-input:focus { outline: none; border-bottom-color: #4477ff; background: #1a1c2e; }
.scene-player-badge { font-size: 10px; color: #4caf50; opacity: 0; width: 10px; flex-shrink: 0; }
.scene-player-badge.visible { opacity: 1; }
.scene-switch-btn, .scene-push-btn, .scene-del-btn {
  background: none; border: 1px solid #444; color: #888; cursor: pointer;
  padding: 2px 5px; border-radius: 4px; font-size: 12px; margin: 0; line-height: 1.4;
}
.scene-switch-btn:hover { color: #d0d4e8; border-color: #666; background: #2e3040; }
.scene-push-btn:hover { color: #4caf50; border-color: #4caf50; background: #1a2a1a; }
.scene-del-btn:hover { color: #fa5252; border-color: #fa5252; background: #2a1a1a; }
.scene-switch-btn.active-scene { color: #4dabf7; border-color: #4dabf7; }
#scene-add-btn {
  margin-top: 2px; background: #22243a; border: 1px dashed #4477ff66;
  color: #aab; border-radius: 6px; padding: 5px 10px;
  font-size: 12px; cursor: pointer; width: 100%;
}
#scene-add-btn:hover { background: #2a2d4a; border-color: #4477ff; color: #d0d4e8; }

/* ---------- Nutzer-Whitelist-Panel ---------- */
#users-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 300;
  background: #1a1c24; border: 1px solid #3a3c46; border-radius: 8px;
  padding: 8px; min-width: 320px;
  display: flex; flex-direction: column; gap: 5px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.6);
}
.user-row { gap: 4px; }
.user-pw-input {
  width: 100px; background: transparent; border: none; border-bottom: 1px solid transparent;
  color: #d0d4e8; font-size: 12px; padding: 2px 4px; border-radius: 3px;
}
.user-pw-input:hover { border-bottom-color: #555; }
.user-pw-input:focus { outline: none; border-bottom-color: #4477ff; background: #1a1c2e; }
.users-add-row { display: flex; gap: 5px; margin-top: 2px; }
.users-add-row input {
  flex: 1; min-width: 0; background: #22243a; border: 1px solid #3a3c46; border-radius: 4px;
  color: #ccc; font-size: 12px; padding: 4px 6px;
}
#user-add-btn {
  margin: 0; background: #22243a; border: 1px dashed #4477ff66;
  color: #aab; border-radius: 6px; padding: 5px 10px;
  font-size: 12px; cursor: pointer; flex-shrink: 0;
}
#user-add-btn:hover { background: #2a2d4a; border-color: #4477ff; color: #d0d4e8; }

#map-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 300;
  background: #1b1d22; border: 1px solid #3a3d4a; border-radius: 8px;
  padding: 12px; min-width: 280px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.6);
}
.map-panel-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.map-panel-row label { font-size: 12px; color: #9aa; white-space: nowrap; }
.map-panel-row input[type=number] { width: 70px; }
.map-panel-row select { flex: 1; }
#map-panel .file-btn { align-self: flex-start; }
#map-apply { align-self: flex-start; margin-top: 2px; }
.file-btn {
  background: #4c6ef5; color: #fff; padding: 6px 10px; border-radius: 6px;
  cursor: pointer; font-size: 12px;
}
.hint { color: #888; font-size: 12px; }

main { flex: 1; display: flex; overflow: hidden; }
#map-wrapper { flex: 1; overflow: auto; background: #0e0f12; position: relative; scrollbar-width: thin; scrollbar-color: #2e3040 transparent; }
#map-wrapper::-webkit-scrollbar { width: 6px; height: 6px; }
#map-wrapper::-webkit-scrollbar-track { background: transparent; }
#map-wrapper::-webkit-scrollbar-thumb { background: #2e3040; border-radius: 3px; }
#map-wrapper::-webkit-scrollbar-thumb:hover { background: #3a3d52; }
#map-canvas { display: block; cursor: grab; box-shadow: 0 0 0 1px #333, 0 0 40px rgba(0,0,0,0.6); }
#dice-box { position: fixed; z-index: 9999; pointer-events: none; opacity: 0; transition: opacity 0.15s; }
#dice-box.dice-active { opacity: 1; }
#dice-box canvas { width: 100%; height: 100%; display: block; }
#players-hud { position: fixed; bottom: 10px; left: 10px; display: flex; flex-direction: column; gap: 4px; pointer-events: none; z-index: 50; }
#gambits-panel { position: fixed; top: 56px; left: 12px; z-index: 50; background: rgba(10,10,14,0.85); border: 1px solid #3a3c46; border-radius: 8px; padding: 8px 14px; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 90px; backdrop-filter: blur(4px); }
#gambits-panel .gambits-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #888; }
#gambits-panel .gambits-controls { display: flex; align-items: center; gap: 8px; position: relative; }
#gambits-panel #gambits-value { font-size: 28px; font-weight: bold; color: #ffcf6b; min-width: 32px; text-align: center; line-height: 1; }
#gambits-panel .gambits-icon { width: 18px; height: auto; margin-right: -12px; }
#gambits-panel .gambits-btn { background: none; border: 1px solid #555; color: #ccc; border-radius: 4px; width: 22px; height: 22px; font-size: 16px; line-height: 1; cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center; margin: 0; }
#gambits-panel .gambits-btn:hover { background: #2e3040; }
.gambit-fx {
  position: absolute; top: 100%; left: 50%;
  font-weight: 800; font-size: 32px;
  pointer-events: none; white-space: nowrap;
  text-shadow: 0 0 10px currentColor, 0 2px 4px rgba(0,0,0,0.7);
  animation: gambit-fx-float 1.4s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}
.gambit-fx-minus { color: #fa5252; }
.gambit-fx-plus { color: #51cf66; }
@keyframes gambit-fx-float {
  0%   { transform: translate(-50%, 0) scale(0.4); opacity: 0; }
  15%  { transform: translate(-50%, -6px) scale(1.5); opacity: 1; }
  32%  { transform: translate(-50%, 0) scale(1.1); opacity: 1; }
  100% { transform: translate(-50%, 46px) scale(0.9); opacity: 0; }
}
.phud-entry { font-size: 12px; color: #ccc; background: rgba(10,10,14,0.7); padding: 2px 8px; border-radius: 10px; display: flex; align-items: center; gap: 6px; }
.phud-dot { width: 8px; height: 8px; border-radius: 50%; background: #51cf66; flex-shrink: 0; }
.phud-entry.is-gm .phud-dot { background: #f59f00; }

#sidebar { width: 340px; background: #20212a; border-left: 1px solid #333540; display: flex; flex-direction: column; }
.tabs { display: flex; border-bottom: 1px solid #333540; }
.tab-btn {
  flex: 1; background: none; color: #aab; border-radius: 0; margin: 0;
  padding: 10px; border-bottom: 2px solid transparent;
}
.tab-btn.active { color: #ffcf6b; border-bottom-color: #ffcf6b; background: none; }
.tab-content { display: none; flex: 1; flex-direction: column; overflow: hidden; padding: 10px; }
.tab-content.active { display: flex; }

#chat-log { flex: 1; overflow-y: auto; font-size: 13px; padding-right: 4px; scrollbar-width: thin; scrollbar-color: #2e3040 transparent; }
#chat-log::-webkit-scrollbar { width: 6px; }
#chat-log::-webkit-scrollbar-track { background: transparent; }
#chat-log::-webkit-scrollbar-thumb { background: #2e3040; border-radius: 3px; }
#chat-log::-webkit-scrollbar-thumb:hover { background: #3a3d52; }
#chat-log .msg { margin-bottom: 8px; }
#chat-log .msg .author { color: #ffcf6b; font-weight: bold; margin-right: 4px; }
#chat-log .msg.system { color: #888; font-style: italic; }
#chat-log .msg.system .chat-highlight { font-style: normal; }
#chat-log .msg.system .chat-highlight-gambit { color: #ffcf6b; }
#chat-log .msg.system .chat-highlight-stress { color: #fa5252; }
#chat-log .msg.system .chat-highlight-push { color: #51cf66; }
#chat-log .msg.system .chat-highlight-warn { color: #fa5252; text-shadow: 0 0 6px rgba(250,82,82,0.4); }
#chat-log .msg.roll { color: #69db7c; }
#chat-log .msg a { color: #74c0fc; text-decoration: none; }
#chat-log .msg a:hover { text-decoration: underline; }
#chat-log .chat-img { display: block; max-width: 100%; max-height: 220px; margin-top: 4px; border-radius: 4px; cursor: pointer; }
.msg-wrapper { position: relative; }
@keyframes msgFadeIn { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: translateY(0); } }
@keyframes msgFadeOut { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-2px); } }
.msg-wrapper.msg-enter { animation: msgFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1); }
.msg-wrapper.msg-exit { animation: msgFadeOut 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards; pointer-events: none; }
.msg-wrapper .chat-msg-del {
  position: absolute; top: 0; right: 0;
  background: none; border: none; color: #555; cursor: pointer;
  font-size: 11px; line-height: 1; padding: 2px 4px; margin: 0;
}
.msg-wrapper .chat-msg-del:hover { color: #fa5252; }
.chat-input-row { display: flex; gap: 6px; margin-top: 8px; }
.chat-input-row input { flex: 1; padding: 8px; border-radius: 6px; border: 1px solid #3a3c46; background: #1b1d22; color: #fff; }
.chat-input-row button { margin-top: 0; }
#chat-custom-roll-btn { padding: 0 8px; flex-shrink: 0; }

#sheet-list { overflow-y: auto; margin-top: 10px; flex: 1; }
.sheet-card {
  background: #1b1d22; border: 1px solid #333540; border-radius: 8px;
  padding: 10px; margin-bottom: 8px; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
}
.sheet-card:hover { border-color: #4c6ef5; }
.sheet-card-thumb {
  width: 36px; height: 36px; border-radius: 6px; flex: 0 0 auto;
  background: #2a2c35; object-fit: cover; border: 1px solid #333540;
}
.sheet-card-text { flex: 1; min-width: 0; }
.sheet-card .sname { font-weight: bold; color: #ffcf6b; }
.sheet-card .sfield { font-size: 12px; color: #ccc; }

.field-row { display: flex; gap: 6px; margin-bottom: 6px; }
.field-row input { padding: 6px; border-radius: 6px; border: 1px solid #3a3c46; background: #1b1d22; color: #fff; }
.field-row .flabel { width: 35%; }
.field-row .fvalue { flex: 1; }
.field-row button { margin: 0; padding: 4px 8px; }


/* ---------- Stars in the Dark Sheet (PDF-Look, responsive) ---------- */
/* ---------- Sheet-Modal-Container: kein blockierendes Overlay mehr ---------- */
#sheet-modal.overlay-screen {
  background: transparent;
  pointer-events: none;
  display: block; /* Positionierung übernimmt .sheet-paper selbst */
}

#ship-modal { display: contents; }
#ship-modal.hidden { display: none; }

.sheet-dragbar {
  display: flex; justify-content: space-between; align-items: center;
  background: #1b1d22; border-bottom: 1px solid #3a3d4a; border-radius: 10px 10px 0 0;
  padding: 7px 12px; cursor: move; flex: 0 0 auto;
  font-size: 12px; color: #9aa; user-select: none;
}
.sheet-close-x {
  background: #3a3d4a; color: #fff; border: none; border-radius: 5px;
  width: 24px; height: 24px; margin: 0; padding: 0; font-size: 13px; cursor: pointer;
}
.sheet-close-x:hover { background: #e03131; }

.autosave-status {
  font-size: 11px; color: #69db7c; opacity: 0; transition: opacity 0.3s;
  align-self: center;
}
.autosave-status.show { opacity: 1; }

.handout-paper {
  position: fixed;
  pointer-events: auto;
  resize: both;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 320px;
  min-height: 200px;
  max-width: 98vw;
  max-height: 96vh;
  background: #2b2e3a;
  border: 1px solid #3a3d4a;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
  color: #e8e8ec;
  padding: 0;
  z-index: 200;
}
.handout-paper.hidden { display: none; }
.handout-dragbar {
  display: flex; justify-content: space-between; align-items: center;
  background: #1b1d22; border-bottom: 1px solid #3a3d4a; border-radius: 10px 10px 0 0;
  padding: 7px 12px; cursor: move; flex: 0 0 auto;
  font-size: 12px; color: #9aa; user-select: none;
}
.handout-body {
  display: flex; flex-direction: column; gap: 6px;
  padding: 12px; overflow-y: auto; flex: 1;
  scrollbar-width: thin; scrollbar-color: #2e3040 transparent;
}
.handout-body::-webkit-scrollbar { width: 6px; }
.handout-body::-webkit-scrollbar-track { background: transparent; }
.handout-body::-webkit-scrollbar-thumb { background: #2e3040; border-radius: 3px; }
.handout-body::-webkit-scrollbar-thumb:hover { background: #3a3d52; }
.handout-body label { font-size: 12px; color: #9aa; margin: 0; }
.handout-body input, .handout-body textarea {
  width: 100%; box-sizing: border-box;
}

/* ---------- SRD (Notion-Regelwerk) ---------- */
.srd-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.srd-toolbar #srd-sync-btn { margin: 0; }
#srd-synced-at { font-size: 11px; color: #888; }
#srd-sync-status {
  font-size: 12px; padding: 6px 8px; border-radius: 6px; margin-bottom: 8px;
}
#srd-sync-status.pending { background: #2e3040; color: #ccc; }
#srd-sync-status.error { background: #3a1f22; color: #ff8787; }

.srd-tree {
  font-size: 13px; flex: 1; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: #2e3040 transparent;
}
.srd-tree::-webkit-scrollbar { width: 6px; }
.srd-tree::-webkit-scrollbar-track { background: transparent; }
.srd-tree::-webkit-scrollbar-thumb { background: #2e3040; border-radius: 3px; }
.srd-tree::-webkit-scrollbar-thumb:hover { background: #3a3d52; }
.srd-node-row {
  display: flex; align-items: center; gap: 4px; padding: 3px 4px; border-radius: 4px; cursor: pointer;
}
.srd-node-row:hover { background: #2a2c35; }
.srd-arrow {
  width: 14px; flex: 0 0 auto; text-align: center; color: #888; font-size: 10px;
  transition: transform 0.15s;
}
.srd-arrow.expanded { transform: rotate(90deg); }
.srd-arrow.leaf { visibility: hidden; }
.srd-node-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srd-children { margin-left: 16px; display: none; }
.srd-children.expanded { display: block; }
.srd-empty { color: #888; font-size: 12px; padding: 6px 4px; }

.srd-body {
  line-height: 1.5; font-size: 14px;
}
.srd-body h1 { font-size: 19px; color: #ffcf6b; margin: 14px 0 8px; }
.srd-body h2 { font-size: 17px; color: #ffcf6b; margin: 12px 0 6px; }
.srd-body h3 { font-size: 15px; color: #ffcf6b; margin: 10px 0 6px; }
.srd-body p { margin: 0 0 8px; }
.srd-body ul, .srd-body ol { margin: 0 0 8px; padding-left: 22px; }
.srd-body blockquote {
  margin: 0 0 8px; padding: 4px 10px; border-left: 3px solid #4c6ef5; color: #ccc; background: #22242c;
}
.srd-body pre {
  background: #1b1d22; border: 1px solid #3a3c46; border-radius: 6px; padding: 8px 10px;
  overflow-x: auto; margin: 0 0 8px;
}
.srd-body code { font-family: 'Consolas', monospace; font-size: 12px; }
.srd-body hr { border: none; border-top: 1px solid #3a3c46; margin: 12px 0; }
.srd-body .srd-callout {
  background: #22242c; border: 1px solid #3a3c46; border-radius: 6px; padding: 8px 10px; margin: 0 0 8px;
}
.srd-body .srd-todo { margin: 0 0 4px; }
.srd-body table.srd-table { border-collapse: collapse; margin: 0 0 8px; width: 100%; }
.srd-body table.srd-table td, .srd-body table.srd-table th {
  border: 1px solid #3a3c46; padding: 5px 8px; text-align: left; vertical-align: top;
}
.srd-body table.srd-table th { background: #2a2c35; }
.srd-body figure.srd-img { margin: 0 0 8px; }
.srd-body figure.srd-img img { max-width: 100%; border-radius: 6px; }
.srd-body figure.srd-img figcaption { font-size: 12px; color: #999; margin-top: 4px; }
.srd-body figure.srd-cover { margin: -12px -12px 10px; }
.srd-body figure.srd-cover img { width: 100%; max-height: 220px; object-fit: cover; display: block; }
.srd-body .srd-columns { display: flex; gap: 16px; margin: 0 0 8px; }
.srd-body .srd-columns .srd-column { flex: 1; min-width: 0; }
.srd-body a { color: #4c6ef5; cursor: pointer; }

.sheet-paper {
  position: fixed;
  pointer-events: auto;
  resize: both;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 480px;
  min-height: 320px;
  max-width: 98vw;
  max-height: 96vh;
  background: #2b2e3a;
  border: 1px solid #3a3d4a;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
  color: #e8e8ec;
  padding: 0;
}

.sheet-toolbar {
  flex: 0 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  margin: 0; padding: 4px 12px; flex-wrap: wrap; gap: 4px;
  border-bottom: 1px solid #3a3d4a; font-size: 11px;
}
.sheet-toolbar button { font-size: 11px; padding: 2px 8px; }
.sheet-toolbar label { font-size: 11px; }
.sheet-toolbar .modal-actions.inline { gap: 4px; }

.sheet-tabs { display: flex; flex: 0 0 auto; border-bottom: 1px solid #3a3d4a; }
.sheet-tab-btn {
  flex: 0 0 auto; margin: 0; background: none; color: #aab; border-radius: 0;
  padding: 4px 12px; border: none; border-bottom: 2px solid transparent; font-size: 11px;
}
.sheet-tab-btn.active { color: #ffcf6b; border-bottom-color: #ffcf6b; background: none; }
.sheet-tab-panel { display: none; }
.sheet-tab-panel.active { display: block; }

.sheet-body::-webkit-scrollbar { width: 6px; }
.sheet-body::-webkit-scrollbar-track { background: transparent; }
.sheet-body::-webkit-scrollbar-thumb { background: #2e3040; border-radius: 3px; }
.sheet-body::-webkit-scrollbar-thumb:hover { background: #3a3d52; }

.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 16px 20px 24px;
}
.sheet-content {
  min-width: 915px;
}

.modal-actions.inline { display: flex; gap: 8px; margin: 0; }
.modal-actions.inline button { margin: 0; }

.sheet-titlebar-v2 {
  display: grid; grid-template-columns: 1.7fr 0.6fr 1.3fr 1.35fr 1.35fr; gap: 10px;
  align-items: stretch; margin-bottom: 10px; height: 130px;
}
.portrait-box {
  grid-column: 1; align-self: start;
  width: 100%; height: 130px; max-height: 130px; border-radius: 8px; border: 1px solid #3a3d4a;
  background: #1b1d22; cursor: pointer; overflow: hidden;
  display: flex; align-items: center; justify-content: center; position: relative;
}
.portrait-box img { width: 100%; height: 100%; object-fit: cover; }
.portrait-placeholder { font-size: 11px; color: #777; }
.portrait-box:hover { border-color: #ffcf6b; }

.head-middle {
  grid-column: 2 / 5; min-width: 0; display: flex; gap: 14px;
  background: #20212a; border: 1px solid #3a3d4a; border-radius: 8px; padding: 10px 12px;
  height: 130px; box-sizing: border-box; overflow: hidden;
}
.head-col { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.head-col-name { max-width: 180px; }

.sheet-logo {
  display: flex;
  /* align-items: center; */
  justify-content: center;
  /* flex: 1; */
  height: 31px;
}
.sheet-logo img { max-width: 100%; max-height: 56px; object-fit: contain; }

.head-col input {
  width: 100%; padding: 7px 9px; border-radius: 5px; border: 1px solid #3a3d4a;
  background: #1b1d22; color: #fff; font-size: 13px; flex: 0 0 auto; box-sizing: border-box;
}
.head-col input::placeholder { color: #778; }

.sheet-side-box {
  grid-column: 5; display: flex; flex-direction: column; gap: 8px; min-width: 0;
  height: 130px; box-sizing: border-box;
}
.sheet-side-box .side-block { flex: 1; }
.sheet-side-box .credits-block { flex: 0 0 auto; }
.side-block { background: #20212a; border: 1px solid #3a3d4a; border-radius: 8px; padding: 10px 12px; }
.side-block-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.side-block .side-block-row input[type=number] { width: 60px; margin-top: 0; flex-shrink: 0; }
.side-title { font-size: 10.5px; font-weight: bold; letter-spacing: 1px; color: #ffcf6b; text-transform: uppercase; }
.side-title-row { display: flex; justify-content: space-between; align-items: baseline; }
.side-sub { font-size: 10px; color: #9aa; }
.side-block input[type=number] {
  /* width: 100%; */
  margin-top: 4px;
  /* padding: 5px 7px; */
  border-radius: 5px;
  border: 1px solid #3a3d4a;
  background: #1b1d22;
  color: #fff;
  font-size: 13px;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}
.side-block input[type=number]::-webkit-outer-spin-button,
.side-block input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.side-credits-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 4px; flex-wrap: nowrap; }
.credit-dots { flex-wrap: nowrap; }
.stash-input { width: 50px; margin-top: 0; text-align: center; flex-shrink: 0; }
.xp-reminder { font-size: 9.5px; color: #888; line-height: 1.3; margin-top: 4px; }

.sheet-columns { display: grid; grid-template-columns: minmax(450px, 1fr) 1fr 1fr; gap: 10px; }
.sheet-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }

.stat-strip { display: grid; grid-template-columns: 2.6fr 1fr 2fr 2fr 2fr; gap: 10px; margin-bottom: 10px; align-items: stretch; }
.strip-col { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.sub-strip { display: flex; gap: 8px; flex: 1; }
.strip-card {
  min-width: 0;
  background: #20212a; border: 1px solid #3a3d4a; border-radius: 8px; padding: 10px 12px;
}
.sub-strip .strip-card { min-width: 0; flex: 1; padding: 8px 8px; }

.sheet-block {
  background: #20212a; border: 1px solid #3a3d4a; border-radius: 8px; padding: 10px 12px;
}
.sheet-block > input, .strip-card > input, .trauma-input {
  width: 100%; margin-top: 4px; padding: 7px 9px; border-radius: 5px; border: 1px solid #3a3d4a;
  background: #1b1d22; color: #fff; font-size: 13px;
}
.block-title {
  font-size: 12px; font-weight: bold; letter-spacing: 1px; color: #ffcf6b;
  text-transform: uppercase; margin-bottom: 8px; display: block;
}
.block-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.load-title-row { margin-bottom: 0; }
.playbook-title-row { margin-bottom: 0; gap: 10px; }
.playbook-title-row .block-title { flex-shrink: 0; margin-bottom: 0; }
.playbook-title-row input {
  flex: 1; padding: 6px 9px; border-radius: 5px; border: 1px solid #3a3d4a;
  background: #1b1d22; color: #fff; font-size: 13px; margin: 0;
}
.block-title-row select, .block-title-row .playbook-name {
  background: #1b1d22; color: #fff; border: 1px solid #3a3d4a; border-radius: 5px; padding: 4px 6px; font-size: 12px;
}
.playbook-name { flex: 1; margin-left: 10px; }

.small-label { display: block; font-size: 11px; color: #9aa; margin: 8px 0 4px; text-transform: uppercase; }

/* Attribute blocks farblich wie im Original (Mind/Body/Soul) */
.sheet-attributes { display: contents; }
.attr-block {
  min-width: 0;
  border-radius: 8px; padding: 10px 12px 10px 14px; border: 1px solid #3a3d4a; background: #20212a;
  border-left: 3px solid var(--attr-color, #4c6ef5);
}
.attr-block[data-attr="mind"] { --attr-color: #4c6ef5; }
.attr-block[data-attr="body"] { --attr-color: #f59f00; }
.attr-block[data-attr="soul"] { --attr-color: #be4bdb; }

.attr-title {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-weight: bold; color: var(--attr-color, #ffcf6b); margin-bottom: 6px;
  font-size: 13px; letter-spacing: 1px;
}
.attr-title .checkbox-row { font-size: 11px; color: #aab; text-transform: none; letter-spacing: 0; opacity: 0.5; transition: opacity 0.15s; }
.attr-title .checkbox-row:has(input:checked) { opacity: 1; }
.attr-bruised { accent-color: #fa5252; }

.skill-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 5px 0; font-size: 12.5px; }
.skill-row .skill-name { color: #d8d8e0; }
.dot-row { display: flex; gap: 4px; flex-wrap: wrap; }
.dot {
  width: 17px; height: 17px; border-radius: 50%; box-sizing: border-box;
  border: 2px solid var(--attr-color, #4c6ef5);
  cursor: pointer; background: transparent; flex-shrink: 0; padding: 0; margin: 0;
  opacity: 0.5; transition: opacity 0.15s;
}
.dot.filled { opacity: 1; }
.attr-block .dot.filled { background: var(--attr-color, #4c6ef5); }
/* Erster Dot jeder Action bekommt einen quadratischen Halo (Hintergrund RUND
   UM den runden Dot, nicht im Dot selbst) — da alle Dot-Rows gleich breit und
   rechtsbuendig sind (skill-row: justify-content:space-between), liegt Dot 1
   in jeder Zeile an exakt derselben X-Position, wodurch die gestapelten Halos
   wie eine leicht hervorgehobene Spalte wirken, ohne dass wir deren Position
   hart verdrahten muessten. box-shadow wuerde der runden Dot-Form folgen
   (border-radius:50%) — fuer eine eckige Flaeche stattdessen ein ::before mit
   eigenem border-radius, per isolation+negativem z-index hinter dem Dot
   platziert (sonst wuerde es den Dot selbst ueberdecken). Vertikal reicht der
   Halo (-6px) weiter als der Zeilenabstand (.skill-row margin: 5px 0 → 10px
   Luecke zwischen zwei Dots), sodass sich die Halos benachbarter Zeilen leicht
   ueberlappen und zu einer durchgehenden Saeule verschmelzen statt einzelne
   Kaestchen mit Luecke zu bleiben.
*/
.attr-block .dot-row .dot:first-child { position: relative; isolation: isolate; }
.attr-block .dot-row .dot:first-child::before {
  content: ''; position: absolute; inset: -6px -4px;
  background: rgba(255,255,255,0.09); border-radius: 4px; z-index: -1;
}
.dot.stress { border-radius: 3px; border-color: #fa5252; width: 15px; height: 20px; }
.dot.stress.filled { background: #fa5252; }

.harm-tier { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.harm-tier .harm-level { width: 64px; font-size: 11px; color: #aab; flex-shrink: 0; }
.harm-tier input[type=text] { flex: 1; padding: 6px 8px; border-radius: 5px; border: 1px solid #3a3d4a; background: #1b1d22; color: #fff; font-size: 12.5px; }

.item-row, .contact-row { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.ability-row { display: flex; align-items: flex-start; gap: 6px; margin-bottom: 3px; }
.row-actions { display: flex; flex-direction: column; align-items: center; gap: 1px; flex-shrink: 0; }
.drag-handle { cursor: grab; color: #444; font-size: 11px; line-height: 1; user-select: none; padding: 0 2px; }
.drag-handle:hover { color: #888; }
.drag-handle:active { cursor: grabbing; }
.row-drag-hide { opacity: 0.25; }
.row-drop-line { height: 2px; background: #4dabf7; border-radius: 1px; margin: 1px 0; pointer-events: none; }
.item-row, .ability-row { opacity: 0.5; transition: opacity 0.15s; }
.item-row:has(input:checked), .ability-row:has(input:checked) { opacity: 1; }
.item-row input[type=checkbox], .ability-row input[type=checkbox] { width: auto; accent-color: #ffcf6b; margin-top: 8px; flex-shrink: 0; }
.item-check2.hidden { display: none; }
.item-check2:not(.hidden) + .item-check1 { margin-left: -6px; }
.contact-row input[type=checkbox] { width: auto; accent-color: #ffcf6b; flex-shrink: 0; }

/* ---------- Rich-Text-Felder (Items, Abilities, Notes): Strg+B fett, Strg+I kursiv ---------- */
.rich-field {
  padding: 6px 8px; border-radius: 5px; border: 1px solid #3a3d4a;
  background: #1b1d22; color: #fff; font-size: 12.5px; font-family: inherit;
  white-space: pre-wrap; word-wrap: break-word;
  line-height: 1.4; box-sizing: border-box; outline: none;
}
.rich-field:focus { border-color: #4c6ef5; }
.rich-field:empty::before { content: attr(data-placeholder); color: #666; pointer-events: none; }
.rich-field b, .rich-field strong { color: #ffcf6b; }
.rich-field i, .rich-field em { color: #d0d9ff; }

.item-field { flex: 1; min-height: 1.4em; }
.adesc { flex: 1; min-height: 1.8em; }
.notes-field { width: 100%; min-height: 110px; }

.contact-row input.cname { flex: 1; padding: 6px 8px; border-radius: 5px; border: 1px solid #3a3d4a; background: #1b1d22; color: #fff; font-size: 12.5px; }
.row-del {
  display: inline-flex; align-items: center; justify-content: center;
  width: 0; height: 20px; padding: 0; margin: 0; border: none;
  background: none; color: #666; font-size: 20px; line-height: 1;
  flex-shrink: 0; cursor: pointer; border-radius: 4px; overflow: visible;
}
.ability-row .row-del { margin-top: 0; }
.row-del:hover { color: #fa5252; background: rgba(250,82,82,0.1); }

.sheet-block textarea {
  width: 100%; padding: 8px; border-radius: 6px; border: 1px solid #3a3d4a;
  background: #1b1d22; color: #fff; font-family: inherit; resize: vertical; margin-bottom: 8px; font-size: 12.5px;
}

.stat-row { display: flex; gap: 10px; }
.stat-row .hf { flex: 1; }

.sheet-block button[type="button"] { font-size: 12px; padding: 6px 10px; }
.sheet-block button.row-del[type="button"] { font-size: 20px; padding: 0px 4px; }

.sheet-card .sname { display: flex; justify-content: space-between; }
.sheet-card .splaybook { font-size: 11px; color: #888; font-weight: normal; }

/* Inhalt hat eine feste Mindestbreite von 915px (siehe .sheet-content) -
   darunter wird gescrollt statt umgebrochen, daher kein Reflow-CSS nötig. */
.sheet-paper { min-width: 480px; }

/* ---------- Stress +-Button ---------- */
.stress-row-wrap { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; margin-top: 0; }
.add-box-btn {
  width: 15px; height: 20px; border-radius: 3px; border: 1.5px dashed #666; box-sizing: border-box;
  background: transparent; color: #888; font-size: 11px; line-height: 1;
  margin: 0; padding: 0; cursor: pointer; flex-shrink: 0; margin-top: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.remove-box-btn { width: 14px; height: 18px; font-size: 9px; border-style: solid; opacity: 0.7; margin-left: 4px; margin-top: 0; }
.add-box-btn:hover { border-color: #ffcf6b; color: #ffcf6b; background: rgba(255,207,107,0.08); }
.remove-box-btn:hover { border-color: #fa5252; color: #fa5252; background: rgba(250,82,82,0.08); opacity: 1; }
.hint-inline { font-size: 10px; color: #777; font-weight: normal; text-transform: none; letter-spacing: 0; }

/* ---------- Harm: 2 Checkboxen statt Freitext-Level ---------- */
#sh-harm { display: flex; gap: 10px; margin-top: 4px; }
.harm-checkbox-row { display: inline-flex; cursor: pointer; }
.harm-checkbox-row input {
  width: 22px; height: 22px; accent-color: #fa5252; cursor: pointer; margin: 0;
  opacity: 0.5; transition: opacity 0.15s;
}
.harm-checkbox-row input:checked { opacity: 1; }

/* ---------- Mini-Sektionen: Armor/Expertise, Harm/Healing ---------- */
.mini-row { display: flex; gap: 14px; }
.mini-col { flex: 1; min-width: 0; }
.expertise-card { display: flex; flex-direction: column; align-items: center; text-align: center; }
.expertise-card .block-title { width: 100%; text-align: center; }
.expertise-card .mini-check-row { justify-content: center; }
.armor-title-row { justify-content: flex-start; }
.armor-title-text {
  font-size: 11px; font-weight: bold; letter-spacing: 1px; color: #ffcf6b; text-transform: uppercase;
}
.mini-check-row {
  display: flex; align-items: center; gap: 6px; font-size: 12px; color: #d8d8e0;
  cursor: pointer; margin: 4px 0; opacity: 0.5; transition: opacity 0.15s;
}
.mini-check-row:has(input:checked) { opacity: 1; }
.mini-check-row input { width: auto; accent-color: #ffcf6b; }
.mini-check-pair { display: flex; gap: 10px; margin-top: 4px; justify-content: center; }
.mini-check-pair input {
  width: 18px; height: 18px; accent-color: #ffcf6b; cursor: pointer;
  opacity: 0.5; transition: opacity 0.15s;
}
.mini-check-pair input:checked { opacity: 1; }

.harm-card { display: flex; flex-direction: column; align-items: center; text-align: center; }
.harm-card .block-title { width: 100%; text-align: center; }
.harm-card #sh-harm { justify-content: center; }
.harm-card #sh-healing-clock { justify-content: center; }

/* ---------- Credits: goldene Dots statt Zahl ---------- */
.credit-dots .dot { border-color: #ffcf6b; }
.credit-dots .dot.filled { background: #ffcf6b; }
.hf-credits { flex: 1; }
.hf-credits .dot-row { margin-top: 4px; }

/* ---------- Healing Clock (Blades-Style, 4 Ticks) ---------- */
#sh-healing-clock { display: flex; align-items: center; justify-content: center; margin-top: 4px; }
#sh-healing-clock svg { width: 46px; height: 46px; cursor: pointer; }
#sh-healing-clock path { fill: #1b1d22; stroke: #3a3d4a; stroke-width: 1.5; transition: fill 0.15s; }
#sh-healing-clock path:hover { fill: #3a3d4a; }
#sh-healing-clock path.filled { fill: #51cf66; stroke: #2f8f47; }
#sh-healing-clock path.filled:hover { fill: #69db7c; }

/* ---------- Skill-Namen klickbar = Action Roll ---------- */
.skill-name {
  cursor: pointer; padding: 2px 4px; border-radius: 4px; transition: background 0.15s;
  background: none; border: none; margin: 0; font: inherit; color: inherit; text-align: left;
}
.skill-name:hover { background: rgba(255,207,107,0.15); color: #ffcf6b; }
.skill-name::after { content: ' 🎲'; opacity: 0; font-size: 10px; transition: opacity 0.15s; }
.skill-name:hover::after { opacity: 0.7; }

/* ---------- Difficulty-Auswahl-Modal ---------- */
.roll-box { width: 360px; }
.roll-modal-sub { color: #aab; font-size: 13px; margin: 4px 0 12px; }
.diff-btn-row { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.diff-btn {
  background: #2b2e3a; border: 1px solid #3a3d4a; color: #fff; text-align: left;
  padding: 10px 14px; border-radius: 6px; margin: 0; cursor: pointer;
}
.diff-btn:hover { background: #4c6ef5; border-color: #4c6ef5; }

/* ---------- Roll Windows (draggable floating) ---------- */
.roll-paper {
  position: fixed;
  left: calc(50% - 165px);
  top: 12vh;
  pointer-events: auto;
  background: #1e2028;
  border: 1px solid #3a3d4a;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.55);
  color: #e8e8ec;
  z-index: 300;
  width: 330px;
  display: flex;
  flex-direction: column;
}
.roll-paper.hidden { display: none; }
.roll-dragbar {
  display: flex; justify-content: space-between; align-items: center;
  background: #1b1d22; border-bottom: 1px solid #3a3d4a; border-radius: 10px 10px 0 0;
  padding: 7px 12px; cursor: move; user-select: none; flex: 0 0 auto;
  font-size: 13px; color: #aab;
}
.roll-paper-body {
  padding: 16px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.roll-win-title {
  font-size: 20px; font-weight: bold;
  margin: 0 0 2px; text-align: center;
  color: #f59f00;
}
.roll-modal-sub { color: #aab; font-size: 12px; margin: 0 0 6px; text-align: center; min-height: 1em; }
.roll-section-label { font-size: 12px; color: #9aa; margin-top: 8px; margin-bottom: 8px; text-align: center; }
.roll-pick-row + .roll-section-label { margin-top: 20px; }
.roll-section-label-row { display: flex; align-items: center; justify-content: center; gap: 10px; }

/* ---- Bonus dice sources: Gambit (gold) / Assist (green) / Push (purple) ---- */
.roll-source-row { display: flex; gap: 10px; justify-content: center; margin: 6px 0 10px; }
.roll-source-gambit { --source-color: #ffcf6b; }
.roll-source-assist { --source-color: #51cf66; }
.roll-source-push   { --source-color: #9775fa; }
.roll-source-push-choice { --source-color: #9775fa; }
.roll-source-btn .roll-source-icon-emoji { font-size: 20px; line-height: 1; }

.roll-source-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: #252830; border: 2px solid #3a3d4a; border-radius: 8px;
  padding: 10px 14px; cursor: pointer; margin: 0; min-width: 64px;
  transition: background 0.12s, border-color 0.12s, filter 0.12s;
}
.roll-source-btn .roll-source-icon {
  width: 20px; height: 20px; fill: #6b7280;
  transition: fill 0.12s;
}
.roll-source-btn span { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: #6b7280; transition: color 0.12s; }
.roll-source-btn:not(.active):hover { background: #2f3240; border-color: var(--source-color); }
.roll-source-btn:not(.active):hover .roll-source-icon { fill: #ccc; }
.roll-source-btn:not(.active):hover span { color: #ccc; }
.roll-source-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.roll-source-btn.hidden { display: none; }

/* Action Roll (gross): nur das Icon selbst + Label werden farbig, kein
   Farb-Chip/Hintergrund dahinter — button bleibt dunkel, nur Rahmen faerbt sich. */
.roll-source-btn.active:not(.compact) { border-color: var(--source-color); }
.roll-source-btn.active:not(.compact) .roll-source-icon { fill: var(--source-color); }
.roll-source-btn.active:not(.compact) span { color: var(--source-color); }
.roll-source-btn.active:not(.compact):hover { background: #2f3240; }

/* Custom Roll (kompakt): ganze Pille wird gefuellt, Icon+Label brauchen daher
   dunklen Kontrast (#25262e) statt der Quellfarbe. */
.roll-source-btn.compact {
  flex-direction: row; gap: 4px; padding: 3px 8px; margin: 0;
  min-width: 0; border-radius: 6px; border-width: 1.5px;
}
.roll-source-btn.compact::before { content: '+'; font-size: 11px; font-weight: 700; color: #6b7280; }
.roll-source-btn.compact .roll-source-icon { width: 13px; height: 13px; padding: 0; border-radius: 0; }
.roll-source-btn.compact span { font-size: 9px; }
.roll-source-btn.active.compact { background: var(--source-color); border-color: var(--source-color); }
.roll-source-btn.active.compact::before { color: #25262e; }
.roll-source-btn.active.compact .roll-source-icon { background: transparent; fill: #25262e; }
.roll-source-btn.active.compact span { color: #25262e; }
.roll-source-btn.active.compact:hover { filter: brightness(1.15); }

.roll-pick-row-sm { margin-top: 4px; }
.roll-pick-row-sm .roll-pick-btn { padding: 8px 0; min-width: 36px; font-size: 13px; }
.roll-pick-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.roll-pick-btn {
  background: #252830; border: 1.5px solid #3a3d4a; color: #ccc;
  border-radius: 7px; padding: 14px 0; cursor: pointer; margin: 0;
  min-width: 48px; text-align: center; font-size: 16px; font-weight: 600;
  border: 2px solid #3a3d4a;
  transition: background 0.1s, border-color 0.1s, color 0.1s, filter 0.1s;
}
.roll-pick-btn:hover { background: #2f3240; border-color: #5a6070; color: #fff; }
.roll-pick-btn.roll-pick-active { background: #4c6ef5; border-color: #4c6ef5; color: #fff; }
.roll-pick-btn.roll-pick-active:hover { filter: brightness(1.15); }
.roll-diff-row { gap: 16px; padding: 8px 0; align-items: center; }
.roll-diff-btn {
  width: 44px; height: 44px;
  transform: rotate(45deg);
  border: 2px solid #5a3d4a; border-radius: 6px;
  background: transparent; color: #ccc;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  margin: 0; padding: 0;
  transition: background 0.1s, border-color 0.1s, filter 0.1s;
}
.roll-diff-btn:hover { background: rgba(250,82,82,0.2); border-color: #fa5252; }
.roll-diff-btn.roll-pick-active { background: #fa5252; border-color: #fa5252; }
.roll-diff-btn.roll-pick-active:hover { filter: brightness(1.15); }
.roll-diff-btn span { transform: rotate(-45deg); font-size: 15px; font-weight: 600; color: #ccc; }
.roll-diff-btn.roll-pick-active span { color: #fff; }
.roll-go-btn {
  margin-top: 14px; padding: 12px; background: #4c6ef5;
  border: none; border-radius: 8px; color: #fff;
  font-size: 16px; font-weight: bold; cursor: pointer; width: 100%;
  transition: background 0.15s;
}
.roll-go-btn:hover { background: #3b5bdb; }
.roll-name-input {
  width: 100%; box-sizing: border-box; margin-top: 2px;
  padding: 8px; border-radius: 6px; border: 1px solid #3a3c46;
  background: #1b1d22; color: #fff;
}

/* ---------- Action-Roll-Chat-Template (Roll20-Style) ---------- */
.roll-template {
  border-radius: 8px; overflow: hidden; border: 1px solid #3a3d4a;
  background: #1b1d22; margin: 4px 0 10px; max-width: 320px; font-size: 12.5px;
}
.rt-header {
  background: var(--rt-accent, #6a3fa0);
  background: linear-gradient(135deg, var(--rt-accent, #6a3fa0), color-mix(in srgb, var(--rt-accent, #6a3fa0) 65%, white));
  color: #fff;
  padding: 8px 12px; font-weight: bold; letter-spacing: 0.5px;
  display: flex; align-items: center; gap: 6px; font-size: 13px;
}
.msg.roll-author { margin-bottom: 2px; font-size: 12px; color: #aab; }
.msg.roll-author .author { color: #ffcf6b; font-weight: bold; }
.rt-row { display: flex; padding: 6px 12px; border-top: 1px solid #2a2c36; align-items: center; flex-wrap: wrap; gap: 6px; }
.rt-row .rt-label { width: 64px; color: #9aa; font-size: 11px; text-transform: uppercase; flex-shrink: 0; }
.rt-row .rt-value { color: #fff; font-weight: bold; }
.rt-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 24px; padding: 0 4px; border-radius: 4px;
  font-weight: bold; font-size: 13px;
}
.rt-chip.d6 {
  background: var(--rt-accent, #6a3fa0); border: none; color: #fff;
  width: 28px; height: 28px; font-size: 14px;
}
.rt-chip.d6.crit { background: #51cf66; color: #fff; }
.rt-chip.d6.pushed { box-shadow: 0 0 0 2px #9775fa; }
.rt-chip.rt-chip-spin { filter: brightness(0.55) saturate(0.6); }
@keyframes chipSettlePop { 0% { transform: scale(1.4); } 60% { transform: scale(0.95); } 100% { transform: scale(1); } }
.rt-chip.rt-chip-pop { animation: chipSettlePop 0.26s ease-out; }
/* d8 ist per Grundstil um 45deg gedreht (Diamant) — Pop-Animation muss die
   Rotation die ganze Zeit mitführen, sonst "entdreht" sich der Chip kurz. */
@keyframes chipSettlePopRotated { 0% { transform: rotate(45deg) scale(1.4); } 60% { transform: rotate(45deg) scale(0.95); } 100% { transform: rotate(45deg) scale(1); } }
.rt-chip.d8.rt-chip-pop { animation-name: chipSettlePopRotated; }

/* Ergebnis + Folge-Buttons bleiben verborgen bis alle Würfel-Chips fertig
   gerattert haben (siehe animateDiceChips/revealPendingResult in client.js).
   Spezifität bewusst über .roll-template hochgezogen — sonst gewinnt einfach
   das quellcode-spätere .rt-add-gambit-row/.rt-clear-bruise-row/.rt-push-row
   (gleiche Spezifität, deren "display: flex" kommt weiter unten im File). */
.roll-template .rt-result-pending { display: none; }
@keyframes resultReveal { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: translateY(0); } }
.rt-result-reveal { animation: resultReveal 0.35s ease-out; }
.rt-chip.d8 {
  background: #8b4fc9; color: #fff; min-width: 0;
  width: 22px; height: 22px; padding: 0; margin: 3px;
  border-radius: 3px; transform: rotate(45deg);
}
.rt-chip.d8 .d8-num { display: inline-block; transform: rotate(-45deg); font-size: 12px; }
.rt-chip.d8.downgrade { background: #e8590c; box-shadow: 0 0 0 2px rgba(232,89,12,0.4) inset; }
.rt-status { color: #ffcf6b; font-size: 11.5px; font-weight: bold; }
.rt-status.rt-source-badge { display: inline-flex; align-items: center; gap: 3px; }
.rt-status.rt-source-badge .rt-source-icon { width: 8px; height: auto; fill: currentColor; }

.rt-result {
  text-align: center; font-size: 18px; font-weight: bold; letter-spacing: 0.5px;
  padding: 9px 12px; border-top: 1px solid #2a2c36; border-bottom: 1px solid #2a2c36;
}
.rt-result-sub { display: block; font-size: 10.5px; font-weight: normal; color: #aab; margin-top: 1px; }
.rt-result.crit { color: #ffd43b; }
.rt-result.full { color: #51cf66; }
.rt-result.partial { color: #ffa94d; }
.rt-result.fail { color: #ff8787; }
.rt-result.disaster { color: #ff4040; text-shadow: 0 0 8px rgba(255,64,64,0.4); }

.rt-add-gambit-row { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 12px 2px; border-bottom: 1px solid #2a2c36; }
.rt-add-gambit-btn {
  display: inline-flex; align-items: center; gap: 5px; margin: 0;
  background: rgba(255,207,107,0.12); border: 1px solid #ffcf6b; color: #ffcf6b;
  border-radius: 6px; padding: 5px 11px; font-size: 11px; font-weight: 700;
  cursor: pointer; transition: background 0.1s, opacity 0.1s;
}
.rt-add-gambit-btn:hover { background: rgba(255,207,107,0.25); }
.rt-add-gambit-btn .rt-source-icon { width: 8px; height: auto; fill: #ffcf6b; transition: fill 0.1s; }
.rt-add-gambit-btn.dimmed { background: transparent; border-color: #4a4d5a; color: #6b7280; }
.rt-add-gambit-btn.dimmed .rt-source-icon { fill: #6b7280; }
.rt-add-gambit-btn.dimmed:hover, .rt-add-gambit-btn.dimmed:active {
  background: rgba(255,207,107,0.2); border-color: #ffcf6b; color: #ffcf6b;
}
.rt-add-gambit-btn.dimmed:hover .rt-source-icon, .rt-add-gambit-btn.dimmed:active .rt-source-icon { fill: #ffcf6b; }

.rt-clear-bruise-row { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 12px 2px; border-bottom: 1px solid #2a2c36; }
.rt-clear-bruise-btn {
  display: inline-flex; align-items: center; gap: 5px; margin: 0;
  background: rgba(245,159,0,0.12); border: 1px solid #f59f00; color: #f59f00;
  border-radius: 6px; padding: 5px 11px; font-size: 11px; font-weight: 700;
  cursor: pointer; transition: background 0.1s;
}
.rt-clear-bruise-btn:hover { background: rgba(245,159,0,0.25); }

.rt-push-row { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 12px 2px; border-bottom: 1px solid #2a2c36; }
.rt-push-btn {
  display: inline-flex; align-items: center; gap: 5px; margin: 0;
  background: rgba(151,117,250,0.12); border: 1px solid #9775fa; color: #9775fa;
  border-radius: 6px; padding: 5px 11px; font-size: 11px; font-weight: 700;
  cursor: pointer; transition: background 0.1s;
}
.rt-push-btn:hover { background: rgba(151,117,250,0.25); }

.rt-row-dismiss {
  background: none; border: none; color: #555; cursor: pointer;
  font-size: 11px; line-height: 1; padding: 3px 5px; margin: 0; flex-shrink: 0;
}
.rt-row-dismiss:hover { color: #fa5252; }

.rt-notes { padding: 6px 12px; border-top: 1px solid #2a2c36; color: #9aa; font-size: 11px; line-height: 1.4; }

/* ---------- Notes-Zeile (2 Boxen nebeneinander) ---------- */
.notes-row { display: flex; gap: 10px; margin-top: 10px; }
.notes-row .sheet-block { flex: 1; min-width: 0; }

/* ---------- Eigene Clocks (Notes-Tab) ---------- */
.clocks-section { margin-top: 10px; }
.clocks-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.clock-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.clock-row-svg { width: 70px; height: 70px; flex-shrink: 0; }
.clock-row-svg svg { width: 100%; height: 100%; cursor: pointer; }
.clock-row-svg path { fill: #1b1d22; stroke: #3a3d4a; stroke-width: 1.5; transition: fill 0.15s; }
.clock-row-svg path:hover { fill: #3a3d4a; }
.clock-row-svg path.filled { fill: #51cf66; stroke: #2f8f47; }
.clock-row-svg path.filled:hover { fill: #69db7c; }
.clk-name { flex: 1; min-width: 0; padding: 6px 8px; border-radius: 5px; border: 1px solid #3a3d4a; background: #1b1d22; color: #fff; font-size: 12.5px; }
.clk-segments { width: 52px; flex-shrink: 0; padding: 6px 4px; border-radius: 5px; border: 1px solid #3a3d4a; background: #1b1d22; color: #ccc; font-size: 12px; text-align: center; }

/* ---------- Downtime Activities (Notes-Tab) ---------- */
.downtime-section { margin-top: 10px; }
.downtime-activity-row { display: flex; align-items: center; gap: 14px; }
.downtime-activity-row + .downtime-activity-row { margin-top: 10px; border-top: 1px solid #2c2f3a; padding-top: 10px; }
/* Feste Buttonbreite, damit die Regeltexte aller Zeilen buendig starten —
   die Labels sind unterschiedlich lang ("Recover" vs. "Indulge Vice"). */
.downtime-activity-row .roll-source-btn { flex: 0 0 96px; width: 96px; }
.roll-source-vice { --source-color: #e64980; }
.roll-source-project { --source-color: #4dabf7; }
.roll-source-acquire { --source-color: #ffcf6b; }
.roll-source-craft   { --source-color: #748ffc; }
.roll-source-laylow  { --source-color: #22b8cf; }
.roll-source-repair  { --source-color: #74c0fc; }
.roll-source-fuel    { --source-color: #fab005; }
.roll-source-recover { --source-color: #40c057; }
.downtime-rule-text { flex: 1; min-width: 0; font-size: 11px; color: #9a9aa4; line-height: 1.35; }
.downtime-rule-text b { color: #b8b8c0; font-weight: 600; }

/* ---------- Statische Info-Boxen (Bonus Dice / Gambits Reminder) ---------- */
.static-info { font-size: 10.5px; color: #9a9aa4; line-height: 1.2; padding: 0; overflow: hidden; min-height: 82px; }
.static-info .block-title.banner {
  background: none; color: #8a8a94; margin: 0; padding: 8px 10px 3px;
  letter-spacing: 0.5px; font-size: 10px; font-weight: 600;
}
.static-info .static-line {
  display: flex; align-items: flex-start; gap: 6px; margin: 0; padding: 2px 10px;
}
.static-info .static-line:last-child { border-bottom: none; }
.static-info .static-plus {
  color: #6a6a74; font-weight: bold; flex-shrink: 0; width: 10px; text-align: center;
}
.static-info b { color: #b8b8c0; font-weight: 600; }

/* ---------- Load: zwei Checkboxen statt Dropdown ---------- */
.load-checks { display: flex; gap: 14px; }
.load-block { display: flex; align-items: center; }
.load-block .load-title-row { flex: 1; }

/* ---------- Friends/Rivals: Dreiecks-Toggle, kann auch leer bleiben ---------- */
.custom-roll-row { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.custom-roll-row input.cr-label { flex: 1; padding: 5px 8px; border-radius: 5px; border: 1px solid #3a3d4a; background: #1b1d22; color: #fff; font-size: 12.5px; }
.custom-roll-row input.cr-dice { width: 46px; padding: 5px 6px; border-radius: 5px; border: 1px solid #3a3d4a; background: #1b1d22; color: #fff; font-size: 12.5px; text-align: center; }
.custom-roll-row .cr-roll-btn { padding: 4px 10px; font-size: 12px; background: #6a3fa0; color: #fff; border: none; border-radius: 5px; cursor: pointer; margin: 0; }
.custom-roll-row .cr-roll-btn:hover { background: #7e52b8; }

.fr-toggle { display: flex; flex-direction: column; gap: 3px; flex-shrink: 0; align-items: center; justify-content: center; }
.fr-toggle button[type="button"] {
  width: 0; height: 0; margin: 0; padding: 0; line-height: 0;
  background: none; border: none; cursor: pointer;
  opacity: 0.4; transition: opacity 0.15s;
}
.fr-toggle button.fr-friend {
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-bottom: 8px solid #777;
}
.fr-toggle button.fr-rival {
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-top: 8px solid #777;
}
.fr-toggle button:hover { opacity: 0.8; }
.fr-toggle button.active { opacity: 1; }
.fr-toggle button.fr-friend.active { border-bottom-color: #51cf66; }
.fr-toggle button.fr-rival.active { border-top-color: #fa5252; }

/* ===== Ship Sheet ===== */
#ship-paper { top: 60px; left: 80px; width: 1060px; height: 780px; }
.ship-content { min-width: 980px; padding: 12px 4px 4px; display: flex; flex-direction: column; gap: 10px; font-size: 12px; }

/* Header row */
.ship-header { display: grid; grid-template-columns: 200px 1fr auto; gap: 10px; align-items: start; min-height: 130px; }
.ship-portrait-box { width: 200px; height: 130px; background: #1b1d22; border: 2px dashed #444; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #555; font-size: 12px; overflow: hidden; position: relative; }
.ship-portrait-box img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.ship-name-look { display: flex; flex-direction: column; gap: 6px; }
.ship-name-look input { background: #1b1d22; border: 1px solid #3a3c46; border-radius: 4px; color: #e8e8ec; padding: 5px 8px; font-size: 12.5px; height: 31px; width: 100%; box-sizing: border-box; }
.ship-name-look input::placeholder { color: #555; font-style: italic; }
.ship-tier-box { background: #1b1d22; border: 1px solid #3a3c46; border-radius: 6px; padding: 8px 12px; min-width: 160px; }
.ship-tier-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: #ffcf6b; font-weight: bold; margin-bottom: 6px; }
.ship-tier-boxes { display: flex; gap: 6px; }
.ship-tier-boxes .tier-box { width: 28px; height: 28px; border: 2px solid #555; border-radius: 3px; cursor: pointer; }
.ship-tier-boxes .tier-box.filled { background: #e8e8ec; }

/* Info row */
.ship-name-look-block { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.ship-info-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.ship-info-block { background: #1b1d22; border: 1px solid #3a3c46; border-radius: 6px; padding: 8px 12px; }
.sib-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: #ffcf6b; font-weight: bold; margin-bottom: 4px; }
.sib-row { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.sib-row span { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: #ffcf6b; font-weight: bold; }
.sib-dots { display: flex; gap: 4px; }
.sib-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #555; cursor: pointer; }
.sib-dot.filled { background: #e8e8ec; border-color: #e8e8ec; }
.sib-sq { width: 14px; height: 14px; border: 2px solid #555; border-radius: 2px; cursor: pointer; }
.sib-sq.filled { background: #e8e8ec; border-color: #e8e8ec; }
.sib-input { background: #2b2e3a; border: 1px solid #3a3c46; border-radius: 4px; color: #e8e8ec; padding: 3px 6px; font-size: 12.5px; height: 31px; width: 80px; box-sizing: border-box; }

/* Modules row */
.ship-modules { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ship-module { border: 1px solid #3a3c46; border-radius: 6px; padding: 8px; background: #1b1d22; }
.ship-module.hull { border-left: 3px solid #f08c00; }
.ship-module.comm { border-left: 3px solid #4c6ef5; }
.ship-module.engs { border-left: 3px solid #40c057; }
.ship-module.wpns { border-left: 3px solid #fa5252; }
.sm-header { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 6px; margin-bottom: 6px; padding-bottom: 5px; border-bottom: 1px solid #2e3040; }
.sm-title { font-size: 13px; font-weight: bold; display: flex; align-items: center; gap: 5px; }
.sm-title.hull { color: #f08c00; }
.sm-title.comm { color: #4c6ef5; }
.sm-title.engs { color: #40c057; }
.sm-title.wpns { color: #fa5252; }
.sm-rating-wrap { display: flex; align-items: center; gap: 3px; font-size: 10px; color: #888; }
.sm-rating { background: #2b2e3a; border: 1px solid #3a3c46; border-radius: 3px; color: #ffcf6b; padding: 2px 4px; font-size: 15px; font-weight: bold; height: 31px; width: 60px; text-align: center; box-sizing: border-box; }
.sm-dmg-diamonds { display: flex; gap: 3px; }
.sm-diamond { font-size: 18px; cursor: pointer; color: #444; line-height: 1; }
.sm-diamond.filled { color: #fa5252; }
.sm-row { display: grid; grid-template-columns: 14px 1fr 16px 18px; align-items: center; gap: 5px; margin-bottom: 3px; }
.sm-row .sib-sq { flex-shrink: 0; }
.sm-row { opacity: 0.5; transition: opacity 0.15s; }
.sm-row:has(.sib-sq.filled) { opacity: 1; }
.sm-rich-field { background: #2b2e3a; border: 1px solid #2e3040; border-radius: 3px; color: #e8e8ec; padding: 2px 6px; font-size: 12.5px; min-height: 31px; width: 100%; box-sizing: border-box; line-height: 27px; outline: none; overflow: hidden; white-space: pre-wrap; word-break: break-word; }
.sm-rich-field:focus { border-color: #555; }
.sm-rich-field b, .sm-rich-field strong { color: #ffcf6b; font-weight: bold; }
.sm-rich-field i, .sm-rich-field em { color: #d0d9ff; font-style: italic; }

/* Upgrades + right column */
/* Mid + Bottom in einem gemeinsamen Grid damit Spaltenbreiten fluchten */
.ship-lower { display: grid; grid-template-columns: 1fr 1fr 1fr; grid-template-rows: auto auto; gap: 8px; }
.ship-lower .ship-right-col { grid-row: 1; grid-column: 3; }
.ship-lower .ship-notes   { grid-row: 2; grid-column: 3; }
.ship-lower .ship-clocks-block { grid-row: 3; grid-column: 1 / -1; }
.ship-upgrades { background: #1b1d22; border: 1px solid #3a3c46; border-radius: 6px; padding: 8px 10px; }
.su-label { font-size: 9px; text-transform: uppercase; letter-spacing: 1px; color: #ffcf6b; margin-bottom: 2px; }
.su-label-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.su-label-row .su-label { margin-bottom: 0; }
.ship-clocks-block #ss-add-clock { font-size: 11px; padding: 2px 8px; margin: 0; }
.ship-clocks-block .clocks-wrap { margin-top: 6px; }
.su-title { font-size: 12px; font-weight: bold; color: #ffcf6b; margin-bottom: 6px; }
.su-row { display: grid; grid-template-columns: 14px 1fr 16px; align-items: center; gap: 5px; margin-bottom: 3px; opacity: 0.5; transition: opacity 0.15s; }
.su-row:has(.sib-sq.filled) { opacity: 1; }
.su-row .sm-rich-field { min-height: 31px; }
.ship-right-col { display: flex; flex-direction: column; gap: 8px; }
.ship-fuel-shields { background: #1b1d22; border: 1px solid #3a3c46; border-radius: 6px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.sfs-row { display: flex; align-items: center; gap: 8px; }
.sfs-label { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: #ffcf6b; font-weight: bold; white-space: nowrap; }
.sfs-input { background: #2b2e3a; border: 1px solid #3a3c46; border-radius: 3px; color: #e8e8ec; padding: 2px 6px; font-size: 12px; height: 31px; flex: 1; box-sizing: border-box; }
#ss-shields { width: 20px; height: 20px; }
.ship-contacts { background: #1b1d22; border: 1px solid #3a3c46; border-radius: 6px; padding: 8px 10px; flex: 1; }
.sc-title { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: #ffcf6b; font-weight: bold; margin-bottom: 6px; }
.sc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 6px; }
.sc-entry { display: flex; align-items: center; gap: 4px; }
.sc-alliance { font-size: 12px; cursor: pointer; color: #555; line-height: 1; padding: 0; background: none; border: none; transition: color 0.15s; flex-shrink: 0; margin: 0; }
.sc-alliance.positive { color: #40c057; }
.sc-entry input { background: #2b2e3a; border: 1px solid #2e3040; border-radius: 3px; color: #e8e8ec; padding: 2px 4px; font-size: 12px; height: 31px; flex: 1; min-width: 0; box-sizing: border-box; }
.sm-info-btn { width: 15px; height: 15px; border-radius: 50%; background: none; border: 1px solid #444; color: #666; font-size: 9px; font-style: italic; font-weight: bold; cursor: pointer; padding: 0; margin: 0; line-height: 1; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: border-color 0.15s, color 0.15s; }
.sm-info-btn:hover { border-color: #ffcf6b; color: #ffcf6b; }
.sm-info-btn.has-info { border-color: #888; color: #aaa; }
#ship-info-popup { position: fixed; z-index: 9999; width: 200px; }
#ship-info-popup.hidden { display: none; }
#ship-info-text { width: 100%; min-height: 36px; max-height: 300px; overflow-y: auto; background: #2b2e3a; border: 1px solid #3a3c46; color: #e8e8ec; font-size: 12px; padding: 4px 6px; border-radius: 3px; box-sizing: border-box; font-family: inherit; outline: none; white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
#ship-info-text:empty::before { content: attr(data-placeholder); color: #555; pointer-events: none; }
#ship-info-text b, #ship-info-text strong { color: #ffcf6b; font-weight: bold; }
#ship-info-text i, #ship-info-text em { color: #d0d9ff; font-style: italic; }

/* Bottom row */
/* ship-bottom-row nicht mehr genutzt, alles in .ship-lower */
.ship-notes { background: #1b1d22; border: 1px solid #3a3c46; border-radius: 6px; padding: 8px 10px; }
.ship-notes #ss-notes { width: 100%; box-sizing: border-box; background: #2b2e3a; border: 1px solid #3a3c46; border-radius: 4px; color: #e8e8ec; padding: 6px 8px; font-size: 13px; min-height: 100px; outline: none; white-space: pre-wrap; word-break: break-word; line-height: 1.5; scrollbar-width: thin; }
.ship-notes #ss-notes b, .ship-notes #ss-notes strong { color: #ffcf6b; font-weight: bold; }
.ship-notes #ss-notes i, .ship-notes #ss-notes em { color: #d0d9ff; font-style: italic; }

/* ========== Restart Panel ========== */
#restart-panel {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 300;
  background: #1b1d22; border: 1px solid #3a3d4a; border-radius: 8px;
  padding: 10px; width: 250px; box-shadow: 0 4px 18px rgba(0,0,0,0.5);
  display: flex; flex-direction: column; gap: 6px;
}
#restart-panel.hidden { display: none; }
.restart-hint { font-size: 11px; color: #666; margin: 0 0 2px; line-height: 1.4; }
#restart-local-btn, #restart-online-btn, #restart-p2p-btn, #restart-both-btn {
  width: 100%; text-align: left; background: #2b2e3a; border: 1px solid #3a3d4a;
  border-radius: 4px; color: #ccc; cursor: pointer; font-size: 12px;
  padding: 6px 10px; margin: 0; transition: background 0.1s;
}
#restart-local-btn:hover { background: #353848; color: #fff; }
#restart-online-btn:hover { background: #353848; color: #4dabf7; }
#restart-p2p-btn:hover { background: #353848; color: #be4bdb; }
#restart-both-btn:hover { background: #353848; color: #ffcf6b; }

/* Overlay beim Neustart */
#restart-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.75);
  z-index: 9999; display: flex; align-items: center; justify-content: center;
}
.restart-msg {
  background: #1b1d22; border: 1px solid #3a3d4a; border-radius: 10px;
  padding: 28px 36px; text-align: center; color: #ccc; font-size: 15px; line-height: 1.8;
}
.restart-msg small { color: #555; font-size: 12px; }
.restart-spinner {
  width: 28px; height: 28px; border: 3px solid #3a3d4a; border-top-color: #4dabf7;
  border-radius: 50%; margin: 0 auto 14px; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== Audio Panel (GM) ========== */
#audio-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 300;
  background: #1b1d22; border: 1px solid #3a3d4a; border-radius: 8px;
  padding: 10px; width: 320px; box-shadow: 0 4px 18px rgba(0,0,0,0.5);
}
.audio-playlist {
  margin: 8px 0 6px; max-height: 180px; overflow-y: auto;
  border: 1px solid #2e3040; border-radius: 4px; background: #16181f;
  scrollbar-width: thin; scrollbar-color: #2e3040 transparent;
}
.audio-playlist::-webkit-scrollbar { width: 6px; }
.audio-playlist::-webkit-scrollbar-track { background: transparent; }
.audio-playlist::-webkit-scrollbar-thumb { background: #2e3040; border-radius: 3px; }
.audio-playlist::-webkit-scrollbar-thumb:hover { background: #3a3d52; }
.audio-empty { font-size: 11px; color: #555; padding: 8px; text-align: center; }
.audio-track-row {
  display: flex; align-items: center; gap: 4px;
  padding: 5px 8px; cursor: pointer; border-bottom: 1px solid #23252d;
  transition: background 0.1s;
}
.audio-track-row:last-child { border-bottom: none; }
.audio-track-row:hover { background: #23252d; }
.audio-track-row.playing .audio-track-name::before { content: '▶ '; color: #4dabf7; font-size: 9px; }
.audio-track-row.playing { border-left: 2px solid #4dabf7; }
.audio-track-row.dragging, .audio-saved-row.dragging { opacity: 0.4; }
.audio-track-drag-handle { flex-shrink: 0; color: #555; font-size: 12px; cursor: grab; }
.audio-track-name { flex: 1; font-size: 12px; color: #ccc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audio-track-del { flex-shrink: 0; background: none; border: none; color: #555; cursor: pointer; font-size: 11px; margin: 0; padding: 0 3px; line-height: 1; }
.audio-track-del:hover { color: #fa5252; }
.audio-controls-gm {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px; row-gap: 4px; margin-top: 6px;
}
.audio-controls-gm button,
#gm-tools .audio-controls-gm button {
  background: #2b2e3a; border: 1px solid #3a3d4a; border-radius: 4px;
  color: #ccc; cursor: pointer; font-size: 12px; padding: 4px 7px; margin: 0;
  line-height: 1; transition: background 0.1s;
}
.audio-controls-gm button:hover { background: #353848; color: #fff; }
.audio-controls-gm button.active,
#gm-tools .audio-controls-gm button.active { border-color: #4dabf7; color: #4dabf7; background: rgba(77,171,247,0.1); }
.audio-loop-label { font-size: 11px; color: #888; display: flex; align-items: center; gap: 4px; margin-left: auto; cursor: pointer; user-select: none; }
.audio-folder-row { display: flex; gap: 4px; margin-bottom: 4px; }
.audio-folder-row input { flex: 1; background: #2b2e3a; border: 1px solid #3a3d4a; border-radius: 4px; color: #ccc; font-size: 11px; padding: 4px 6px; min-width: 0; outline: none; }
.audio-folder-row input::placeholder { color: #555; }
.audio-folder-row button { background: #2b2e3a; border: 1px solid #3a3d4a; border-radius: 4px; color: #ccc; cursor: pointer; font-size: 11px; padding: 4px 8px; margin: 0; white-space: nowrap; }
.audio-folder-row button:hover { background: #353848; color: #fff; }
.audio-now-playing {
  font-size: 11px; color: #4dabf7; margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 16px;
}
.audio-progress-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
#audio-progress-gm { flex: 1; accent-color: #4dabf7; cursor: pointer; height: 4px; }
#audio-time-gm { font-size: 10px; color: #666; white-space: nowrap; flex-shrink: 0; min-width: 70px; text-align: right; }
.audio-mastervol-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 11px; color: #888; }
#audio-mastervolume { flex: 1; accent-color: #ffcf6b; cursor: pointer; height: 4px; }
#audio-mastervolume-label { font-size: 10px; color: #666; white-space: nowrap; flex-shrink: 0; min-width: 32px; text-align: right; }
.audio-save-row { display: flex; gap: 4px; margin: 5px 0 2px; }
.audio-save-row input { flex: 1; background: #2b2e3a; border: 1px solid #3a3d4a; border-radius: 4px; color: #ccc; font-size: 11px; padding: 3px 6px; min-width: 0; outline: none; }
.audio-save-row input::placeholder { color: #555; }
.audio-save-row button { background: #2b2e3a; border: 1px solid #3a3d4a; border-radius: 4px; color: #ccc; cursor: pointer; font-size: 12px; padding: 3px 7px; margin: 0; }
.audio-save-row button:hover { background: #353848; }
.audio-saved-list { max-height: 90px; overflow-y: auto; border: 1px solid #2e3040; border-radius: 4px; background: #16181f; margin-bottom: 4px; scrollbar-width: thin; scrollbar-color: #2e3040 transparent; }
.audio-saved-list::-webkit-scrollbar { width: 6px; }
.audio-saved-list::-webkit-scrollbar-track { background: transparent; }
.audio-saved-list::-webkit-scrollbar-thumb { background: #2e3040; border-radius: 3px; }
.audio-saved-list::-webkit-scrollbar-thumb:hover { background: #3a3d52; }
.audio-saved-list:empty { display: none; }
.audio-saved-row { display: flex; align-items: center; gap: 4px; padding: 4px 8px; cursor: pointer; border-bottom: 1px solid #23252d; transition: background 0.1s; }
.audio-saved-row:last-child { border-bottom: none; }
.audio-saved-row:hover { background: #23252d; }
.audio-saved-row.drop-target { background: rgba(77,171,247,0.15); outline: 1px dashed #4dabf7; outline-offset: -1px; }
.audio-saved-name { flex: 1; font-size: 12px; color: #ccc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audio-saved-count { font-size: 10px; color: #555; flex-shrink: 0; }

/* ========== Audio Widget (alle Clients) ========== */
#audio-widget {
  position: fixed; top: 50px; right: calc(340px + 14px); z-index: 500;
  background: #1b1d22; border: 1px solid #3a3d4a; border-radius: 8px;
  padding: 6px 10px; display: flex; align-items: center; gap: 8px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.5); max-width: 270px;
}
#audio-widget.hidden { display: none; }
#audio-widget-icon { font-size: 13px; color: #4dabf7; flex-shrink: 0; }
#audio-widget-track { font-size: 11px; color: #aaa; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#audio-volume { width: 90px; accent-color: #4dabf7; cursor: pointer; flex-shrink: 0; }
#audio-mute-btn { background: none; border: none; cursor: pointer; font-size: 14px; margin: 0; padding: 0; line-height: 1; flex-shrink: 0; width: 22px; text-align: center; }

/* ---------- Freihand-Zeichnen ---------- */
#draw-toggle-btn.draw-active { border-color: #4dabf7; color: #4dabf7; background: rgba(77,171,247,0.12); }
#draw-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 300;
  background: #1b1d22; border: 1px solid #3a3d4a; border-radius: 8px;
  padding: 12px; min-width: 250px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.6);
}
.draw-tools-row { display: flex; gap: 6px; }
.draw-tool-btn {
  margin: 0 !important; flex: 1; padding: 5px 8px !important; font-size: 11px !important;
  border: 1px solid #444; background: #1b1d22; color: #888; border-radius: 4px; cursor: pointer;
}
.draw-tool-btn.active { border-color: #4dabf7; color: #4dabf7; background: rgba(77,171,247,0.1); }
.draw-tool-btn:hover:not(.active) { border-color: #666; color: #ccc; }
#draw-swatches { display: flex; gap: 5px; flex-wrap: wrap; }
.draw-swatch {
  margin: 0 !important; width: 22px; height: 22px; padding: 0 !important;
  border: 1px solid #555; border-radius: 4px; cursor: pointer;
}
.draw-swatch:hover { border-color: #fff; }
.draw-value { font-size: 11px; color: #9aa; min-width: 40px; text-align: right; }
.draw-hint { color: #777; font-size: 11px; margin: 0; line-height: 1.5; }
#draw-clear-btn { margin-top: 0; font-size: 11px; }
#map-canvas.draw-mode { cursor: crosshair; }
#map-canvas.erase-mode { cursor: cell; }

/* ---------- Downtime-Roll-Fenster (Long Term Project / Recover) ---------- */
.roll-select {
  width: 100%; background: #23252e; color: #d8d8e0;
  border: 1px solid #3a3d4a; border-radius: 6px; padding: 7px 9px; font-size: 13px;
}
.roll-select:disabled { opacity: 0.5; }
.roll-hint { font-size: 11px; color: #8a8a95; line-height: 1.4; margin-top: 6px; text-align: center; }
.roll-hint:empty { display: none; }
.roll-go-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- Freitextfeld in den Downtime-Roll-Fenstern ---------- */
.roll-text-input {
  width: 100%; background: #23252e; color: #d8d8e0;
  border: 1px solid #3a3d4a; border-radius: 6px; padding: 7px 9px; font-size: 13px;
}

/* ---------- Downtime-Aktionen auf dem Schiffsbogen ---------- */
.ship-downtime { margin-top: 10px; border-top: 1px solid #2c2f3a; padding-top: 8px; }
.ship-downtime-title { font-size: 10px; letter-spacing: 1px; color: #7a7a86; margin-bottom: 6px; }
.ship-downtime-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.ship-downtime-select {
  flex: 1; min-width: 0; background: #23252e; color: #d8d8e0;
  border: 1px solid #3a3d4a; border-radius: 5px; padding: 4px 6px; font-size: 11px;
}
.ship-downtime-btn {
  margin: 0 !important; padding: 5px 9px !important; font-size: 11px !important;
  border: 1px solid #444; background: #1b1d22; color: #aab; border-radius: 5px; cursor: pointer;
  white-space: nowrap;
}
.ship-downtime-btn.wide { width: 100%; }
.ship-downtime-btn:hover { border-color: #6b7280; color: #e8e8f0; }
.ship-downtime-hint { font-size: 10px; line-height: 1.4; color: #7f8a7f; margin-top: 4px; }
.ship-downtime-hint.is-error { color: #d98b8b; }
.ship-downtime-hint:empty { display: none; }

/* Kleiner Vorher-Nachher-Zusatz in den wuerfellosen Downtime-Karten */
.rt-delta { margin-left: 8px; font-size: 11px; color: #8a8a95; font-weight: 400; }
