*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #111827; /* fallback color */
  color: #e5e7eb;
  margin: 0;
  padding: 0;
  position: relative;
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url("/static/img/pic.jpg") center center / cover no-repeat;
  opacity: 0.3;
  z-index: -1;
  pointer-events: none;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

h1 {
  margin-top: 0;
  font-size: 1.8rem;
  color: #f9fafb;
}

/* What's New twirldown */
.whats-new {
  display: block;
  width: 100%;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 10px;
  margin-bottom: 16px;
  opacity: 0.9;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.whats-new summary {
  cursor: pointer;
  padding: 8px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #93c5fd;
  list-style: none;
  user-select: none;
}

.whats-new summary::-webkit-details-marker {
  display: none;
}

.whats-new summary::before {
  content: "\25B8";
  display: inline-block;
  margin-right: 8px;
  transition: transform 0.15s ease;
}

.whats-new[open] summary::before {
  transform: rotate(90deg);
}

.whats-new ul {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px 16px;
  margin: 0;
  padding: 4px 14px 10px;
  font-size: 0.85rem;
  color: #d1d5db;
  list-style-position: inside;
}

.whats-new li {
  margin: 0;
}

.whats-new-footer {
  text-align: center;
  font-size: 0.8rem;
  color: #9ca3af;
  border-top: 1px solid #374151;
  padding: 8px 14px;
}

/* Info ? buttons + popup */
.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  margin-left: 4px;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  background: #374151;
  color: #93c5fd;
  vertical-align: 1px;
}

.info-btn:hover {
  background: #4b5563;
}

.info-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 16px;
}

.info-overlay[hidden] {
  display: none;
}

.info-modal {
  background: #1f2937;
  border: 1px solid #4b5563;
  border-radius: 12px;
  padding: 20px 24px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  animation: jackpot-pop 0.2s ease;
}

.info-modal h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  color: #93c5fd;
}

.info-modal p {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: #d1d5db;
  line-height: 1.55;
}

.info-modal button {
  margin-top: 8px;
}

@media (max-width: 800px) {
  .whats-new ul {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .whats-new ul {
    grid-template-columns: 1fr;
  }
}

.card {
  background: #1f2937;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  opacity: 0.9;
}

/* Rows of side-by-side panels */
.card-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.card-row .panel {
  flex: 1 1 300px;
  margin-bottom: 0;
}

/* Narrower panel (Break Even) */
.card-row .panel-slim {
  flex: 0 1 220px;
  min-width: 180px;
}

label {
  font-size: 0.9rem;
  color: #d1d5db;
}

.stack-label {
  display: block;
  margin-top: 10px;
}

.form-actions {
  margin-top: 10px;
}

/* Side-by-side form fields */
.form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.form-row .form-field {
  flex: 1 1 200px;
  min-width: 160px;
}

.hint {
  font-size: 0.75rem;
  color: #9ca3af;
  font-weight: normal;
}

/* Player Names input box */
textarea.aliases {
  width: 100%;
  min-height: 90px;
  resize: vertical;
  margin-top: 4px;
  border-radius: 8px;
  border: 1px solid #374151;
  background: #111827;
  color: #e5e7eb;
  padding: 8px 10px;
  box-sizing: border-box;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 0.85rem;
  overflow-y: hidden;
  field-sizing: content; /* native auto-grow (Chrome 123+); JS fallback below */
}

textarea.aliases:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 1px #60a5fa55;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  padding: 8px 10px;
  margin-top: 4px;
  border-radius: 8px;
  border: 1px solid #374151;
  background: #111827;
  color: #e5e7eb;
  box-sizing: border-box;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 1px #60a5fa55;
}

button {
  border: none;
  border-radius: 9999px;
  padding: 8px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  background: #3b82f6;
  color: white;
  transition: background 0.15s ease, transform 0.05s ease;
  white-space: nowrap;
}

button:hover {
  background: #2563eb;
}

button:active {
  transform: scale(0.98);
}

button.secondary {
  background: #4b5563;
}

button.secondary:hover {
  background: #374151;
}

.status {
  font-size: 0.85rem;
  margin-top: 8px;
  color: #9ca3af;
}

/* Auto-height output blocks (replaces textareas) */
.output {
  width: 100%;
  margin: 0;
  border-radius: 8px;
  border: 1px solid #374151;
  background: #020617;
  color: #e5e7eb;
  padding: 8px 10px;
  box-sizing: border-box;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  min-height: 40px;
}

.output.small {
  font-size: 0.8rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 10px;
}

.section-header h2 {
  font-size: 1rem;
  margin: 0;
  color: #e5e7eb;
}

.section-header h2.muted {
  opacity: 0.9;
}

.flash {
  background: #b91c1c33;
  border: 1px solid #fecaca55;
  color: #fecaca;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.warn {
  background: #b4530933;
  border: 1px solid #fdba7455;
  color: #fdba74;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

/* Jackpot */
.jackpot-banner {
  border: 1px solid #fbbf2488;
  background: linear-gradient(180deg, #78350f55, #1f2937);
}

.jackpot-banner h2 {
  margin: 0 0 6px;
  color: #fcd34d;
  font-size: 1.2rem;
}

.jackpot-banner p {
  margin: 2px 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9rem;
}

.jackpot-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.jackpot-modal {
  background: #1f2937;
  border: 2px solid #fbbf24;
  border-radius: 16px;
  padding: 32px 40px;
  text-align: center;
  box-shadow: 0 0 60px #fbbf2455;
  animation: jackpot-pop 0.35s ease;
  max-width: 90vw;
}

.jackpot-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #fcd34d;
  margin-bottom: 14px;
}

.jackpot-detail {
  font-size: 1.15rem;
  color: #f9fafb;
  margin-top: 8px;
}

.jackpot-sub {
  font-size: 0.85rem;
  color: #9ca3af;
  margin-bottom: 6px;
}

.jackpot-modal button {
  margin-top: 16px;
  background: #fbbf24;
  color: #111827;
  font-weight: 600;
}

.jackpot-modal button:hover {
  background: #f59e0b;
}

@keyframes jackpot-pop {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .jackpot-modal { animation: none; }
}

@media (max-width: 640px) {
  .card-row {
    flex-direction: column;
  }
  .card-row .panel,
  .card-row .panel-slim {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
  }
  button {
    width: 100%;
    text-align: center;
  }
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .section-header button {
    width: auto;
  }
}