:root {
  --bg: #1f2229;
  --panel: #2a2f38;
  --panel-2: #22262d;
  --text: #eef3f8;
  --muted: #9eabbc;
  --ok: #31bf5a;
  --warn: #d7a31f;
  --bad: #d14a4a;
  --accent: #5eb3ff;
}

* { box-sizing: border-box; }
.hidden { display: none !important; }
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: radial-gradient(circle at 15% 10%, #303745, var(--bg) 35%);
  color: var(--text);
}
body.pwa-mode {
  background: #171a20;
}

.app { padding: 16px; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}
body.pwa-mode .topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 10px 0;
  background: rgba(31, 34, 41, 0.94);
  backdrop-filter: blur(10px);
}
.topbar h1 { margin: 0; font-size: 1.4rem; }
.session-info {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.save-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: end;
}
.top-field {
  display: grid;
  gap: 4px;
}
.top-field span {
  color: var(--muted);
  font-size: 0.72rem;
  padding-left: 2px;
}
.load-field select {
  min-width: 260px;
}
.lineup-status {
  flex-basis: 100%;
  min-height: 18px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: right;
}
.lineup-status.ok {
  color: #8ff9ab;
}
.lineup-status.bad {
  color: #ff9d9d;
}
input, select, button {
  background: var(--panel);
  color: var(--text);
  border: 1px solid #3a404b;
  border-radius: 8px;
  padding: 8px 10px;
}
button { cursor: pointer; }
button.secondary {
  background: transparent;
  border-color: #586273;
}
button.danger {
  border-color: rgba(209, 74, 74, 0.65);
  color: #ffb0b0;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 25% 20%, rgba(94, 179, 255, 0.18), transparent 30%),
    linear-gradient(145deg, #10141b, #232832 58%, #15191f);
}
.password-view {
  position: fixed;
  inset: 0;
  z-index: 100;
  background:
    radial-gradient(circle at 70% 10%, rgba(94, 179, 255, 0.2), transparent 30%),
    rgba(10, 13, 18, 0.82);
  backdrop-filter: blur(8px);
}
.login-card {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid #384251;
  border-radius: 22px;
  background: rgba(31, 36, 45, 0.92);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}
.password-card {
  position: relative;
  width: min(460px, 100%);
}
.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  border-color: #4a5567;
  background: rgba(255, 255, 255, 0.06);
  font-size: 1.25rem;
}
.login-card h1 {
  margin: 0 0 8px;
}
.login-card p {
  margin: 0 0 24px;
  color: var(--muted);
}
.login-card label {
  display: block;
  margin: 14px 0 6px;
  color: #cbd6e4;
  font-size: 0.9rem;
}
.login-card input,
.login-card select,
.login-card button {
  width: 100%;
}
.login-card button {
  margin-top: 18px;
  background: linear-gradient(135deg, #3278d8, #49a1ff);
  border: 0;
  font-weight: 700;
}
.login-error {
  min-height: 20px;
  margin-top: 12px;
  color: #ff9d9d;
  font-size: 0.9rem;
}

.layout {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 300px 1fr 260px;
  gap: 14px;
}

.pool, .metrics {
  background: var(--panel-2);
  border: 1px solid #343a45;
  border-radius: 12px;
  padding: 12px;
}
.pool h2, .metrics h2 { margin-top: 0; font-size: 1rem; }
.person-pool { display: grid; gap: 8px; max-height: 72vh; overflow: auto; }
.person-pool.return-drop {
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
  background: rgba(94, 179, 255, 0.08);
}

.person-card {
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #3a404b;
  background: var(--panel);
}
.person-card.left-only {
  background: linear-gradient(90deg, rgba(38, 110, 255, 0.35), rgba(38, 110, 255, 0.2));
}
.person-card.right-only {
  background: linear-gradient(90deg, rgba(215, 55, 55, 0.2), rgba(215, 55, 55, 0.35));
}
.person-card.both {
  background: linear-gradient(90deg, rgba(38, 110, 255, 0.34) 0 50%, rgba(215, 55, 55, 0.34) 50% 100%);
}
.person-card[draggable="true"] { cursor: grab; }
.person-name { font-weight: 600; }
.person-meta {
  margin-top: 4px;
  font-size: 0.83rem;
  color: var(--muted);
}
.person-meta.hidden {
  display: none;
}
.cap-list {
  margin-top: 6px;
  font-size: 0.74rem;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.cap {
  border: 1px solid #4e5664;
  border-radius: 999px;
  padding: 2px 6px;
}

.boat-section {
  background: #171a20;
  border: 1px solid #313744;
  border-radius: 12px;
  padding: 10px;
}
.boat-wrapper {
  position: relative;
  height: 800px;
}

.boat-area {
  position: absolute;
  left: 50%;
  top: 20px;
  transform: translateX(-50%);
  width: 82px;
  height: 760px;
  background-image: url("./Drachenboot.svg");
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
}
.boat-area::before, .boat-area::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
.boat-area::before {
  display: none;
}
.boat-area::after {
  display: none;
}

.cg-marker {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #31bf5a;
  border: 2px solid #f4fff7;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px rgba(49, 191, 90, 0.8);
  z-index: 2;
}

.seat-column {
  position: absolute;
  inset-block: 0;
  width: 220px;
}
.seat-column.left { left: 50%; transform: translateX(-275px); }
.seat-column.right { left: 50%; transform: translateX(55px); }

.seat, .special-seat {
  height: 32px;
  min-height: 32px;
  border-radius: 8px;
  border: 2px dashed #4d5563;
  background: #1f2530;
  padding: 2px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
}
.seat {
  position: absolute;
  width: 100%;
  transform: translateY(-50%);
}
.seat.left-seat {
  background: rgba(38, 110, 255, 0.2);
}
.seat.right-seat {
  background: rgba(215, 55, 55, 0.2);
}

.special-seat {
  position: absolute;
  width: 220px;
  height: 32px;
  left: 50%;
  transform: translate(55px, -50%);
  z-index: 3;
}

.seat.valid-drop, .special-seat.valid-drop {
  border-color: var(--ok);
  background: rgba(49, 191, 90, 0.12);
}
.seat.invalid-drop, .special-seat.invalid-drop {
  border-color: var(--bad);
  background: rgba(209, 74, 74, 0.12);
}

.occupant {
  width: 100%;
  border: 1px solid #4b5564;
  border-radius: 6px;
  padding: 4px 5px;
  color: var(--text);
  font-size: 0.76rem;
  line-height: 1.15;
  cursor: grab;
}
.occupant:active {
  cursor: grabbing;
}
.occupant.left-only {
  background: linear-gradient(90deg, rgba(38, 110, 255, 0.55), rgba(38, 110, 255, 0.32));
}
.occupant.right-only {
  background: linear-gradient(90deg, rgba(215, 55, 55, 0.32), rgba(215, 55, 55, 0.55));
}
.occupant.both {
  background: linear-gradient(90deg, rgba(38, 110, 255, 0.52) 0 50%, rgba(215, 55, 55, 0.52) 50% 100%);
}
.occupant.neutral {
  background: #2a313d;
}

.metric {
  border: 1px solid #37404d;
  background: var(--panel);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
}
.metric label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
}
.value { margin-top: 4px; font-size: 1.2rem; }
.state {
  margin-top: 6px;
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
}
.state.ok { background: rgba(49, 191, 90, 0.16); color: #8ff9ab; }
.state.warn { background: rgba(215, 163, 31, 0.16); color: #ffd06d; }
.state.bad { background: rgba(209, 74, 74, 0.16); color: #ff9d9d; }

.password-form {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}
.password-form label {
  color: #cbd6e4;
  font-size: 0.9rem;
}
.password-form button {
  background: linear-gradient(135deg, #3278d8, #49a1ff);
  border: 0;
  font-weight: 700;
}
.password-message {
  min-height: 20px;
  margin-top: 10px;
  font-size: 0.88rem;
}
.password-message.ok {
  color: #8ff9ab;
}
.password-message.bad {
  color: #ff9d9d;
}

@media (max-width: 1300px) {
  .layout { grid-template-columns: 1fr; }
  .boat-wrapper { overflow-x: auto; }
}
