:root {
  --green: #173d2a;
  --green2: #245b3d;
  --gold: #dfad3e;
  --paper: #f3f0e8;
  --line: #ded9ca;
  --muted: #6f766f;
  --card: #fffef9;
  --red: #a5473d;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background:
    radial-gradient(circle at 90% 0, #e8dfc5, transparent 32rem), var(--paper);
  color: #142019;
  font:
    16px system-ui,
    -apple-system,
    sans-serif;
}
button,
input,
select {
  font: inherit;
}
.shell {
  width: min(1160px, calc(100% - 32px));
  margin: auto;
  padding-bottom: 40px;
}
.top {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}
.logo {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--green);
  color: var(--gold);
  font-size: 24px;
}
.brand b {
  display: block;
  font: 700 21px Georgia;
}
.brand small {
  color: var(--muted);
}
.actions {
  display: flex;
  gap: 7px;
}
.actions select,
.actions button {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffc;
  padding: 0 12px;
  font-weight: 750;
}
.actions button {
  width: 44px;
  padding: 0;
  cursor: pointer;
}
.actions .add {
  background: var(--green);
  color: white;
  border: 0;
  font-size: 24px;
}
.balances {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 14px;
  border-radius: 22px;
  background: var(--green);
}
.balance {
  padding: 14px;
  border-radius: 15px;
  background: #ffffff0d;
  color: white;
}
.player-name {
  display: flex;
  align-items: center;
  gap: 8px;
}
.avatar {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: white;
  font-weight: 850;
  box-shadow: inset 0 0 0 1px #00000012;
}
.avatar.player-0 {
  background: #d95b52;
}
.avatar.player-1 {
  background: #397fbd;
}
.avatar.player-2 {
  background: #b68520;
}
.avatar.player-3 {
  background: #7659ad;
}
.balance small,
.balance strong {
  display: block;
}
.balance small {
  color: #d8e2db;
}
.balance strong {
  font-size: 20px;
  margin-top: 3px;
}
.positive {
  color: #63c984 !important;
}
.negative {
  color: #ef7f73 !important;
}
.tabs {
  display: flex;
  width: max-content;
  margin: 22px auto 18px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff9;
}
.tabs button {
  border: 0;
  background: none;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.tabs .active {
  background: var(--green);
  color: white;
}
.grid {
  display: grid;
  grid-template-columns: 1fr 330px;
  gap: 18px;
  align-items: start;
}
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 24px;
  box-shadow: 0 12px 35px #483b2110;
}
.heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
}
.heading h1 {
  font: 700 28px Georgia;
  margin: 0;
}
.dealer {
  display: inline-block;
  margin-top: 7px;
  padding: 7px 10px;
  border-radius: 11px;
  background: #e9f2eb;
  color: var(--green);
  font-weight: 750;
}
.price {
  padding: 10px 13px;
  border-radius: 12px;
  background: #f7edcd;
  font-weight: 850;
}
.undo {
  display: block;
  margin: 9px 0 0 auto;
  border: 1px solid #d9b1aa;
  border-radius: 10px;
  background: #fff7f5;
  color: var(--red);
  padding: 7px 10px;
  cursor: pointer;
}
.label {
  font-weight: 800;
  margin: 24px 0 9px;
}
.type-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.type-grid button,
.player-grid button {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: white;
  padding: 12px 7px;
  font-weight: 750;
  cursor: pointer;
}
.player-grid button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}
.type-grid button small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}
.type-grid .selected,
.player-grid .selected {
  border-color: #4a9665;
  background: #e8f3eb;
}
.player-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.extras {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 20px;
}
.extras label {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  background: white;
}
.extras span {
  display: block;
  font-size: 12px;
  font-weight: 750;
}
.extras select {
  width: 100%;
  border: 0;
  background: transparent;
  margin-top: 5px;
  font-weight: 800;
}
.save {
  width: 100%;
  margin-top: 20px;
  border: 0;
  border-radius: 14px;
  background: var(--green);
  color: white;
  padding: 15px;
  font-weight: 850;
  cursor: pointer;
}
.game {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #ece8dd;
}
.game > i {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: #eeeade;
  font-style: normal;
  font-size: 12px;
  font-weight: 800;
}
.game strong,
.game small {
  display: block;
}
.game small {
  color: var(--muted);
}
.game .right {
  text-align: right;
}
.history .game {
  grid-template-columns: 34px 1fr auto 35px;
}
.type-summary {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin: 18px 0 22px;
}
.type-count {
  padding: 13px 8px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f2efe6;
  text-align: center;
}
.type-count small,
.type-count strong,
.type-count span {
  display: block;
}
.type-count small {
  color: var(--muted);
  font-weight: 750;
}
.type-count strong {
  margin: 3px 0 1px;
  color: var(--green);
  font-size: 24px;
}
.type-count span {
  color: var(--muted);
  font-size: 12px;
}
.trash {
  border: 0;
  background: none;
  color: var(--red);
  cursor: pointer;
}
.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.stat h2 {
  font: 700 21px Georgia;
  margin-top: 0;
}
.statnums {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: #f2efe6;
  border-radius: 13px;
  padding: 12px;
}
.statnums div {
  text-align: center;
}
.statnums strong,
.statnums small {
  display: block;
}
.empty {
  text-align: center;
  color: var(--muted);
  padding: 50px 10px;
}
.modal-bg {
  position: fixed;
  inset: 0;
  background: #0a120eaa;
  display: grid;
  place-items: center;
  padding: 15px;
  z-index: 5;
}
.modal {
  width: min(480px, 100%);
  background: var(--card);
  border-radius: 20px;
  padding: 23px;
}
.modal h2 {
  font: 700 23px Georgia;
  margin: 0 0 7px;
}
.modal p {
  color: var(--muted);
}
.names {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.names label span,
.field span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 750;
  margin-bottom: 4px;
}
.names input,
.field input {
  width: 100%;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.modal-actions button {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  padding: 10px 13px;
  font-weight: 750;
  cursor: pointer;
}
.modal-actions .primary {
  margin-left: auto;
  background: var(--green);
  color: white;
}
.modal-actions .danger {
  color: var(--red);
  border-color: #d9b1aa;
  background: #fff7f5;
}
#toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: #142019;
  color: white;
  border-radius: 12px;
  padding: 10px 15px;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
}
#toast.show {
  opacity: 1;
}
.loading {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--green);
  font-weight: 800;
}
@media (max-width: 850px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .balances {
    grid-template-columns: repeat(2, 1fr);
  }
  .type-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .player-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .type-summary {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 560px) {
  .shell {
    width: 100%;
    padding: 0 9px 30px;
  }
  .top {
    min-height: 74px;
  }
  .brand small {
    display: none;
  }
  .brand b {
    font-size: 16px;
  }
  .logo {
    width: 38px;
    height: 38px;
  }
  .actions select {
    max-width: 105px;
  }
  .actions button {
    width: 40px;
  }
  .balances {
    padding: 8px;
    gap: 6px;
  }
  .balance {
    padding: 10px;
  }
  .tabs {
    width: 100%;
    margin: 14px 0;
  }
  .tabs button {
    flex: 1;
    padding: 9px 5px;
    font-size: 13px;
  }
  .panel {
    padding: 16px;
  }
  .type-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .player-grid {
    grid-template-columns: 1fr 1fr;
  }
  .extras {
    grid-template-columns: 1fr 1fr;
  }
  .stats {
    grid-template-columns: 1fr;
  }
  .names {
    grid-template-columns: 1fr;
  }
  .type-summary {
    grid-template-columns: repeat(2, 1fr);
  }
}
/* Spielarten-Verwaltung */
.type-modal{width:min(650px,95vw);max-height:90vh;overflow-y:auto}
.type-list{display:grid;gap:8px;margin:18px 0}
.type-list-row{display:flex;align-items:center;gap:10px;padding:10px 12px;border:1px solid #344153;border-radius:10px}
.type-list-row>div{flex:1;display:grid;gap:3px}
.type-list-row small{opacity:.7}
.type-list-row button{cursor:pointer;padding:8px 12px;border-radius:8px}
.type-edit-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:15px 0}
.type-edit-grid .wide{grid-column:1/-1}
.type-edit-grid .field{display:grid;gap:5px}
.type-edit-grid input:not([type=checkbox]),.type-edit-grid select{width:100%;box-sizing:border-box;padding:10px;border-radius:8px;border:1px solid #576578;background:#172332;color:inherit}
.type-section{padding-top:10px;border-top:1px solid #344153}
.type-check{display:flex;align-items:center;gap:10px;font-weight:600}
.type-check input{width:19px;height:19px}
.settings-types{width:100%;margin:5px 0 18px;padding:13px;border-radius:10px;border:1px solid #53667c;text-align:left;cursor:pointer}
@media(max-width:520px){.type-edit-grid{grid-template-columns:1fr}.type-edit-grid .wide{grid-column:1}}

/* Eingabefelder der Spielarten-Verwaltung */
input, select, textarea {
  color: #ffffff;
  caret-color: #ffffff;
}

input::placeholder, textarea::placeholder {
  color: #aab4c0;
}

select option {
  color: #ffffff;
  background-color: #172333;
}

/* Tischauswahl oben rechts wieder lesbar */
header select,
.topbar select {
  color: #173d2b !important;
  background-color: #ffffff !important;
}

header select option,
.topbar select option {
  color: #173d2b !important;
  background-color: #ffffff !important;
}

/* Eingabefelder in Dialogfenstern */
dialog input,
dialog select,
dialog textarea,
.modal input,
.modal select,
.modal textarea {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  caret-color: #ffffff !important;
}

dialog select option,
.modal select option {
  color: #ffffff !important;
  background: #172333 !important;
}

/* Eingabefelder beim aktuellen Spiel */
input:not(dialog input):not(.modal input),
select:not(dialog select):not(.modal select) {
  color: #173d2b;
  -webkit-text-fill-color: #173d2b;
  caret-color: #173d2b;
}


.auth-card{max-width:420px;margin:10vh auto;padding:32px;border-radius:20px;background:#fff;color:#193528;box-shadow:0 10px 40px #0002}.auth-card h1{margin:0 0 12px}.auth-card label{display:block;margin:16px 0}.auth-card input{display:block;width:100%;padding:12px;margin-top:6px;border:1px solid #aaa;border-radius:8px}.auth-card button{padding:12px 24px;background:#176d43;color:white;border:0;border-radius:8px;cursor:pointer}#loginError{color:#a22}
