/* ============================================
   Adventure Engine – Dark Fantasy Theme
   Split-Panel Layout mit Fullscreen Background
   ============================================ */

/* Reset und Basis */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  font-size: 16px;
  min-height: 100vh;
}

body {
  font-family: 'Crimson Text', Georgia, serif;
  background-color: #0c1123;
  color: #f5f0e8;
  line-height: 1.6;
}

/* --- Typografie --- */
h1, h2, h3 {
  font-family: 'Crimson Text', Georgia, serif;
  color: #d4a574;
  font-weight: 700;
}

button, input, select, label, .ui-element {
  font-family: 'Courier New', monospace;
}

/* --- Fade-Uebergangsanimationen --- */
.fade-in {
  animation: fadeIn 0.6s ease-in forwards;
}

.fade-out {
  animation: fadeOut 0.4s ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-10px); }
}

.transition-opacity {
  transition: opacity 0.4s ease;
}

/* --- Bildschirm-Container --- */
.screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.screen.hidden {
  display: none;
}

/* ============================================
   Upload-Screen
   ============================================ */
#upload-screen {
  justify-content: center;
  text-align: center;
}

#upload-screen h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  text-shadow: 0 0 20px rgba(212, 165, 116, 0.3);
}

#upload-screen .subtitle {
  color: #a09880;
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

/* Home Layout: Upload links, Stories rechts */
.home-layout {
  display: flex;
  gap: 32px;
  width: 100%;
  max-width: 900px;
  align-items: flex-start;
}

.home-upload-side {
  flex: 1;
  min-width: 0;
}

.home-stories-side {
  flex: 1;
  min-width: 250px;
  text-align: left;
}

.stories-list-title {
  font-size: 1.1rem;
  color: #d4a574;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(212, 165, 116, 0.3);
}

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

.stories-loading {
  color: #666;
  font-size: 0.85rem;
  font-style: italic;
}

.story-card {
  background: rgba(22, 33, 62, 0.6);
  border: 1px solid rgba(212, 165, 116, 0.2);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s;
  text-align: left;
}

.story-card:hover {
  background: rgba(212, 165, 116, 0.08);
  border-color: rgba(212, 165, 116, 0.4);
}

.story-card-content {
  flex: 1;
  min-width: 0;
}

.story-card-title {
  color: #f5f0e8;
  font-size: 0.95rem;
  font-family: 'Crimson Text', serif;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-card-info {
  color: #666;
  font-size: 0.75rem;
  font-family: 'Courier New', monospace;
}

.story-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.story-action-btn {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  color: #888;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
}

.story-action-play {
  background: rgba(40, 167, 69, 0.2);
  border-color: rgba(40, 167, 69, 0.4);
  color: #4ecca3;
}

.story-action-play:hover {
  background: #28a745;
  color: #fff;
  border-color: #28a745;
}

.story-action-edit {
  color: #d4a574;
}

.story-action-edit:hover {
  background: rgba(212, 165, 116, 0.2);
  border-color: #d4a574;
  color: #d4a574;
}

.story-action-generate {
  color: #d4a574;
  font-size: 12px;
}

.story-action-generate:hover {
  background: rgba(212, 165, 116, 0.2);
  border-color: #d4a574;
}

.story-action-generate:disabled {
  opacity: 0.7;
  cursor: wait;
}

.story-action-delete {
  color: #888;
}

.story-action-delete:hover {
  background: rgba(192, 57, 43, 0.2);
  border-color: #c0392b;
  color: #e74c3c;
}

.stories-empty {
  color: #555;
  font-size: 0.85rem;
  font-style: italic;
  padding: 16px 0;
}

@media (max-width: 700px) {
  .home-layout {
    flex-direction: column;
    align-items: center;
  }
  .home-stories-side {
    width: 100%;
    max-width: 400px;
  }
}

.drop-zone {
  width: 100%;
  max-width: 500px;
  min-height: 200px;
  border: 2px dashed #d4a574;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  cursor: pointer;
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  background-color: rgba(22, 33, 62, 0.5);
}

.drop-zone:hover,
.drop-zone.drag-over {
  background-color: rgba(212, 165, 116, 0.1);
  border-color: #c49464;
  box-shadow: 0 0 25px rgba(212, 165, 116, 0.15);
}

.drop-zone-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: #d4a574;
}

.drop-zone-text {
  font-size: 1.1rem;
  color: #f5f0e8;
  margin-bottom: 0.5rem;
}

