﻿:root {
  --bg:        #1a1f2e;
  --surface:   #252d3d;
  --surface2:  #2e3850;
  --accent:    #4caf82;
  --accent2:   #3a8c66;
  --danger:    #e05555;
  --text:      #e8eaf0;
  --text-dim:  #8892a4;
  --radius:    8px;
  --shadow:    0 4px 20px rgba(0,0,0,.4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: system-ui, sans-serif; min-height: 100vh; }

/* ── Screens ── */
.screen        { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; align-items: center; justify-content: center; }
#screen-lobby.active, #screen-game.active { justify-content: flex-start; }

/* ── Auth ── */
.auth-card { background: var(--surface); border-radius: var(--radius); padding: 2rem; width: min(420px, 94vw); box-shadow: var(--shadow); }
.auth-card h1 { text-align: center; font-size: 1.8rem; margin-bottom: 1.2rem; color: var(--accent); }

.tabs { display: flex; gap: .5rem; margin-bottom: 1rem; }
.tab  { flex: 1; padding: .6rem; background: var(--surface2); border: none; border-radius: var(--radius); color: var(--text-dim); cursor: pointer; transition: .2s; }
.tab.active { background: var(--accent); color: #fff; }

.tab-panel        { display: none; flex-direction: column; gap: .8rem; }
.tab-panel.active { display: flex; }

input[type=email], input[type=password], input[type=text] {
  padding: .7rem 1rem; border: 1px solid var(--surface2); border-radius: var(--radius);
  background: var(--bg); color: var(--text); font-size: 1rem; width: 100%;
  transition: border-color .2s;
}
input:focus { outline: none; border-color: var(--accent); }

/* ── Buttons ── */
.btn-primary { background: var(--accent); color: #fff; border: none; padding: .7rem 1.4rem; border-radius: var(--radius); cursor: pointer; font-size: 1rem; font-weight: 600; transition: background .2s; }
.btn-primary:hover { background: var(--accent2); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm     { background: var(--surface2); color: var(--text-dim); border: none; padding: .4rem .9rem; border-radius: var(--radius); cursor: pointer; font-size: .85rem; transition: .2s; }
.btn-sm:hover { background: var(--accent); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }

/* ── Error / Hint ── */
.error-msg { color: var(--danger); font-size: .85rem; min-height: 1.2rem; }
.hint      { color: var(--text-dim); font-size: .85rem; }
.hidden    { display: none !important; }

/* ── Lobby ── */
header { width: 100%; background: var(--surface); padding: .7rem 1.5rem; display: flex; align-items: center; gap: 1rem; box-shadow: var(--shadow); }
header span { font-weight: 600; }
#lobby-elo { color: var(--accent); }
header button { margin-left: auto; }

.lobby-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; padding: 1.5rem; width: 100%; max-width: 1100px; }
@media (max-width: 800px) { .lobby-grid { grid-template-columns: 1fr; } }

.panel { background: var(--surface); border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--shadow); }
.panel h2 { font-size: 1.1rem; color: var(--accent); margin-bottom: .8rem; }

#deck-list { list-style: none; display: flex; flex-direction: column; gap: .4rem; margin-top: .6rem; }
#deck-list li { display: flex; align-items: center; gap: .5rem; background: var(--surface2); border-radius: var(--radius); padding: .5rem .8rem; }
#deck-list li span { flex: 1; }

#room-created { margin-top: 1rem; text-align: center; }
#room-code-display { font-size: 1.6rem; letter-spacing: .2rem; color: var(--accent); }
.join-row { display: flex; gap: .5rem; margin-top: .8rem; }
.join-row input { flex: 1; text-transform: uppercase; letter-spacing: .1rem; }

#leaderboard-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
#leaderboard-table th { color: var(--text-dim); border-bottom: 1px solid var(--surface2); padding: .4rem .3rem; text-align: left; }
#leaderboard-table td { padding: .4rem .3rem; }
#leaderboard-table tr:hover td { background: var(--surface2); }

/* ── Spinner ── */
.spinner { width: 32px; height: 32px; border: 3px solid var(--surface2); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin: .8rem auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Game ── */
#game-status-bar { width: 100%; background: var(--surface); padding: .6rem 1rem; display: flex; align-items: center; gap: 1.2rem; font-size: .9rem; }
#gs-turn { font-weight: 700; color: var(--accent); }
#game-status-bar button { margin-left: auto; }

#game-main { display: grid; grid-template-rows: auto 1fr auto; gap: .8rem; padding: .8rem; flex: 1; width: 100%; max-width: 900px; margin: 0 auto; }

.garden { background: var(--surface); border-radius: var(--radius); padding: .8rem; }
.garden h3 { font-size: .9rem; color: var(--text-dim); margin-bottom: .5rem; }

.pots { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.pot  { background: var(--surface2); border-radius: var(--radius); min-height: 80px; padding: .5rem; cursor: pointer; transition: .15s; border: 2px solid transparent; }
.pot:hover       { border-color: var(--accent); }
.pot.selected    { border-color: #fff; background: var(--bg); }
.pot.has-plant   { border-color: var(--accent2); }
.pot-name  { font-size: .75rem; font-weight: 700; color: var(--accent); }
.pot-stufe { font-size: .65rem; color: var(--text-dim); }

#game-middle { display: flex; flex-direction: column; gap: .5rem; align-items: center; }
.mana-bar { display: flex; flex-wrap: wrap; gap: .3rem; }
.mana-token { width: 28px; height: 28px; border-radius: 50%; font-size: .65rem; display: flex; align-items: center; justify-content: center; font-weight: 700; cursor: default; }
.mana-SUN   { background: #e8c530; color: #333; }
.mana-WATER { background: #3a7ebf; color: #fff; }
.mana-ANY   { background: #888;    color: #fff; }
.mana-used  { opacity: .35; }

.action-log { width: 100%; max-height: 100px; overflow-y: auto; background: var(--bg); border-radius: var(--radius); padding: .5rem; font-size: .75rem; color: var(--text-dim); }

#submit-area { display: flex; flex-direction: column; align-items: center; gap: .4rem; }

/* ── Turn timer ── */
#turn-timer { font-weight: 700; }

/* ── Move history (Verlauf) ── */
.game-log { width: 100%; max-height: 180px; overflow-y: auto; font-size: .78rem; color: var(--text-dim); background: var(--surface2); border-radius: 8px; padding: .5rem .7rem; }
.game-log h4 { font-size: .75rem; color: var(--text-dim); margin-bottom: .3rem; }
.game-log li { margin-bottom: .2rem; list-style: none; }

/* ── Round-resolved flash on the gardens ── */
@keyframes gg-flash { 0% { box-shadow: 0 0 0 2px rgba(74,222,128,.7); } 100% { box-shadow: none; } }
.flash-update { animation: gg-flash .6s ease; }

/* ── Hand ── */
#hand-area { background: var(--surface); padding: .8rem; border-top: 2px solid var(--surface2); max-width: 900px; width: 100%; margin: 0 auto; }
#hand-area h3 { font-size: .85rem; color: var(--text-dim); margin-bottom: .5rem; }
#hand-cards { display: flex; gap: .5rem; flex-wrap: wrap; }
.hand-card { background: var(--surface2); border-radius: var(--radius); padding: .5rem .7rem; min-width: 90px; cursor: pointer; border: 2px solid transparent; transition: .15s; font-size: .8rem; }
.hand-card:hover    { border-color: var(--accent); }
.hand-card { transition: transform .15s ease, outline .15s ease, border-color .15s ease; }
.hand-card.selected { border-color: #fff; background: var(--bg); outline: 2px solid var(--accent); transform: translateY(-4px); }
.card-name   { font-weight: 700; font-size: .8rem; }
.card-type   { font-size: .65rem; color: var(--text-dim); }
.card-region { font-size: .65rem; }

/* ── Game Over ── */
.gameover-card { background: var(--surface); border-radius: var(--radius); padding: 2.5rem; text-align: center; width: min(420px, 94vw); box-shadow: var(--shadow); }
.gameover-card h2 { font-size: 2rem; color: var(--accent); margin-bottom: .8rem; }
.gameover-card p  { font-size: 1.1rem; margin-bottom: 1.5rem; color: var(--text-dim); }

/* ── Modal ── */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-content { background: var(--surface); border-radius: var(--radius); padding: 1.5rem; width: min(700px, 96vw); max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow); }
.modal-content h2 { color: var(--accent); margin-bottom: 1rem; }
#card-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; }
#card-picker > div { background: var(--bg); border-radius: var(--radius); padding: .5rem; max-height: 350px; overflow-y: auto; }
.modal-actions { display: flex; gap: .5rem; margin-top: .5rem; }

/* ── Toast ── */
.toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); background: var(--surface); color: var(--text); padding: .7rem 1.5rem; border-radius: 2rem; box-shadow: var(--shadow); z-index: 200; font-size: .9rem; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } }

/* ── Screen system fix ── */
/* Screens are display:none by default; .active makes them visible */
#screen-lobby.active  { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; }
#screen-game.active   { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; }

/* ── .btn base (so "btn btn-primary" works) ── */
.btn { border: none; border-radius: var(--radius); cursor: pointer; font-size: 1rem; font-weight: 600; padding: .7rem 1.4rem; transition: background .2s; }
.btn.btn-primary  { background: var(--accent); color: #fff; }
.btn.btn-primary:hover { background: var(--accent2); }
.btn.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn.btn-sm      { background: var(--surface2); color: var(--text-dim); padding: .4rem .9rem; font-size: .85rem; }
.btn.btn-sm:hover { background: var(--accent); color: #fff; }
.btn.btn-danger  { background: var(--danger); color: #fff; }

/* ── Toast (replaces old single-div version) ── */
#toast-container .toast {
  background: var(--surface);
  color: var(--text);
  padding: .7rem 1.4rem;
  border-radius: 2rem;
  box-shadow: var(--shadow);
  font-size: .9rem;
  pointer-events: auto;
  animation: toastIn .2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } }

/* ── Card-selected highlight ── */
.hand-card.selected { border-color: #fff; background: var(--bg); }

/* ── Lobby header ── */
.lobby-header { width: 100%; background: var(--surface); padding: .7rem 1.5rem; display: flex; align-items: center; gap: 1rem; box-shadow: var(--shadow); }
.lobby-header span { font-weight: 600; }
#lobby-elo { color: var(--accent); }
.lobby-header button { margin-left: auto; }

/* ── Game status bar: new IDs ── */
#turn-counter { font-weight: 700; color: var(--accent); }

/* ── Friends Panel ── */
#panel-friends { grid-column: span 1; }

.friends-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; }
.friends-header h2 { margin-bottom: 0; }

.friends-tabs { display: flex; gap: .4rem; }
.friends-tab { background: var(--surface2); border: none; border-radius: var(--radius); padding: .3rem .7rem; color: var(--text-dim); cursor: pointer; font-size: .8rem; transition: .2s; }
.friends-tab.active { background: var(--accent); color: #fff; }

.add-friend-row { display: flex; gap: .5rem; margin-bottom: .4rem; }
.add-friend-row input { flex: 1; }

.friends-list { list-style: none; display: flex; flex-direction: column; gap: .3rem; margin-top: .4rem; }
.friends-empty { color: var(--text-dim); font-size: .85rem; padding: .4rem 0; }

.friend-item { display: flex; align-items: center; gap: .5rem; background: var(--surface2); border-radius: var(--radius); padding: .4rem .7rem; cursor: context-menu; transition: .15s; }
.friend-item:hover { background: var(--bg); }

.friend-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.friend-dot.online  { background: var(--accent); box-shadow: 0 0 5px var(--accent); }
.friend-dot.offline { background: var(--text-dim); }

.friend-name { flex: 1; font-size: .88rem; font-weight: 600; }
.friend-elo  { font-size: .75rem; color: var(--text-dim); }

.request-item { display: flex; align-items: center; gap: .4rem; background: var(--surface2); border-radius: var(--radius); padding: .35rem .6rem; }
.request-item .friend-name { flex: 1; }

.badge { background: var(--danger); color: #fff; border-radius: 999px; padding: .05rem .4rem; font-size: .7rem; font-weight: 700; margin-left: .25rem; }

/* ── Context menu ── */
.ctx-menu { position: fixed; background: var(--surface); border: 1px solid var(--surface2); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 500; min-width: 160px; overflow: hidden; }
.ctx-item { padding: .55rem 1rem; cursor: pointer; font-size: .9rem; transition: background .15s; }
.ctx-item:hover       { background: var(--surface2); }
.ctx-item.ctx-danger  { color: var(--danger); }
.ctx-item.ctx-disabled { color: var(--text-dim); cursor: not-allowed; }

/* ── Invite toast ── */
.invite-toast { pointer-events: auto !important; background: var(--surface) !important; border: 1px solid var(--accent); }
.invite-actions { display: flex; gap: .5rem; margin-top: .5rem; }

/* ── Context menu separator ── */
.ctx-separator { height: 1px; background: var(--surface2); margin: 3px 0; }

/* ── Chat windows ── */
#chat-container { position: fixed; bottom: 0; right: 0; z-index: 500; pointer-events: none; }
.chat-window {
  position: fixed; bottom: 0; width: 220px;
  background: var(--surface); border: 1px solid var(--surface2);
  border-bottom: none; border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow); pointer-events: auto;
  display: flex; flex-direction: column; max-height: 340px;
  transition: max-height .2s;
}
.chat-window.minimized { max-height: 38px; overflow: hidden; }
.chat-header {
  display: flex; align-items: center; gap: .4rem;
  padding: .45rem .7rem; background: var(--surface2);
  border-radius: var(--radius) var(--radius) 0 0; cursor: pointer;
  font-size: .88rem; font-weight: 600; color: var(--text);
}
.chat-friend-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-header-btns { display: flex; gap: .25rem; }
.chat-min-btn, .chat-close-btn {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  padding: 0 .3rem; font-size: 1rem; line-height: 1;
}
.chat-min-btn:hover, .chat-close-btn:hover { color: var(--accent); }
.chat-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-messages { flex: 1; overflow-y: auto; padding: .5rem; display: flex; flex-direction: column; gap: .3rem; }
.chat-msg { display: flex; flex-direction: column; }
.chat-msg.mine  { align-items: flex-end; }
.chat-msg.theirs { align-items: flex-start; }
.chat-bubble {
  background: var(--surface2); border-radius: 12px; padding: .35rem .65rem;
  font-size: .83rem; max-width: 170px; word-break: break-word;
}
.chat-msg.mine .chat-bubble { background: var(--accent); color: #fff; }
.chat-time { font-size: .65rem; color: var(--text-dim); margin-top: 2px; }
.chat-input-row { display: flex; gap: .3rem; padding: .4rem; border-top: 1px solid var(--surface2); }
.chat-input { flex: 1; background: var(--bg); border: 1px solid var(--surface2); border-radius: 12px; padding: .3rem .65rem; color: var(--text); font-size: .83rem; }
.chat-input:focus { outline: none; border-color: var(--accent); }
.chat-send-btn { background: var(--accent); border: none; border-radius: 50%; width: 28px; height: 28px; color: #fff; cursor: pointer; font-size: .9rem; flex-shrink: 0; }
.chat-unread { font-size: .7rem; }
.friend-msg-badge { font-size: .7rem; margin-left: auto; }
.chat-toast { pointer-events: auto !important; cursor: pointer; }

/* ── Profile modal ── */
.profile-modal-content { max-width: 440px; }
.profile-header {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1.2rem; padding-bottom: 1rem;
  border-bottom: 1px solid var(--surface2);
}
.profile-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 700; flex-shrink: 0;
}
.profile-title { flex: 1; }
.profile-title h2 { font-size: 1.2rem; margin: 0; }
.profile-online-badge { color: var(--accent); font-size: .8rem; }
.profile-close-btn { margin-left: auto; }
.profile-stats-grid {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: .5rem; margin-bottom: 1rem;
}
.profile-stat {
  background: var(--surface2); border-radius: var(--radius);
  padding: .6rem .4rem; text-align: center;
}
.stat-value { display: block; font-size: 1.3rem; font-weight: 700; color: var(--text); }
.stat-label { font-size: .7rem; color: var(--text-dim); }
.elo-value { color: var(--accent); }
.profile-stat.win  .stat-value { color: var(--accent); }
.profile-stat.loss .stat-value { color: var(--danger); }
.profile-details { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .8rem; }
.profile-detail-row { display: flex; justify-content: space-between; font-size: .88rem; }
.detail-label { color: var(--text-dim); }
.detail-value { color: var(--text); font-weight: 600; }
.profile-winbar {
  height: 8px; background: var(--surface2); border-radius: 4px; overflow: hidden;
}
.winbar-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width .4s; }

/* ── Emotes ── */
.emote-panel {
  position: absolute; bottom: 110%; right: 0;
  background: var(--surface); border: 1px solid var(--surface2);
  border-radius: var(--radius); padding: .4rem;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: .3rem;
  box-shadow: var(--shadow); z-index: 400;
}
.emote-btn {
  background: var(--surface2); border: none; border-radius: 6px;
  font-size: 1.4rem; padding: .3rem; cursor: pointer; transition: .15s;
}
.emote-btn:hover { background: var(--accent); transform: scale(1.15); }

@keyframes emoteFloat {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  70%  { opacity: 1; transform: translateY(-60px) scale(1.3); }
  100% { opacity: 0; transform: translateY(-90px) scale(0.8); }
}
.emote-float {
  position: fixed; font-size: 2.8rem; pointer-events: none; z-index: 800;
  animation: emoteFloat 2.2s ease forwards;
  transform: translateX(-50%);
}

/* Position emote button relative */
#btn-emote { position: relative; }

/* ── Matchmaking Queue ──────────────────────────────────────────────────── */
.play-section { margin-bottom: .75rem; }
.section-sub  { font-size: .85rem; color: var(--text-dim); margin: 0 0 .5rem; text-transform: uppercase; letter-spacing: .05em; }
.queue-btns   { display: flex; gap: .5rem; flex-wrap: wrap; }
.btn-queue-ranked   { background: #b8920a; color: #fff; padding: .45rem 1rem; border-radius: 6px; border: none; cursor: pointer; font-weight: 600; transition: .15s; }
.btn-queue-ranked:hover   { background: #d4a80c; }
.btn-queue-unranked { background: var(--accent2,#3a8c66); color: #fff; padding: .45rem 1rem; border-radius: 6px; border: none; cursor: pointer; font-weight: 600; transition: .15s; }
.btn-queue-unranked:hover { filter: brightness(1.15); }

/* Queue searching modal */
.queue-modal  { text-align: center; padding: 2rem 2.5rem; max-width: 340px; }
.queue-modal h2 { margin-bottom: .5rem; }
.queue-mode-label { font-size: 1.1rem; font-weight: 700; margin: .25rem 0 1rem; }
.queue-modal .spinner { margin: .75rem auto; }
.queue-modal .hint { margin: .5rem 0 1rem; }

/* ── Avatar styles ──────────────────────────────────────────────────────── */

/* Lobby header */
.lobby-user-info        { display:flex; align-items:center; gap:.5rem; }
.lobby-avatar-wrap      { position:relative; width:32px; height:32px; flex-shrink:0; }
.lobby-avatar           { width:32px; height:32px; border-radius:50%; object-fit:cover; border:2px solid var(--accent); }
.lobby-avatar-initial   { display:flex; align-items:center; justify-content:center; width:32px; height:32px; border-radius:50%; background:var(--accent); color:#fff; font-weight:700; font-size:.9rem; }
.btn-avatar-upload      { cursor:pointer; font-size:1rem; padding:.2rem .5rem; }

/* Friends list */
.friend-avatar-wrap     { position:relative; display:inline-flex; flex-shrink:0; }
.friend-avatar          { width:32px; height:32px; border-radius:50%; object-fit:cover; border:2px solid var(--surface2); }
.friend-avatar-initial  { display:flex; align-items:center; justify-content:center; width:32px; height:32px; border-radius:50%; background:var(--accent); color:#fff; font-weight:700; font-size:.85rem; border:2px solid var(--surface2); }
.friend-dot             { position:absolute; bottom:1px; right:1px; width:10px; height:10px; border-radius:50%; border:2px solid var(--surface); }
.friend-item            { display:flex; align-items:center; gap:.5rem; }

/* Profile modal avatar */
.profile-avatar         { width:64px; height:64px; border-radius:50%; background:var(--accent); display:flex; align-items:center; justify-content:center; font-size:1.8rem; font-weight:700; color:#fff; overflow:hidden; flex-shrink:0; }

/* ── Match History ─────────────────────────────────────────────── */
.history-list { display: flex; flex-direction: column; gap: .4rem; max-height: 320px; overflow-y: auto; }
.history-item { display: flex; align-items: center; gap: .6rem; padding: .45rem .6rem;
  border-radius: 6px; font-size: .85rem; background: var(--bg-card); }
.history-item.win  { border-left: 3px solid var(--success, #4ade80); }
.history-item.loss { border-left: 3px solid var(--danger,  #f87171); }
.history-result { font-weight: 600; min-width: 90px; }
.history-opp    { flex: 1; color: var(--text-dim); }
.elo-change     { font-weight: 700; min-width: 70px; text-align: right; }
.elo-change.pos { color: var(--success, #4ade80); }
.elo-change.neg { color: var(--danger,  #f87171); }
.elo-change.neutral { color: var(--text-dim); }
.history-date   { color: var(--text-dim); font-size: .78rem; min-width: 70px; text-align: right; }

/* ── Import deck row ───────────────────────────────────────────── */
.import-deck-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .8rem; align-items: center; }
.import-deck-row input { flex: 1; min-width: 120px; }

/* ── Achievements ──────────────────────────────────────────────── */
.achievement-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); gap: .6rem; margin-top: .6rem; }
.achievement-card { background: var(--bg-card); border-radius: 8px; padding: .6rem .7rem;
  display: flex; flex-direction: column; align-items: center; gap: .3rem; text-align: center;
  border: 1px solid var(--border); }
.achievement-card .ach-icon  { font-size: 1.8rem; }
.achievement-card .ach-title { font-size: .8rem; font-weight: 700; }
.achievement-card .ach-desc  { font-size: .72rem; color: var(--text-dim); }
.achievement-card.locked     { opacity: .4; filter: grayscale(1); }

/* ── Progression: Rank + XP bar ───────────────────────────────── */
#lobby-rank { color: var(--text-dim); font-size: .9rem; white-space: nowrap; }
.xp-bar  { width: 160px; height: 6px; background: var(--bg-card, #222); border: 1px solid var(--border, #333);
  border-radius: 3px; overflow: hidden; margin-top: .35rem; }
.xp-fill { height: 100%; width: 0; background: var(--accent, #4caf82); transition: width .3s ease; }

/* ── Daily Quests ──────────────────────────────────────────────── */
.quest-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.quest-item { display: flex; align-items: center; gap: .6rem; padding: .45rem .6rem;
  background: var(--bg-card); border-radius: 8px; border: 1px solid var(--border); font-size: .85rem; }
.quest-item .quest-title    { flex: 1; }
.quest-item .quest-xp       { color: var(--accent); font-weight: 600; white-space: nowrap; }
.quest-item .quest-progress { color: var(--text-dim); font-weight: 600; min-width: 36px; text-align: right; }
.quest-item .quest-claimed  { color: var(--success, #4ade80); font-size: .8rem; white-space: nowrap; }
.quest-item.completed       { border-left: 3px solid var(--success, #4ade80); }

/* ── Settings modal ────────────────────────────────────────────── */
.settings-row { display: flex; gap: .5rem; align-items: center; margin-top: .4rem; flex-wrap: wrap; }
.settings-row input { flex: 1; min-width: 140px; }
#modal-settings hr { margin: 1rem 0; border-color: var(--border, #333); }

/* ── Game pause / reconnect overlay ───────────────────────────────────────── */
.game-pause-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 500; color: #fff; font-size: 1.2rem; gap: .6rem; }
.game-pause-overlay .countdown { font-size: 2.2rem; font-weight: 800; }

/* -- Profil-Einstellungen (settings modal head + clickable user info) -- */
.settings-profile-head { display: flex; align-items: center; gap: .8rem; }
.settings-profile-head .hint { margin: 0; }
#lobby-user-info { cursor: pointer; border-radius: 8px; padding: .15rem .4rem; }
#lobby-user-info:hover { background: rgba(255,255,255,.06); }

/* ── Deckbuilder: Region-Chips ───────────────────────────────────── */
.region-chip { display: inline-block; padding: 0 .45em; margin-left: .4em; border-radius: 10px;
               font-size: .65rem; font-weight: 700; color: #fff; vertical-align: middle; }
.region-gruen { background: #3a9d4e; }
.region-blau  { background: #3b6fd4; }
.region-grau  { background: #6b7686; }
.region-gelb  { background: #c2a019; color: #1a1f2e; }
.region-braun { background: #9a6232; }

/* Braune Fraktion: weiße Schrift für Lesbarkeit (1:1 zur Desktop-Version) */
.card-region-braun .card-name,
.card-region-braun .card-type,
.card-region-braun .card-effect,
.card-region-braun .card-vp,
.card-region-braun .card-cost { color: #fff !important; }

#card-region-filter { width: 100%; margin-top: .6rem; padding: .5rem .8rem;
  border: 1px solid var(--surface2); border-radius: var(--radius);
  background: var(--bg); color: var(--text); font-size: .9rem; }

#deck-validity.valid   { color: var(--accent); }
#deck-validity.invalid { color: var(--danger); }

.deck-count-chip { background: var(--surface2); border-radius: 10px; padding: 0 .45em;
                   font-size: .7rem; font-weight: 700; margin-right: .4em; color: var(--accent); }

/* ── Deckbuilder: Mana curve (Stufen-Verteilung) ─────────────────── */
.deck-curve { display: flex; align-items: flex-end; gap: 4px; height: 60px; margin-top: .5rem; }
.deck-curve .col { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.deck-curve .bar { width: 22px; background: var(--accent, #4ade80); border-radius: 3px 3px 0 0; position: relative; }
.deck-curve .bar span { position: absolute; top: -16px; left: 0; right: 0; text-align: center; font-size: .65rem; }
.deck-curve .lbl { font-size: .65rem; text-align: center; color: var(--text-dim); }

/* ── Deckliste: Statistikzeile ───────────────────────────────────── */
.deck-stats { display: block; font-size: .72rem; color: var(--text-dim); }

/* ── Replay-Viewer ───────────────────────────────────────────────── */
.replay-turns { max-height: 55vh; overflow-y: auto; display: flex; flex-direction: column; gap: .4rem; margin: .6rem 0; }
.replay-turn  { background: var(--bg); border-radius: var(--radius); padding: .5rem .7rem; font-size: .82rem; }
.replay-turn .replay-turn-no { color: var(--accent); font-weight: 700; }
.replay-turn .replay-line { display: block; color: var(--text); }
.replay-turn .replay-line .who { color: var(--text-dim); font-weight: 600; }
.replay-turn pre { white-space: pre-wrap; font-size: .7rem; color: var(--text-dim); }

/* ── Kartendetails (Hand / Garten / Aktionszone) ─────────────────── */
.card-cost   { display: flex; gap: 2px; flex-wrap: wrap; margin-top: .2rem; }
.cost-pip    { display: inline-flex; align-items: center; justify-content: center;
               min-width: 16px; height: 16px; border-radius: 50%; padding: 0 2px;
               font-size: .6rem; font-weight: 700; }
.card-vp     { font-size: .65rem; color: var(--accent); margin-top: .15rem; font-weight: 600; }
.card-effect { font-size: .62rem; color: var(--text-dim); margin-top: .15rem;
               max-width: 150px; line-height: 1.25; }
.pot-vp      { color: var(--accent); font-weight: 600; }
.pot-cost    { display: flex; gap: 2px; flex-wrap: wrap; margin-top: .15rem; }
.pot-parasite { font-size: .6rem; color: #f59e42; margin-top: .15rem; font-weight: 600; }
.pot-object   { font-size: .6rem; color: var(--text-dim); margin-top: .15rem; }
.pot-region-gruen { border-color: #3a9d4e55; }
.pot-region-blau  { border-color: #3b6fd455; }
.pot-region-grau  { border-color: #6b768655; }
.pot-region-gelb  { border-color: #c2a01955; }
.pot-region-braun { border-color: #9a623255; }

/* ── Zielauswahl-Modus (Helio / Parasitisch) ─────────────────────── */
.pot-targetable { outline: 2px dashed var(--accent, #4ade80); cursor: crosshair; }
.pot-targetable:hover { outline-style: solid; }
.target-banner { position: fixed; top: 52px; left: 50%; transform: translateX(-50%);
                 z-index: 300; display: flex; align-items: center; gap: .8rem;
                 background: var(--surface, #1a1f2e); border: 1px solid var(--accent, #4ade80);
                 border-radius: var(--radius, 8px); padding: .5rem .9rem;
                 font-size: .85rem; box-shadow: 0 4px 16px rgba(0,0,0,.5); }

/* ── Aktionszone (verdeckte Karten) ──────────────────────────────── */
.action-zone { margin: .6rem 0; }
.action-zone h4 { font-size: .8rem; color: var(--text-dim); margin-bottom: .3rem; }
.action-zone .az-card { display: inline-block; margin: 0 .3rem .3rem 0; }

/* ════════════════════════════════════════════════════════════════
   SPIELBRETT-DESIGN — Etappe 1: Holztisch, Goldrahmen, Pergament-HUD
   (Garten-/Pergament-Look, passend zur Karten-Optik)
   ════════════════════════════════════════════════════════════════ */
#screen-game.active {
  position: relative;
  padding: 16px;
  box-sizing: border-box;
  background:
    radial-gradient(ellipse 120% 90% at 50% -10%, #5a3f24 0%, #3a2715 48%, #261a0c 100%),
    repeating-linear-gradient(90deg, rgba(0,0,0,.05) 0 3px, rgba(255,255,255,.012) 3px 7px);
}
/* Goldener Doppelrahmen ums ganze Brett */
#screen-game.active::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 3px solid #7d5e22;
  border-radius: 16px;
  box-shadow: inset 0 0 0 1.5px #e7c977,
              inset 0 0 28px rgba(0,0,0,.45),
              0 0 0 1.5px #e7c977;
  pointer-events: none;
  z-index: 4;
}
/* Statusleiste als Pergament-Banner */
#game-status-bar {
  background: linear-gradient(#efe4c8, #e1d0a8);
  color: #3d2c12;
  border: 2px solid #c8a24c;
  border-radius: 12px;
  margin: 6px 8px 2px;
  padding: .55rem 1.1rem;
  box-shadow: inset 0 0 0 1px rgba(125,94,34,.35),
              inset 0 1px 0 rgba(255,255,255,.5);
  font-family: Georgia, "Times New Roman", serif;
  position: relative;
  z-index: 6;
}
#game-status-bar strong       { color: #2c2008; font-weight: 700; }
#game-status-bar #my-score,
#game-status-bar #opp-score   { color: #6b4f12; }
#game-status-bar #turn-counter{ color: #6b5326; font-weight: 700; }
#game-status-bar #turn-timer  { color: #2c5818; font-weight: 700; }
#game-status-bar #game-status { color: #5a3a12; font-style: italic; }
/* Buttons in der Leiste an den Gold-Look angleichen */
#game-status-bar .btn {
  background: rgba(125,94,34,.12);
  border: 1px solid #b08a3a;
  color: #3d2c12;
}
#game-status-bar .btn:hover   { background: rgba(125,94,34,.24); }
#game-status-bar .btn-danger  { border-color: #b0563a; color: #7a2e16; }
/* Spielbereich + Hand hebt sich leicht vom Holz ab, bleibt aber im Rahmen */
#game-main, #hand-area { position: relative; z-index: 6; }

/* ════════════════════════════════════════════════════════════════
   LOBBY / HOME im Garten-Look (Holz, Pergament-Kopf, Gold-Panels)
   ════════════════════════════════════════════════════════════════ */
#screen-lobby.active {
  position: relative;
  background:
    radial-gradient(ellipse 120% 80% at 50% -10%, #5a3f24 0%, #3a2715 48%, #261a0c 100%),
    repeating-linear-gradient(90deg, rgba(0,0,0,.05) 0 3px, rgba(255,255,255,.012) 3px 7px);
}
.lobby-header {
  background: linear-gradient(#efe4c8, #e1d0a8);
  border-bottom: 3px solid #c8a24c;
  box-shadow: inset 0 -1px 0 rgba(125,94,34,.4);
  font-family: Georgia, "Times New Roman", serif;
  position: relative;
  z-index: 2;
}
.lobby-header span      { color: #3d2c12; }
#lobby-username         { color: #5a3a12; font-weight: 700; }
#lobby-elo              { color: #7a5a14; }
#lobby-rank             { color: #6b5326; }
.lobby-header .btn {
  background: rgba(125,94,34,.14);
  border: 1px solid #b08a3a;
  color: #3d2c12;
}
.lobby-header .btn:hover { background: rgba(125,94,34,.26); }

.lobby-grid { position: relative; z-index: 1; }
.panel {
  background: #2f2114;
  border: 1.5px solid #7d5e22;
  box-shadow: inset 0 0 0 1px rgba(231,201,119,.18), 0 4px 14px rgba(0,0,0,.35);
}
.panel h2 {
  color: #e7c977;
  font-family: Georgia, "Times New Roman", serif;
  border-bottom: 1px solid rgba(231,201,119,.25);
  padding-bottom: .4rem;
}
/* Primaer-Buttons (Spielen/Decks) im Gold-Grün-Look */
.panel .btn-primary {
  background: linear-gradient(#5a8a3a, #4a7a30);
  border: 1px solid #e7c977;
  color: #f3ead2;
}
.panel .btn-primary:hover { background: linear-gradient(#67994a, #538636); }

/* ════════════════════════════════════════════════════════════════
   LOGIN-SCREEN im Garten-Look (Holz + Pergament-Karte mit Goldrahmen)
   ════════════════════════════════════════════════════════════════ */
#screen-login.active {
  background:
    radial-gradient(ellipse 120% 90% at 50% -10%, #5a3f24 0%, #3a2715 48%, #261a0c 100%),
    repeating-linear-gradient(90deg, rgba(0,0,0,.05) 0 3px, rgba(255,255,255,.012) 3px 7px);
}
#screen-login .auth-card {
  background: linear-gradient(#efe4c8, #e3d2aa);
  border: 3px solid #7d5e22;
  box-shadow: inset 0 0 0 1.5px #e7c977, 0 8px 30px rgba(0,0,0,.5);
  font-family: Georgia, "Times New Roman", serif;
}
#screen-login .auth-card h1 { color: #5a3a12; }
#screen-login .tab {
  background: rgba(125,94,34,.16);
  color: #6b5326;
}
#screen-login .tab.active {
  background: linear-gradient(#5a8a3a, #4a7a30);
  color: #f3ead2;
}
#screen-login .auth-card input {
  background: #fbf5e6;
  border: 1px solid #c8a24c;
  color: #3d2c12;
}
#screen-login .auth-card input::placeholder { color: #9a8556; }
#screen-login .auth-card .btn-primary {
  background: linear-gradient(#5a8a3a, #4a7a30);
  border: 1px solid #e7c977;
  color: #f3ead2;
}
#screen-login .auth-card .btn-primary:hover { background: linear-gradient(#67994a, #538636); }
#screen-login #link-forgot-pw { color: #7a5a14; }
