:root {
  color-scheme: dark;
  --bg: #34363f;
  --bg-elevated: #1a1d29;
  --bg-panel: #282a36;
  --bg-panel-strong: #303447;
  --bg-input: #1b2030;
  --bg-glass: rgba(40, 42, 54, 0.86);
  --bg-overlay: rgba(10, 12, 19, 0.8);
  --border: #44475a;
  --border-strong: #5f6480;
  --text: #f8f8f2;
  --text-muted: #c7cce0;
  --text-dim: #9ea7c7;
  --accent: #ff9f43;
  --accent-strong: #ffb86c;
  --accent-deep: #db7a16;
  --accent-soft: rgba(255, 159, 67, 0.16);
  --success: #0e7a29;
  --success-soft: rgba(80, 250, 123, 0.14);
  --danger: #ff6b81;
  --danger-soft: rgba(223, 28, 58, 0.14);
  --shadow: rgba(2, 6, 23, 0.45);
}

/* Team and Player label styles for Add Score modal and game list */
.team-a-label {
  color: var(--accent-strong);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 700;
  margin-right: 6px;
}
.team-b-label {
  color: var(--accent-strong);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 700;
  margin-right: 6px;
}
.player-label {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.1px;
  font-weight: 600;
  margin-right: 2px;
}
.result-win-label {
  color: var(--success);
  text-transform: uppercase;
  letter-spacing: 1.1px;
  font-weight: 600;
  margin-right: 2px;
}
.result-defeat-label {
  color: var(--danger);
  text-transform: uppercase;
  letter-spacing: 1.1px;
  font-weight: 600;
  margin-right: 2px;
}
.leaderboard-details-wrap {
  margin-top: 12px;
  margin-bottom: 2px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.leaderboard-details-section {
  margin-bottom: 2px;
  font-size: 14px;
  color: var(--text);
  font-weight: 400;
  letter-spacing: 0.5px;
}
.leaderboard-details-wins-box {
  background: var(--success-soft);
  border: 1px solid rgba(80, 250, 123, 0.34);
  border-radius: 6px;
  box-shadow: 0 4px 12px var(--shadow);
  padding: 8px 18px 10px 18px;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
  max-width: 100%;
  box-sizing: border-box;
}
.leaderboard-details-defeats-box {
  background: var(--danger-soft);
  border: 1px solid rgba(255, 107, 129, 0.34);
  border-radius: 6px;
  box-shadow: 0 4px 12px var(--shadow);
  padding: 8px 18px 10px 18px;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
  max-width: 100%;
  box-sizing: border-box;
}
.leaderboard-details-win-row,
.leaderboard-details-defeat-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
  margin-bottom: 4px;
  font-size: 15px;
}

#game-list .game-result-row {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-bottom: 12px;
  background: var(--bg);
  border: 1px solid rgba(95, 100, 128, 0.42);
  border-radius: 2px;
  box-shadow: 0 8px 18px rgba(2, 6, 23, 0.14);
}
#game-list .game-result-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
  background: var(--bg);
  border-bottom: 1px solid rgba(95, 100, 128, 0.3);
}
#game-list .game-result-meta.has-score-actions {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}
#game-list .game-result-category-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 4px;
  background: rgba(61, 67, 83, 0.92);
  color: #ffe0bb;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  justify-self: start;
}
#game-list .game-result-timestamp {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
  justify-self: end;
}
#game-list .game-result-meta.has-score-actions .game-result-timestamp {
  text-align: center;
  justify-self: center;
}
#game-list .game-result-timestamp-placeholder {
  min-width: 94px;
  min-height: 16px;
  visibility: hidden;
}
#game-list .game-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-self: end;
}
#game-list .game-result-action-button {
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 6px 10px;
  font-size: 12px;
  box-shadow: none;
  background: rgba(255, 184, 108, 0.18);
  color: #ffd8ad;
  border: 1px solid rgba(255, 184, 108, 0.38);
  border-radius: 3px;
  font-weight: 700;
}