.drop-zone-hint {
  font-size: 0.85rem;
  color: #a09880;
  font-family: 'Courier New', monospace;
}

.drop-zone input[type="file"] {
  display: none;
}

/* Start-Buttons */
.start-buttons {
  display: flex;
  gap: 12px;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.demo-button {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background-color: transparent;
  color: #d4a574;
  border: 1px solid rgba(212, 165, 116, 0.4);
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.25s ease, border-color 0.25s ease;
  text-decoration: none;
  text-align: center;
}

.demo-button:hover {
  background-color: rgba(212, 165, 116, 0.1);
  border-color: #d4a574;
}

/* ============================================
   Spiel-Screen – Comic Layout
   ============================================ */
/* ============================================
   Login-Overlay
   ============================================ */
.login-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(12, 17, 35, 0.95);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-overlay.hidden { display: none; }

.login-box {
  background: #151a30;
  border: 2px solid #2a2f45;
  border-radius: 12px;
  padding: 40px;
  max-width: 400px;
  width: 90%;
  text-align: center;
}

.login-box h2 {
  color: #d4a574;
  margin-bottom: 8px;
  font-size: 22px;
}

.login-box p {
  color: #888;
  font-size: 14px;
  margin-bottom: 20px;
}

.login-input {
  width: 100%;
  padding: 12px;
  background: #0a0f1a;
  border: 1px solid #2a2f45;
  border-radius: 6px;
  color: #f5f0e8;
  font-size: 16px;
  text-align: center;
  margin-bottom: 16px;
}

.login-input:focus {
  outline: none;
  border-color: #d4a574;
}

.login-buttons {
  display: flex;
  gap: 8px;
}

.login-submit-btn {
  flex: 1;
  padding: 10px;
  background: #d4a574;
  color: #0c1123;
  border: none;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  cursor: pointer;
  font-weight: bold;
}

.login-submit-btn:hover { background: #e8c89e; }

.login-skip-btn {
  flex: 1;
  padding: 10px;
  background: transparent;
  color: #888;
  border: 1px solid #2a2f45;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  cursor: pointer;
}

.login-skip-btn:hover { border-color: #555; color: #aaa; }

.login-error {
  color: #e74c3c;
  font-size: 13px;
  margin-top: 12px;
}

.login-error.hidden { display: none; }

.home-top-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 900px;
  justify-content: center;
}

.admin-login-btn {
  background: transparent;
  color: #555;
  border: 1px solid #333;
  padding: 5px 14px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
  position: absolute;
  right: 20px;
  top: 20px;
}

.admin-login-btn:hover {
  color: #d4a574;
  border-color: #d4a574;
}

.admin-login-btn.admin-active {
  color: #4ecca3;
  border-color: #4ecca3;
}

/* ============================================
   Editor-Screen
   ============================================ */
#editor-screen {
  padding: 0;
  align-items: stretch;
  justify-content: flex-start;
  height: 100vh;
  background: #0c1123;
}

.editor-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
}

.editor-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: #151a30;
  border-bottom: 2px solid #2a2f45;
  flex-shrink: 0;
}

.editor-title {
  flex: 1;
  font-size: 18px;
  color: #d4a574;
}

