/* === D&D App — Globales Styling === */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-card: #1e2a47;
  --accent: #e94560;
  --accent-hover: #d13550;
  --gold: #d4a574;
  --gold-dim: #a07850;
  --text: #eee;
  --text-muted: #888;
  --danger: #e94560;
  --success: #4caf50;
  --radius: 8px;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Beta-Umgebung: Akzentfarbe ändern */
[data-app-env="beta"] {
  --accent: #ff9800;
  --accent-hover: #e68900;
  --danger: #ff9800;
}

/* Beta-Banner */
.beta-banner {
  position: sticky;
  top: 0;
  z-index: 10000;
  background: #ff9800;
  color: #000;
  text-align: center;
  padding: 6px 12px;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Accessibility: Focus-Indikator bei Tastatur-Navigation, nicht bei Maus-Klick */
:focus:not(:focus-visible) { outline: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Utility-Klassen */
.is-hidden { display: none !important; }

html, body { height: 100%; overflow-x: hidden; max-width: 100vw; }

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3, h4 { font-family: Georgia, serif; color: var(--gold); }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--text); }
.text-muted { color: var(--text-muted); font-size: 0.85rem; }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px; border: none; border-radius: var(--radius);
  font-size: 1rem; font-weight: 600; cursor: pointer;
  transition: background-color 0.2s, opacity 0.2s; text-decoration: none;
  min-height: 44px;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background-color: var(--accent); color: white; }
.btn-primary:hover:not(:disabled) { background-color: var(--accent-hover); }
.btn-secondary { background-color: var(--bg-card); color: var(--text); border: 1px solid var(--gold-dim); }
.btn-secondary:hover:not(:disabled) { background-color: var(--bg-secondary); border-color: var(--gold); }
.btn-danger { background-color: #c0392b; color: white; }
.btn-danger:hover:not(:disabled) { background-color: #a93226; }
.btn-small { padding: 6px 14px; font-size: 0.85rem; min-height: 36px; }
.btn-full { width: 100%; }

/* --- Header & Navigation --- */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; background-color: var(--bg-secondary);
  border-bottom: 2px solid var(--gold-dim); flex-shrink: 0;
}
.header-left { display: flex; align-items: center; gap: 16px; min-width: 0; overflow: hidden; }
.header-left .btn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 1; min-width: 0; }
.header-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.header-logo {
  display: flex; align-items: center; gap: 8px;
  font-family: Georgia, serif; font-size: 1.2rem; font-weight: 700;
  color: var(--gold); white-space: nowrap;
}
.header-logo:hover { color: var(--text); }
.header-logo-img { height: 36px; width: auto; border-radius: 4px; }

.header-title {
  font-size: 1.2rem; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 400px;
}

.main-nav { display: flex; gap: 4px; }
.nav-link {
  padding: 6px 14px; border-radius: var(--radius); color: var(--text-muted);
  font-size: 0.9rem; font-weight: 600; transition: background-color 0.2s, color 0.2s;
  min-height: 44px; display: flex; align-items: center;
}
.nav-link:hover { color: var(--text); background-color: rgba(255,255,255,0.05); }
.nav-link.active { color: var(--gold); background-color: rgba(212, 165, 116, 0.1); }

.nav-burger {
  display: none; background: none; border: 1px solid var(--gold-dim);
  color: var(--gold); font-size: 1.3rem; padding: 4px 10px;
  border-radius: var(--radius); cursor: pointer; min-height: 44px;
}

.mobile-nav {
  display: none; flex-direction: column; gap: 4px;
  padding: 12px 24px; background: var(--bg-secondary);
  border-bottom: 1px solid var(--gold-dim);
}
.mobile-nav .nav-link { padding: 10px 14px; }

.version-badge { color: var(--text-muted); font-size: 0.7rem; opacity: 0.5; font-weight: 400; }
.username-badge { color: var(--gold); font-weight: 600; font-size: 0.9rem; }

.mode-badge {
  padding: 4px 10px; border-radius: 12px; font-size: 0.8rem;
  font-weight: 600; text-transform: uppercase;
}
.mode-badge.player { background-color: rgba(76, 175, 80, 0.2); color: #4caf50; border: 1px solid #4caf50; }
.mode-badge.dm { background-color: rgba(233, 69, 96, 0.2); color: var(--accent); border: 1px solid var(--accent); }

/* --- Auth-Seite --- */
.auth-container {
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  min-height: 100vh; padding: 20px;
}
.auth-card {
  background: var(--bg-secondary); border: 2px solid var(--gold-dim);
  border-radius: 12px; padding: 40px; width: 100%; max-width: 420px;
  box-shadow: var(--shadow), 0 0 40px rgba(212, 165, 116, 0.08);
}
.auth-logo { text-align: center; margin-bottom: 12px; }
.auth-logo-img { height: 80px; width: auto; border-radius: 8px; }
.auth-title { text-align: center; font-size: 1.8rem; margin-bottom: 4px; }
.auth-subtitle { text-align: center; color: var(--text-muted); margin-bottom: 24px; }

.auth-tabs {
  display: flex; margin-bottom: 24px; border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--gold-dim);
}
.auth-tab {
  flex: 1; padding: 10px; background: transparent; color: var(--text-muted);
  border: none; cursor: pointer; font-size: 0.95rem; font-weight: 600;
  transition: background-color 0.2s, color 0.2s; min-height: 44px;
}
.auth-tab.active { background-color: var(--gold-dim); color: white; }
.auth-tab:hover:not(.active) { color: var(--text); }

/* --- Formulare --- */
.form-group { margin-bottom: 16px; position: relative; overflow: visible; }
.form-group label {
  display: block; margin-bottom: 6px; font-size: 0.9rem;
  color: var(--gold); font-weight: 600;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 14px; background-color: var(--bg-primary);
  color: var(--text); border: 1px solid var(--gold-dim);
  border-radius: var(--radius); font-size: 1rem; font-family: inherit;
  transition: border-color 0.2s; min-height: 44px;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--gold);
}
.form-group textarea { resize: vertical; min-height: auto; }
.form-checkbox { margin-bottom: 10px; }
.form-checkbox label {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.75rem; font-weight: 400; color: var(--text-muted); cursor: pointer;
}
.form-checkbox input[type="checkbox"] {
  width: 16px; height: 16px; min-height: auto; accent-color: var(--gold);
  flex-shrink: 0; cursor: pointer;
}
.form-checkbox a { color: var(--gold-dim); text-decoration: underline; }
.form-checkbox a:hover { color: var(--gold); }
.first-visit-banner { background: rgba(212,165,116,0.1); border: 1px solid var(--gold-dim); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.first-visit-banner h3 { color: var(--gold); margin-bottom: 8px; font-size: 1rem; }
.first-visit-banner p { color: var(--text-muted); font-size: 0.85rem; line-height: 1.5; margin-bottom: 12px; }
.form-error { color: var(--accent); font-size: 0.85rem; margin-bottom: 12px; min-height: 20px; }
.form-success { color: var(--success); font-size: 0.85rem; margin-bottom: 12px; padding: 8px 12px; background: rgba(76,175,80,0.1); border-radius: var(--radius); }
.form-warning {
  background: rgba(233, 69, 96, 0.1); border: 1px solid var(--accent);
  color: var(--accent); padding: 8px 12px; border-radius: var(--radius);
  font-size: 0.85rem; margin-top: 8px;
}
.form-hint { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 8px; }
.size-hint { margin-top: 4px; display: block; }

.form-section {
  margin-bottom: 28px; padding-bottom: 20px;
  border-bottom: 1px solid rgba(212, 165, 116, 0.15);
}
.form-section:last-of-type { border-bottom: none; }
.form-section-title { font-size: 1rem; margin-bottom: 16px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; padding-top: 16px; }
.page-title { margin-bottom: 20px; }

.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-label {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-radius: var(--radius); cursor: pointer; transition: background-color 0.2s;
  min-height: 44px;
}
.radio-label:hover { background-color: rgba(255,255,255,0.03); }
.radio-label input[type="radio"] { width: auto; accent-color: var(--gold); min-height: auto; }

.character-preview { margin-top: 8px; }
.char-preview-card {
  background: var(--bg-card); border: 1px solid var(--gold-dim);
  border-radius: var(--radius); padding: 10px 14px; font-size: 0.9rem;
}
.char-checkbox-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.char-checkbox-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-radius: var(--radius); cursor: pointer; transition: background-color 0.2s;
  min-height: 44px;
}
.char-checkbox-item:hover { background-color: rgba(255,255,255,0.03); }
.char-checkbox-item input[type="checkbox"] { width: auto; accent-color: var(--gold); min-height: auto; }

/* --- Dashboard --- */
.dashboard-container { max-width: 1000px; margin: 0 auto; padding: 32px 24px; }
.dashboard-header {
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 24px;
}
.dashboard-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.campaigns-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px;
}
.campaign-card {
  background: var(--bg-card); border: 1px solid var(--gold-dim);
  border-radius: var(--radius); padding: 20px;
  transition: border-color 0.2s, box-shadow 0.2s; cursor: pointer;
}
.campaign-card:hover { border-color: var(--gold); box-shadow: 0 4px 20px rgba(212, 165, 116, 0.15); }
.campaign-card-header { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.campaign-card h3 { font-size: 1.1rem; margin-right: 8px; }
.campaign-card-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.campaign-tag {
  padding: 3px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 600;
  background: rgba(212, 165, 116, 0.15); color: var(--gold);
}
.campaign-characters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.char-mini {
  padding: 2px 8px; border-radius: 4px; font-size: 0.75rem;
  background: rgba(76, 175, 80, 0.15); color: #4caf50;
}
.campaign-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px; border-top: 1px solid rgba(212, 165, 116, 0.15);
}
.campaign-date { font-size: 0.8rem; color: var(--text-muted); }
.campaign-delete-btn {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 4px 8px; font-size: 0.85rem; border-radius: 4px;
  transition: color 0.2s, background-color 0.2s; min-height: 44px;
}
.campaign-delete-btn:hover { color: var(--danger); background-color: rgba(233, 69, 96, 0.1); }

.char-personality-preview { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 12px; font-style: italic; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-icon { font-size: 4rem; margin-bottom: 16px; }
.empty-state .btn { margin-top: 20px; }

/* --- Formular-Container --- */
.form-container { max-width: 600px; margin: 0 auto; padding: 32px 24px; }
.form-container-wide { max-width: 750px; }
.campaign-form {
  background: var(--bg-secondary); border: 1px solid var(--gold-dim);
  border-radius: var(--radius); padding: 32px;
}

/* --- Detail-Modus Toggle --- */
.detail-toggle {
  display: flex; align-items: center; gap: 12px; margin-bottom: 24px;
  padding-bottom: 16px; border-bottom: 1px solid rgba(212, 165, 116, 0.15);
}
.toggle-label { color: var(--gold); font-weight: 600; font-size: 0.9rem; }
.toggle-switch { display: flex; border: 1px solid var(--gold-dim); border-radius: var(--radius); overflow: hidden; }
.toggle-btn {
  padding: 6px 16px; border: none; background: transparent; color: var(--text-muted);
  font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: background-color 0.2s, color 0.2s;
  min-height: 36px;
}
.toggle-btn.active { background: var(--gold-dim); color: white; }
.toggle-btn:hover:not(.active) { color: var(--text); }

.detailed-section { animation: slideDown 0.3s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* --- Attribute Circles --- */
.attributes-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.attribute-circle {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--bg-primary); border: 2px solid var(--gold-dim);
  border-radius: 12px; padding: 12px 8px; transition: border-color 0.2s;
}
.attribute-circle:hover { border-color: var(--gold); }
.attribute-circle label { font-size: 0.75rem; font-weight: 700; color: var(--gold); letter-spacing: 1px; }
.attribute-circle input {
  width: 48px; text-align: center; padding: 4px; background: var(--bg-secondary);
  border: 1px solid var(--gold-dim); border-radius: 6px; color: var(--text);
  font-size: 1.1rem; font-weight: 700; min-height: auto;
}
.attribute-circle input:focus { outline: none; border-color: var(--gold); }
.attr-mod { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }

.combat-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.combat-stats .form-group input { text-align: center; }

.saves-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.save-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.save-item label { font-size: 0.75rem; font-weight: 700; color: var(--gold); }
.save-item input {
  width: 48px; text-align: center; padding: 4px; background: var(--bg-primary);
  border: 1px solid var(--gold-dim); border-radius: 6px; color: var(--text);
  font-size: 0.9rem; min-height: auto;
}
.save-item input:focus { outline: none; border-color: var(--gold); }

.skills-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; }
.skill-item { padding: 4px 0; }
.skill-label {
  display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.9rem;
  padding: 4px 8px; border-radius: 4px; transition: background-color 0.2s; min-height: 44px;
}
.skill-label:hover { background-color: rgba(255,255,255,0.03); }
.skill-label input[type="checkbox"] { width: auto; accent-color: var(--gold); min-height: auto; }
.skill-attr { color: var(--text-muted); font-size: 0.8rem; }