#game-list .game-result-action-button:hover {
  background: rgba(255, 184, 108, 0.28);
  color: #fff3df;
}
#game-list .game-result-half {
  width: 100%;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
}
#game-list .winner-half {
  background: var(--bg);
  border-bottom: 1px solid rgba(95, 100, 128, 0.26);
}
#game-list .defeated-half {
  background: var(--bg);
}
#game-list .game-result-label-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
#game-list .game-result-label {
  font-weight: 600;
  margin-bottom: 0;
  font-size: 12px;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  opacity: 1;
}
#game-list .game-result-team-name {
  color: var(--text);
  font-weight: 700;
  letter-spacing: 1.2px;
}
#game-list .game-result-names {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
  margin: 0;
  padding: 0;
  width: 100%;
}
#game-list .game-result-player-item {
  min-width: 0;
  margin: 0;
}

#game-list .player-name-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 34px;
  padding: 8px 10px;
  margin: 0;
  color: #fffefa;
  border-radius: 2px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  text-align: center;
  line-height: 1.3;
}

#game-list .winner-half .game-result-label,
#game-list .winner-half .result-win-label {
  color: var(--success);
  font-weight: 700;
}

#game-list .defeated-half .game-result-label,
#game-list .defeated-half .result-defeat-label {
  color: var(--danger);
  font-weight: 700;
}

#game-list .winner-half .player-name-pill {
  border-color: rgba(44, 132, 84, 0.45);
  background: linear-gradient(
    180deg,
    rgba(43, 124, 74, 0.96),
    rgba(38, 128, 75, 0.98)
  );
}

#game-list .defeated-half .player-name-pill {
  border-color: rgba(150, 39, 50, 0.45);
  background: linear-gradient(
    180deg,
    rgba(204, 59, 73, 0.96),
    rgba(153, 39, 47, 0.98)
  );
}
/* Leaderboard Modal Styles */
#leaderboard-modal {
  z-index: 1002;
}
.modal-card.leaderboard-modal-card {
  width: 100%;
  max-width: 440px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  padding: 12px 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  box-shadow: 0 14px 30px var(--shadow);
}
.modal-card.leaderboard-modal-card h3 {
  color: var(--text);
  letter-spacing: 1.2px;
  font-weight: 500;
}

#leaderboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  margin-bottom: 12px;
  overflow-y: auto;
  max-height: 60vh;
  padding-right: 2px;
  width: 100%;
  max-width: none;
}
.leaderboard-player-item {
  background: rgba(19, 21, 31, 0.92);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 10px;
  color: var(--text);
  transition: box-shadow 0.2s;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}
.leaderboard-player-item:hover {
  box-shadow: 0 10px 20px var(--shadow);
}
.leaderboard-rank {
  font-weight: 400;
  margin-right: 8px;
  color: var(--text-dim);
  font-size: 14px;
  letter-spacing: 0.6px;
}
.leaderboard-player-name {
  font-weight: 400;
  margin-right: 8px;
  text-transform: uppercase;
  font-size: 14px;
  letter-spacing: 1px;
  color: var(--text);
}