.editor-mermaid-btn {
  background: transparent;
  color: #d4a574;
  border: 1px solid rgba(212,165,116,0.4);
  padding: 8px 16px;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.editor-mermaid-btn:hover {
  background: rgba(212,165,116,0.15);
  border-color: #d4a574;
}

.editor-save-btn {
  background: #28a745;
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.editor-save-btn:hover {
  background: #218838;
}

.editor-textarea {
  flex: 1;
  width: 100%;
  padding: 20px;
  background: #0a0f1a;
  color: #e8e0d0;
  border: none;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.6;
  resize: none;
  outline: none;
}

.editor-textarea::placeholder {
  color: #3a4060;
}

/* ============================================
   Validierungs-Overlay
   ============================================ */
.validation-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.validation-box {
  background: #151a30;
  border: 2px solid #c0392b;
  border-radius: 8px;
  max-width: 700px;
  width: 90%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

.validation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #2a2f45;
}

.validation-header h2 {
  color: #e74c3c;
  font-size: 18px;
  margin: 0;
}

.validation-close {
  background: none;
  border: none;
  color: #888;
  font-size: 20px;
  cursor: pointer;
}

.validation-close:hover { color: #fff; }

.validation-list {
  overflow-y: auto;
  padding: 12px 20px;
  flex: 1;
}

.validation-item {
  padding: 8px 0;
  border-bottom: 1px solid #1e2440;
  font-size: 13px;
  color: #ccc;
  line-height: 1.5;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.validation-item:last-child { border-bottom: none; }

.validation-badge {
  background: #2a2f45;
  color: #888;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-family: 'Courier New', monospace;
  white-space: nowrap;
  flex-shrink: 0;
}

.validation-type-struktur .validation-badge { background: #5b2c2c; color: #e74c3c; }
.validation-type-bildstil .validation-badge { background: #4a3520; color: #d4a574; }
.validation-type-ort .validation-badge { background: #1e3a2a; color: #4ecca3; }
.validation-type-item .validation-badge { background: #2c3a5b; color: #6ca0dc; }
.validation-type-seite .validation-badge { background: #3a2c5b; color: #a06cdc; }
.validation-type-panel .validation-badge { background: #5b5b2c; color: #dcdc6c; }

.validation-copy-area {
  padding: 12px 20px;
  border-top: 1px solid #2a2f45;
}

.validation-copy-btn {
  width: 100%;
  padding: 10px;
  background: #c0392b;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.validation-copy-btn:hover { background: #e74c3c; }

/* ============================================
   Spiel-Screen – Comic Layout
   ============================================ */
#game-screen {
  padding: 0;
  position: relative;
  align-items: stretch;
  justify-content: flex-start;
  height: auto;
  min-height: 100vh;
  background: #f0f0f0;
}

#game-screen .game-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: #222;
  color: #fff;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.game-back-btn {
  background: none;
  border: 1px solid #555;
  color: #aaa;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.game-back-btn:hover {
  border-color: #d4a574;
  color: #d4a574;
}

.game-title {
  flex: 1;
  color: #d4a574;
  font-size: 14px;
}

.game-page-info {
  color: #888;
  font-size: 12px;
}

#game-screen #comic-container {
  padding: 24px 16px;
}

/* Kapitel-Bild – Fullscreen Fixed Background */
#chapter-image {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  overflow: hidden;
  background-color: #0c1123;
}

#chapter-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Bild-Ladeanimation */
#chapter-image.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    110deg,
    #0c1123 30%,
    #131b33 50%,
    #0c1123 70%
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================
   Chapter Content – Overlay ueber dem Bild
   ============================================ */
.chapter-content {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  max-height: 55vh;
  background: linear-gradient(
    180deg,
    rgba(10, 14, 30, 0.0) 0%,
    rgba(10, 14, 30, 0.7) 6%,
    rgba(10, 14, 30, 0.88) 15%,
    rgba(10, 14, 30, 0.94) 100%
  );
  backdrop-filter: blur(2px);
}

/* Titel-Bereich */
.chapter-header {
  flex-shrink: 0;
  padding: 0.75rem 2rem 0.5rem;
  text-align: center;
}

#chapter-title {
  font-size: 1.6rem;
  text-shadow: 0 0 20px rgba(212, 165, 116, 0.3);
}

/* ============================================
   Zwei-Panel-Layout
   ============================================ */
.chapter-panels {
  flex: 1;
  display: flex;
  gap: 2rem;
  padding: 0 2rem 4.5rem;
  min-height: 0; /* Wichtig fuer Flex-Overflow */
}

/* --- Linkes Panel: Scrollbarer Text --- */
.chapter-text-panel {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 1rem;
  min-height: 0;
}

#chapter-text {
  font-size: 1.15rem;
  line-height: 1.8;
  color: #f5f0e8;
  text-align: justify;
  hyphens: auto;
}

#chapter-text p {
  margin-bottom: 1rem;
}

#chapter-text p:last-child {
  margin-bottom: 0;
}

/* --- Rechtes Panel: Aktionen --- */
.chapter-actions-panel {
  flex: 0 0 340px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 0;
}

/* Bereichs-Labels fuer Aktionen */
#chapter-investigations:not(:empty)::before {
  content: 'Untersuchen';
  display: block;
  font-family: 'Courier New', monospace;
  font-size: 0.7rem;
  color: #a09880;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.4rem;
}

#chapter-choices:not(:empty)::before {
  content: 'Weiter';
  display: block;
  font-family: 'Courier New', monospace;
  font-size: 0.7rem;
  color: #a09880;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.4rem;
}

#chapter-investigations:not(:empty) {
  margin-bottom: 0.75rem;
}

