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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #1a2e1a;
  color: #f1f5f9;
  min-height: 100vh;
}

.screen { display: none; }
.screen.active {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 100vh; padding: 2rem 1rem;
}

/* ===================== SETUP ===================== */
.page-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 2rem 2.5rem 2.5rem;
  width: 100%; max-width: 480px;
}

.page-title { font-size: 1.5rem; font-weight: 700; color: #f1f5f9; margin-bottom: 0.25rem; }
.page-subtitle { font-size: 0.85rem; color: #64748b; margin-bottom: 1.75rem; }

.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; color: #94a3b8; margin-bottom: 0.4rem; }
.form-label .req { color: #ef4444; margin-left: 2px; }

.form-input {
  width: 100%; padding: 0.6rem 0.9rem;
  border: 1px solid #334155; border-radius: 8px;
  font-size: 0.95rem; color: #f1f5f9;
  background: #0f172a; outline: none;
  transition: border-color 0.15s; font-family: inherit;
}
.form-input:focus { border-color: #22c55e; }
.form-input.filled { background: #1a2e1a; border-color: #166534; }
.form-input::placeholder { color: #475569; }

.toggle-group {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 0.9rem; border: 1px solid #334155;
  border-radius: 8px; margin-bottom: 1.25rem; background: #0f172a;
}
.toggle-text .toggle-label { font-size: 0.9rem; font-weight: 600; color: #e2e8f0; }
.toggle-text .toggle-hint { font-size: 0.75rem; color: #64748b; margin-top: 0.1rem; }
.toggle { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: #334155; border-radius: 24px; cursor: pointer; transition: background 0.2s; }
.toggle-slider:before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #94a3b8; border-radius: 50%; transition: transform 0.2s; }
.toggle input:checked + .toggle-slider { background: #16a34a; }
.toggle input:checked + .toggle-slider:before { background: white; transform: translateX(20px); }

.btn-row { display: flex; gap: 0.75rem; margin-top: 1.5rem; justify-content: flex-end; }
.btn-submit { padding: 0.6rem 1.75rem; background: #16a34a; color: white; border: none; border-radius: 8px; font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: background 0.15s; font-family: inherit; }
.btn-submit:hover { background: #15803d; }
.btn-cancel { padding: 0.6rem 1.25rem; background: transparent; color: #94a3b8; border: 1px solid #334155; border-radius: 8px; font-size: 0.95rem; cursor: pointer; font-family: inherit; }
.btn-cancel:hover { background: #1e293b; }

.info-box { background: #1a2e1a; border: 1px solid #166534; border-radius: 8px; padding: 0.75rem 1rem; font-size: 0.85rem; color: #4ade80; margin-bottom: 1rem; word-break: break-all; }

/* ===================== 404 ===================== */
#screen-404 { justify-content: center; }
.error-card { background: #1e293b; border: 1px solid #334155; border-radius: 12px; padding: 3rem 2.5rem; width: 100%; max-width: 520px; text-align: center; }
.error-code { font-size: 5rem; font-weight: 700; color: #22c55e; line-height: 1; margin-bottom: 0.25rem; }
.error-subtitle { font-size: 0.85rem; color: #475569; font-weight: 500; margin-bottom: 2rem; text-transform: uppercase; letter-spacing: 0.06em; }
.error-msgs { display: flex; flex-direction: column; gap: 0.65rem; }
.error-msg { padding: 0.8rem 1rem; border-radius: 8px; font-size: 0.88rem; font-weight: 500; text-align: left; background: #1a2e1a; color: #dcfce7; border-left: 3px solid #16a34a; line-height: 1.4; }

/* ===================== GAME ===================== */
#screen-game {
  justify-content: flex-start;
  padding: 0.75rem 1rem 1.5rem;
  align-items: center; gap: 0.5rem;
}

.game-topbar {
  width: 100%; max-width: 960px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 1rem; background: #1e293b;
  border: 1px solid #334155; border-radius: 10px;
}
.topbar-title { font-size: 1rem; font-weight: 700; color: #f1f5f9; }
.topbar-id { font-size: 0.72rem; color: #475569; margin-top: 1px; }
.topbar-right { display: flex; gap: 0.5rem; align-items: center; }
.badge-player { font-size: 0.78rem; background: #1a2e1a; color: #4ade80; border: 1px solid #166534; padding: 0.25rem 0.65rem; border-radius: 20px; font-weight: 600; }
.badge-master { font-size: 0.72rem; background: #16a34a; color: white; padding: 0.22rem 0.55rem; border-radius: 20px; font-weight: 600; }
.btn-tickets-sm { padding: 0.3rem 0.75rem; background: #16a34a; color: white; border: none; border-radius: 6px; font-size: 0.78rem; font-weight: 600; cursor: pointer; display: none; font-family: inherit; }

.session-link-bar {
  width: 100%; max-width: 960px;
  background: #1a2e1a; border: 1px solid #166534;
  border-radius: 8px; padding: 0.45rem 1rem;
  display: none; align-items: center; gap: 0.5rem;
}
.session-link-bar.visible { display: flex; }
.session-link-text { font-size: 0.78rem; color: #4ade80; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.btn-copy-link { padding: 0.25rem 0.65rem; background: #16a34a; color: white; border: none; border-radius: 6px; font-size: 0.75rem; font-weight: 600; cursor: pointer; white-space: nowrap; font-family: inherit; }
.btn-copy-link:hover { background: #15803d; }
.btn-add-bot { padding: 0.22rem 0.5rem; background: transparent; color: #4ade80; border: 1px solid #166634; border-radius: 6px; font-size: 0.85rem; line-height: 1; cursor: pointer; font-family: inherit; transition: all 0.15s; }
.btn-add-bot:hover { background: #16a34a; color: white; }
.btn-del-sessions { padding: 0.22rem 0.5rem; background: transparent; color: #f87171; border: 1px solid #7f1d1d; border-radius: 6px; font-size: 0.85rem; line-height: 1; cursor: pointer; font-family: inherit; transition: all 0.15s; }
.btn-del-sessions:hover { background: #7f1d1d; color: white; }

/* ===================== POKER TABLE ===================== */
.game-area {
  width: 100%; max-width: 960px;
  display: flex; gap: 1rem; align-items: center;
}

.table-wrap {
  flex: 1; position: relative; height: 520px;
  display: flex; align-items: center; justify-content: center;
}

.tp-slot {
  position: absolute; top: 40px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  z-index: 2; white-space: nowrap;
}

.tp-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: #14532d; border: 2px solid #4ade80;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 700; color: #86efac; letter-spacing: 1px;
}

.tp-label { font-size: 0.6rem; color: #4ade80; letter-spacing: 0.5px; font-weight: 600; opacity: 0.7; }

.felt-table {
  width: 400px; height: 240px;
  background: #14532d; border: 4px solid #166634;
  border-radius: 50% / 30%; outline: 8px solid #0a1f0a;
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
}

.round-label { font-size: 0.65rem; color: #4ade80; font-weight: 700; text-transform: uppercase; letter-spacing: 2px; }
.round-title { font-size: 0.88rem; font-weight: 600; color: #dcfce7; line-height: 1.4; text-align: center; padding: 0 1rem; max-width: 240px; }
.ticket-nav { display: flex; gap: 0.3rem; justify-content: center; flex-wrap: wrap; }
.ticket-dot { width: 6px; height: 6px; border-radius: 50%; background: #166534; transition: background 0.15s; }
.ticket-dot.active { background: #22c55e; }
.ticket-dot.done { background: #4ade80; }

.countdown { font-size: 3.5rem; font-weight: 700; color: #dcfce7; line-height: 1; display: none; }
@keyframes pop { 0% { transform: scale(0.4); opacity: 0; } 60% { transform: scale(1.3); } 100% { transform: scale(1); opacity: 1; } }
.countdown.show { display: block; animation: pop 0.4s ease; }

.vote-num { font-size: 2rem; font-weight: 700; color: #dcfce7; line-height: 1; }
.vote-lbl { font-size: 0.72rem; color: #86efac; }
.all-voted-msg { font-size: 0.78rem; font-weight: 700; color: #052e16; background: #4ade80; border-radius: 6px; padding: 0.3rem 0.75rem; display: none; }

.btn-reveal { padding: 0.55rem 1.5rem; background: #22c55e; color: #052e16; border: none; border-radius: 8px; font-size: 0.85rem; font-weight: 700; cursor: pointer; transition: background 0.15s; font-family: inherit; display: none; }
.btn-reveal:hover { background: #16a34a; color: white; }
.btn-next { padding: 0.55rem 1.5rem; background: #1e293b; color: #dcfce7; border: 1px solid #334155; border-radius: 8px; font-size: 0.85rem; font-weight: 600; cursor: pointer; font-family: inherit; display: none; }
.btn-next:hover { background: #334155; }
.waiting-msg { font-size: 0.82rem; color: #86efac; }

/* Seats */
.seat {
  position: absolute;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer; z-index: 2;
}

.seat-card {
  width: 46px; height: 64px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; font-weight: 700; transition: transform 0.15s;
}

.seat-card.open { background: #1e293b; border: 2px dashed #334155; }
.seat-card.open:hover { border-color: #22c55e; transform: translateY(-3px); }

.seat-card.taken, .seat-card.taken-me {
  background: #16a34a;
  background-image: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(255,255,255,0.12) 5px, rgba(255,255,255,0.12) 10px);
  border: 2px solid #22c55e; position: relative; overflow: hidden;
}
.seat-card.taken-me { outline: 3px solid #4ade80; outline-offset: 2px; }
.seat-card.taken::after, .seat-card.taken-me::after {
  content: 'SIMPL'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; color: rgba(255,255,255,0.70);
  transform: rotate(-45deg); letter-spacing: 2px; pointer-events: none;
}

.seat-card.taken-empty { background: transparent; border: 2px solid #22c55e; }
.seat-card.taken-me-empty { background: transparent; border: 2px solid #4ade80; outline: 3px solid #4ade80; outline-offset: 2px; box-shadow: 0 0 10px rgba(74,222,128,0.3); }
.seat-card.revealed-card { background: #1e293b; border: 2px solid #22c55e; color: #4ade80; font-size: 1.3rem; }

/* FIX: Namen nicht abschneiden */
.seat-name {
  font-size: 0.68rem; font-weight: 600;
  color: #94a3b8; text-align: center;
  white-space: nowrap;
}
.seat-name.me { color: #4ade80; font-weight: 700; }
.seat-name.taken-name { color: #86efac; font-weight: 600; }
.you-badge { font-size: 0.55rem; font-weight: 800; color: #4ade80; letter-spacing: 1.5px; background: rgba(74,222,128,0.15); border: 1px solid #4ade80; border-radius: 4px; padding: 1px 5px; margin-top: 2px; }

/* Master console */
.master-console {
  display: none; flex-direction: column; gap: 0.75rem;
  width: 200px; min-width: 200px; max-height: 520px;
  background: #1e293b;
  border: 1px solid #334155; border-radius: 10px; padding: 1rem;
  overflow: hidden;
}
.master-console.visible { display: flex; }
.console-section { display: flex; flex-direction: column; gap: 0.5rem; }
.console-row { display: flex; justify-content: space-between; align-items: center; }
.console-label { font-size: 0.6rem; color: #475569; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.console-value { font-size: 1rem; font-weight: 700; color: #f1f5f9; }
.console-value.small { font-size: 0.82rem; }
.console-divider { border: none; border-top: 1px solid #334155; margin: 0; }
.console-phase-label { font-size: 0.82rem; font-weight: 700; color: #4ade80; }
.console-phase-timer { font-size: 1.6rem; font-weight: 800; color: #f1f5f9; letter-spacing: 1px; font-variant-numeric: tabular-nums; }

/* Ticket Log Table */
.ticket-log-table { width: 100%; border-collapse: collapse; font-size: 0.7rem; }
.ticket-log-table thead th { color: #475569; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; padding: 0 2px 4px; text-align: left; border-bottom: 1px solid #334155; }
.ticket-log-table tbody tr:nth-child(even) { background: #0f172a; }
.ticket-log-table td { padding: 3px 2px; vertical-align: middle; }
.log-ticket { color: #94a3b8; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-time { color: #64748b; font-variant-numeric: tabular-nums; text-align: right; }
.log-result { color: #4ade80; font-weight: 700; text-align: right; }
.console-avg { font-size: 0.7rem; color: #475569; margin-top: 4px; text-align: right; }
.console-total-sp { font-size: 0.8rem; color: #4ade80; font-weight: 700; margin-top: 2px; text-align: right; }

/* Card picker */
.card-picker { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; min-width: 100px; }
.card-picker-label { font-size: 0.65rem; color: #475569; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 2px; }
.cards-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; }
.card {
  width: 46px; height: 62px; border: 1.5px solid #166534; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem; font-weight: 700; color: #4ade80; background: #0f172a;
  cursor: pointer; transition: all 0.15s; user-select: none;
}
.card:hover { background: #1a2e1a; transform: translateY(-2px); border-color: #22c55e; }
.card.selected { background: #16a34a; color: white; transform: translateY(-2px); border-color: #22c55e; }
.card.special { font-size: 1.4rem; position: relative; }
.card.special[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; bottom: 110%; left: 50%; transform: translateX(-50%);
  background: #1e293b; color: #4ade80; border: 1px solid #166534;
  border-radius: 6px; padding: 4px 8px; font-size: 0.7rem; font-weight: 600;
  white-space: nowrap; pointer-events: none; z-index: 10;
}
.card.locked {
  background: #16a34a;
  background-image: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(255,255,255,0.12) 5px, rgba(255,255,255,0.12) 10px);
  border-color: #22c55e; color: transparent; cursor: default; position: relative; overflow: hidden;
}
.card.locked::after {
  content: 'SIMPL'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 8px; font-weight: 700; color: rgba(255,255,255,0.70);
  transform: rotate(-45deg); letter-spacing: 2px; pointer-events: none;
}

/* Confirm modal */
.confirm-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 200; align-items: center; justify-content: center; }
.confirm-overlay.open { display: flex; }
.confirm-box { background: #1e293b; border: 1px solid #334155; border-radius: 12px; padding: 2rem; text-align: center; max-width: 320px; width: 90%; }
.confirm-title { font-size: 1.1rem; font-weight: 700; color: #f1f5f9; margin-bottom: 0.5rem; }
.confirm-sub { font-size: 0.85rem; color: #64748b; margin-bottom: 1.5rem; }
.confirm-btns { display: flex; gap: 0.75rem; justify-content: center; }
.confirm-yes { padding: 0.6rem 1.5rem; background: #16a34a; color: white; border: none; border-radius: 8px; font-size: 0.95rem; font-weight: 600; cursor: pointer; font-family: inherit; }
.confirm-yes:hover { background: #15803d; }
.confirm-no { padding: 0.6rem 1.25rem; background: transparent; color: #94a3b8; border: 1px solid #334155; border-radius: 8px; font-size: 0.95rem; cursor: pointer; font-family: inherit; }
.confirm-no:hover { background: #334155; }

/* Ticket modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 100; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: #1e293b; border: 1px solid #334155; border-radius: 12px; padding: 2rem; width: 90%; max-width: 520px; max-height: 80vh; overflow-y: auto; }
.modal-title { font-size: 1.1rem; font-weight: 700; color: #f1f5f9; margin-bottom: 1.25rem; }
.modal textarea { width: 100%; min-height: 140px; padding: 0.75rem; border: 1px solid #334155; border-radius: 8px; font-size: 0.9rem; resize: vertical; outline: none; font-family: inherit; color: #f1f5f9; background: #0f172a; }
.modal textarea:focus { border-color: #22c55e; }
.modal-hint { font-size: 0.78rem; color: #475569; margin: 0.4rem 0 1rem; }
.upload-area { border: 2px dashed #166534; border-radius: 8px; padding: 1.5rem; text-align: center; cursor: pointer; transition: background 0.15s; margin-bottom: 1rem; }
.upload-area:hover { background: #1a2e1a; }
.upload-area p { font-size: 0.9rem; color: #4ade80; font-weight: 600; }
.upload-area span { font-size: 0.78rem; color: #475569; }
.ai-status { font-size: 0.85rem; color: #4ade80; font-weight: 600; text-align: center; padding: 0.5rem; display: none; }
.ticket-item { padding: 0.5rem 0.75rem; background: #1a2e1a; border-radius: 6px; font-size: 0.83rem; color: #dcfce7; margin-bottom: 0.4rem; border-left: 3px solid #16a34a; font-weight: 500; }
.modal-label { display: block; font-size: 0.85rem; font-weight: 600; color: #94a3b8; margin-bottom: 0.4rem; }

/* Welcome Screen */
.welcome-session-box { background: #0f172a; border: 1px solid #1e3a2e; border-radius: 10px; padding: 0.85rem 1rem; margin-bottom: 1rem; }
.welcome-session-label { font-size: 0.6rem; color: #475569; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; margin-bottom: 4px; }
.welcome-session-name { font-size: 1.1rem; font-weight: 700; color: #f1f5f9; }
.welcome-session-host { font-size: 0.78rem; color: #4ade80; margin-top: 2px; }
.welcome-team-box { background: #0f172a; border: 1px solid #1e3a2e; border-radius: 10px; padding: 0.85rem 1rem; margin-bottom: 1.5rem; }
.welcome-team-label { font-size: 0.6rem; color: #475569; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; margin-bottom: 8px; }
.welcome-team-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.welcome-pill { font-size: 0.75rem; background: #1e293b; border: 1px solid #334155; border-radius: 20px; padding: 3px 10px; color: #94a3b8; }

/* Start Voting Button */
.btn-start-voting { padding: 0.55rem 1.5rem; background: #16a34a; color: white; border: none; border-radius: 8px; font-size: 0.85rem; font-weight: 700; cursor: pointer; font-family: inherit; display: none; transition: background 0.15s; }
.btn-start-voting:hover { background: #15803d; }

/* Consensus Panel */
.consensus-panel {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
  padding: 0.5rem 1rem;
  width: 100%;
  max-width: 960px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
}
.consensus-input { padding: 0.4rem 0.75rem; background: #0f172a; border: 1px solid #334155; border-radius: 7px; color: #f1f5f9; font-size: 0.85rem; font-family: inherit; outline: none; width: 150px; text-align: center; }
.consensus-input:focus { border-color: #22c55e; }
.btn-consensus { padding: 0.4rem 1rem; background: #16a34a; color: white; border: none; border-radius: 7px; font-size: 0.82rem; font-weight: 700; cursor: pointer; font-family: inherit; }
.btn-consensus:hover { background: #15803d; }

/* Consensus result display on table */
.consensus-result { font-size: 1.4rem; font-weight: 800; color: #4ade80; text-align: center; }