.leaderboard-player-item .leaderboard-rank,
.leaderboard-player-item .leaderboard-player-name,
.leaderboard-player-item .leaderboard-details-section {
  font-weight: 400 !important;
}
.leaderboard-score {
  justify-self: end;
  font-size: 14px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  font-weight: 500;
}
.leaderboard-player-details {
  grid-column: 1 / -1;
  margin-top: 6px;
  font-size: 14px;
  background: rgba(20, 22, 32, 0.92);
  border-radius: 4px;
  padding: 6px 8px;
  border: 1px solid var(--border);
}
.leaderboard-player-details b {
  color: var(--text);
}
.leaderboard-player-details .win {
  color: var(--success);
}
.leaderboard-player-details .defeat {
  color: var(--danger);
}
* {
  padding: 0%;
  margin: 0%;
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  background: var(--bg);
  font-family: Inter, "Segoe UI", "Segoe UI Variable", system-ui, sans-serif;
  min-height: 100vh;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

body.game-page-bg {
  position: relative;
  /* background:
    radial-gradient(
      circle at 20% 0%,
      rgba(255, 184, 108, 0.14),
      transparent 28%
    ), */
  /* radial-gradient(
      circle at 80% 0%,
      rgba(255, 159, 67, 0.08),
      transparent 26%
    ), */
  /* linear-gradient(180deg, #161924 0%, #0f121a 100%); */
}

nav {
  background: rgba(72, 74, 83, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  text-align: center;
  font-size: 18px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  position: fixed;
  bottom: 0;
  width: 100%;
  z-index: 2000;
  border-top: 1px solid var(--border);
  box-shadow: 0 -12px 24px var(--shadow);
}

nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 10px;
  display: block;
  border-right: 1px solid var(--border);
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

nav a:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

nav a:last-child {
  border-right: none;
}
h2 {
  color: var(--text);
  font-size: 18px;
  padding: 10px;
  font-weight: 500;
  width: min(360px, 100%);
  margin: 0 auto;
  text-align: center;
}

.settings-page-title {
  color: var(--text);
}

input {
  width: 100%;
  padding: 10px;
  margin: 10px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--text);
}

input::placeholder {
  color: var(--text-dim);
}

button {
  width: 100%;
  padding: 10px;
  margin: 10px 0;
  border: 1px solid rgba(202, 146, 86, 0.45);
  /* border-radius: 10px; */
  background: linear-gradient(180deg, var(--accent-strong), var(--accent));
  color: #24170d;
  font-size: 16px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(255, 159, 67, 0.2);
}

button:hover {
  background: linear-gradient(180deg, #ffc487, #ffab56);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.list-toggle-button {
  width: auto;
  min-width: 0;
  margin: 4px 0 10px;
  display: block;
  padding: 5px 10px;
  font-size: 14px;

  background: rgba(255, 184, 108, 0.18);
  color: #ffd9b0;
  border: 1px solid rgba(255, 184, 108, 0.34);
  box-shadow: none;
}

.list-toggle-button:hover {
  background: rgba(255, 184, 108, 0.28);
  color: #fff5e8;
}

.mobile-screen-size {
  max-width: 400px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
}

.login-form,
.game-page,
.trip-page,
.player-management,
.user-management {
  background: linear-gradient(180deg, var(--bg-panel), var(--bg-elevated));
  border: 1px solid rgba(255, 184, 108, 0.18);
  border-radius: 8px;
  margin-top: 10px;
  box-shadow: 0 12px 28px var(--shadow);
}

.login-form {
  margin-bottom: 24px;
}

.player-management {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.user-management {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.player-management h3 {
  color: var(--text);
  margin-bottom: 10px;
}

.user-management h3 {
  color: var(--text);
  margin-bottom: 10px;
}

#player-message {
  margin: 8px 0 6px;
  color: var(--accent-strong);
}

#players-list {
  list-style: none;
  margin-top: 12px;
  padding: 0;
}

#accounts-section {
  margin: 10px 0 12px;
  background: rgba(26, 29, 41, 0.95);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
}

#accounts-section h4 {
  margin: 0 0 6px 0;
  color: var(--accent-strong);
  font-size: 15px;
}

#accounts-list {
  list-style: none;
  margin-top: 12px;
  padding: 0;
}

#players-list li {
  background: rgba(20, 22, 32, 0.9);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.player-item-header {
  align-items: flex-start;
}

.player-summary {
  min-width: 0;
  flex: 1;
}

.player-name-line {
  color: var(--text);
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}

.player-id-line {
  margin-top: 4px;
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: 0.4px;
}

.player-edit-form {
  margin-top: 10px;
}

#accounts-list li {
  background: rgba(20, 22, 32, 0.9);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 8px;
  color: var(--text-muted);
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}
.account-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.account-email-line {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 2px;
}

.account-role-line {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 12px;
}

.account-role-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-left: 6px;
}

.account-role-badge.is-admin {
  background: rgba(255, 184, 108, 0.18);
  color: var(--accent-strong);
  border: 1px solid rgba(255, 184, 108, 0.28);
}

.account-role-badge.is-user {
  background: rgba(143, 155, 170, 0.12);
  color: var(--text-dim);
  border: 1px solid rgba(143, 155, 170, 0.2);
}

.account-edit-form {
  margin-top: 8px;
}

.account-edit-form label {
  display: block;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 8px;
}

.account-edit-form label:first-child {
  margin-top: 0;
}

.account-edit-note {
  margin-top: 8px;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.45;
}

.account-edit-form input[readonly] {
  opacity: 0.82;
}

.account-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.account-edit-actions button {
  width: auto;
  padding: 6px 10px;
  margin: 0;
  font-size: 13px;
}

.account-secondary-button,
.account-danger-button {
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 6px 10px;
  font-size: 13px;
  box-shadow: none;
}