/* ============================================
   Buttons – Auswahl und Untersuchung
   ============================================ */
.choice-button {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: rgba(212, 165, 116, 0.9);
  color: #1a1a2e;
  border: none;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.25s ease, transform 0.15s ease, box-shadow 0.25s ease;
  margin-bottom: 0.4rem;
}

.choice-button:hover {
  background-color: rgba(196, 148, 100, 0.95);
  transform: translateX(4px);
  box-shadow: 0 3px 12px rgba(212, 165, 116, 0.25);
}

.choice-button:active {
  transform: translateX(2px) scale(0.98);
}

.choice-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Investigation-Buttons – etwas subtiler */
.investigation-button {
  background-color: rgba(212, 165, 116, 0.15) !important;
  color: #d4a574 !important;
  border: 1px solid rgba(212, 165, 116, 0.4) !important;
}

.investigation-button:hover:not(:disabled) {
  background-color: rgba(212, 165, 116, 0.25) !important;
}

.investigation-button.requires-item {
  opacity: 0.4;
  cursor: not-allowed;
}

.investigation-button.requires-met {
  border-color: rgba(78, 204, 163, 0.4) !important;
  color: #4ecca3 !important;
}

/* Hinweis fuer deaktivierte Aktionen */
.disabled-actions-hint {
  font-family: 'Courier New', monospace;
  font-size: 0.7rem;
  color: #555;
  text-align: center;
  padding: 0.3rem 0;
  font-style: italic;
}

/* Restart-Button */
.restart-button {
  display: block;
  margin-top: auto;
  padding: 0.5rem 1rem;
  background: transparent;
  color: #555;
  border: 1px solid #2a2a3e;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.restart-button:hover {
  color: #a09880;
  border-color: #555;
}

/* ============================================
   Inventarleiste (fixed bottom) – Interaktiv
   ============================================ */
#inventory-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, rgba(12, 17, 35, 0.95) 0%, rgba(8, 12, 25, 0.98) 100%);
  border-top: 1px solid rgba(212, 165, 116, 0.2);
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 100;
  min-height: 3.5rem;
  overflow-x: auto;
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.6);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Kombiniermodus – Inventarleiste leuchtet */
#inventory-bar.combine-mode {
  border-top-color: rgba(78, 204, 163, 0.6);
  box-shadow: 0 -4px 30px rgba(78, 204, 163, 0.15);
}

#inventory-bar .inventory-label {
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  color: #d4a574;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
  flex-shrink: 0;
}

#inventory-bar.combine-mode .inventory-label {
  color: #4ecca3;
}

.combine-hint {
  font-family: 'Courier New', monospace;
  font-size: 0.65rem;
  color: #4ecca3;
  white-space: nowrap;
  flex-shrink: 0;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

#inventory-items {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  overflow-x: auto;
  flex: 1;
}

.inventory-item {
  background-color: rgba(212, 165, 116, 0.15);
  color: #d4a574;
  border: 1px solid rgba(212, 165, 116, 0.3);
  border-radius: 4px;
  padding: 0.25rem 0.6rem;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  white-space: nowrap;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  cursor: pointer;
  user-select: none;
}

.inventory-item:hover {
  background-color: rgba(212, 165, 116, 0.3);
  border-color: rgba(212, 165, 116, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 3px 10px rgba(212, 165, 116, 0.2);
}

.inventory-item.selected {
  background-color: rgba(78, 204, 163, 0.25);
  border-color: rgba(78, 204, 163, 0.6);
  color: #4ecca3;
  box-shadow: 0 0 12px rgba(78, 204, 163, 0.3);
}

.inventory-item-new {
  animation: itemHighlight 0.8s ease-out;
}

@keyframes itemHighlight {
  0%   { background-color: rgba(212, 165, 116, 0.7); transform: scale(1.25); box-shadow: 0 0 12px rgba(212, 165, 116, 0.6); }
  50%  { background-color: rgba(212, 165, 116, 0.4); transform: scale(1.1);  box-shadow: 0 0 8px rgba(212, 165, 116, 0.3); }
  100% { background-color: rgba(212, 165, 116, 0.15); transform: scale(1);   box-shadow: none; }
}

#inventory-items:empty::after {
  content: '\2014 leer \2014';
  color: #555;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  font-style: italic;
}

/* ============================================
   Item-Popup (Modal)
   ============================================ */