/* --- Modal --- */
.modal {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.modal-content {
  background: var(--bg-secondary); border: 1px solid var(--gold-dim);
  border-radius: var(--radius); padding: 28px; max-width: 440px; width: 100%;
}
.modal-content h3 { margin-bottom: 12px; }
.modal-content p { margin-bottom: 20px; color: var(--text-muted); line-height: 1.5; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; }

/* --- Chat-Seite --- */
.chat-page {
  display: flex; flex-direction: column; height: 100vh; height: 100dvh;
  overflow: hidden; overscroll-behavior: none; position: fixed; inset: 0;
}
.chat-page .app-header { flex-shrink: 0; z-index: 10; }
.chat-layout { flex: 1; display: flex; overflow: hidden; min-height: 0; }
.chat-container { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; }
.chat-input-area { flex-shrink: 0; z-index: 10; }
.chat-messages { flex: 1; display: flex; flex-direction: column; gap: 16px; max-width: 800px; width: 100%; margin: 0 auto; }

.chat-message { display: flex; gap: 10px; max-width: 85%; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.chat-message.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-message.assistant { align-self: flex-start; }

.chat-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}
.chat-message.user .chat-avatar { background: rgba(170, 130, 200, 0.3); border: 1px solid rgba(170, 130, 200, 0.5); }
.chat-message.assistant .chat-avatar { background: var(--bg-card); border: 1px solid var(--gold-dim); }

.chat-bubble { padding: 12px 16px; border-radius: 12px; line-height: 1.6; word-wrap: break-word; overflow-wrap: break-word; }
.chat-message.user .chat-bubble { background: rgba(160, 130, 100, 0.18); color: var(--text); border: 1px solid rgba(170, 130, 200, 0.5); border-bottom-right-radius: 4px; }
.chat-message.assistant .chat-bubble { background: var(--bg-card); border: 1px solid var(--gold-dim); border-bottom-left-radius: 4px; }

/* Markdown in Chat */
.chat-message.assistant .chat-bubble h1, .chat-message.assistant .chat-bubble h2, .chat-message.assistant .chat-bubble h3 { font-size: 1.1rem; margin: 12px 0 6px; color: var(--gold); }
.chat-message.assistant .chat-bubble h1:first-child, .chat-message.assistant .chat-bubble h2:first-child, .chat-message.assistant .chat-bubble h3:first-child { margin-top: 0; }
.chat-message.assistant .chat-bubble h4, .chat-message.assistant .chat-bubble h5, .chat-message.assistant .chat-bubble h6 { font-size: 1rem; margin: 10px 0 4px; color: var(--gold); }
.chat-message.assistant .chat-bubble p { margin-bottom: 8px; }
.chat-message.assistant .chat-bubble p:last-child { margin-bottom: 0; }
.chat-message.assistant .chat-bubble strong { color: var(--gold); }
.chat-message.assistant .chat-bubble em { color: #ccc; }
.chat-message.assistant .chat-bubble hr { border: none; border-top: 1px solid var(--gold-dim); margin: 12px 0; opacity: 0.5; }
.chat-message.assistant .chat-bubble ul, .chat-message.assistant .chat-bubble ol { margin: 8px 0; padding-left: 20px; }
.chat-message.assistant .chat-bubble li { margin-bottom: 4px; }
.chat-message.assistant .chat-bubble blockquote { border-left: 3px solid var(--gold-dim); padding-left: 12px; margin: 8px 0; color: var(--text-muted); font-style: italic; }
.chat-message.assistant .chat-bubble code { background: rgba(0,0,0,0.3); padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }
.chat-message.assistant .chat-bubble pre { background: rgba(0,0,0,0.3); padding: 10px; border-radius: var(--radius); overflow-x: auto; margin: 8px 0; }
.chat-message.assistant .chat-bubble pre code { background: none; padding: 0; }

/* Markdown in User-Nachrichten */
.chat-message.user .chat-bubble p { margin-bottom: 8px; }
.chat-message.user .chat-bubble p:last-child { margin-bottom: 0; }
.chat-message.user .chat-bubble strong { color: rgba(200, 170, 230, 1); }
.chat-message.user .chat-bubble em { color: #ccc; }
.chat-message.user .chat-bubble ul, .chat-message.user .chat-bubble ol { margin: 8px 0; padding-left: 20px; }
.chat-message.user .chat-bubble li { margin-bottom: 4px; }
.chat-message.user .chat-bubble blockquote { border-left: 3px solid rgba(170, 130, 200, 0.5); padding-left: 12px; margin: 8px 0; color: var(--text-muted); font-style: italic; }
.chat-message.user .chat-bubble hr { border: none; border-top: 1px solid rgba(170, 130, 200, 0.3); margin: 12px 0; opacity: 0.5; }

.dice-result { display: inline-block; background: rgba(212, 165, 116, 0.2); border: 1px solid var(--gold-dim); border-radius: 4px; padding: 2px 8px; font-weight: 600; color: var(--gold); }
.dice-line .dice-result { background: rgba(233, 69, 96, 0.15); border-color: rgba(233, 69, 96, 0.3); color: #e94560; }

.retry-btn { margin-top: 8px; display: block; }

/* Typing */
.typing-indicator { display: flex; align-items: center; gap: 10px; padding: 0 24px 12px; max-width: 800px; width: 100%; margin: 0 auto; flex-wrap: wrap; }
.typing-avatar { font-size: 1.2rem; }
.typing-dots { display: flex; gap: 4px; }
.typing-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); animation: pulse 1.4s infinite ease-in-out; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
.typing-hint { color: var(--text-muted); font-size: 0.8rem; }

@keyframes pulse { 0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }

/* Streaming-Cursor */
.stream-cursor { color: var(--gold); animation: blink-cursor 0.8s step-end infinite; font-weight: bold; }
@keyframes blink-cursor { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* Chat-Eingabe */
.chat-input-area { background: var(--bg-secondary); border-top: 2px solid var(--gold-dim); padding: 12px 24px 16px; flex-shrink: 0; }
.chat-form { display: flex; gap: 12px; max-width: 800px; margin: 0 auto; align-items: flex-end; }

/* Collapsible Extra-Panel (Modellauswahl + Szene) — Desktop: immer sichtbar */
.chat-extra-toggle { display: none; }
.chat-extra-panel { max-width: 800px; margin: 0 auto 10px; }

/* Modell-Auswahl */
.model-selector-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.model-selector-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; flex-shrink: 0; }
.model-dropdown {
  background: var(--bg-card); color: var(--text); border: 1px solid var(--gold-dim);
  border-radius: var(--radius); padding: 4px 10px; font-size: 0.78rem; font-weight: 600;
  cursor: pointer; min-height: 28px; line-height: 1; outline: none;
  appearance: auto; -webkit-appearance: auto; max-width: 200px;
}
.model-dropdown:focus { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(212,175,55,0.2); }
.model-dropdown optgroup { font-weight: 700; color: var(--text-muted); }
.model-dropdown option { font-weight: 400; color: var(--text); background: var(--bg-card); }
.model-info-btn {
  background: none; border: none; cursor: pointer; font-size: 1rem;
  padding: 2px 6px; border-radius: 4px; transition: background-color 0.2s;
  min-height: 28px; line-height: 1;
}
.model-info-btn:hover { background: rgba(255,255,255,0.08); }

/* Modell-Info Modal */
.model-info-modal-content { max-width: 620px; max-height: 80vh; overflow-y: auto; }
.model-info-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px; }
.model-info-item { padding: 14px; background: var(--bg-primary); border: 1px solid var(--gold-dim); border-radius: var(--radius); }
.model-info-item.unavailable { opacity: 0.5; }
.model-info-item h4 { font-size: 0.95rem; margin-bottom: 8px; color: var(--gold); }
.model-info-item p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; margin: 0; }
.model-info-meta { display: flex; align-items: center; gap: 12px; margin-top: 8px; font-size: 0.8rem; }
.model-info-cost { color: var(--gold); font-weight: 600; }
.model-info-status { color: var(--accent); font-style: italic; }
.model-select-wrapper { display: flex; align-items: center; gap: 8px; }

/* ─── Model Grid (Profil: erweiterte Modelleinstellungen) ─────────────────── */
.model-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.model-grid-tier-label { grid-column: 1 / -1; font-size: 0.85rem; font-weight: 600; color: var(--gold); margin: 8px 0 4px; padding-top: 8px; border-top: 1px solid var(--gold-dim); }
.model-grid-tier-label:first-child { border-top: none; margin-top: 0; }
.model-grid-item { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--bg-primary); border: 1px solid var(--gold-dim); border-radius: var(--radius); cursor: pointer; transition: border-color 0.2s, background 0.2s; }
.model-grid-item:hover { border-color: var(--gold); }
.model-grid-item.active { border-color: var(--gold); background: rgba(212, 165, 116, 0.1); }
.model-grid-item.unavailable { opacity: 0.4; pointer-events: none; }
.model-grid-check { width: 22px; height: 22px; border-radius: 4px; border: 2px solid var(--gold-dim); display: flex; align-items: center; justify-content: center; font-size: 0.8rem; color: var(--gold); flex-shrink: 0; }
.model-grid-item.active .model-grid-check { background: var(--gold); color: var(--bg-primary); border-color: var(--gold); }
.model-grid-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.model-grid-info strong { font-size: 0.8rem; color: #eee; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-grid-name { font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-grid-cost { font-size: 0.7rem; color: var(--gold); }
@media (max-width: 480px) { .model-grid { grid-template-columns: 1fr; } }

/* Denkvorgang (einklappbar) */
.thinking-block {
  margin-bottom: 10px; border-radius: var(--radius); overflow: hidden;
  border: 1px solid rgba(160, 120, 80, 0.35);
}
.thinking-block summary {
  padding: 5px 10px; cursor: pointer; color: var(--text-muted); font-size: 0.78rem;
  font-weight: 600; background: rgba(0,0,0,0.2); user-select: none;
  list-style: none; display: flex; align-items: center; gap: 6px;
}
.thinking-block summary::-webkit-details-marker { display: none; }
.thinking-block summary::before { content: '▶'; font-size: 0.65rem; transition: transform 0.2s; }
.thinking-block[open] summary::before { transform: rotate(90deg); }
.thinking-content {
  padding: 10px 12px; font-size: 0.8rem; color: var(--text-muted);
  white-space: pre-wrap; background: rgba(0,0,0,0.12); line-height: 1.55;
  max-height: 280px; overflow-y: auto;
}

/* KI-Gedächtnis (einklappbar, violetter Ton) */
.memory-block {
  margin-top: 10px; border-radius: var(--radius); overflow: hidden;
  border: 1px solid rgba(130, 90, 180, 0.35);
}
.memory-block summary {
  padding: 5px 10px; cursor: pointer; color: #b89ae0; font-size: 0.78rem;
  font-weight: 600; background: rgba(90, 50, 140, 0.15); user-select: none;
  list-style: none; display: flex; align-items: center; gap: 6px;
}
.memory-block summary::-webkit-details-marker { display: none; }
.memory-block summary::before { content: '▶'; font-size: 0.65rem; transition: transform 0.2s; }
.memory-block[open] summary::before { transform: rotate(90deg); }
.memory-content {
  padding: 10px 12px; font-size: 0.8rem; color: #c4a8e0;
  white-space: pre-wrap; background: rgba(90, 50, 140, 0.08); line-height: 1.55;
  max-height: 280px; overflow-y: auto;
}

/* Neues Denkvorgang-/Gedächtnis-Container-Design (klick-basiert statt <details>) */
.think-container, .memory-container {
  background: rgba(22, 33, 62, 0.5);
  border: 1px solid rgba(212, 165, 116, 0.15);
  border-radius: 6px;
  padding: 10px 14px;
  margin: 8px 0;
  font-size: 0.85em;
  color: #999;
  cursor: pointer;
}
.think-container .think-header, .memory-container .think-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: #aaa;
  user-select: none;
}
.think-container .think-header::before, .memory-container .think-header::before {
  content: '▶';
  font-size: 0.65rem;
  transition: transform 0.2s;
}
.think-container.expanded .think-header::before, .memory-container.expanded .think-header::before {
  transform: rotate(90deg);
}
.think-container .think-content, .memory-container .think-content {
  display: none;
  margin-top: 8px;
  white-space: pre-wrap;
  line-height: 1.55;
  max-height: 300px;
  overflow-y: auto;
  font-size: 0.92em;
}
.think-container.expanded .think-content, .memory-container.expanded .think-content {
  display: block;
}

/* KI-Antwort-Formatierung */
.ai-content h1, .ai-content h2, .ai-content h3, .chat-bubble h1, .chat-bubble h2, .chat-bubble h3 {
  color: #d4a574;
  font-family: Georgia, serif;
  margin: 0.8em 0 0.4em 0;
  border-bottom: 1px solid rgba(212, 165, 116, 0.2);
  padding-bottom: 0.3em;
}
.ai-content h1, .chat-bubble h1 { font-size: 1.3em; }
.ai-content h2, .chat-bubble h2 { font-size: 1.15em; }
.ai-content h3, .chat-bubble h3 { font-size: 1.05em; }
.ai-content strong, .chat-bubble .assistant strong { color: #d4a574; }

/* Direkte Rede */
.direct-speech {
  color: #f0e6d3;
  border-left: 2px solid #d4a574;
  padding-left: 8px;
  margin: 4px 0;
  display: inline;
}

/* Würfelergebnis — Inline-Highlight für Würfelzeilen */
.dice-line {
  display: block;
  background: rgba(212, 165, 116, 0.12);
  border: 1px solid rgba(212, 165, 116, 0.25);
  border-radius: 6px;
  padding: 6px 12px;
  margin: 8px 0;
  font-size: 0.92em;
  color: var(--gold);
}
.dice-line strong { color: var(--gold); }

/* Fantasy-Trennlinie */
.ai-content hr, .chat-bubble hr, .message-content hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, #d4a574, transparent);
  margin: 1em 0;
}

/* Role-based: hide think/memory for regular users */
body[data-role="user"] .think-container,
body[data-role="user"] .memory-container { display: none !important; }

/* Debug-Prompt (einklappbar, unter User-Nachrichten, grauer Ton) */
.debug-prompt-block {
  margin-top: 8px; border-radius: var(--radius); overflow: hidden;
  border: 1px solid rgba(100, 100, 120, 0.35);
}
.debug-prompt-block summary {
  padding: 5px 10px; cursor: pointer; color: var(--text-muted); font-size: 0.75rem;
  font-weight: 600; background: rgba(0,0,0,0.15); user-select: none;
  list-style: none; display: flex; align-items: center; gap: 6px;
}
.debug-prompt-block summary::-webkit-details-marker { display: none; }
.debug-prompt-block summary::before { content: '▶'; font-size: 0.65rem; transition: transform 0.2s; }
.debug-prompt-block[open] summary::before { transform: rotate(90deg); }
.debug-prompt-content {
  padding: 10px 12px; font-size: 0.72rem; color: var(--text-muted);
  white-space: pre-wrap; background: rgba(0,0,0,0.1); line-height: 1.5;
  max-height: 400px; overflow-y: auto; font-family: 'Consolas', 'Monaco', monospace;
}

/* Notizen-Panel */
.notes-panel {
  position: fixed; top: 0; right: 0; height: 100vh; width: 370px; max-width: 85vw;
  background: var(--bg-secondary); border-left: 2px solid var(--gold-dim);
  z-index: 1001; flex-direction: column; padding: 0;
  transform: none; box-shadow: -4px 0 20px rgba(0,0,0,0.5);
}
.notes-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; border-bottom: 1px solid var(--gold-dim); flex-shrink: 0;
}
.notes-panel-header h3 { font-size: 1rem; margin: 0; }
.notes-panel-scroll {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column;
}
.notes-section { padding: 0 0 8px; }
.notes-section-title {
  font-size: 0.9rem; color: var(--gold); margin: 0; padding: 12px 16px 0;
  font-family: Georgia, serif;
}
.ai-memory-section {
  border-top: 1px solid rgba(130, 90, 180, 0.3);
}
.ai-memory-section .notes-section-title { color: #b89ae0; }
.ai-memory-section textarea { border-color: rgba(130, 90, 180, 0.35); }
.ai-memory-section textarea:focus { border-color: #b89ae0; }
.notes-hint {
  padding: 8px 16px 0; font-size: 0.78rem; color: var(--text-muted); line-height: 1.4;
}
.notes-panel textarea {
  margin: 8px 16px; padding: 10px 12px; background: var(--bg-primary);
  color: var(--text); border: 1px solid var(--gold-dim); border-radius: var(--radius);
  font-size: 0.85rem; font-family: inherit; resize: none; line-height: 1.5;
  min-height: 120px; width: calc(100% - 32px); box-sizing: border-box;
}
.notes-panel textarea:focus { outline: none; border-color: var(--gold); }
.notes-counter {
  padding: 0 16px 4px; font-size: 0.78rem; color: var(--text-muted); text-align: right;
}
.notes-status {
  padding: 0 16px 8px; font-size: 0.78rem; text-align: right; min-height: 18px;
}
.notes-status.saved { color: var(--success); }
.notes-status.error { color: var(--accent); }

/* Modell-Hinweis unter KI-Nachrichten */
.message-model-hint {
  margin-top: 8px; font-size: 0.7rem; color: var(--text-muted);
  opacity: 0.6; text-align: right; font-style: italic;
}

/* Settings Toggle Row */
.settings-toggle-row { display: flex; flex-direction: column; gap: 4px; }

.chat-form textarea {
  flex: 1; padding: 12px 16px; background: var(--bg-primary); color: var(--text);
  border: 1px solid var(--gold-dim); border-radius: var(--radius);
  font-size: 1rem; font-family: inherit; resize: none;
  min-height: 44px; max-height: 150px; line-height: 1.5; transition: border-color 0.2s;
  min-width: 0;
}
.chat-form textarea:focus { outline: none; border-color: var(--gold); }
.btn-send { height: 44px; padding: 0 24px; flex-shrink: 0; }

/* --- Charakter-Sidebar --- */
.char-sidebar {
  position: fixed; top: 0; right: 0; height: 100vh; width: 320px; max-width: 85vw;
  background: var(--bg-secondary); border-left: 2px solid var(--gold-dim);
  overflow-y: auto; flex-shrink: 0;
  z-index: 1001; /* ÜBER dem Overlay */
  transform: translateX(100%);
  transition: transform 0.3s ease;
  pointer-events: auto;
  display: flex; flex-direction: column;
}
.char-sidebar.open { transform: translateX(0); }

.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 1000; /* unter der Sidebar */
  pointer-events: auto;
}

.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--gold-dim); }
.sidebar-header h3 { font-size: 1rem; }
.sidebar-close-btn { background: none; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; padding: 4px; min-height: 44px; min-width: 44px; }
.sidebar-close-btn:hover { color: var(--text); }
.sidebar-characters { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.sidebar-char { background: var(--bg-card); border: 1px solid var(--gold-dim); border-radius: var(--radius); overflow: hidden; }
.sidebar-char-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; cursor: pointer; transition: background-color 0.2s; min-height: 44px; }
.sidebar-char-header:hover { background: rgba(255,255,255,0.03); }
.sidebar-char-name { display: flex; flex-direction: column; gap: 2px; }
.sidebar-char-name strong { color: var(--gold); font-size: 0.95rem; }
.sidebar-char-hp { text-align: center; }
.hp-display { display: block; font-weight: 700; color: var(--success); font-size: 0.95rem; }
.hp-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }
.sidebar-char-detail { padding: 12px; border-top: 1px solid rgba(212, 165, 116, 0.15); animation: fadeIn 0.2s ease; }
.sidebar-attrs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: 12px; }
.sidebar-attrs span { font-size: 0.8rem; color: var(--text-muted); text-align: center; padding: 3px; background: var(--bg-primary); border-radius: 4px; }
.sidebar-edit-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sidebar-edit-row label { font-size: 0.8rem; color: var(--gold); font-weight: 600; white-space: nowrap; }
.sidebar-edit-col { flex-direction: column; align-items: stretch; }
.sidebar-edit-col .btn { align-self: flex-end; margin-top: 4px; }
.sidebar-input { width: 60px; padding: 4px 6px; background: var(--bg-primary); border: 1px solid var(--gold-dim); border-radius: 4px; color: var(--text); font-size: 0.9rem; text-align: center; min-height: auto; }
.sidebar-input:focus { outline: none; border-color: var(--gold); }
.sidebar-textarea { width: 100%; padding: 6px 8px; background: var(--bg-primary); border: 1px solid var(--gold-dim); border-radius: 4px; color: var(--text); font-size: 0.8rem; font-family: inherit; resize: vertical; min-height: auto; }
.sidebar-textarea:focus { outline: none; border-color: var(--gold); }
.sidebar-info { font-size: 0.8rem; margin-bottom: 6px; color: var(--text-muted); }
.sidebar-info strong { color: var(--gold); }

/* --- Admin-Panel --- */
.admin-container { max-width: 1400px; }
.admin-table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid rgba(212, 165, 116, 0.15); white-space: nowrap; }
.admin-table th { color: var(--gold); font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; position: sticky; top: 0; background: var(--bg-secondary); }
.admin-table th.sortable { cursor: pointer; user-select: none; }
.admin-table th.sortable:hover { color: var(--text); }
.admin-table tbody tr:nth-child(even) { background: rgba(255,255,255,0.02); }
.admin-table tbody tr:hover { background: rgba(212, 165, 116, 0.05); }
.admin-table .row-inactive { opacity: 0.5; }
.actions-cell { white-space: nowrap; display: flex; gap: 4px; flex-wrap: nowrap; }
.admin-badge { background: var(--gold-dim); color: white; padding: 2px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 700; }
.status-active { color: var(--success); font-weight: 600; }
.status-inactive { color: var(--accent); font-weight: 600; }
.admin-section-title { color: var(--gold); font-size: 1rem; font-weight: 600; margin: 1rem 0 0.5rem; }
.detail-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.detail-table td { padding: 4px 8px; border-bottom: 1px solid rgba(212,165,116,0.1); }
.detail-table td:first-child { color: var(--text-muted); white-space: nowrap; width: 40%; }
.detail-section { background: rgba(255,255,255,0.02); border-radius: 8px; padding: 12px; }