.account-secondary-button {
  background: rgba(255, 184, 108, 0.14);
  color: var(--accent-strong);
  border: 1px solid rgba(255, 184, 108, 0.28);
  border-radius: 2px;
}

.account-secondary-button:hover {
  background: rgba(255, 184, 108, 0.2);
  color: var(--text);
}

.account-danger-button {
  background: rgba(255, 107, 129, 0.14);
  color: #ffd4dc;
  border: 1px solid rgba(255, 107, 129, 0.28);
}

.account-danger-button:hover {
  background: rgba(255, 107, 129, 0.22);
  color: #fff1f4;
}

#account-message {
  margin: 8px 0 6px;
  color: var(--accent-strong);
}

#current-user-role {
  margin: 10px 0 4px;
  color: var(--accent-strong);
  font-size: 14px;
  line-height: 1.5;
  padding: 10px 12px;
  background: rgba(255, 159, 67, 0.08);
  border: 1px solid rgba(255, 184, 108, 0.18);
  border-radius: 10px;
}

#refresh-role-button {
  margin-top: 2px;
}

#update-rights-form {
  margin-bottom: 8px;
}

#update-rights-button {
  margin-top: 2px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-panel);
  border-radius: 8px;
  padding: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 14px 34px var(--shadow);
}

.modal-card h3 {
  margin-bottom: 10px;
  color: var(--text);
}

.modal-card label {
  color: var(--text-muted);
  font-size: 14px;
}

.score-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.score-modal-actions button {
  flex: 1 1 120px;
  width: auto;
  margin: 0;
}

.password-input-wrap {
  position: relative;
}

.password-input-wrap input {
  padding-right: 40px;
}

.password-toggle-button {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: auto;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.password-toggle-button:hover {
  background: transparent;
}

.eye-icon {
  width: 18px;
  height: 12px;
  border: 2px solid var(--border-strong);
  border-radius: 100%/80%;
  display: block;
  position: relative;
}

.eye-icon::after {
  content: "";
  width: 4px;
  height: 4px;
  background-color: var(--accent);
  border-radius: 50%;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.password-toggle-button.is-visible .eye-icon {
  border-color: var(--accent-strong);
}

.password-toggle-button.is-visible .eye-icon::after {
  background-color: var(--accent-strong);
}

select {
  width: 100%;
  padding: 10px;
  margin: 10px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background-color: var(--bg-input);
  color: var(--text);
}

.link-button {
  width: auto;
  margin: 0;
  padding: 0;
  background: transparent;
  color: var(--accent-strong);
  text-decoration: underline;
  border: none;
  border-radius: 0;
  font-size: 14px;
  box-shadow: none;
}

.link-button:hover {
  background: transparent;
  color: var(--accent);
}

#login-message {
  margin-top: 8px;
  color: var(--accent-strong);
}

#login-message.is-success {
  color: var(--success);
}

.global-app-notification,
.inactivity-warning-banner {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100vw - 24px), 460px);
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: 0 14px 28px rgba(2, 6, 23, 0.24);
  z-index: 2000;
  text-align: center;
  line-height: 1.45;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.global-app-notification {
  top: 14px;
  background: rgba(26, 29, 41, 0.96);
  border: 1px solid rgba(95, 100, 128, 0.52);
  color: var(--text);
}

.global-app-notification.is-success {
  color: var(--success);
  border-color: rgba(80, 250, 123, 0.28);
}

.global-app-notification.is-warning {
  color: #fff0bf;
  border-color: rgba(255, 184, 108, 0.4);
}

.inactivity-warning-banner {
  bottom: 16px;
  background: rgba(255, 247, 219, 0.98);
  border: 1px solid rgba(255, 184, 108, 0.44);
  color: #6f4a00;
  font-weight: 700;
}

.game-page {
  margin-bottom: 72px;
}

.game-page h3 {
  color: var(--text);
  margin-bottom: 10px;
}

.game-page-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: stretch;
}

.game-page-actions button {
  width: 100%;
  min-width: 0;
  margin: 0;
}

.game-page-actions .list-toggle-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 10px;
  margin: 0;
}

#load-more-games-button,
#load-more-trips-button {
  width: auto;
  min-width: 180px;
  display: block;
  margin: 14px auto 0;
}

#score-message {
  margin: 6px 0 8px;
  color: var(--text-muted);
}

