﻿:root {
  --bg: #07160f;
  --bg-2: #0d241a;
  --panel: #102a1f;
  --panel-2: #173325;
  --line: #2d4a3a;
  --gold: #d8b06a;
  --gold-soft: #f0cf95;
  --text: #f2ead9;
  --muted: #c9b895;
  --danger: #8d2d2d;
  --ok: #2d7f53;
  --shadow: 0 16px 50px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  color: var(--text);
  background: var(--bg);
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
}

.app-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 10% 10%, rgba(216, 176, 106, 0.15) 0, rgba(216, 176, 106, 0) 45%),
    radial-gradient(circle at 90% 90%, rgba(44, 93, 64, 0.5) 0, rgba(44, 93, 64, 0) 40%),
    linear-gradient(130deg, #06110c, #0f2d20 45%, #123625);
  z-index: -1;
}

.app-shell {
  width: min(1600px, 95vw);
  margin: 20px auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  background: linear-gradient(145deg, rgba(16, 42, 31, 0.95), rgba(9, 23, 17, 0.95));
  border: 1px solid rgba(216, 176, 106, 0.35);
  border-radius: 18px;
  padding: 18px 22px;
  box-shadow: var(--shadow);
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.3px;
}

h1 {
  font-size: 1.55rem;
}

.sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
}

.btn-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.session-meta {
  min-width: 230px;
  text-align: right;
  color: var(--gold-soft);
  font-size: 0.9rem;
  line-height: 1.5;
}

.layout {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1.65fr 1fr 1fr;
  gap: 14px;
  align-items: start;
}

.panel {
  background: linear-gradient(165deg, rgba(16, 42, 31, 0.95), rgba(10, 30, 21, 0.95));
  border: 1px solid rgba(216, 176, 106, 0.3);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.section-block {
  border: 1px solid rgba(216, 176, 106, 0.2);
  border-radius: 12px;
  background: rgba(23, 51, 37, 0.45);
  padding: 11px;
  margin-top: 12px;
}

.section-block h3 {
  margin-bottom: 10px;
  color: var(--gold-soft);
  font-size: 1rem;
}

.inline-form,
.action-form,
.small-actions,
.export-options,
.timer-row,
.winner-block {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  background: #0d1f16;
  color: var(--text);
  border: 1px solid #32503f;
  border-radius: 9px;
  padding: 7px 10px;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 58px;
  margin-top: 8px;
}

.inline-form input,
.inline-form select,
.action-form input,
.action-form select {
  flex: 1 1 140px;
}

.btn {
  border: 1px solid rgba(216, 176, 106, 0.45);
  background: linear-gradient(130deg, #1f3f2d, #173324);
  color: var(--text);
  border-radius: 9px;
  padding: 7px 12px;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn.gold {
  border-color: rgba(216, 176, 106, 0.8);
  background: linear-gradient(130deg, #5b4723, #735727);
  color: #fff5e2;
}

.btn.danger {
  background: linear-gradient(130deg, #552424, #6e2b2b);
  border-color: rgba(255, 160, 160, 0.5);
}

.player-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.player-card {
  border: 1px solid rgba(216, 176, 106, 0.3);
  border-radius: 12px;
  background: rgba(6, 18, 13, 0.62);
  padding: 10px;
}

.player-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.player-name {
  font-weight: 700;
  color: var(--gold-soft);
}

.player-metrics {
  margin-top: 8px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #e8dfcd;
}

.player-actions {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hand-card {
  margin-top: 8px;
  border: 1px solid rgba(216, 176, 106, 0.3);
  border-radius: 10px;
  padding: 10px;
  background: rgba(7, 21, 15, 0.62);
}

.hand-card.empty {
  color: var(--muted);
}

.hand-card .pot {
  margin-top: 4px;
  font-size: 1.25rem;
  color: var(--gold-soft);
  font-weight: 700;
}

.winner-block {
  margin-top: 10px;
  flex-direction: column;
}

.winner-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: rgba(7, 21, 15, 0.6);
  border: 1px solid #34513f;
  border-radius: 8px;
  padding: 8px;
}

.winner-selector label {
  display: flex;
  gap: 4px;
  align-items: center;
  font-size: 0.9rem;
}

.toggle {
  display: flex;
  gap: 8px;
  align-items: center;
}

.timer-row {
  justify-content: space-between;
  align-items: center;
}

.timer-display {
  min-width: 95px;
  text-align: center;
  padding: 8px 10px;
  border: 1px solid rgba(216, 176, 106, 0.6);
  border-radius: 9px;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold-soft);
  background: rgba(9, 18, 13, 0.8);
}

.overview-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.metric-card {
  border-radius: 10px;
  border: 1px solid rgba(216, 176, 106, 0.27);
  padding: 8px;
  background: rgba(6, 19, 14, 0.62);
}

.metric-title {
  color: var(--muted);
  font-size: 0.78rem;
}

.metric-value {
  margin-top: 4px;
  color: var(--gold-soft);
  font-size: 1.13rem;
  font-weight: 700;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.log-list {
  margin-top: 8px;
  max-height: 320px;
  overflow: auto;
  border: 1px solid rgba(216, 176, 106, 0.2);
  border-radius: 10px;
  background: rgba(6, 18, 13, 0.62);
}

.log-item {
  border-bottom: 1px dashed rgba(216, 176, 106, 0.18);
  padding: 8px;
  font-size: 0.84rem;
  line-height: 1.4;
}

.log-time {
  color: var(--muted);
  font-size: 0.76rem;
}

.action-row {
  border: 1px solid rgba(216, 176, 106, 0.2);
  border-radius: 8px;
  padding: 6px;
  margin-top: 6px;
}

.action-row strong {
  color: var(--gold-soft);
}

.action-row .inline {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

th,
td {
  border: 1px solid rgba(216, 176, 106, 0.22);
  padding: 6px;
  text-align: left;
}

th {
  color: var(--gold-soft);
  background: rgba(23, 51, 37, 0.8);
}

.floating-log {
  position: sticky;
  top: 10px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: grid;
  place-items: center;
  z-index: 20;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(460px, 92vw);
  background: #0e2419;
  border: 1px solid rgba(216, 176, 106, 0.35);
  border-radius: 12px;
  padding: 14px;
}

.modal-card.wide {
  width: min(1050px, 96vw);
}

#pdfPreviewFrame {
  margin-top: 10px;
  width: 100%;
  height: min(72vh, 780px);
  border: 1px solid rgba(216, 176, 106, 0.3);
  background: #fff;
}

.modal-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.empty-state {
  color: var(--muted);
  font-size: 0.88rem;
  padding: 10px;
}

@media (max-width: 1260px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .floating-log {
    position: static;
  }

  .session-meta {
    text-align: left;
  }

  .topbar {
    flex-direction: column;
  }
}