/* Admin-Übersicht */
.admin-overview { padding: 0; }
.stat-group { margin-bottom: 24px; }
.stat-group h3 { color: var(--gold); font-size: 1rem; margin-bottom: 12px; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.stat-card { background: var(--bg-card); border: 1px solid rgba(212,165,116,0.1); border-radius: var(--radius); padding: 14px 16px; text-align: center; }
.stat-card.highlight { border-color: rgba(212,165,116,0.3); }
.stat-value { font-size: 1.4rem; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.stat-card.highlight .stat-value { color: var(--gold); }
.stat-label { font-size: 0.75rem; color: var(--text-muted); }

/* Admin-Tabs */
.admin-tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 2px solid rgba(212, 165, 116, 0.2); padding-bottom: 0; }
.admin-tab { background: none; border: none; color: var(--text-muted); font-size: 0.95rem; padding: 10px 20px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color 0.2s, border-color 0.2s; }
.admin-tab:hover { color: var(--text); }
.admin-tab.active { color: var(--gold); border-bottom-color: var(--gold); font-weight: 600; }

/* Admin Order Status Badges */
.order-status { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.7rem; font-weight: 600; color: #fff; }
.order-status.pending { background: #d4a574; }
.order-status.invoice_created { background: #5a8a8a; }
.order-status.invoice_sent { background: #3a7acf; }
.order-status.paid { background: #5a9a3a; }
.order-status.completed { background: #4caf50; }
.order-status.cancelled { background: #e94560; }

/* Admin Order Action Buttons */
.order-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.order-actions select { background: var(--bg-primary); color: var(--text); border: 1px solid rgba(255,255,255,0.15); border-radius: 4px; padding: 4px 6px; font-size: 0.75rem; }
.order-actions .btn { font-size: 0.7rem; padding: 3px 8px; }

/* Admin Billing Info Tooltip */
.billing-info { font-size: 0.75rem; color: var(--text-muted); line-height: 1.4; }
.billing-info strong { color: var(--text); font-weight: 500; }
.sort-arrow { font-size: 0.75rem; margin-left: 2px; }
.coins-cell { white-space: nowrap; }
.btn-tiny { padding: 1px 6px; font-size: 0.7rem; min-width: auto; margin-left: 2px; line-height: 1.4; cursor: pointer; border: 1px solid var(--gold-dim); background: transparent; color: var(--gold); border-radius: 3px; }
.btn-tiny:hover { background: var(--gold-dim); color: white; }
.role-select { background: var(--bg-primary); color: var(--text); border: 1px solid var(--gold-dim); border-radius: 4px; padding: 3px 6px; font-size: 0.8rem; cursor: pointer; }
.role-select:disabled { opacity: 0.5; cursor: not-allowed; }
.usage-total-row td { border-top: 2px solid var(--gold-dim); }

/* ─── Analytics Tab ────────────────────────────────────────────────────────── */
.analytics-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.analytics-stat-card { background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary)); border: 1px solid rgba(212, 165, 116, 0.2); border-radius: 12px; padding: 20px; text-align: center; }
.analytics-stat-icon { font-size: 1.5rem; margin-bottom: 6px; }
.analytics-stat-value { font-size: 1.8rem; font-weight: 700; color: var(--gold); font-family: Georgia, serif; }
.analytics-stat-label { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }
.analytics-stat-sub { font-size: 0.7rem; color: var(--text-muted); margin-top: 6px; opacity: 0.7; }
.analytics-source-filter { display: flex; gap: 4px; }
.funnel-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.funnel-label { min-width: 130px; font-size: 0.9rem; color: var(--text); text-align: right; }
.funnel-bar-bg { flex: 1; height: 28px; background: rgba(255,255,255,0.05); border-radius: 6px; overflow: hidden; }
.funnel-bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--gold)); border-radius: 6px; transition: width 0.5s ease; min-width: 2px; }
.funnel-value { min-width: 90px; font-size: 0.85rem; color: var(--gold); font-weight: 600; }
.timeline-chart { display: flex; align-items: flex-end; gap: 2px; min-height: 140px; padding: 10px 0; overflow-x: auto; }
.timeline-bar-wrap { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.timeline-bar { background: linear-gradient(180deg, var(--gold), var(--accent)); border-radius: 3px 3px 0 0; transition: height 0.3s ease; }
.timeline-bar-wrap:hover .timeline-bar { opacity: 0.8; }
.timeline-date { font-size: 0.6rem; color: var(--text-muted); margin-top: 4px; writing-mode: vertical-lr; transform: rotate(180deg); }
@media (max-width: 768px) {
  .analytics-stats { grid-template-columns: repeat(2, 1fr); }
  .funnel-label { min-width: 90px; font-size: 0.8rem; }
  .funnel-value { min-width: 70px; font-size: 0.75rem; }
  .admin-tabs { flex-wrap: wrap; }
}

/* --- Portraits --- */
.portrait-section {
  display: flex; align-items: center; gap: 20px;
  margin-bottom: 24px; padding-bottom: 20px;
  border-bottom: 1px solid rgba(212, 165, 116, 0.15);
}
.portrait-preview {
  width: 120px; height: 120px; border-radius: 12px;
  background: var(--bg-primary); border: 2px solid var(--gold-dim);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}
.portrait-preview img { width: 100%; height: 100%; object-fit: cover; }
.portrait-fallback { font-size: 3rem; display: flex; align-items: center; justify-content: center; }
.portrait-actions { display: flex; flex-direction: column; gap: 8px; }
.portrait-upload-btn { cursor: pointer; }
.portrait-ai-btn { cursor: pointer; }
.portrait-modal-content { max-width: 520px; }
.portrait-modal-content textarea { width: 100%; min-height: 120px; margin-bottom: 12px; }
.portrait-modal-hint { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 12px; }

/* Portrait Cover-Fix: Rahmen komplett ausfüllen */
.portrait-preview img,
.chat-avatar-img,
.char-card-portrait,
.sidebar-portrait,
.char-preview-portrait,
.wb-thumb { object-fit: cover; object-position: center; }

/* Attribut-Hinweis bei Werten über 20 */
.attribute-hint {
  color: #d4a574;
  font-size: 0.75em;
  margin-top: 4px;
  padding: 4px 8px;
  background: rgba(212, 165, 116, 0.1);
  border-left: 2px solid #d4a574;
  border-radius: 0 4px 4px 0;
}

/* Chat-Avatare mit Portraits */
.chat-avatar { position: relative; }
.chat-avatar-img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }

/* Charakter-Card Portraits */
.char-card-name-row { display: flex; align-items: center; gap: 10px; }
.char-card-portrait { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 2px solid var(--gold-dim); }
.char-card-portrait-fallback {
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-primary); font-size: 1.2rem;
}

/* Dashboard Campaign-Card Portraits */
.campaign-char-portraits { display: flex; align-items: center; margin-bottom: 12px; }
.char-portrait-mini {
  width: 32px; height: 32px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--bg-card); margin-left: -8px;
}
.char-portrait-mini:first-child { margin-left: 0; }
.char-portrait-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-primary); font-size: 0.8rem;
}
.char-portrait-more {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--gold-dim); color: white; font-size: 0.7rem; font-weight: 700;
}

/* Sidebar Portraits */
.sidebar-char-info { display: flex; align-items: center; gap: 8px; }
.sidebar-portrait { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 1px solid var(--gold-dim); }
.sidebar-portrait-fallback { width: 36px; height: 36px; border-radius: 50%; background: var(--bg-primary); border: 1px solid var(--gold-dim); display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }

/* Campaign-new preview portrait */
.char-preview-card { display: flex; align-items: center; gap: 12px; background: var(--bg-card); border: 1px solid var(--gold-dim); border-radius: var(--radius); padding: 10px 14px; font-size: 0.9rem; }
.char-preview-portrait { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.char-preview-portrait-fallback { width: 44px; height: 44px; border-radius: 50%; background: var(--bg-primary); border: 1px solid var(--gold-dim); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }

/* --- KI-Portrait Loading Overlay --- */
.ai-loading-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0, 0, 0, 0.75); display: flex;
  align-items: center; justify-content: center;
}
.ai-loading-box {
  text-align: center; padding: 40px 48px; border-radius: 16px;
  background: var(--bg-secondary); border: 1px solid var(--gold-dim);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5); max-width: 360px;
}
.ai-spinner {
  width: 48px; height: 48px; margin: 0 auto 20px;
  border: 4px solid rgba(212, 165, 116, 0.2);
  border-top-color: var(--gold); border-radius: 50%;
  animation: aiSpin 0.9s linear infinite;
}
@keyframes aiSpin { to { transform: rotate(360deg); } }
.ai-loading-title {
  font-family: Georgia, serif; color: var(--gold);
  font-size: 1.05rem; font-weight: 700; margin-bottom: 8px;
}
.ai-loading-hint {
  color: var(--text-muted); font-size: 0.82rem; line-height: 1.5;
}

/* --- Legal Pages (Impressum, Datenschutz) --- */
.legal-container {
  min-height: 100vh; padding: 40px 20px;
  display: flex; justify-content: center; align-items: flex-start;
}
.legal-card {
  background: var(--bg-secondary); border: 1px solid var(--gold-dim);
  border-radius: 12px; padding: 40px; max-width: 780px; width: 100%;
  box-shadow: var(--shadow); line-height: 1.75;
}
.legal-card h1 { font-size: 1.6rem; margin-bottom: 24px; }
.legal-card h3 { font-size: 1rem; margin: 24px 0 8px; }
.legal-card p { margin-bottom: 12px; color: var(--text); font-size: 0.92rem; }
.legal-card ul { margin: 8px 0 12px 20px; font-size: 0.92rem; }
.legal-card li { margin-bottom: 4px; }
.legal-card code { background: rgba(0,0,0,0.3); padding: 1px 5px; border-radius: 3px; font-size: 0.85em; }
.legal-card a { color: var(--gold); }
.legal-card a:hover { color: var(--text); }
.legal-back {
  display: inline-block; margin-bottom: 16px; font-size: 0.9rem;
  color: var(--text-muted); text-decoration: none;
}
.legal-back:hover { color: var(--gold); }
.legal-footer-links { margin-top: 32px; padding-top: 16px; border-top: 1px solid rgba(212, 165, 116, 0.15); }

/* Site Footer Links */
.site-footer {
  text-align: center; padding: 16px 24px; color: var(--text-muted);
  font-size: 0.78rem;
}
.site-footer a { color: var(--text-muted); text-decoration: none; margin: 0 8px; }
.site-footer a:hover { color: var(--gold); }

/* Auth Footer (Login-Seite) */
.auth-footer { text-align: center; margin-top: 20px; }
.auth-footer a { color: var(--text-muted); font-size: 0.8rem; text-decoration: none; margin: 0 8px; }
.auth-footer a:hover { color: var(--gold); }
.btn-link { background: none; border: none; color: var(--gold-dim); cursor: pointer; text-decoration: underline; display: block; text-align: center; width: 100%; }
.btn-link:hover { color: var(--gold); }
.form-success { color: #4caf50; font-size: 0.85rem; margin-bottom: 8px; padding: 8px; background: rgba(76,175,80,0.1); border-radius: var(--radius); }

/* --- Auth: Google OAuth Button + Divider --- */
.auth-or-divider {
  display: flex; align-items: center; gap: 12px; margin: 16px 0; color: #666; font-size: 0.8rem;
}
.auth-or-divider::before, .auth-or-divider::after {
  content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.1);
}
.google-login-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 11px 16px; background: #ffffff; color: #3c4043;
  border: 1px solid #dadce0; border-radius: 8px; font-size: 0.9rem; font-weight: 500;
  text-decoration: none; cursor: pointer; transition: box-shadow 0.2s, background 0.2s;
  font-family: 'Segoe UI', Roboto, sans-serif;
}
.google-login-btn:hover { background: #f7f8f8; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.google-login-btn svg { flex-shrink: 0; }

/* --- Auth: Trust-Signale unter Registrierungsformular --- */
.auth-trust {
  margin-top: 24px; padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  text-align: center;
}
.auth-trust-badges {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  margin-bottom: 12px;
}
.auth-trust-badge {
  font-size: 0.7rem; color: #888; white-space: nowrap;
  background: rgba(255,255,255,0.04); padding: 4px 10px;
  border-radius: 20px; border: 1px solid rgba(255,255,255,0.06);
}
.auth-trust-payments {
  font-size: 0.65rem; color: #666; margin-bottom: 14px;
}
.auth-trust-pay-label { margin-right: 4px; }
.auth-trust-pay-item { font-weight: 600; color: #888; }
.auth-trust-pay-sep { margin: 0 2px; opacity: 0.4; }
.auth-creator-mini {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: 8px;
}
.auth-creator-photo {
  width: 36px; height: 36px; border-radius: 50%;
  object-fit: cover; border: 1px solid rgba(212,165,116,0.3);
}
.auth-creator-info {
  display: flex; flex-direction: column; text-align: left;
}
.auth-creator-name {
  font-size: 0.7rem; color: #aaa; font-weight: 600;
}
.auth-creator-email {
  font-size: 0.65rem; color: #d4a574; text-decoration: none;
}
.auth-creator-email:hover { text-decoration: underline; }

/* --- Responsive --- */
@media (max-width: 768px) {
  .portrait-section { flex-direction: column; align-items: center; }
  .portrait-preview { width: 100px; height: 100px; }
  .app-header { padding: 10px 16px; gap: 8px; }
  .header-title { font-size: 1rem; max-width: 150px; }
  .header-logo { font-size: 0; gap: 0; }
  .header-logo-img { height: 32px; }
  .main-nav { display: none; }
  .nav-burger { display: block; }
  .version-badge { display: none; }

  .dashboard-container { padding: 20px 16px; }
  .dashboard-header { flex-direction: column; gap: 12px; align-items: stretch; }
  .dashboard-actions { flex-direction: column; }
  .campaigns-grid { grid-template-columns: 1fr; }

  .form-container { padding: 20px 16px; }
  .campaign-form { padding: 20px; }
  .wizard-progress { flex-wrap: wrap; }
  .wizard-step { font-size: 0.75rem; padding: 6px 10px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .attributes-grid { grid-template-columns: repeat(3, 1fr); }
  .saves-grid { grid-template-columns: repeat(3, 1fr); }
  .skills-grid { grid-template-columns: 1fr; }
  .combat-stats { grid-template-columns: repeat(2, 1fr); }
  .form-actions { flex-direction: column-reverse; }

  .auth-card { padding: 24px 16px; }
  .legal-card { padding: 24px 16px; }
  .legal-container { padding: 20px 12px; }

  .chat-container { padding: 12px 12px; }
  .chat-input-area { padding: 8px 10px 10px; }
  .chat-form { gap: 6px; }
  .chat-form textarea { padding: 10px 12px; font-size: 0.95rem; }
  .btn-send { padding: 0 16px; font-size: 0.85rem; }
  .chat-message { max-width: 92%; }
  .chat-bubble { padding: 10px 12px; }

  /* Collapsible Extra-Panel auf Mobile */
  .chat-extra-toggle {
    display: flex; align-items: center; gap: 6px;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(212,165,116,0.2);
    border-radius: var(--radius); color: var(--text-muted); font-size: 0.75rem;
    padding: 5px 12px; cursor: pointer; width: 100%; max-width: 800px;
    margin: 0 auto 6px; transition: background 0.2s, border-color 0.2s;
  }
  .chat-extra-toggle::after { content: '▾'; margin-left: auto; font-size: 0.65rem; transition: transform 0.2s; }
  .chat-extra-toggle.open { border-color: var(--gold-dim); background: rgba(255,255,255,0.06); }
  .chat-extra-toggle.open::after { transform: rotate(180deg); }
  .chat-extra-panel {
    display: none; max-width: 800px; margin: 0 auto 6px;
    padding: 8px 10px; background: rgba(255,255,255,0.03);
    border: 1px solid rgba(212,165,116,0.15); border-radius: var(--radius);
  }
  .chat-extra-panel.open { display: block; }
  .chat-extra-panel .model-selector-row { margin-bottom: 6px; gap: 6px; }
  .chat-extra-panel .model-dropdown { max-width: none; flex: 1; min-width: 0; }
  .chat-extra-panel .scene-image-btn { width: 100%; margin-left: 0; justify-content: center; }

  /* Modals auf Mobile: volle Breite, am unteren Rand */
  .modal { padding: 10px; align-items: flex-end; }
  .modal-content { max-width: 100%; border-radius: 16px 16px 8px 8px; padding: 20px 16px; max-height: 85vh; overflow-y: auto; }
  .modal-content-wide { max-width: 100%; width: 100%; }
  .model-info-modal-content { max-width: 100%; }

  .username-badge { display: none; }

  /* Sidebar: schon fixed, nur Schatten auf Mobile */
  .char-sidebar { box-shadow: -4px 0 20px rgba(0,0,0,0.5); }

  /* Admin-Tabelle auf Mobile */
  .admin-table { font-size: 0.8rem; }
  .admin-table th, .admin-table td { padding: 8px 6px; }
  .actions-cell { flex-direction: column; gap: 4px; }
}

@media (max-width: 480px) {
  .attributes-grid { grid-template-columns: repeat(2, 1fr); }
  .saves-grid { grid-template-columns: repeat(2, 1fr); }
  .combat-stats { grid-template-columns: 1fr; }
  .chat-message { max-width: 95%; }
}

/* === Navigation Dropdown === */
.nav-dropdown { position: relative; }
.nav-dropdown-trigger {
  background: none; border: none; cursor: pointer; font-family: inherit;
}
.nav-dropdown-menu {
  display: none; position: absolute; top: 100%; left: 0; z-index: 100;
  background: var(--bg-secondary); border: 1px solid var(--gold-dim);
  border-radius: var(--radius); min-width: 200px; padding: 8px 0;
  box-shadow: var(--shadow);
}
.nav-dropdown:hover .nav-dropdown-menu { display: block; }
.nav-dropdown-item {
  display: block; padding: 8px 16px; color: var(--text-muted);
  font-size: 0.85rem; transition: background 0.2s, color 0.2s;
}
.nav-dropdown-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.nav-dropdown-item.active { color: var(--gold); }
.nav-dropdown-divider { height: 1px; background: rgba(212,165,116,0.15); margin: 4px 0; }

/* Mobile nav groups (einklappbar) */
.mobile-nav-group { display: flex; flex-direction: column; }
.mobile-nav-group-title {
  padding: 10px 14px 4px; color: var(--gold-dim); font-size: 0.75rem;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  cursor: pointer; display: flex; justify-content: space-between; align-items: center;
}
.mobile-nav-group-title::after { content: '▾'; font-size: 0.7rem; transition: transform 0.2s; }
.mobile-nav-group.collapsed .mobile-nav-group-title::after { transform: rotate(-90deg); }
.mobile-nav-group.collapsed .nav-link-indent { display: none; }
.nav-link-indent { padding-left: 28px !important; }

/* === World Element Type Tabs === */
.world-type-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.world-type-tab {
  padding: 6px 12px; border-radius: var(--radius); font-size: 0.8rem;
  color: var(--text-muted); background: var(--bg-card); border: 1px solid transparent;
  transition: all 0.2s; text-decoration: none;
}
.world-type-tab:hover { color: var(--text); border-color: var(--gold-dim); }
.world-type-tab.active { color: var(--gold); border-color: var(--gold); background: rgba(212, 165, 116, 0.1); }

/* === Worldbuilding Selection (Campaign Creation + Chat Modal) === */
.worldbuilding-select-container { max-height: 60vh; overflow-y: auto; padding-right: 4px; }
.worldbuilding-section { margin-top: 8px; }
.wb-type-group { margin-bottom: 16px; }
.wb-type-title {
  font-size: 0.9rem; color: var(--gold); margin-bottom: 8px;
  font-family: Georgia, serif;
}
.wb-limit { color: var(--text-muted); font-size: 0.75rem; font-family: 'Segoe UI', sans-serif; }
.wb-type-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: nowrap; }
.wb-type-header .wb-type-title { margin-bottom: 0; flex: 1; min-width: 0; }
.wb-checkbox-list { display: flex; flex-direction: column; gap: 6px; }
.wb-checkbox-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: var(--bg-card); border: 1px solid rgba(255,255,255,0.05);
  border-radius: var(--radius); cursor: pointer; transition: border-color 0.2s;
}
.wb-checkbox-item:hover { border-color: var(--gold-dim); }
.wb-checkbox-item input[type="checkbox"] {
  width: 18px; height: 18px; accent-color: var(--gold); flex-shrink: 0;
}
.wb-thumb {
  width: 40px; height: 40px; border-radius: 6px; object-fit: cover; flex-shrink: 0;
}
.wb-thumb-fallback {
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-secondary); font-size: 1.2rem;
}
.wb-item-info { display: flex; flex-direction: column; min-width: 0; }
.wb-item-info strong { font-size: 0.85rem; color: var(--text); }
.wb-item-info .text-muted { font-size: 0.75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wb-count { font-size: 0.8rem; color: var(--gold-dim); margin-top: 4px; }

/* === Modal Wide (for worldbuilding) === */
.modal-content-wide { max-width: 600px; width: 95%; max-height: 80vh; overflow-y: auto; }

/* === Worldbuilding Hierarchy Info === */
.wb-hierarchy-info {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px; margin: 4px 0 2px;
}
.wb-hierarchy-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.75rem; color: var(--gold); background: rgba(212,165,116,0.1);
  padding: 2px 8px; border-radius: 10px; border: 1px solid rgba(212,165,116,0.2);
}
.wb-children-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.75rem; color: var(--text-muted); background: rgba(255,255,255,0.03);
  padding: 2px 8px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.05);
}

