/* ===== MAIN APP ===== */
#app { display: none; min-height: 100vh; }
#app.app-visible { display: block !important; min-height: 100vh; }

/* ===== HEADER ===== */
.app-header {
  background: var(--ink);
  border-bottom: 2px solid var(--gold);
  padding: 0 1rem;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  height: 52px;
}

.header-tabs {
  display: flex;
  align-items: stretch;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 0.5rem;
}
.header-tabs::-webkit-scrollbar { display: none; }
.header-tabs .tab-btn {
  padding: 0 0.9rem;
  height: 100%;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  font-size: 0.68rem;
  white-space: nowrap;
  color: var(--stone-light);
}
.header-tabs .tab-btn:hover { color: var(--gold); }
.header-tabs .tab-btn.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
  background: rgba(200,151,42,0.08);
}

.app-logo {
  font-family: 'Cinzel', serif;
  font-weight: 900;
  font-size: 1.2rem;
  color: var(--gold);
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.app-logo span { color: var(--blood); }

.mobile-toggle { display: none; }

/* ===== BURGER MENU ===== */
.burger-menu {
  position: relative;
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
}

.burger-btn {
  padding: 0 1rem;
  height: 100%;
  border-bottom: 3px solid transparent;
  border-left: 1px solid rgba(200,151,42,0.2);
  border-radius: 0;
  font-size: 1rem;
  color: var(--stone-light);
  background: transparent;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.burger-btn:hover { color: var(--gold); background: rgba(200,151,42,0.06); }
.burger-btn.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
  background: rgba(200,151,42,0.08);
}

.burger-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 180px;
  background: linear-gradient(160deg, #1e1309, #120d06);
  border: 1px solid rgba(200,151,42,0.4);
  border-top: 2px solid var(--gold);
  border-radius: 0 0 6px 6px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.65);
  z-index: 200;
  overflow: hidden;
}
.burger-dropdown.open { display: block; }

.burger-item {
  display: block;
  width: 100%;
  padding: 0.72rem 1.1rem;
  text-align: left;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(200,151,42,0.12);
  color: var(--stone-light);
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.burger-item:last-child { border-bottom: none; }
.burger-item:hover { background: rgba(200,151,42,0.1); color: var(--gold); }
.burger-item.active { color: var(--gold); background: rgba(200,151,42,0.08); }
.burger-divider { height: 1px; background: rgba(200,151,42,0.3); margin: 0.2rem 0; }

/* ===== CHARACTER LAYOUT ===== */
.char-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 52px);
}

/* ===== SIDEBAR ===== */
.char-sidebar {
  background: linear-gradient(180deg, #1e1608, #140f06);
  border-right: 1px solid rgba(200,151,42,0.3);
  display: flex;
  flex-direction: column;
  padding: 1rem;
  gap: 1rem;
}

.char-portrait {
  background: rgba(200,151,42,0.1);
  border: 2px solid var(--bronze);
  border-radius: 4px;
  aspect-ratio: 3/4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  color: var(--stone);
  overflow: hidden;
  position: relative;
  transition: border-color 0.2s;
  cursor: pointer;
}
.char-portrait:hover { border-color: var(--gold); }
.char-portrait img { width: 100%; height: 100%; object-fit: cover; }

.char-name-display {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gold);
  text-align: center;
}
.char-prof {
  font-style: italic;
  color: var(--stone-light);
  font-size: 0.85rem;
  text-align: center;
}

.stat-bars { display: flex; flex-direction: column; gap: 0.6rem; }
.stat-bar-wrap { display: flex; flex-direction: column; gap: 0.2rem; }
.stat-bar-header { display: flex; justify-content: space-between; align-items: center; }
.stat-bar-name {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  color: var(--stone-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stat-bar-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--gold);
  cursor: pointer;
}
.stat-bar-track {
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
}
.stat-bar-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.lp-bar { background: linear-gradient(90deg, var(--blood), #e03030); }
.au-bar { background: linear-gradient(90deg, var(--forest), #6abc5e); }
.ae-bar { background: linear-gradient(90deg, #1a4a8b, #4a8ae8); }

.geld-box {
  background: rgba(200,151,42,0.1);
  border: 1px solid rgba(200,151,42,0.3);
  border-radius: var(--radius);
  padding: 0.6rem;
  cursor: pointer;
}
.geld-title {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  color: var(--stone-light);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.4rem;
}
.geld-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.3rem; }
.geld-coin { text-align: center; }
.geld-coin-label { font-family: 'Cinzel', serif; font-size: 0.6rem; color: var(--stone-light); display: block; }
.geld-coin-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--gold);
  border-bottom: 1px dashed rgba(200,151,42,0.4);
}

.sidebar-actions {
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(200,151,42,0.2);
}
.sidebar-section-label {
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  color: var(--stone-light);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 0.3rem;
}
.sidebar-char-tabs { display: flex; flex-direction: column; gap: 0.3rem; }
.sidebar-char-tabs .char-tab {
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.7rem;
  font-size: 0.78rem;
  border-radius: var(--radius);
}
.sidebar-divider { height: 1px; background: rgba(200,151,42,0.25); margin: 0.3rem 0; }
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(200,151,42,0.1);
  border: 1px solid rgba(200,151,42,0.25);
  border-radius: var(--radius);
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.5rem;
}
.sidebar-user-name { font-family: 'Cinzel', serif; font-size: 0.75rem; color: var(--gold); flex: 1; }

/* ===== MAIN CONTENT ===== */
.char-main {
  background: var(--parchment);
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 52px);
  overflow: hidden;
}

.tab-content { padding: 1.5rem; flex: 1; overflow-y: auto; }

.section-title {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--blood);
  border-bottom: 2px solid var(--bronze);
  padding-bottom: 0.4rem;
  margin-bottom: 1rem;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.section-title-text { flex: 1; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .char-layout { grid-template-columns: 1fr; }
  .char-main { display: flex; flex-direction: column; min-height: calc(100vh - 52px); width: 100%; }
  .tab-content { padding: 0.75rem; }

  .mobile-toggle {
    display: flex !important;
    background: var(--blood);
    color: var(--parchment);
    border: none;
    padding: 0.5rem 0.8rem;
    border-radius: var(--radius);
    font-family: 'Cinzel', serif;
    font-size: 0.7rem;
    cursor: pointer;
    align-items: center;
    gap: 0.3rem;
  }

  .char-sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 260px;
    z-index: 150;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.3s;
  }
  .char-sidebar.open { transform: translateX(0); }
}