.item-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeInFast 0.2s ease-out;
}

@keyframes fadeInFast {
  from { opacity: 0; }
  to { opacity: 1; }
}

.item-popup {
  background: linear-gradient(135deg, #131b33 0%, #0c1123 100%);
  border: 1px solid rgba(212, 165, 116, 0.3);
  border-radius: 16px;
  width: 90%;
  max-width: 360px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: popupSlideIn 0.3s ease-out;
}

@keyframes popupSlideIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.item-popup-image {
  width: 100%;
  height: 200px;
  background-color: #0c1123;
  overflow: hidden;
  position: relative;
}

.item-popup-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-popup-image.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, #0c1123 30%, #131b33 50%, #0c1123 70%);
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
}

.item-popup-body {
  padding: 1.25rem;
}

.item-popup-name {
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 1.4rem;
  color: #d4a574;
  margin-bottom: 1rem;
  text-align: center;
}

.item-popup-actions {
  display: flex;
  gap: 0.75rem;
}

.item-popup-actions button {
  flex: 1;
  padding: 0.6rem;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

.item-popup-actions button:active {
  transform: scale(0.97);
}

.item-popup-combine {
  background-color: rgba(78, 204, 163, 0.2);
  color: #4ecca3;
  border: 1px solid rgba(78, 204, 163, 0.4);
}

.item-popup-combine:hover {
  background-color: rgba(78, 204, 163, 0.3);
}

.item-popup-close {
  background-color: rgba(160, 152, 128, 0.15);
  color: #a09880;
  border: 1px solid rgba(160, 152, 128, 0.3);
}

.item-popup-close:hover {
  background-color: rgba(160, 152, 128, 0.25);
}

/* ============================================
   Kombinations-Feedback (Toast)
   ============================================ */
.combine-result-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, rgba(78, 204, 163, 0.15), rgba(12, 17, 35, 0.95));
  border: 1px solid rgba(78, 204, 163, 0.5);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  z-index: 250;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.3s ease-out;
}

.combine-result-toast .toast-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.combine-result-toast .toast-text {
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  color: #4ecca3;
}

.combine-result-toast.fail .toast-text {
  color: #a09880;
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ============================================
   Allgemeine Buttons
   ============================================ */
.btn-primary {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background-color: #d4a574;
  color: #1a1a2e;
  border: none;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

.btn-primary:hover {
  background-color: #c49464;
  box-shadow: 0 4px 15px rgba(212, 165, 116, 0.3);
}

/* ============================================
   Panel-Scrollbar-Styling (Webkit)
   ============================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(212, 165, 116, 0.3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 165, 116, 0.5);
}

/* ============================================
   Responsive – Mobile
   ============================================ */
@media (max-width: 767px) {
  .chapter-content {
    max-height: 50vh;
  }

  .chapter-header {
    padding: 0.5rem 1rem 0.25rem;
  }

  #chapter-title {
    font-size: 1.3rem;
  }

  .chapter-panels {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 1rem 4rem;
  }

  .chapter-text-panel {
    flex: 1;
    min-height: 0;
    padding-right: 0.5rem;
  }

  #chapter-text {
    font-size: 1rem;
  }

  .chapter-actions-panel {
    flex: 0 0 auto;
    max-height: 30vh;
    overflow-y: auto;
  }

  .choice-button {
    font-size: 0.85rem;
    padding: 0.65rem 0.9rem;
  }
}

/* Desktop ab 768px */
@media (min-width: 768px) {
  #upload-screen h1 {
    font-size: 3.5rem;
  }

  .drop-zone {
    min-height: 250px;
    padding: 3rem;
  }

  .chapter-content {
    max-height: 50vh;
  }

  .chapter-header {
    padding: 0.75rem 2.5rem 0.5rem;
  }

  #chapter-title {
    font-size: 2rem;
  }

  .chapter-panels {
    padding: 0 2.5rem 4.5rem;
  }

  #chapter-text {
    font-size: 1.2rem;
  }

  .chapter-actions-panel {
    flex: 0 0 360px;
  }

  #inventory-bar {
    padding: 0.6rem 2rem;
    gap: 1rem;
  }

  .item-popup {
    max-width: 420px;
  }

  .item-popup-image {
    height: 250px;
  }
}

/* Grosse Bildschirme */
@media (min-width: 1400px) {
  .chapter-actions-panel {
    flex: 0 0 400px;
  }
}