/* === Worldbuilding Cascading Selection === */
.wb-world-group { margin-bottom: 12px; border: 1px solid rgba(212,165,116,0.15); border-radius: var(--radius); padding: 10px; background: rgba(0,0,0,0.15); }
.wb-world-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: nowrap; }
.wb-world-header label { font-weight: bold; color: var(--gold); font-size: 0.9rem; display: flex; align-items: center; gap: 8px; cursor: pointer; flex: 1; min-width: 0; }
.wb-select-all-btn { font-size: 0.7rem; padding: 2px 8px; background: rgba(212,165,116,0.15); color: var(--gold); border: 1px solid rgba(212,165,116,0.3); border-radius: 4px; cursor: pointer; transition: background 0.2s; white-space: nowrap; flex-shrink: 0; }
.wb-select-all-btn:hover { background: rgba(212,165,116,0.3); }
.wb-children-indent { margin-left: 20px; border-left: 2px solid rgba(212,165,116,0.15); padding-left: 10px; }
.wb-children-indent .wb-checkbox-item { background: rgba(0,0,0,0.1); }

/* --- Nav Dropdown Group Titles --- */
.nav-dropdown-group-title {
  display: block;
  padding: 4px 14px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gold-dim);
  pointer-events: none;
}
.nav-dropdown-group-title:not(:first-child) {
  margin-top: 4px;
  border-top: 1px solid rgba(212, 165, 116, 0.15);
  padding-top: 6px;
}

/* --- Wizard Progress --- */
.wizard-progress {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.wizard-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}
.wizard-step span:first-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 50%;
  background: var(--bg-secondary);
  font-size: 0.75rem;
  flex-shrink: 0;
}
.wizard-step.active {
  color: var(--gold);
  border-color: var(--gold-dim);
}
.wizard-step.active span:first-child {
  background: var(--gold);
  color: var(--bg-primary);
}
.wizard-step.completed {
  color: var(--success);
}
.wizard-step.completed span:first-child {
  background: var(--success);
  color: white;
}
.wizard-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}

/* --- Spielbau Cards --- */
.spielbau-select-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}
.spielbau-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.spielbau-card:hover {
  border-color: var(--gold-dim);
}
.spielbau-card.selected {
  border-color: var(--gold);
  background: rgba(212, 165, 116, 0.08);
}
.spielbau-card-main {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
}
.spielbau-card-portrait {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.spielbau-card-portrait-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  font-size: 1.2rem;
}
.spielbau-card-info {
  flex: 1;
  min-width: 0;
}
.spielbau-card-info strong {
  color: var(--text);
  font-size: 0.95rem;
}
.spielbau-card-desc {
  padding: 0 14px 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* --- Card Select (Volk/Klasse) --- */
.card-search {
  margin-bottom: 8px;
}
.card-select-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(212, 165, 116, 0.1);
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  cursor: pointer;
  margin-bottom: 8px;
  transition: background 0.2s;
}
.card-select-preview:hover {
  background: rgba(212, 165, 116, 0.18);
}
.card-select-preview .card-select-portrait {
  width: 40px;
  height: 40px;
}
.card-select-preview-name {
  flex: 1;
  font-weight: bold;
  color: var(--gold);
  font-size: 1rem;
}
.card-select-preview-toggle {
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: transform 0.2s;
}
.card-select-preview-toggle.open {
  transform: rotate(180deg);
}
.card-select-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  padding: 8px;
  background: var(--bg-secondary);
}
.card-select-list.collapsed {
  max-height: 200px;
}
.card-select-list.hidden {
  display: none;
}
.card-select-item {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s;
}
.card-select-item:hover {
  border-color: var(--gold-dim);
}
.card-select-item.selected {
  border-color: var(--gold);
  background: rgba(212, 165, 116, 0.08);
}
.card-select-main {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
}
.card-select-portrait {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.card-select-portrait-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  font-size: 1rem;
}
.card-select-info {
  flex: 1;
  min-width: 0;
}
.card-select-info strong {
  color: var(--text);
  font-size: 0.9rem;
}
.card-select-info-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  opacity: 0.6;
  transition: opacity 0.2s;
}
.card-select-info-btn:hover {
  opacity: 1;
}
.card-select-desc {
  padding: 0 12px 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* --- System/Custom Badges --- */
.wb-system-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 4px;
  background: rgba(212, 165, 116, 0.15);
  color: var(--gold);
  margin-left: 6px;
}
.wb-custom-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 4px;
  background: rgba(76, 175, 80, 0.15);
  color: var(--success);
  margin-left: 6px;
}

/* --- World Type Tab Separator --- */
.world-type-tab-separator {
  width: 2px;
  height: 20px;
  background: var(--gold-dim);
  opacity: 0.4;
  margin: 0 4px;
  align-self: center;
}

/* --- Character Select Dropdown (Campaign Wizard) --- */
#char-select-single {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--gold-dim);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.95rem;
  font-family: 'Segoe UI', system-ui, sans-serif;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23d4a574' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  cursor: pointer;
  min-height: 44px;
}
#char-select-single:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(212, 165, 116, 0.2);
}
#char-select-single option {
  background: var(--bg-secondary);
  color: var(--text);
  padding: 8px;
}

/* --- Button Height Fix: Align all header buttons --- */
.dashboard-header .btn {
  padding: 8px 16px;
  font-size: 0.85rem;
  min-height: 36px;
}

@media (max-width: 768px) {
  .nav-dropdown { display: none; }
  .world-type-tabs { display: none; }
  .dashboard-actions { flex-direction: column; gap: 8px; }
}

/* ===================================================================
   TAFELRUNDE — Styles
   =================================================================== */

:root {
  --tr-accent: #e6a53c;
  --tr-accent-hover: #cc8c28;
  --tr-npc: #4caf50;
  --tr-assistant: #42a5f5;
  --tr-chronicler: #ab47bc;
}

/* --- Tafelrunde Buttons --- */
.btn-tr-primary { background-color: var(--tr-accent); color: #1a1a2e; font-weight: 700; }
.btn-tr-primary:hover:not(:disabled) { background-color: var(--tr-accent-hover); }

/* --- Tafelrunde Card --- */
.tr-card { border-left: 3px solid var(--tr-accent); }

.tr-roles { display: flex; gap: 4px; flex-wrap: wrap; }

.tr-role-badge {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 2px 8px; border-radius: 12px; font-size: 0.75rem; font-weight: 600;
}
.tr-role-npc { background: rgba(76, 175, 80, 0.2); color: var(--tr-npc); }
.tr-role-assistant { background: rgba(66, 165, 245, 0.2); color: var(--tr-assistant); }
.tr-role-chronicler { background: rgba(171, 71, 188, 0.2); color: var(--tr-chronicler); }

.tr-card-actions { display: flex; gap: 8px; align-items: center; }

/* --- Rollen-Tabs im Chat --- */
.tr-role-tabs {
  display: flex; gap: 0; background: var(--bg-secondary);
  border-bottom: 1px solid var(--gold-dim);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 0 16px;
}

.tr-tab {
  padding: 10px 20px; border: none; background: none;
  color: var(--text-muted); font-size: 0.9rem; font-weight: 600;
  cursor: pointer; white-space: nowrap; border-bottom: 3px solid transparent;
  transition: all 0.2s; min-height: 44px;
}
.tr-tab:hover { color: var(--text); background: rgba(255,255,255,0.03); }
.tr-tab.active { color: var(--text); }
.tr-tab-npc.active { border-bottom-color: var(--tr-npc); color: var(--tr-npc); }
.tr-tab-assistant.active { border-bottom-color: var(--tr-assistant); color: var(--tr-assistant); }
.tr-tab-chronicler.active { border-bottom-color: var(--tr-chronicler); color: var(--tr-chronicler); }

/* --- NPC-Auswahl-Leiste --- */
.tr-npc-bar {
  background: var(--bg-secondary); border-bottom: 1px solid rgba(255,255,255,0.05);
  padding: 8px 16px;
}

.tr-npc-list {
  display: flex; gap: 12px; overflow-x: auto;
  -webkit-overflow-scrolling: touch; padding-bottom: 4px;
}

.tr-npc-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 10px; border: 2px solid transparent; border-radius: var(--radius);
  background: none; cursor: pointer; transition: all 0.2s; min-width: 70px;
  color: var(--text-muted);
}
.tr-npc-item:hover { border-color: rgba(76, 175, 80, 0.3); color: var(--text); }
.tr-npc-item.active {
  border-color: var(--tr-npc); color: var(--text);
  box-shadow: 0 0 8px rgba(76, 175, 80, 0.3);
}

.tr-npc-portrait {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--gold-dim);
}
.tr-npc-portrait-fallback {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--bg-card); font-size: 1.2rem; border: 2px solid var(--gold-dim);
}
.tr-npc-item.active .tr-npc-portrait { border-color: var(--tr-npc); }
.tr-npc-name { font-size: 0.7rem; text-align: center; max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Session-Leiste --- */
.tr-session-bar {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-secondary); border-bottom: 1px solid rgba(255,255,255,0.05);
  padding: 8px 16px;
}
.tr-session-start { background: rgba(76, 175, 80, 0.2); color: var(--tr-npc); border: 1px solid var(--tr-npc); }
.tr-session-start:hover { background: rgba(76, 175, 80, 0.3); }
.tr-session-end { background: rgba(233, 69, 96, 0.2); color: var(--danger); border: 1px solid var(--danger); }
.tr-session-end:hover { background: rgba(233, 69, 96, 0.3); }
.tr-session-info { font-size: 0.85rem; color: var(--text-muted); }

/* --- Schnellaktions-Leiste --- */
.tr-quick-actions {
  display: flex; gap: 6px; padding: 6px 0;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tr-quick-actions::-webkit-scrollbar { display: none; }

.tr-quick-btn {
  flex-shrink: 0; padding: 6px 12px; border: 1px solid var(--gold-dim);
  border-radius: 20px; background: var(--bg-card); color: var(--text);
  font-size: 0.8rem; cursor: pointer; white-space: nowrap;
  transition: all 0.2s; min-height: 36px;
}
.tr-quick-btn:hover { border-color: var(--tr-accent); background: rgba(230, 165, 60, 0.1); color: var(--tr-accent); }
.tr-quick-btn:active { transform: scale(0.95); }

/* --- Input-Hint --- */
.tr-input-hint {
  font-size: 0.8rem; color: var(--text-muted); padding: 2px 0; margin: 0;
}

/* --- Nachrichten-Styling nach Rolle --- */
.tr-msg-npc .message-content { border-left: 3px solid var(--tr-npc); padding-left: 12px; }
.tr-msg-chronicler .message-content { border-left: 3px solid var(--tr-chronicler); padding-left: 12px; opacity: 0.9; }
.tr-msg-assistant .message-content { border-left: 3px solid var(--tr-assistant); padding-left: 12px; }

.message-avatar {
  width: 36px; height: 36px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 1.2rem;
  flex-shrink: 0; background: var(--bg-card);
}
.tr-avatar-npc { background: rgba(76, 175, 80, 0.15); }
.tr-avatar-assistant { background: rgba(66, 165, 245, 0.15); }
.tr-avatar-chronicler { background: rgba(171, 71, 188, 0.15); }

.message-body { flex: 1; min-width: 0; }

.message-sender {
  display: block; font-size: 0.75rem; font-weight: 600; margin-bottom: 2px;
}
.tr-sender-npc { color: var(--tr-npc); }
.tr-sender-assistant { color: var(--tr-assistant); }
.tr-sender-chronicler { color: var(--tr-chronicler); }

.assistant-message {
  display: flex; gap: 10px; align-items: flex-start;
}

.system-message {
  text-align: center; padding: 4px 12px;
}
.system-message .message-content {
  display: inline-block; padding: 4px 12px; border-radius: 12px;
  background: rgba(255,255,255,0.05); font-size: 0.8rem; color: var(--text-muted);
}

/* --- Rollen-Auswahl im Erstellungs-Wizard --- */
.tr-role-select {
  display: flex; flex-direction: column; gap: 8px;
}

.tr-role-option {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border: 2px solid var(--bg-card);
  border-radius: var(--radius); cursor: pointer;
  transition: all 0.2s; background: var(--bg-card);
}
.tr-role-option:hover { border-color: var(--tr-accent); }
.tr-role-option:has(input:checked) { border-color: var(--tr-accent); background: rgba(230, 165, 60, 0.08); }

.tr-role-option input[type="checkbox"] { width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--tr-accent); }

.tr-role-option-content {
  display: flex; flex-direction: column; gap: 2px;
}
.tr-role-option-emoji { font-size: 1.5rem; }
.tr-role-option-content strong { color: var(--text); }
.tr-role-option-content .text-muted { font-size: 0.8rem; }

/* --- Wizard Progress Amber --- */
.tr-wizard-progress .wizard-step.active span:first-child { background: var(--tr-accent); }
.tr-wizard-progress .wizard-step.completed span:first-child { background: var(--tr-accent); }

/* --- Sessions im Übersicht-Modal --- */
.sessions-list { display: flex; flex-direction: column; gap: 16px; max-height: 60vh; overflow-y: auto; }