#game-list {
  list-style: none;
  margin-top: 10px;
  padding: 0;
  margin-bottom: 0;
}

#game-list > li {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin-bottom: 10px;
  color: var(--text);
  line-height: 1.35;
}

#game-list .game-result-empty {
  margin: 0;
  padding: 18px 16px;
  text-align: center;
  color: var(--text-muted);
  background: rgba(26, 29, 41, 0.95);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.trip-page {
  margin-bottom: 72px;
}

.trip-page h3 {
  color: var(--text);
  margin-bottom: 8px;
}

.trip-page-intro {
  margin-bottom: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

#create-trip-form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 14px;
  background: rgba(18, 20, 29, 0.9);
  border: 1px solid var(--border);
  border-radius: 12px;
}

#trip-message {
  margin: 10px 0 0;
  color: var(--accent-strong);
}

#trip-message.is-success {
  color: var(--success);
}

#trip-list {
  list-style: none;
  display: grid;
  gap: 16px;
  margin-top: 16px;
  padding: 0;
}

.trip-card {
  display: grid;
  gap: 0;
  background: linear-gradient(
    180deg,
    rgba(29, 33, 47, 0.98),
    rgba(18, 21, 31, 0.98)
  );
  border: 1px solid rgba(95, 100, 128, 0.52);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 14px 28px rgba(2, 6, 23, 0.36);
}

.trip-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(
    90deg,
    rgba(255, 159, 67, 0.14),
    rgba(255, 184, 108, 0.06)
  );
  border-bottom: 1px solid rgba(255, 159, 67, 0.18);
}

.trip-card-toggle {
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.trip-card-toggle:hover {
  background: linear-gradient(
    90deg,
    rgba(255, 159, 67, 0.2),
    rgba(255, 184, 108, 0.1)
  );
}

.trip-card-toggle-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border-right: 2px solid var(--accent-strong);
  border-bottom: 2px solid var(--accent-strong);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 160ms ease;
}

.trip-card.is-expanded .trip-card-toggle-indicator {
  transform: rotate(-135deg) translateY(-1px);
}

.trip-card-details {
  display: grid;
  gap: 0;
}

.trip-card-heading {
  min-width: 0;
}

.trip-card-heading h4 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
}

.trip-card-meta {
  margin: 4px 0 0;
  color: var(--text-dim);
  font-size: 12px;
}

.trip-card-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 16px 0;
}

.trip-card-state-meta {
  margin: 0;
}

.trip-card-status-group {
  display: grid;
  gap: 4px;
}

.trip-card-button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.trip-card-button-group button {
  width: auto;
  min-width: 0;
  margin: 0;
}

.trip-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.trip-status-badge.is-open {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border: 1px solid rgba(255, 184, 108, 0.3);
}

.trip-status-badge.is-closed {
  background: rgba(95, 100, 128, 0.2);
  color: var(--text-muted);
  border: 1px solid rgba(95, 100, 128, 0.34);
}

.trip-status-badge.is-activity {
  background: rgba(95, 100, 128, 0.16);
  color: var(--text-muted);
  border: 1px solid rgba(95, 100, 128, 0.3);
}

.trip-status-badge.is-deleted {
  background: rgba(223, 28, 58, 0.16);
  color: #ffb2bc;
  border: 1px solid rgba(223, 28, 58, 0.32);
}

.trip-close-button {
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 8px 12px;
}

.trip-delete-button {
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 8px 12px;
}

.trip-summary-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 16px;
}

.trip-summary-card {
  display: grid;
  gap: 8px;
  width: 100%;
  min-height: 88px;
  padding: 16px;
  background: rgba(18, 20, 29, 0.78);
  border: 1px solid rgba(95, 100, 128, 0.44);
  border-radius: 12px;
}

.trip-summary-label {
  color: var(--text-dim);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  line-height: 1.4;
}

.trip-summary-card strong {
  color: var(--text);
  font-size: 28px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.trip-section {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid rgba(95, 100, 128, 0.28);
}

.trip-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.trip-section-header h5 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
}

.trip-section-toggle {
  width: auto;
  min-width: 0;
  margin: 0;
}

.trip-section-note {
  margin: 0;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.5;
}

.trip-inline-form {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: rgba(18, 20, 29, 0.82);
  border: 1px solid rgba(95, 100, 128, 0.4);
  border-radius: 12px;
}