.tab-btn-admin { margin-left: auto; border-left: 1px solid rgba(200,151,42,0.2); }

/* ===== GRUPPEN-CHAT ===== */
.chat-box {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(200,151,42,0.25);
  border-radius: var(--radius);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.chat-title {
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  color: var(--stone-light);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-height: 2.6rem;
}
.chat-msg {
  font-size: 0.71rem;
  color: var(--parchment);
  line-height: 1.35;
  word-break: break-word;
}
.chat-msg-kuerzel {
  font-family: 'Cinzel', serif;
  color: var(--gold);
  font-size: 0.64rem;
  font-weight: 700;
  margin-right: 0.25em;
}
.chat-input-row {
  display: flex;
  gap: 0.3rem;
}
.chat-input {
  flex: 1;
  min-width: 0;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(200,151,42,0.3);
  border-radius: var(--radius);
  color: var(--parchment);
  font-size: 0.72rem;
  padding: 0.28rem 0.45rem;
  font-family: 'JetBrains Mono', monospace;
}
.chat-input:focus { outline: none; border-color: var(--gold); }
.chat-input::placeholder { color: var(--stone); }
.chat-send-btn {
  flex-shrink: 0;
  background: var(--blood);
  border: none;
  border-radius: var(--radius);
  color: var(--parchment);
  padding: 0.28rem 0.55rem;
  font-size: 0.68rem;
  cursor: pointer;
  transition: background 0.15s;
}
.chat-send-btn:hover { background: #a02020; }
.chat-link { color: var(--gold); text-decoration: underline; word-break: break-all; }
.chat-link:hover { color: var(--parchment); }

/* ===== CHAT MODAL ===== */
.chat-modal-box {
  background: linear-gradient(160deg, #1e1309, #120d06);
  border: 2px solid var(--bronze);
  border-radius: 8px;
  width: 100%;
  max-width: 620px;
  height: 75vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.75);
  overflow: hidden;
}
.chat-modal-header {
  background: var(--ink);
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  border-bottom: 2px solid var(--gold);
  flex-shrink: 0;
}
.chat-modal-title {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--gold);
  flex: 1;
  letter-spacing: 0.06em;
}
.chat-modal-close {
  background: none;
  border: none;
  color: var(--stone-light);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}
.chat-modal-close:hover { background: rgba(255,255,255,0.1); color: #fff; }

.chat-modal-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.7rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(200,151,42,0.4) transparent;
}
.chat-modal-messages::-webkit-scrollbar { width: 5px; }
.chat-modal-messages::-webkit-scrollbar-track { background: transparent; }
.chat-modal-messages::-webkit-scrollbar-thumb { background: rgba(200,151,42,0.4); border-radius: 3px; }

.chat-modal-msg {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  transition: background 0.12s;
}
.chat-modal-msg:hover { background: rgba(255,255,255,0.04); }
.chat-modal-msg-name {
  font-family: 'Cinzel', serif;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 90px;
}
.chat-modal-msg-body {
  flex: 1;
  font-size: 0.84rem;
  color: var(--parchment);
  line-height: 1.4;
  word-break: break-word;
}
.chat-modal-msg-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  color: var(--stone);
  white-space: nowrap;
  flex-shrink: 0;
}
.chat-modal-msg-del {
  background: none;
  border: none;
  color: transparent;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0.1rem 0.25rem;
  border-radius: 3px;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
  line-height: 1;
}
.chat-modal-msg:hover .chat-modal-msg-del { color: var(--stone); }
.chat-modal-msg-del:hover { color: var(--blood) !important; background: rgba(180,30,30,0.18); }

.chat-modal-footer {
  display: flex;
  gap: 0.5rem;
  padding: 0.65rem 0.9rem;
  border-top: 1px solid rgba(200,151,42,0.25);
  background: rgba(0,0,0,0.25);
  flex-shrink: 0;
}
.chat-modal-footer .chat-input { font-size: 0.85rem; padding: 0.42rem 0.65rem; }
.chat-modal-footer .chat-send-btn { font-size: 0.82rem; padding: 0.42rem 0.75rem; }