.session-item {
  padding: 12px; background: var(--bg-card); border-radius: var(--radius);
  border-left: 3px solid var(--tr-chronicler);
}
.session-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.session-summary { font-size: 0.9rem; line-height: 1.5; white-space: pre-wrap; }

/* --- AI Memory Block in Chat --- */
.ai-memory-block { margin-top: 8px; }
.ai-memory-block summary {
  cursor: pointer; font-size: 0.8rem; color: var(--text-muted);
  padding: 4px 0;
}
.ai-memory-content {
  padding: 8px 12px; margin-top: 4px; background: rgba(255,255,255,0.03);
  border-radius: var(--radius); font-size: 0.8rem; color: var(--text-muted);
  white-space: pre-wrap; max-height: 200px; overflow-y: auto;
}

/* --- Chat Settings Sidebar (Mobile) --- */
.chat-settings-toggle {
  display: none; border: none; background: transparent; color: var(--gold);
  font-size: 1.2rem; cursor: pointer; padding: 4px; min-height: 36px;
}
.chat-settings-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 1100;
  transition: opacity 0.25s ease; opacity: 0; pointer-events: none;
}
.chat-settings-overlay.open { opacity: 1; pointer-events: auto; }
.chat-settings-sidebar {
  display: none; position: fixed; top: 0; right: 0; z-index: 1101;
  width: 280px; max-width: 85vw; height: 100vh; height: 100dvh;
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  border-left: 2px solid var(--gold-dim); box-shadow: -4px 0 20px rgba(0,0,0,0.5);
  flex-direction: column;
  transform: translateX(100%); transition: transform 0.25s ease;
  overflow-y: auto;
}
.chat-settings-sidebar.open {
  display: flex; transform: translateX(0);
}
.chat-settings-sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; border-bottom: 1px solid var(--gold-dim); flex-shrink: 0;
}
.chat-settings-sidebar-body {
  display: flex; flex-direction: column; gap: 6px; padding: 16px;
  flex: 1; overflow-y: auto; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}
.chat-settings-sidebar .sidebar-close-btn {
  margin: 0;
}
.chat-settings-sidebar .btn { justify-content: flex-start; width: 100%; text-align: left; }

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
  .tr-role-tabs { padding: 0 8px; }
  .tr-tab { padding: 8px 14px; font-size: 0.85rem; }
  .tr-npc-bar { padding: 6px 8px; }
  .tr-npc-list { gap: 8px; }
  .tr-quick-actions { padding: 4px 0; }
  .tr-quick-btn { padding: 8px 14px; font-size: 0.78rem; min-height: 40px; }
  .tr-session-bar { padding: 6px 8px; flex-wrap: wrap; }
  .tr-input-hint { font-size: 0.75rem; }

  .tr-role-select { gap: 6px; }
  .tr-role-option { padding: 10px 12px; }

  .message-avatar { width: 30px; height: 30px; font-size: 1rem; }

  /* Chat header: collapse buttons into settings sidebar */
  .chat-page .header-right .btn-secondary:not(.chat-settings-toggle) { display: none; }
  .chat-page .header-right .mode-badge { display: none; }
  .chat-page .header-right .share-btn { display: none; }
  .chat-settings-toggle { display: inline-flex; align-items: center; }
  .chat-settings-sidebar { display: flex; }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   COIN SYSTEM (v2.3)
   ═══════════════════════════════════════════════════════════════════════════════ */

/* --- Header Coin Display --- */
.coin-header-link {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--gold); font-weight: bold; font-size: 0.85rem;
  text-decoration: none; padding: 4px 10px; border-radius: var(--radius);
  background: rgba(212,165,116,0.1); border: 1px solid rgba(212,165,116,0.25);
  transition: background 0.2s, border-color 0.2s;
}
.coin-header-link:hover { background: rgba(212,165,116,0.2); border-color: rgba(212,165,116,0.4); }

/* --- Coin Shop Page --- */
.coins-container { max-width: 900px; margin: 90px auto 40px; padding: 0 20px; }
.coin-balance-hero {
  text-align: center; padding: 32px 20px; margin-bottom: 24px;
  background: rgba(212,165,116,0.05); border: 1px solid rgba(212,165,116,0.15);
  border-radius: var(--radius);
}
.coin-balance-hero-icon { font-size: 3rem; margin-bottom: 8px; }
.coin-balance-hero-amount { font-size: 2rem; font-weight: bold; color: var(--gold); font-family: Georgia, serif; }
.coin-balance-hero-sub { color: var(--text-muted); font-size: 0.85rem; margin-top: 6px; }

.section-title { color: var(--gold); font-family: Georgia, serif; margin-bottom: 16px; }

/* --- Package Grid --- */
.coin-packages-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.coin-package {
  background: var(--card-bg); border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius); padding: 20px; text-align: center;
  transition: border-color 0.2s, transform 0.15s; position: relative;
}
.coin-package:hover { border-color: rgba(212,165,116,0.3); transform: translateY(-2px); }
.coin-package.featured { border-color: var(--gold); box-shadow: 0 0 20px rgba(212,165,116,0.15); }
.coin-package-badge {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--gold); color: #1a1a2e; font-size: 0.7rem; font-weight: bold;
  padding: 2px 12px; border-radius: 10px; white-space: nowrap;
}
.coin-package-name { font-weight: bold; color: var(--gold); font-size: 1.1rem; margin-bottom: 8px; }
.coin-package-coins { font-size: 1.5rem; margin-bottom: 4px; }
.coin-package-price { font-size: 1.2rem; font-weight: bold; color: var(--text-primary); margin-bottom: 4px; }
.coin-package-perunit { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 12px; }
.coin-package-buy { width: 100%; }

/* --- Price Table --- */
.coin-price-details { margin-bottom: 24px; }
.coin-price-summary {
  cursor: pointer; padding: 10px 16px; color: var(--gold); font-weight: bold;
  background: rgba(212,165,116,0.05); border: 1px solid rgba(212,165,116,0.15);
  border-radius: var(--radius); list-style: none;
}
.coin-price-summary::-webkit-details-marker { display: none; }
.coin-price-summary::before { content: '▸ '; }
.coin-price-details[open] .coin-price-summary::before { content: '▾ '; }
.coin-cost-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 0.85rem; }
.coin-cost-table th { text-align: left; color: var(--gold); padding: 6px 12px; border-bottom: 1px solid rgba(212,165,116,0.2); }
.coin-cost-table td { padding: 5px 12px; border-bottom: 1px solid rgba(255,255,255,0.04); }
.coin-cost-section td { color: var(--gold); font-weight: bold; padding-top: 12px; background: rgba(212,165,116,0.03); }

/* --- Donation Box --- */
.coin-donation-box {
  background: rgba(212,165,116,0.04); border: 1px solid rgba(212,165,116,0.12);
  border-radius: var(--radius); padding: 16px 20px; margin-bottom: 24px;
}
.coin-donation-box h3 { color: var(--gold); margin-bottom: 8px; font-size: 1rem; }
.coin-donation-box p { font-size: 0.85rem; color: var(--text-muted); margin: 4px 0; }
.donation-payment-methods { display: flex; gap: 8px; flex-wrap: wrap; }
.donation-payment-methods .btn { flex: 1; min-width: 160px; }