.trip-inline-form label {
  color: var(--text-muted);
  font-size: 13px;
}

.trip-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.trip-form-actions button {
  flex: 1 1 140px;
  width: auto;
  margin: 0;
}

.trip-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.trip-checkbox-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(40, 42, 54, 0.84);
  border: 1px solid rgba(95, 100, 128, 0.42);
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
}

.trip-checkbox-pill input {
  width: auto;
  margin: 0;
}

.trip-section-list {
  list-style: none;
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
}

.trip-person-row,
.trip-entry-row,
.trip-balance-row,
.trip-empty-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: rgba(18, 20, 29, 0.72);
  border: 1px solid rgba(95, 100, 128, 0.34);
  border-radius: 12px;
}

.trip-contributor-row {
  align-items: center;
  padding: 10px 12px;
}

.trip-manageable-row {
  flex-wrap: wrap;
}

.trip-contributor-row.trip-manageable-row {
  row-gap: 10px;
}

.trip-row-side {
  display: grid;
  gap: 8px;
  justify-items: end;
  width: auto;
}

.trip-contributor-row .trip-row-side {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.trip-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.trip-contributor-actions {
  flex-wrap: nowrap;
  align-items: center;
}

.trip-row-action-button {
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 6px 10px;
  font-size: 12px;
}

.trip-row-form {
  flex: 1 1 100%;
  width: 100%;
}

.trip-row-main {
  display: grid;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
  width: 100%;
}

.trip-contributor-row .trip-row-main {
  gap: 2px;
}

.trip-row-sequence {
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.trip-row-title {
  color: var(--text);
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.trip-row-detail {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.trip-row-meta {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.trip-history-row {
  flex-direction: column;
  align-items: stretch;
}

.trip-history-row .trip-status-badge {
  align-self: flex-start;
}

.trip-amount-chip,
.trip-balance-value {
  white-space: nowrap;
  font-weight: 700;
  font-size: 14px;
}

.trip-amount-chip {
  color: var(--accent-strong);
}

.trip-amount-chip.is-positive,
.trip-balance-value.is-positive {
  color: var(--success);
}

.trip-amount-chip.is-expense,
.trip-balance-value.is-negative {
  color: var(--danger);
}

.trip-balance-value.is-neutral {
  color: var(--text-muted);
}

.trip-empty-row {
  color: var(--text-muted);
}

.trip-card-deleted {
  background: linear-gradient(
    180deg,
    rgba(32, 20, 24, 0.98),
    rgba(22, 15, 18, 0.98)
  );
  border-color: rgba(223, 28, 58, 0.24);
}

.trip-card-deleted-header {
  border-bottom: 0;
  background: linear-gradient(
    90deg,
    rgba(223, 28, 58, 0.12),
    rgba(223, 28, 58, 0.04)
  );
}

@media (max-width: 520px) {
  #game-list .game-result-meta {
    gap: 8px;
    padding: 6px 10px;
  }

  .trip-card-header-actions,
  .trip-person-row,
  .trip-entry-row,
  .trip-balance-row,
  .trip-empty-row {
    flex-direction: column;
  }

  .trip-card-header-actions {
    align-items: stretch;
  }

  .trip-card-button-group,
  .trip-item-actions {
    justify-content: stretch;
  }

  .trip-card-button-group button,
  .trip-row-action-button {
    width: 100%;
  }

  .trip-row-side {
    width: 100%;
    justify-items: stretch;
  }

  .trip-card-toggle {
    flex-direction: row;
    align-items: center;
  }

  .trip-summary-grid,
  .trip-checkbox-grid {
    grid-template-columns: 1fr;
  }

  .trip-form-actions button {
    flex-basis: 100%;
  }

  .game-page-actions {
    grid-template-columns: 1fr;
  }

  #load-more-games-button,
  #load-more-trips-button {
    width: 100%;
    min-width: 0;
  }

  #game-list .game-result-names {
    grid-template-columns: 1fr;
  }

  #game-list .player-name-pill {
    min-height: 34px;
    font-size: 12px;
  }

  .score-modal-actions button {
    flex-basis: 100%;
  }
}

.page-subtitle {
  text-align: center;
  margin-top: -5px;
  color: var(--text-dim);
}

.coming-soon-note {
  text-align: center;
  color: var(--accent-strong);
}