/* --- Tabs --- */
.coin-tabs { display: flex; gap: 0; margin-bottom: 16px; border-bottom: 1px solid rgba(212,165,116,0.15); }
.coin-tab {
  padding: 8px 16px; background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 0.9rem; border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.coin-tab:hover { color: var(--text-primary); }
.coin-tab.active { color: var(--gold); border-bottom-color: var(--gold); }

/* --- Orders Table --- */
.coin-orders-table, .coin-history-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.coin-orders-table th, .coin-history-table th { text-align: left; color: var(--gold); padding: 6px 8px; border-bottom: 1px solid rgba(212,165,116,0.2); }
.coin-orders-table td, .coin-history-table td { padding: 6px 8px; border-bottom: 1px solid rgba(255,255,255,0.04); }

/* --- Spending Summary --- */
.coin-summary-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 0.85rem; }
.coin-summary-total { display: flex; justify-content: space-between; padding: 6px 0; font-weight: bold; border-top: 1px solid rgba(212,165,116,0.15); margin-top: 6px; }
.coin-spent { color: var(--accent); }
.coin-earned { color: #4caf50; }
.coin-history-filter { margin-bottom: 12px; }
.coin-history-filter select { background: var(--card-bg); color: var(--text-primary); border: 1px solid rgba(255,255,255,0.1); border-radius: 4px; padding: 4px 8px; }
.coin-pagination { margin-top: 12px; display: flex; gap: 4px; flex-wrap: wrap; }

/* --- Purchase Modal --- */
.coin-purchase-modal { max-width: 480px; }
.coin-modal-price { font-size: 1.3rem; font-weight: bold; color: var(--gold); text-align: center; margin-bottom: 16px; }
.coin-payment-options { display: flex; gap: 8px; }
.coin-payment-options .btn { flex: 1; }
.coin-payment-options .btn.active { border-color: var(--gold); background: rgba(212,165,116,0.15); }
.coin-prepayment-form .form-group { margin-bottom: 10px; }
.coin-prepayment-form .form-row { display: flex; gap: 8px; }
.coin-prepayment-form .form-row .form-group { flex: 1; }
.coin-prepayment-form input { width: 100%; padding: 8px 10px; background: var(--bg-primary); color: var(--text-primary); border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius); font-size: 0.85rem; }
.coin-prepayment-form label { font-size: 0.8rem; color: var(--text-muted); display: block; margin-bottom: 3px; }
.coin-checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; margin: 8px 0; cursor: pointer; }
.coin-total { padding: 10px; background: rgba(212,165,116,0.05); border-radius: var(--radius); margin: 12px 0; text-align: center; }
.coin-info-box { padding: 16px; background: rgba(212,165,116,0.05); border-radius: var(--radius); text-align: center; }
.coin-success-box { padding: 16px; background: rgba(76,175,80,0.05); border: 1px solid rgba(76,175,80,0.15); border-radius: var(--radius); }
.coin-success-box h4 { color: #4caf50; margin-bottom: 8px; }

/* --- Insufficient Coins Popup --- */
.coin-popup-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 9999;
  background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center;
}
.coin-popup {
  background: var(--card-bg); border: 1px solid rgba(212,165,116,0.25);
  border-radius: var(--radius); padding: 32px; text-align: center; max-width: 380px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.coin-popup-icon { font-size: 3rem; margin-bottom: 12px; }
.coin-popup h3 { color: var(--accent); margin-bottom: 12px; }
.coin-popup p { font-size: 0.9rem; margin-bottom: 16px; }
.coin-popup-actions { display: flex; gap: 8px; justify-content: center; }

/* --- Chat Cost Indicator --- */
.chat-cost-indicator { font-size: 0.75rem; color: var(--text-muted); padding: 2px 8px; }
.chat-cost-indicator.insufficient { color: var(--accent); }
.nsfw-model-hint { font-size: 0.7rem; color: #e94560; padding: 2px 8px; white-space: nowrap; }

/* --- Upsell-Hinweis --- */
.upsell-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(212, 165, 116, 0.08);
  border: 1px solid rgba(212, 165, 116, 0.2);
  border-radius: 8px;
  font-size: 0.78rem;
  color: var(--gold);
  margin: 4px 0;
  animation: upsell-fadein 0.4s ease;
}
.upsell-hint.is-hidden { display: none; }
.upsell-hint-dismiss {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 0.9rem; padding: 2px 4px; margin-left: auto; opacity: 0.6;
}
.upsell-hint-dismiss:hover { opacity: 1; }
@keyframes upsell-fadein { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* --- Tägliche Truhe --- */
.daily-chest-btn { background: none; border: none; font-size: 1.3rem; cursor: pointer; padding: 4px 6px; border-radius: 50%; transition: all 0.3s; opacity: 0.5; filter: grayscale(1); }
.daily-chest-btn.chest-available { opacity: 1; filter: none; animation: chest-icon-glow 2s ease-in-out infinite; }
@keyframes chest-icon-glow { 0%, 100% { text-shadow: 0 0 4px rgba(212,165,116,0.3); } 50% { text-shadow: 0 0 12px rgba(212,165,116,0.8); } }

/* Prominente Truhen-Card auf dem Dashboard */
.daily-chest-card { display: flex; align-items: center; gap: 16px; padding: 16px 20px; margin-bottom: 20px; border-radius: var(--radius); background: var(--bg-card); border: 1px solid rgba(212,165,116,0.15); cursor: pointer; transition: all 0.3s; }
.daily-chest-card.available { border-color: var(--gold); animation: chest-card-glow 2.5s ease-in-out infinite; }
.daily-chest-card.claimed { opacity: 0.7; cursor: default; }
@keyframes chest-card-glow { 0%, 100% { box-shadow: 0 0 8px rgba(212,165,116,0.2); } 50% { box-shadow: 0 0 20px rgba(212,165,116,0.5); } }
.chest-card-icon { font-size: 2rem; flex-shrink: 0; }
.chest-card-content { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.chest-card-content strong { color: var(--gold); font-size: 0.95rem; }
.chest-card-content span { font-size: 0.8rem; color: var(--text-muted); }
.chest-card-streak { color: var(--gold) !important; font-weight: 600; }

/* --- Promo/Launch Banner --- */
.explicit-promo-banner { background: linear-gradient(135deg, #16213e, #1a1a2e); border-bottom: 1px solid rgba(233,69,96,0.3); color: var(--text); padding: 12px 24px; text-align: center; font-size: 0.85rem; display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; }
.promo-dismiss { background: none; border: 1px solid var(--text-muted); color: var(--text-muted); padding: 4px 12px; border-radius: 4px; cursor: pointer; font-size: 0.8rem; white-space: nowrap; }
.referral-info-banner { background: var(--bg-card); border: 1px solid rgba(212,165,116,0.2); border-radius: var(--radius); color: var(--text); padding: 12px 16px; margin-bottom: 16px; font-size: 0.85rem; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.launch-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; background: linear-gradient(135deg, #16213e, #1a1a2e); border-bottom: 2px solid var(--gold); color: var(--text); padding: 1rem 2rem; text-align: center; transform: translateY(-100%); transition: transform 0.5s ease-out; font-size: 0.95rem; }
.launch-banner.visible { transform: translateY(0); }
.launch-banner .banner-close { position: absolute; top: 0.5rem; right: 1rem; background: none; border: none; color: var(--text); font-size: 1.2rem; cursor: pointer; }
.launch-banner a { color: var(--gold); text-decoration: underline; }

/* --- Creation Cost Badge --- */
.create-cost-badge { font-size: 0.75rem; color: var(--gold); margin-left: 6px; }
.create-cost-badge.free { color: #4caf50; }

/* --- Role-based visibility --- */
body[data-role="user"] .thinking-block,
body[data-role="user"] .debug-prompt-block { display: none !important; }
body[data-role="user"] .ai-memory-block { display: none !important; }

/* Image model selector in portrait modals */
.image-model-selector { margin: 10px 0; display: flex; gap: 8px; align-items: center; }
.image-model-selector label { font-size: 0.85rem; color: var(--text-muted); }
.image-model-selector select { background: var(--bg-primary); color: var(--text-primary); border: 1px solid rgba(255,255,255,0.1); border-radius: 4px; padding: 4px 8px; font-size: 0.85rem; }
.image-model-cost { font-size: 0.75rem; color: var(--gold); margin-left: 6px; }

@media (max-width: 768px) {
  .coin-packages-grid { grid-template-columns: repeat(2, 1fr); }
  .coin-header-link { font-size: 0.75rem; padding: 3px 6px; }
  .coin-orders-table, .coin-history-table { font-size: 0.7rem; }
  .coin-payment-options { flex-direction: column; }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SHOP — PayPal Coin-Shop
   ═══════════════════════════════════════════════════════════════════════════════ */

.shop-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* Sandbox-Banner */
.shop-sandbox-banner {
  background: rgba(212, 165, 116, 0.15);
  border-bottom: 2px solid var(--gold);
  color: var(--gold);
  text-align: center;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
}

/* Pakete-Grid */
.shop-packages-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

/* Einzelne Paketkarte */
.shop-package-card {
  background: #16213e;
  border: 1px solid rgba(212, 165, 116, 0.2);
  border-radius: 12px;
  padding: 24px 16px 16px;
  text-align: center;
  position: relative;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.shop-package-card:hover {
  transform: translateY(-4px);
  border-color: var(--gold);
  box-shadow: 0 8px 32px rgba(212, 165, 116, 0.15);
}
.shop-package-card.highlighted {
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(212, 165, 116, 0.1);
}
.shop-package-card.best-deal {
  border-color: rgba(233, 69, 96, 0.5);
}
.shop-package-card.best-deal:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 32px rgba(233, 69, 96, 0.2);
}

/* Welcome-Paket */
.shop-package-card.welcome-package {
  border-color: rgba(212, 165, 116, 0.5);
  box-shadow: 0 0 20px rgba(212, 165, 116, 0.1);
  background: linear-gradient(135deg, #16213e 0%, #1a2744 100%);
}
.shop-package-card.welcome-pulse {
  animation: welcome-glow 2s ease-in-out 3;
}
@keyframes welcome-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(212, 165, 116, 0.1); }
  50% { box-shadow: 0 0 30px rgba(212, 165, 116, 0.3); }
}
.welcome-badge {
  background: linear-gradient(135deg, #d4a574, #c49560) !important;
  color: #0d0d1a !important;
}
.shop-welcome-hint {
  font-size: 0.7rem; color: #888; margin-top: 4px;
}

/* Web-Bonus */
.shop-bonus-info {
  font-size: 0.75rem; color: #888; margin-top: 2px;
}
.shop-bonus-highlight {
  color: #4caf50; font-weight: 600;
}

/* Badge */
.shop-package-badge {
  position: absolute;
  top: -10px;
  right: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Paketname */
.shop-package-name {
  font-family: Georgia, serif;
  font-size: 1.1rem;
  color: var(--gold);
  margin-bottom: 12px;
  font-weight: 600;
}

/* Coin-Anzahl */
.shop-package-coins {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
}
.shop-package-coins-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Preis */
.shop-package-price {
  font-size: 1.5rem;
  font-weight: 700;
  color: #eee;
  margin-bottom: 4px;
}
.shop-package-per-coin {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* PayPal Button Container */
.shop-paypal-button-container {
  min-height: 45px;
}

/* PayPal-Lade-Fehler */
.shop-paypal-error {
  background: rgba(233, 69, 96, 0.1);
  border: 1px solid rgba(233, 69, 96, 0.3);
  border-radius: 8px;
  padding: 16px;
  color: var(--accent);
  text-align: center;
  margin-bottom: 24px;
  font-size: 0.9rem;
}
.shop-paypal-error a { color: var(--gold); }

/* Kaufhistorie */
.shop-history-details {
  margin-bottom: 24px;
}
.shop-history-summary {
  cursor: pointer;
  color: var(--gold);
  font-size: 1rem;
  font-weight: 600;
  padding: 12px 0;
  user-select: none;
}
.shop-history-summary:hover { color: #eee; }
.shop-history-content {
  padding: 12px 0;
}
.shop-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.shop-history-table th {
  text-align: left;
  padding: 8px 12px;
  color: var(--gold);
  border-bottom: 1px solid rgba(212, 165, 116, 0.3);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.shop-history-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #eee;
}

/* Status-Badge */
.shop-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
}

/* Rechtliche Hinweise */
.shop-legal {
  margin-top: 32px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.shop-legal a { color: var(--gold); }
.shop-legal p { margin: 4px 0; }

/* Verarbeitungs-Overlay */
.shop-purchase-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.shop-purchase-overlay-content {
  text-align: center;
  color: #eee;
  font-size: 1.1rem;
}
.shop-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(212, 165, 116, 0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: shop-spin 0.8s linear infinite;
  margin: 0 auto 16px;
}
@keyframes shop-spin {
  to { transform: rotate(360deg); }
}

/* Toast-Nachrichten */
.shop-toast-container {
  position: fixed;
  top: 80px;
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.shop-toast {
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  color: #fff;
  max-width: 400px;
  opacity: 0;
  transform: translateX(100%);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: auto;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.shop-toast.show {
  opacity: 1;
  transform: translateX(0);
}
.shop-toast-success { background: rgba(76, 175, 80, 0.9); }
.shop-toast-error { background: rgba(233, 69, 96, 0.9); }
.shop-toast-info { background: rgba(22, 33, 62, 0.95); border: 1px solid var(--gold); }

/* ─── Coin-Slider ──────────────────────────────────────────────────────────── */

.slider-first-purchase {
  background: linear-gradient(135deg, rgba(212, 165, 116, 0.15), rgba(212, 165, 116, 0.05));
  border: 1px solid rgba(212, 165, 116, 0.4);
  border-radius: 12px;
  padding: 12px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--gold);
  animation: welcome-glow 2s ease-in-out infinite;
}
.slider-first-icon { font-size: 1.5rem; }

.slider-shop-container {
  background: #16213e;
  border: 1px solid rgba(212, 165, 116, 0.2);
  border-radius: 16px;
  padding: 32px 28px;
  margin-bottom: 24px;
}

.slider-coins-display {
  text-align: center;
  margin-bottom: 24px;
}
.slider-coins-value {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
}
.slider-coins-label {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-left: 8px;
}

.slider-track-wrapper {
  position: relative;
  margin-bottom: 16px;
  padding: 0 4px;
}

.coin-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, #1a1a2e, var(--gold));
  outline: none;
  cursor: pointer;
}
.coin-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gold);
  cursor: grab;
  border: 3px solid #0d0d1a;
  box-shadow: 0 2px 8px rgba(212, 165, 116, 0.4);
  transition: transform 0.15s ease;
}
.coin-slider::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.15); }
.coin-slider::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gold);
  cursor: grab;
  border: 3px solid #0d0d1a;
  box-shadow: 0 2px 8px rgba(212, 165, 116, 0.4);
}

.slider-snap-marks {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  padding: 0 2px;
  pointer-events: none;
}
.slider-snap-mark {
  font-size: 0.65rem;
  color: var(--text-muted);
  opacity: 0.5;
}

.slider-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.slider-input {
  width: 100px;
  padding: 6px 10px;
  background: #0d0d1a;
  border: 1px solid rgba(212, 165, 116, 0.3);
  border-radius: 8px;
  color: var(--gold);
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
}

.slider-price-display {
  text-align: center;
  margin-bottom: 20px;
  padding: 16px;
  background: rgba(13, 13, 26, 0.5);
  border-radius: 12px;
}
.slider-total-coins {
  font-size: 1rem;
  color: #eee;
  margin-bottom: 8px;
}
.slider-bonus-info { color: #4caf50; font-weight: 600; }
.slider-price-main {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--gold);
}
.slider-price-discount {
  font-size: 0.9rem;
  color: #4caf50;
  margin-left: 8px;
}
.slider-price-per-coin {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Schwellen-Belohnungen */
.slider-rewards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}
.slider-reward {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(13, 13, 26, 0.4);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  opacity: 0.35;
  filter: grayscale(1);
  transition: opacity 0.3s ease, filter 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.slider-reward.active {
  opacity: 1;
  filter: grayscale(0);
  border-color: rgba(212, 165, 116, 0.3);
  box-shadow: 0 0 12px rgba(212, 165, 116, 0.08);
}
.slider-reward-icon { font-size: 1.3rem; flex-shrink: 0; }
.slider-reward-text { font-size: 0.85rem; color: #ccc; }
.slider-reward.active .slider-reward-text { color: #eee; }

.slider-buy-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.slider-buy-btn { padding: 14px !important; font-size: 1rem !important; }

/* Pending Coins Banner */
.pending-coins-banner {
  background: rgba(212, 165, 116, 0.1);
  border: 1px solid rgba(212, 165, 116, 0.3);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--gold);
  font-size: 0.9rem;
}
.pending-coins-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(212, 165, 116, 0.3);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Shop Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .shop-packages-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .shop-packages-grid { grid-template-columns: 1fr; }
  .shop-package-card { padding: 20px 12px 12px; }
  .shop-package-coins { font-size: 2rem; }
  .shop-package-price { font-size: 1.2rem; }
  .shop-history-table { font-size: 0.75rem; }
  .shop-history-table th, .shop-history-table td { padding: 6px 8px; }
  .shop-toast { max-width: calc(100vw - 32px); }
  .slider-shop-container { padding: 20px 16px; }
  .slider-coins-value { font-size: 2.5rem; }
  .slider-price-main { font-size: 1.8rem; }
  .slider-input-row { flex-wrap: wrap; }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   PAYMENT METHODS — Kauf-Modal Zahlungsauswahl
   ═══════════════════════════════════════════════════════════════════════════════ */

.payment-methods { margin-top: 16px; }

.payment-section { margin: 8px 0; }

.payment-btn {
  width: 100%;
  padding: 12px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.stripe-btn {
  background: linear-gradient(135deg, #635BFF 0%, #7B73FF 100%);
  color: #fff;
  border: none;
  box-shadow: 0 2px 8px rgba(99, 91, 255, 0.3);
}
.stripe-btn:hover { box-shadow: 0 4px 16px rgba(99, 91, 255, 0.5); transform: translateY(-1px); }
.stripe-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.payment-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 4px;
}

.payment-divider {
  display: flex;
  align-items: center;
  margin: 12px 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.payment-divider::before, .payment-divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.payment-divider span { margin: 0 12px; }

.paypal-modal-container { min-height: 45px; }

/* Admin-Test Paket */
.admin-package { border-style: dashed !important; border-color: rgba(99, 91, 255, 0.4) !important; }
.admin-package:hover { border-color: #635BFF !important; }

/* === Cookie-Banner === */
#cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid rgba(212, 165, 116, 0.3);
  padding: 16px 24px;
  z-index: 9999;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
}
.cookie-banner-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.cookie-banner-inner p {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text);
  margin: 0;
  min-width: 200px;
}
.cookie-banner-inner a { color: var(--gold); }
.cookie-banner-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
@media (max-width: 600px) {
  .cookie-banner-inner { flex-direction: column; text-align: center; }
  .cookie-banner-actions { width: 100%; justify-content: center; }
}

/* Login-Cookie-Hinweis */
.login-cookie-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
}
.login-cookie-hint a { color: var(--gold); }

/* ===== RP NACHRICHTENFORMATIERUNG ===== */

/* Überschriften — Gold, Georgia, prominent */
.rp-heading {
    font-family: Georgia, 'Times New Roman', serif;
    color: #d4a574;
    font-size: 1.3em;
    font-weight: bold;
    margin: 1.2em 0 0.5em 0;
    padding-bottom: 0.3em;
    border-bottom: 1px solid rgba(212, 165, 116, 0.3);
    text-shadow: 0 0 8px rgba(212, 165, 116, 0.15);
}

/* Erste Überschrift in einer Nachricht — kein margin-top */
.ai-content .rp-heading:first-child,
.message-content .rp-heading:first-child {
    margin-top: 0;
}

/* Wörtliche Rede — Container */
.rp-speech {
    margin: 0.6em 0;
    padding: 0.5em 0.8em;
    border-left: 3px solid #e94560;
    background: rgba(233, 69, 96, 0.06);
    border-radius: 0 4px 4px 0;
}

/* Sprechername */
.rp-speaker {
    color: #e94560;
    font-weight: bold;
    margin-right: 0.3em;
}

/* Gesprochener Text — kursiv */
.rp-speech-text {
    font-style: italic;
    color: #f0e0e0;
}

/* Würfelergebnisse — Box mit Monospace */
.rp-dice {
    margin: 0.6em 0;
    padding: 0.6em 0.8em;
    background: rgba(212, 165, 116, 0.1);
    border: 1px solid rgba(212, 165, 116, 0.3);
    border-radius: 6px;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    color: #d4a574;
    font-size: 0.95em;
    letter-spacing: 0.02em;
}

/* Wissen/Lore — dezenter Info-Kasten */
.rp-lore {
    margin: 0.6em 0;
    padding: 0.5em 0.8em;
    border-left: 3px solid rgba(100, 140, 180, 0.6);
    background: rgba(100, 140, 180, 0.06);
    border-radius: 0 4px 4px 0;
    color: #b0c4de;
    font-size: 0.92em;
    font-style: italic;
}

/* Normaler Erzähltext */
.rp-narration {
    margin: 0.5em 0;
    line-height: 1.7;
    color: #eee;
}

/* Erzähltext — erster Absatz kein Margin oben */
.ai-content .rp-narration:first-child,
.message-content .rp-narration:first-child {
    margin-top: 0;
}

/* ─── v0.5.2: Kategorie-Akkordeon für Völker/Klassen ──────────────────────── */
.category-accordion { margin-bottom: 1rem; }

.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(22, 33, 62, 0.6);
  border: 1px solid rgba(212, 165, 116, 0.2);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
}

.category-header:hover {
  background: rgba(22, 33, 62, 0.9);
  border-color: rgba(212, 165, 116, 0.4);
}

.category-header .category-title {
  font-family: Georgia, serif;
  font-size: 1.1rem;
  color: #d4a574;
}

.category-header .category-count {
  font-size: 0.85rem;
  color: #aaa;
  margin-left: 8px;
}

.category-header .category-arrow {
  color: #d4a574;
  transition: transform 0.3s ease;
  font-size: 1.2rem;
}

.category-header.open .category-arrow {
  transform: rotate(90deg);
}

.category-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.category-content.open {
  max-height: none;
  overflow: visible;
  padding-top: 12px;
}

/* ─── "Neu"-Badge auf Karten ───────────────────────────────────────────────── */
.campaign-card.world-element-card { position: relative; }

.new-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #e94560;
  color: white;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 2;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* ─── v0.5.3: Info-Icons & Popovers ────────────────────────────────────────── */
.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 0.7rem;
  font-style: normal;
  background: rgba(212, 165, 116, 0.2);
  color: #d4a574;
  border-radius: 50%;
  cursor: pointer;
  margin-left: 6px;
  vertical-align: middle;
  transition: background 0.2s ease;
  user-select: none;
  position: relative;
}

.info-icon:hover {
  background: rgba(212, 165, 116, 0.4);
}

.info-popover {
  display: none;
  position: fixed;
  z-index: 9999;
  background: #16213e;
  border: 1px solid rgba(212, 165, 116, 0.3);
  border-radius: 8px;
  padding: 12px 16px;
  max-width: 350px;
  width: max-content;
  font-size: 0.85rem;
  color: #ddd;
  line-height: 1.5;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}

.info-popover.visible {
  display: block;
}

.info-popover strong {
  color: #d4a574;
}

.info-popover p {
  margin: 6px 0;
}

.info-popover em {
  color: #d4a574;
  font-style: italic;
}

@media (max-width: 600px) {
  .info-popover {
    max-width: 100%;
    left: 0;
    right: 0;
  }
}

/* ─── Bogentyp-Hilfstext ──────────────────────────────────────────────────── */
.sheet-type-hint {
  font-size: 0.85rem;
  color: #aaa;
  margin-top: 4px;
  font-style: italic;
  transition: opacity 0.3s ease;
}

.sheet-type-locked-hint {
  font-size: 0.75rem;
  color: #888;
  margin-top: 4px;
}

/* ─── Bogentyp-Badge in Übersicht ──────────────────────────────────────────── */
.sheet-type-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 4px;
  font-weight: 500;
}

.sheet-type-badge.type-simple,
.sheet-type-badge.type-free {
  background: rgba(212, 165, 116, 0.2);
  color: #d4a574;
}

.sheet-type-badge.type-pnp {
  background: rgba(233, 69, 96, 0.2);
  color: #e94560;
}

/* ─── v0.5.4: Beispielcharaktere ───────────────────────────────────────────── */
.campaign-card.character-card { position: relative; }

.example-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(212, 165, 116, 0.25);
  color: #d4a574;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 2;
  border: 1px solid rgba(212, 165, 116, 0.3);
}

.char-section-divider {
  grid-column: 1 / -1;
  text-align: center;
  padding: 16px 0 8px;
  color: #888;
  font-size: 0.85rem;
  position: relative;
}

.char-section-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(212, 165, 116, 0.2);
}

.char-section-divider span {
  background: var(--bg-primary, #0a0a1a);
  padding: 0 16px;
  position: relative;
  z-index: 1;
}

.system-char-banner {
  background: rgba(212, 165, 116, 0.1);
  border: 1px solid rgba(212, 165, 116, 0.3);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 20px;
  color: #d4a574;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* ─── v0.5.5: Spielmodus-Karten ────────────────────────────────────────────── */
.gamemode-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

@media (max-width: 600px) {
  .gamemode-selector { grid-template-columns: 1fr; }
}

.gamemode-option {
  padding: 16px;
  border: 2px solid rgba(212, 165, 116, 0.2);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: rgba(22, 33, 62, 0.4);
  position: relative;
}

.gamemode-option:hover:not(.disabled) {
  border-color: rgba(212, 165, 116, 0.5);
  background: rgba(22, 33, 62, 0.7);
}

.gamemode-option.selected {
  border-color: #d4a574;
  background: rgba(22, 33, 62, 0.8);
}

.gamemode-option.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.gamemode-title {
  font-family: Georgia, serif;
  color: #d4a574;
  font-size: 1rem;
  margin-bottom: 4px;
}

.gamemode-desc {
  font-size: 0.85rem;
  color: #aaa;
}

.coming-soon-badge {
  display: inline-block;
  background: rgba(233, 69, 96, 0.2);
  color: #e94560;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 8px;
  text-transform: uppercase;
}

/* ─── v0.5.5: Import-Sektion im Chat ──────────────────────────────────────── */
.import-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(212, 165, 116, 0.15);
}

.import-section h3 {
  font-family: Georgia, serif;
  color: #d4a574;
  font-size: 1rem;
  margin-bottom: 12px;
}

.import-btn {
  display: inline-block;
  padding: 6px 12px;
  font-size: 0.8rem;
  background: rgba(22, 33, 62, 0.6);
  border: 1px solid rgba(212, 165, 116, 0.2);
  color: #ccc;
  border-radius: 6px;
  cursor: pointer;
  margin: 4px;
  transition: all 0.2s ease;
}

.import-btn:hover {
  background: rgba(22, 33, 62, 0.9);
  border-color: rgba(212, 165, 116, 0.4);
  color: #d4a574;
}

.assigned-element {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(22, 33, 62, 0.3);
  border-radius: 6px;
  margin: 4px 0;
  font-size: 0.85rem;
}

.assigned-element .remove-btn {
  color: #e94560;
  cursor: pointer;
  font-size: 1rem;
  padding: 0 4px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.assigned-element .remove-btn:hover {
  opacity: 1;
}

/* ─── v0.5.6: Story-Struktur Preisbox ─────────────────────────────────────── */
.structured-price-box {
  background: rgba(22, 33, 62, 0.6);
  border: 2px solid rgba(212, 165, 116, 0.3);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  margin: 20px 0;
}

.price-label { font-size: 0.85rem; color: #aaa; margin-bottom: 4px; }
.price-value { font-family: Georgia, serif; font-size: 2.5rem; color: #d4a574; font-weight: bold; }
.price-unit { font-size: 1rem; color: #d4a574; margin-bottom: 8px; }
.price-detail { font-size: 0.8rem; color: #888; margin-bottom: 12px; }
.price-info { font-size: 0.8rem; color: #aaa; line-height: 1.4; max-width: 400px; margin: 0 auto; }

/* ─── Planning Overlay ─────────────────────────────────────────────────────── */
.planning-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(13, 13, 26, 0.95);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.planning-content { text-align: center; max-width: 500px; padding: 40px; }
.planning-content h2 { font-family: Georgia, serif; color: #d4a574; margin-bottom: 12px; }
.planning-spinner {
  width: 60px; height: 60px;
  border: 3px solid rgba(212, 165, 116, 0.2); border-top-color: #d4a574;
  border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 24px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.planning-step {
  display: flex; align-items: center; gap: 8px; padding: 8px 0;
  color: #555; font-size: 0.9rem; transition: color 0.3s;
}
.planning-step.active { color: #d4a574; }
.planning-step.done { color: #4caf50; }

/* ─── Story-Fortschrittsleiste im Chat ─────────────────────────────────────── */
.story-progress-bar {
  padding: 8px 16px;
  background: rgba(22, 33, 62, 0.6);
  border-bottom: 1px solid rgba(212, 165, 116, 0.15);
}
.progress-text {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.8rem; color: #aaa; margin-bottom: 6px; flex-wrap: wrap;
}
.progress-act { color: #d4a574; }
.progress-chapter { color: #ccc; }
.progress-divider { color: #555; }
.progress-track {
  height: 4px; background: rgba(212, 165, 116, 0.15);
  border-radius: 2px; overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #d4a574, #e94560);
  border-radius: 2px; transition: width 0.5s ease;
}

/* ─── Kapitelwechsel-Banner ────────────────────────────────────────────────── */
.chapter-divider {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 0; margin: 12px 0;
}
.chapter-divider-line {
  flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 165, 116, 0.4), transparent);
}
.chapter-divider-content { text-align: center; white-space: nowrap; }
.chapter-divider-label {
  font-size: 0.65rem; text-transform: uppercase; letter-spacing: 2px;
  color: #d4a574; margin-bottom: 4px;
}
.chapter-divider-title { font-family: Georgia, serif; font-size: 1.1rem; color: #d4a574; }
.chapter-divider-subtitle { font-size: 0.85rem; color: #ccc; margin-top: 2px; }

/* ─── Story-Complete Overlay ───────────────────────────────────────────────── */
.story-complete-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(13, 13, 26, 0.9);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.story-complete-content {
  text-align: center; max-width: 500px; padding: 40px;
  background: rgba(22, 33, 62, 0.8);
  border: 2px solid rgba(212, 165, 116, 0.3); border-radius: 16px;
}
.story-complete-icon { font-size: 4rem; margin-bottom: 16px; }
.story-complete-content h2 { font-family: Georgia, serif; color: #d4a574; margin-bottom: 8px; }
.story-complete-stats { color: #888; font-size: 0.85rem; margin: 12px 0; }
.story-complete-actions { display: flex; flex-direction: column; gap: 8px; margin: 20px 0; }
.story-complete-hint { font-size: 0.8rem; color: #777; margin-top: 12px; }

/* Planning Badge im Dashboard */
.planning-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(212, 165, 116, 0.2);
  color: #d4a574;
  animation: pulse-planning 2s ease-in-out infinite;
}

@keyframes pulse-planning {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ============================================================
   SPRACHUMSCHALTER
   ============================================================ */
.lang-switch {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 0.85rem;
  margin-left: 12px;
  background: none;
  border: 1px solid var(--text-muted);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.2s, border-color 0.2s;
}

.lang-switch:hover {
  color: var(--gold);
  border-color: var(--gold);
}

.lang-switch-flag {
  font-size: 1.1rem;
}

.lang-switch-label {
  font-size: 0.8rem;
}

/* ============================================================
   ONBOARDING TOUR — Overlay, Spotlight, Tooltips
   ============================================================ */
.onboarding-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 99998;
  transition: opacity 0.3s ease;
}
.onboarding-spotlight {
  position: relative;
  z-index: 99999 !important;
  box-shadow: 0 0 0 4px rgba(212, 165, 116, 0.4), 0 0 20px rgba(212, 165, 116, 0.2);
  border-radius: 8px;
}
.onboarding-tooltip {
  position: absolute;
  z-index: 100000;
  max-width: 340px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border: 1px solid rgba(212, 165, 116, 0.4);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(212, 165, 116, 0.1);
  animation: onboarding-fadein 0.3s ease;
}
.onboarding-tooltip--center {
  position: fixed;
  max-width: 400px;
}
@keyframes onboarding-fadein {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.onboarding-tooltip-title {
  font-family: Georgia, serif;
  font-size: 1.1rem;
  color: #d4a574;
  margin-bottom: 8px;
  font-weight: 700;
}
.onboarding-tooltip-text {
  font-size: 0.9rem;
  color: #ccc;
  line-height: 1.6;
  margin-bottom: 16px;
}
.onboarding-tooltip-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.onboarding-progress {
  font-size: 0.7rem;
  color: #666;
  white-space: nowrap;
}
.onboarding-tooltip-actions {
  display: flex; gap: 10px; align-items: center;
}
.onboarding-skip {
  background: none; border: none;
  color: #888; font-size: 0.75rem;
  cursor: pointer; text-decoration: underline;
  padding: 4px;
}
.onboarding-skip:hover { color: #ccc; }
.onboarding-next {
  white-space: nowrap;
}

@media (max-width: 480px) {
  .onboarding-tooltip { max-width: 280px; padding: 16px; }
  .onboarding-tooltip--center { max-width: 300px; }
}

/* TAFELRUNDE — reaktiviert in v0.8.9 */

/* ============================================================
   PWA-MODUS — Bottom-Navigation, Header, Layout-Anpassungen
   Alle Regeln über .pwa-mode auf <html> gesteuert.
   Browser-Modus bleibt unverändert.
   ============================================================ */

/* Safe Area für iPhones mit Notch/Dynamic Island */
.pwa-mode {
  padding-top: env(safe-area-inset-top, 0);
}

/* --- Bottom-Navigation --- */
.pwa-bottom-nav {
  display: none;
}

.pwa-mode .pwa-bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(60px + env(safe-area-inset-bottom, 0));
  background: linear-gradient(180deg, #16213e 0%, #0d0d1a 100%);
  border-top: 1px solid rgba(233, 69, 96, 0.3);
  z-index: 10000;
  justify-content: space-around;
  align-items: flex-start;
  padding-top: 6px;
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.5);
}

.pwa-bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #888;
  font-size: 0.65rem;
  padding: 4px 12px;
  transition: color 0.2s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  gap: 2px;
}

.pwa-bottom-nav-item.active {
  color: #e94560;
}

.pwa-bottom-nav-item:active {
  transform: scale(0.9);
}

.pwa-bottom-nav-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.pwa-bottom-nav-label {
  font-family: 'Segoe UI', sans-serif;
  font-weight: 500;
}

/* --- Welten-Untermenü (Popup über Bottom-Nav) --- */
.pwa-world-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 10001;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: calc(70px + env(safe-area-inset-bottom, 0));
}

.pwa-world-menu {
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
  border: 1px solid rgba(233, 69, 96, 0.3);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 400px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 16px 0 8px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
}

.pwa-world-menu-item {
  display: block;
  padding: 12px 20px;
  color: #eee;
  text-decoration: none;
  font-size: 0.95rem;
  transition: background 0.15s;
}

.pwa-world-menu-item:active {
  background: rgba(233, 69, 96, 0.15);
}

.pwa-world-menu-divider {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 4px 16px;
}

/* --- Header: Kompakte PWA-Variante --- */
.pwa-mode .main-nav,
.pwa-mode .nav-burger,
.pwa-mode .mobile-nav,
.pwa-mode .nav-dropdown,
.pwa-mode .version-badge,
.pwa-mode #logout-btn,
.pwa-mode #mobile-logout-btn {
  display: none !important;
}

.pwa-mode .app-header {
  padding: 6px 12px;
  min-height: unset;
}

.pwa-mode .header-logo-img {
  height: 28px;
}

.pwa-mode .header-logo span {
  font-size: 1rem;
}

/* --- Footer/Legal ausblenden (NICHT die Chat-Eingabe!) --- */
.pwa-mode footer:not(.chat-input-area),
.pwa-mode .footer,
.pwa-mode .legal-links,
.pwa-mode .footer-legal {
  display: none !important;
}

/* --- Profilseite: Legal-Links + Logout (nur PWA) --- */
.pwa-legal-section {
  display: none;
}

.pwa-mode .pwa-legal-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.pwa-legal-section h3 {
  color: #d4a574;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.pwa-legal-section a {
  color: #aaa;
  text-decoration: none;
  font-size: 0.85rem;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.pwa-legal-section a:hover {
  color: #e94560;
}

.pwa-logout-section {
  display: none;
}

.pwa-mode .pwa-logout-section {
  display: block;
  margin-top: 20px;
}

.pwa-logout-btn {
  width: 100%;
  padding: 14px;
  background: transparent;
  border: 1px solid #e94560;
  color: #e94560;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Segoe UI', sans-serif;
}

.pwa-logout-btn:hover {
  background: rgba(233, 69, 96, 0.1);
}

/* --- Dashboard: Quick-Links (nur PWA) --- */
.pwa-quick-links {
  display: none;
}

.pwa-mode .pwa-quick-links {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding: 4px 0;
}

.pwa-quick-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(22, 33, 62, 0.8);
  border: 1px solid rgba(233, 69, 96, 0.2);
  border-radius: 20px;
  color: #eee;
  text-decoration: none;
  font-size: 0.8rem;
  white-space: nowrap;
  transition: all 0.2s;
}

.pwa-quick-link:active {
  background: rgba(233, 69, 96, 0.15);
  transform: scale(0.95);
}

/* --- Chat: PWA-Optimierung --- */
.pwa-mode .chat-page .page-content {
  padding-bottom: calc(60px + env(safe-area-inset-bottom, 0));
}
.pwa-mode .chat-page {
  bottom: calc(60px + env(safe-area-inset-bottom, 0));
}
.pwa-mode .chat-input-area {
  padding-bottom: 10px;
}

/* --- Story-Fortschrittsleiste sticky (beide Modi) --- */
.story-progress-sticky {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(180deg, #1a1a2e 0%, rgba(26, 26, 46, 0.95) 100%);
  border-bottom: 1px solid rgba(233, 69, 96, 0.25);
  padding: 8px 16px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.story-progress-sticky.collapsed {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
  position: absolute;
}

.story-progress-show-btn {
  display: none;
  text-align: center;
  padding: 4px;
  font-size: 0.7rem;
  color: #888;
  cursor: pointer;
  background: rgba(26, 26, 46, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.story-progress-sticky.collapsed ~ .story-progress-show-btn {
  display: block;
}

.pwa-mode .story-progress-sticky {
  font-size: 0.8rem;
  padding: 6px 12px;
}

/* --- Szene-in-Bild Button & Loading --- */
.scene-image-btn {
  white-space: nowrap;
  font-size: 0.78rem !important;
  padding: 4px 12px !important;
}

.scene-loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(212, 165, 116, 0.2);
  border-top: 3px solid var(--gold);
  border-radius: 50%;
  margin: 0 auto;
  animation: scene-spin 1s linear infinite;
}

@keyframes scene-spin {
  to { transform: rotate(360deg); }
}

/* Szenen-Bild im Chat */
.scene-image-message, .rp-scene-image {
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(212, 165, 116, 0.3);
  cursor: pointer;
  transition: border-color 0.3s;
}

.scene-image-message:hover {
  border-color: var(--gold);
}

.scene-image-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.8rem;
}

.scene-image-actions a {
  color: var(--gold-dim);
  text-decoration: none;
}

.scene-image-actions a:hover {
  color: var(--gold);
}

/* --- Offline-Banner --- */
#pwa-offline-banner {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #e94560;
  color: white;
  text-align: center;
  padding: 8px;
  font-size: 0.85rem;
  z-index: 99999;
  font-family: 'Segoe UI', sans-serif;
}

/* === NACHRICHTEN-FLAT === */
.flat-section {
  margin: 2rem 0; padding: 2rem; border: 2px solid var(--gold, #d4a574);
  border-radius: 16px; background: linear-gradient(135deg, rgba(26,26,46,0.9), rgba(22,33,62,0.9));
  position: relative; overflow: hidden;
}
.flat-section::before {
  content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(233,69,96,0.05) 0%, transparent 70%);
  animation: flat-glow 8s ease-in-out infinite; pointer-events: none;
}
@keyframes flat-glow { 0%,100%{transform:translate(0,0)}50%{transform:translate(5%,5%)} }
.flat-header { text-align: center; margin-bottom: 1.5rem; }
.flat-header h2 { font-family: Georgia,serif; color: var(--gold,#d4a574); font-size: 1.8rem; margin: 0.5rem 0; }
.flat-subtitle { color: #ccc; font-size: 1.1rem; }
.new-badge { display:inline-block; background:var(--accent,#e94560); color:white; padding:4px 16px; border-radius:20px; font-size:0.8rem; font-weight:bold; text-transform:uppercase; letter-spacing:1px; }
.new-badge.pulse { animation: badge-pulse 2s ease-in-out infinite; }
@keyframes badge-pulse { 0%,100%{box-shadow:0 0 0 0 rgba(233,69,96,0.4)}50%{box-shadow:0 0 0 10px rgba(233,69,96,0)} }
.flat-active-banner { display:flex; align-items:center; gap:1rem; padding:1rem 1.5rem; background:rgba(39,174,96,0.15); border:1px solid rgba(39,174,96,0.4); border-radius:12px; margin-bottom:1.5rem; }
.flat-active-icon { font-size: 2rem; }
.flat-active-info { flex: 1; }
.flat-active-info strong { color: #27ae60; display: block; }
.flat-active-info span { color: #aaa; font-size: 0.9rem; }
.flat-active-remaining { font-size:1.5rem; font-weight:bold; color:var(--gold,#d4a574); }
.flat-duration-cards, .flat-tier-cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(140px,1fr)); gap:12px; margin:1rem 0; }
.flat-duration-card, .flat-tier-card { padding:1rem; border:1px solid rgba(255,255,255,0.1); border-radius:12px; text-align:center; cursor:pointer; transition:all 0.2s; background:rgba(255,255,255,0.03); }
.flat-duration-card:hover, .flat-tier-card:hover { border-color:var(--gold,#d4a574); background:rgba(212,165,116,0.05); }
.flat-duration-card.selected, .flat-tier-card.selected { border-color:var(--gold,#d4a574); background:rgba(212,165,116,0.1); box-shadow:0 0 12px rgba(212,165,116,0.2); }
.flat-dur-icon, .flat-tier-emoji { font-size:1.5rem; margin-bottom:0.3rem; }
.flat-dur-label, .flat-tier-name { font-weight:bold; color:#eee; }
.flat-dur-hint, .flat-tier-includes { font-size:0.8rem; color:#999; margin-top:0.3rem; }
.flat-price-display { text-align:center; padding:1.5rem; margin:1.5rem 0; background:rgba(212,165,116,0.08); border-radius:12px; }
.flat-price-main { display:flex; align-items:baseline; justify-content:center; gap:0.5rem; }
.flat-price-label { color:#ccc; font-size:1.1rem; }
.flat-price-value { font-size:2.5rem; font-weight:bold; color:var(--gold,#d4a574); }
.flat-price-alt { color:#999; margin-top:0.3rem; }
.flat-includes { color:#aaa; margin-top:0.8rem; font-size:0.9rem; }
.flat-buy-buttons { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin:1rem 0; }
.btn-flat-buy { padding:12px 16px; border:1px solid rgba(255,255,255,0.15); border-radius:10px; background:rgba(255,255,255,0.05); color:#eee; font-size:0.95rem; cursor:pointer; transition:all 0.2s; text-align:center; font-family:inherit; }
.btn-flat-buy:hover { background:rgba(212,165,116,0.15); border-color:var(--gold,#d4a574); }
.btn-flat-buy.stripe { border-left:3px solid #635BFF; }
.btn-flat-buy.paypal { border-left:3px solid #0070BA; }
.btn-flat-buy.coins { border-left:3px solid var(--gold,#d4a574); }
.btn-flat-buy.vorkasse { border-left:3px solid #666; }
.flat-legal-hint { font-size:0.8rem; color:#777; text-align:center; margin-top:1rem; }
.flat-tester { margin-top:1rem; text-align:center; }
.btn-flat-tester { padding:10px 20px; background:rgba(155,89,182,0.2); border:1px dashed #9b59b6; border-radius:8px; color:#bb88dd; cursor:pointer; font-family:inherit; }
.flat-badge { display:inline-block; background:linear-gradient(90deg,var(--gold,#d4a574),var(--accent,#e94560)); color:white; padding:2px 10px; border-radius:12px; font-size:0.75rem; font-weight:bold; margin-left:8px; }
.flat-included { color:#27ae60 !important; font-weight:bold; }
@media (max-width:600px) {
  .flat-duration-cards { grid-template-columns:1fr; }
  .flat-tier-cards { grid-template-columns:repeat(2,1fr); }
  .flat-buy-buttons { grid-template-columns:1fr; }
  .flat-price-value { font-size:2rem; }
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* ─── MILESTONES PAGE ──────────────────────────────────────────────────── */
/* ═══════════════════════════════════════════════════════════════════════════ */

.milestones-container { max-width: 800px; margin: 80px auto 40px; padding: 0 20px; }

/* Tabs */
.milestones-tabs { display: flex; gap: 4px; margin-bottom: 24px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.milestones-tabs::-webkit-scrollbar { display: none; }
.milestones-tab {
  padding: 10px 16px; border: 1px solid rgba(212,165,116,0.2); background: transparent;
  color: var(--text-muted); border-radius: 8px; cursor: pointer; font-size: 0.85rem;
  white-space: nowrap; transition: all 0.2s;
}
.milestones-tab.active { background: rgba(212,165,116,0.15); color: var(--gold); border-color: rgba(212,165,116,0.4); }
.milestones-tab:hover { border-color: rgba(212,165,116,0.3); }

/* ─── Tab 1: Truhe ─────────────────────────────────────────────────────── */
.chest-claim-area {
  background: #16213e; border: 1px solid rgba(212,165,116,0.2); border-radius: 16px;
  padding: 32px; text-align: center; transition: border-color 0.3s;
}
.chest-claim-area.available { border-color: rgba(212,165,116,0.5); }
.chest-icon { font-size: 4rem; margin-bottom: 16px; display: inline-block; }
.chest-icon.chest-glow { animation: chest-card-glow 2.5s ease-in-out infinite; }
.chest-days { font-size: 1.1rem; color: var(--gold); font-weight: 600; margin-bottom: 8px; }
.chest-status { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 8px; }
.chest-next-milestone { font-size: 0.8rem; color: #4caf50; margin-bottom: 16px; }
.chest-claim-btn { padding: 14px 40px !important; font-size: 1.1rem !important; }
#confetti-container { position: relative; height: 0; overflow: visible; }
.confetti-particle {
  position: absolute; width: 8px; height: 8px; border-radius: 2px;
  animation: confetti-fall linear forwards; pointer-events: none; top: -20px;
}
@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(300px) rotate(720deg); opacity: 0; }
}

/* ─── Tab 2: Meilensteine ──────────────────────────────────────────────── */
.milestone-path { padding: 20px 0; }
.milestone-station {
  display: flex; gap: 16px; align-items: flex-start; padding: 16px;
  border-radius: 12px; background: #16213e; border: 1px solid rgba(255,255,255,0.05);
  transition: all 0.3s;
}
.milestone-station.reached { border-color: rgba(76,175,80,0.3); background: rgba(76,175,80,0.05); }
.milestone-station.next, .milestone-station.claimable { border-color: rgba(212,165,116,0.4); background: rgba(212,165,116,0.08); }
.milestone-station.future { opacity: 0.45; }
.milestone-node { font-size: 2rem; flex-shrink: 0; width: 48px; text-align: center; }
.milestone-info { flex: 1; }
.milestone-day { font-size: 1rem; font-weight: 700; color: var(--gold); margin-bottom: 4px; }
.milestone-reward { font-size: 0.85rem; color: #eee; margin-bottom: 6px; }
.milestone-date { font-size: 0.75rem; color: #4caf50; }
.milestone-progress { height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.milestone-progress-bar { height: 100%; background: linear-gradient(90deg, var(--gold), #e94560); border-radius: 3px; transition: width 0.5s ease; }
.milestone-progress-text { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.milestone-connector { width: 2px; height: 24px; background: rgba(212,165,116,0.2); margin: 0 0 0 39px; }
.milestone-connector.done { background: rgba(76,175,80,0.4); }

/* ─── Tab 3: Achievements ──────────────────────────────────────────────── */
.achievement-counter { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 12px; }
.achievement-filter-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.achievement-filter-btn {
  padding: 5px 12px; border-radius: 20px; border: 1px solid rgba(212,165,116,0.2);
  background: transparent; color: var(--text-muted); font-size: 0.75rem; cursor: pointer;
  transition: all 0.15s; white-space: nowrap;
}
.achievement-filter-btn.active, .achievement-filter-btn:hover { border-color: var(--gold); color: var(--gold); background: rgba(212,165,116,0.1); }
.achievement-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.achievement-card {
  display: flex; gap: 10px; padding: 12px; border-radius: 10px;
  background: #16213e; border: 1px solid rgba(255,255,255,0.05); transition: all 0.2s;
}
.achievement-card.locked { filter: grayscale(0.8); opacity: 0.5; }
.achievement-card.unlocked { border-color: rgba(212,165,116,0.3); }
.achievement-icon { font-size: 1.5rem; flex-shrink: 0; }
.achievement-body { flex: 1; min-width: 0; }
.achievement-name { font-size: 0.85rem; font-weight: 600; color: #eee; margin-bottom: 2px; }
.achievement-desc { font-size: 0.72rem; color: var(--text-muted); line-height: 1.4; margin-bottom: 6px; }
.achievement-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.achievement-reward { font-size: 0.68rem; background: rgba(255,255,255,0.05); border-radius: 10px; padding: 2px 7px; color: var(--text-muted); }
.achievement-rarity { font-size: 0.68rem; border-radius: 10px; padding: 2px 7px; font-weight: 600; }
.r-common { background: rgba(180,180,170,0.2); color: #b4b4aa; }
.r-rare { background: rgba(100,160,230,0.2); color: #7ab8f5; }
.r-epic { background: rgba(160,140,240,0.2); color: #b0a0f0; }
.r-legendary { background: rgba(212,165,116,0.2); color: var(--gold); }

/* ─── Tab 4: Referral ──────────────────────────────────────────────────── */
.referral-block { background: #16213e; border-radius: 16px; padding: 24px; border: 1px solid rgba(212,165,116,0.15); }
.referral-link-row { display: flex; gap: 8px; margin-bottom: 20px; }
.referral-link-input { flex: 1; padding: 10px; background: #0d0d1a; border: 1px solid rgba(212,165,116,0.3); border-radius: 8px; color: var(--gold); font-size: 0.85rem; }
.referral-stats { display: flex; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.referral-stat { text-align: center; flex: 1; min-width: 80px; }
.referral-stat-value { display: block; font-size: 1.5rem; font-weight: 800; color: var(--gold); }
.referral-stat-label { font-size: 0.75rem; color: var(--text-muted); }
.referral-tiers { border-top: 1px solid rgba(255,255,255,0.05); padding-top: 16px; }
.referral-tiers h4 { margin-bottom: 12px; color: var(--gold); }
.referral-tier { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 0.85rem; color: #ccc; border-bottom: 1px solid rgba(255,255,255,0.03); }
.referral-tier-icon { font-size: 1.2rem; }
.referral-tier.friend { color: #4caf50; }

/* ─── PWA Coins-Submenu ────────────────────────────────────────────────── */
.pwa-coins-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 999;
  padding-bottom: calc(70px + env(safe-area-inset-bottom, 0));
}
.pwa-coins-menu {
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
  border: 1px solid rgba(212,165,116,0.3); border-radius: 16px 16px 0 0;
  position: fixed; bottom: calc(70px + env(safe-area-inset-bottom, 0)); left: 0; right: 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
}
.pwa-coins-menu-item {
  display: block; padding: 14px 20px; color: #eee; text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.06); transition: background 0.15s; font-size: 1rem;
}
.pwa-coins-menu-item:active { background: rgba(212,165,116,0.15); }

/* ─── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .milestones-container { padding: 0 12px; }
  .achievement-grid { grid-template-columns: 1fr; }
  .chest-claim-area { padding: 20px; }
  .chest-icon { font-size: 3rem; }
  .referral-stats { flex-direction: column; gap: 8px; }
  .milestone-station { flex-direction: column; text-align: center; }
  .milestone-connector { margin: 0 auto; }
}

/* ─── Achievement Toast (global) ───────────────────────────────────────────── */
.achievement-toast {
  position: fixed; top: 20px; right: 20px; z-index: 10000;
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(135deg, #16213e, #1a1a2e); border: 1px solid rgba(212,165,116,0.3);
  border-left: 4px solid var(--gold); border-radius: 10px;
  padding: 12px 16px; min-width: 240px; max-width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  transform: translateX(120%); opacity: 0; transition: transform 0.4s ease, opacity 0.4s ease;
}
.achievement-toast.show { transform: translateX(0); opacity: 1; }
.achievement-toast-icon { font-size: 1.8rem; flex-shrink: 0; }
.achievement-toast-body { display: flex; flex-direction: column; gap: 2px; }
.achievement-toast-body strong { font-size: 0.85rem; color: #eee; }
.achievement-toast-body span { font-size: 0.75rem; color: var(--gold); }

/* ─── Subscription / Abo Section ───────────────────────────────────────────── */
.sub-toggle-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; font-size: 0.9rem; color: var(--text-muted); }
.sub-toggle { display: flex; gap: 4px; }
.sub-toggle-btn {
  padding: 6px 14px; border: 1px solid rgba(212,165,116,0.2); background: transparent;
  color: var(--text-muted); border-radius: 8px; cursor: pointer; font-size: 0.8rem; transition: all 0.2s;
}
.sub-toggle-btn.active { background: rgba(212,165,116,0.15); color: var(--gold); border-color: rgba(212,165,116,0.4); }
.sub-tier-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.sub-tier-card {
  background: #16213e; border: 1px solid rgba(255,255,255,0.05); border-radius: 12px;
  padding: 16px; text-align: center; transition: all 0.2s;
}
.sub-tier-card:hover { border-color: rgba(212,165,116,0.3); }
.sub-tier-card.active { border-color: #4caf50; background: rgba(76,175,80,0.05); }
.sub-tier-emoji { font-size: 1.8rem; margin-bottom: 6px; }
.sub-tier-name { font-size: 0.85rem; font-weight: 600; color: #eee; margin-bottom: 6px; }
.sub-tier-price { font-size: 1.1rem; font-weight: 700; color: var(--gold); margin-bottom: 10px; }
.sub-tier-interval { font-size: 0.7rem; font-weight: 400; color: var(--text-muted); }
.sub-tier-active { font-size: 0.75rem; color: #4caf50; font-weight: 600; }
@media (max-width: 600px) { .sub-tier-grid { grid-template-columns: repeat(2, 1fr); } }

/* ─── PWA-Install-Hinweis (mobiler Browser) ────────────────────────────────── */
.pwa-install-hint {
  position: fixed; bottom: -100px; left: 12px; right: 12px; z-index: 9999;
  background: linear-gradient(135deg, #16213e, #1a1a2e); border: 1px solid rgba(212,165,116,0.4);
  border-radius: 14px; padding: 14px 16px; display: flex; align-items: center; gap: 12px;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.5); transition: bottom 0.5s ease;
}
.pwa-install-hint.show { bottom: 12px; }
.pwa-install-hint-content { flex: 1; }
.pwa-install-hint-content strong { display: block; color: var(--gold); font-size: 0.9rem; margin-bottom: 4px; }
.pwa-install-shortcut { font-size: 0.78rem; color: var(--text-muted); }
.pwa-install-hint-close {
  background: none; border: none; color: var(--text-muted); font-size: 1.1rem;
  cursor: pointer; padding: 4px; opacity: 0.6;
}
.pwa-install-hint-close:hover { opacity: 1; }

/* ─── Mikrofon-Button (STT) ────────────────────────────────────────────────── */
.btn-mic {
  padding: 6px 8px; min-width: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; transition: all 0.2s;
}
.btn-mic.recording {
  background: var(--accent) !important; color: #fff !important;
  animation: mic-pulse 1s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(233,69,96,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(233,69,96,0); }
}

/* ─── TTS-Controls ──────────────────────────────────────────────────────────── */
.tts-controls {
  display: flex; align-items: center; gap: 6px; margin-top: 6px; padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.tts-play-btn, .tts-regen-btn {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 4px; border-radius: 4px; display: flex; align-items: center;
  transition: color 0.2s, background 0.2s;
}
.tts-play-btn:hover, .tts-regen-btn:hover { color: var(--gold); background: rgba(212,165,116,0.1); }
.tts-play-btn.loading { pointer-events: none; }
.tts-play-btn.playing { color: var(--accent); }
.tts-play-btn.cached { color: var(--gold); }
.tts-play-btn.paused { color: var(--gold); }

.tts-spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(212,165,116,0.3); border-top-color: var(--gold);
  border-radius: 50%; animation: tts-spin 0.8s linear infinite;
}
@keyframes tts-spin { to { transform: rotate(360deg); } }

.tts-progress {
  flex: 1; height: 3px; background: rgba(255,255,255,0.1); border-radius: 2px;
  overflow: hidden; min-width: 40px; max-width: 160px;
}
.tts-progress-fill {
  height: 100%; background: var(--accent); border-radius: 2px;
  transition: width 0.2s linear; width: 0%;
}
.tts-time {
  font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums;
}

/* ─── TTS Toast ─────────────────────────────────────────────────────────────── */
.tts-toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--bg-secondary); color: var(--text-color); border: 1px solid var(--gold-dim);
  padding: 10px 18px; border-radius: 8px; font-size: 0.85rem; z-index: 10000;
  opacity: 0; transition: opacity 0.3s, transform 0.3s; pointer-events: none;
  max-width: 90vw; text-align: center;
}
.tts-toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─── Profil: TTS-Slider ───────────────────────────────────────────────────── */
.slider-row {
  display: flex; align-items: center; gap: 8px;
}
.slider-row input[type="range"] {
  flex: 1; accent-color: var(--gold); height: 4px;
}
.slider-label {
  font-size: 0.75rem; color: var(--text-muted); min-width: 50px;
}
.slider-label:last-of-type { text-align: right; }
.slider-value {
  font-size: 0.8rem; color: var(--gold); min-width: 28px; text-align: center; font-weight: 600;
}

/* ─── Audio-First Blase (Messenger-Stil) ────────────────────────────────────── */
.audio-first-bubble {
  padding: 10px 14px !important; background: rgba(26,26,46,0.95) !important;
  border: 1px solid rgba(212,165,116,0.15);
}
.af-player-row {
  display: flex; align-items: center; gap: 10px;
}
.af-play-btn {
  background: none; border: none; color: var(--gold); cursor: pointer;
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; transition: background 0.2s; flex-shrink: 0;
}
.af-play-btn:hover { background: rgba(212,165,116,0.15); }
.af-play-btn:disabled { opacity: 0.5; cursor: default; }

.af-waveform {
  flex: 1; display: flex; align-items: center; gap: 2px; height: 28px;
  position: relative; overflow: hidden;
}
.af-wave-bar {
  width: 3px; border-radius: 2px; background: rgba(255,255,255,0.15);
  transition: background 0.1s; flex-shrink: 0;
}
.af-wave-progress {
  position: absolute; top: 0; left: 0; bottom: 0; width: 0%;
  pointer-events: none;
}
.af-wave-progress ~ .af-wave-bar { position: relative; }
.af-waveform.af-playing .af-wave-bar { background: rgba(255,255,255,0.2); }

/* Farbige Balken via Clip-Path über die Progress-Breite */
.af-waveform::after {
  content: ''; position: absolute; top: 0; left: 0; bottom: 0;
  width: var(--af-progress, 0%);
  background: var(--accent); border-radius: 2px;
  mix-blend-mode: screen; pointer-events: none;
  transition: width 0.15s linear;
}

/* Generating-Animation */
.af-waveform.af-generating .af-wave-bar {
  animation: af-pulse 1.2s ease-in-out infinite;
}
.af-waveform.af-generating .af-wave-bar:nth-child(odd) { animation-delay: 0.3s; }
.af-waveform.af-generating .af-wave-bar:nth-child(3n) { animation-delay: 0.6s; }
@keyframes af-pulse {
  0%, 100% { background: rgba(233,69,96,0.2); height: 4px; }
  50% { background: rgba(233,69,96,0.5); height: 18px; }
}

.af-time {
  font-size: 0.75rem; color: var(--text-muted); white-space: nowrap;
  min-width: 90px; text-align: right; font-variant-numeric: tabular-nums;
}

.af-regen-btn {
  position: absolute; top: 6px; right: 6px; opacity: 0.4;
}
.af-regen-btn:hover { opacity: 1; }
.audio-first-bubble { position: relative; }

.af-text-toggle {
  display: block; background: none; border: none; color: var(--text-muted);
  font-size: 0.78rem; cursor: pointer; padding: 6px 0 0; width: 100%; text-align: left;
  transition: color 0.2s;
}
.af-text-toggle:hover { color: var(--gold); }

.af-text-content {
  margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 0.9rem; line-height: 1.6;
}
.af-generating-hint {
  font-size: 0.75rem; color: var(--text-muted); margin-top: 6px; font-style: italic;
}

/* ─── Feedback Toast ──────────────────────────────────────────────────────── */
.feedback-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(100px);
  background: var(--bg-card); color: var(--text); border: 1px solid var(--gold-dim);
  border-radius: 12px; padding: 14px 24px; font-size: 0.9rem; z-index: 20000;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4); opacity: 0; transition: transform 0.4s ease, opacity 0.4s ease;
  max-width: 90vw; text-align: center;
}
.feedback-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.pwa-mode .feedback-toast { bottom: calc(80px + env(safe-area-inset-bottom, 0)); }

/* Feedback-Nav-Link */
.feedback-nav-link { color: #e94560 !important; }
