@font-face {
  font-family: "Trade Winds";
  src: url("TradeWinds-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --bg: #050505;
  --surface: #111111;
  --surface-alt: #171717;
  --ink: #f5f5f5;
  --muted: #b7b7b7;
  --primary: #d4af37;
  --primary-strong: #f0c75e;
  --danger: #ef6b62;
  --ok: #6fd992;
  --border: #2b2b2b;
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  --radius: 14px;
  --action-font: "Trade Winds", "Trebuchet MS", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, #191919 0%, rgba(25, 25, 25, 0) 40%),
    radial-gradient(circle at 85% 30%, #111111 0%, rgba(17, 17, 17, 0) 45%),
    var(--bg);
  min-height: 100vh;
}

nav.kasite-toolbar {
  background-color: var(--bg);
  border-bottom: 1px solid var(--border);
  color: var(--primary);
}
nav.kasite-toolbar  .kasite-toolbar__title {
  font-family: var(--action-font);
}

/* Alerts */
.kalert {
  position: fixed;
  left: 0;
  right: 0;
  bottom: -200px;
  background: rgb(121, 15, 15);
  padding: 16px;
  z-index: 100;
  font-weight: bold;
  color: red;
  font-size: 1.1rem;
  transition: all 0.5s;
}

.kalert.open {
  bottom: -5px;
}

/* Modale */
#modale {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: all 0.5s ease;
  z-index: 999;
}

#modale.open {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

#modale-content {
  width: min(720px, 92vw);
  max-height: 80vh;
  overflow-y: auto;
  border-radius: 10px;
  padding: 20px;
  background-image: var(--background-img);
  color: var(--textcolor);
  border: 1px solid var(--green-400);
  box-shadow: var(--shadow-soft);
  transform: translateY(10px) scale(0.98);
  opacity: 0;
  transition: all 0.35s ease;
}

#details_tour {
  text-align: center;
}

#modale-content h3 {
  border-radius: 4px;
  margin-top: 0;
  padding: 4px 0;
  color: #fff;
  background-color: #0d420085;
}

#modale.open #modale-content {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.skull-header {
  align-items: center;
  background:
    linear-gradient(135deg, rgba(17, 17, 17, 0.96), rgba(31, 24, 9, 0.88)),
    radial-gradient(circle at 12% 0%, rgba(240, 199, 94, 0.18), transparent 36%);
  border: 1px solid rgba(240, 199, 94, 0.22);
  border-radius: 8px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin: 16px auto 0;
  max-width: 1060px;
  overflow: hidden;
  padding: 16px;
  position: relative;
  width: calc(100% - 32px);
}

.skull-header::before {
  background: linear-gradient(90deg, var(--primary), var(--danger), var(--primary-strong));
  content: "";
  height: 3px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.skull-header__title {
  align-items: center;
  display: flex;
  gap: 12px;
  min-width: 0;
}

.skull-header__mark {
  align-items: center;
  background: #f0c75e;
  border-radius: 8px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.32);
  color: #17130a;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 1.55rem;
  height: 48px;
  justify-content: center;
  width: 48px;
}

.skull-header__brand {
  color: var(--primary-strong);
  display: inline-block;
  font-family: var(--action-font);
  font-size: 1.35rem;
  line-height: 1.05;
  text-decoration: none;
}

.skull-header__title p {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  margin: 5px 0 0;
}

.skull-header__actions {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
}

.skull-header__button {
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(240, 199, 94, 0.2);
  border-radius: 6px;
  color: var(--ink);
  display: inline-flex;
  font-family: var(--action-font);
  gap: 8px;
  min-height: 44px;
  padding: 0 12px 0 7px;
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
  white-space: nowrap;
}

.skull-header__button-icon {
  align-items: center;
  background: rgba(240, 199, 94, 0.12);
  border-radius: 6px;
  display: inline-flex;
  font-size: 1.1rem;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.skull-header__button:hover,
.skull-header__button:focus-visible,
.skull-header__button.is-current {
  background: rgba(240, 199, 94, 0.1);
  border-color: rgba(240, 199, 94, 0.52);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.28);
  outline: none;
  transform: translateY(-1px);
}

.skull-header__button--primary {
  background: var(--primary);
  border-color: #e7c96e;
  color: #17130a;
}

.skull-header__button--primary .skull-header__button-icon {
  background: rgba(255, 255, 255, 0.32);
}

.skull-header__button--primary:hover,
.skull-header__button--primary:focus-visible,
.skull-header__button--primary.is-current {
  background: var(--primary-strong);
  color: #17130a;
}

.app {
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
}

.card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

h1,
h2,
h3 {
  margin: 0 0 10px;
  line-height: 1.2;
  color: var(--primary-strong);
}

h2 {
  font-family: "Trade Winds";
  text-align: center;
}

p {
  margin: 0;
}

.subtle {
  color: var(--muted);
  font-size: 0.95rem;
}

.grid {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  /*! font-weight: 700; */
  font-size: 0.7rem;
  text-align: center;
  text-transform: uppercase;
  color: var(--primary);
}

.switch-field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  background: #111111;
  cursor: pointer;
  user-select: none;
}

.switch-field input[type="checkbox"] {
  appearance: none;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid #4a4a4a;
  background: #2a2a2a;
  position: relative;
  margin: 0;
}

.switch-field input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #dfdfdf;
  transition: transform 140ms ease;
}

.switch-field input[type="checkbox"]:checked {
  background: color-mix(in srgb, var(--primary) 70%, #151515);
  border-color: var(--primary);
}

.switch-field input[type="checkbox"]:checked::after {
  transform: translateX(20px);
  background: #131313;
}

.switch-field span {
  color: var(--ink);
  font-size: 0.92rem;
  text-transform: none;
}

input[type="text"],
input[type="number"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: #0d0d0d;
  color: var(--ink);
  font-size: 1rem;
}

input[type="number"] {
  appearance: textfield;
  font-family: var(--action-font);
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  appearance: none;
  margin: 0;
}

input:focus {
  outline: 2px solid color-mix(in srgb, var(--primary) 65%, white);
  outline-offset: 1px;
  border-color: var(--primary);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn-row.centered {
  justify-content: center;
}

.compact-new-game {
  gap: 10px;
}

.game-config-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  align-items: end;
}

.player-picker {
  display: grid;
  gap: 8px;
}

.selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 34px;
}

.player-tag {
  min-height: 34px;
  border: 1px solid #9d7a20;
  border-radius: 999px;
  padding: 6px 10px;
  background: #2a220e;
  color: #f0c75e;
  font-size: 0.85rem;
  font-family: var(--action-font);
  cursor: pointer;
}

.create-big {
  min-height: 52px;
  min-width: min(100%, 340px);
  width: 100%;
  font-size: 1.1rem;
  border-radius: 14px;
}

button,
.button-link {
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #161616;
  background: var(--primary);
  font-family: var(--action-font);
}

button.secondary {
  background: #2f2f2f;
  color: #f5f5f5;
}

button.danger {
  background: var(--danger);
  color: #1a1a1a;
}

.button-link.small {
  min-height: 34px;
  border-radius: 9px;
  padding: 7px 10px;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.error-box,
.info-box {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.95rem;
}

.error-box {
  border: 1px solid #8a2f28;
  background: #2a1210;
  color: #ffd5d2;
}

.info-box {
  border: 1px solid #2c6b3f;
  background: #102217;
  color: #c8f4d6;
}

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

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  background: #101010;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.player-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.player-list li {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: #101010;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.player-main {
  display: grid;
  gap: 6px;
}

.player-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid #3a3118;
  border-radius: 999px;
  padding: 2px 9px;
  background: #1a160a;
  color: #f0c75e;
  font-size: 0.78rem;
}

.players-round {
  display: grid;
  gap: 10px;
}

.pirate-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.pirate-game-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 14px;
  text-decoration: none;
  color: #231a00;
  background:
    linear-gradient(160deg, #f0c75e 0%, #d4af37 60%, #b9932d 100%);
  border: 1px solid #e7c96e;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

.pirate-game-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.45);
  filter: saturate(1.05);
}

.pirate-game-card:focus-visible {
  outline: 2px solid #ffe7a5;
  outline-offset: 2px;
}

.pirate-game-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pirate-game-head h3 {
  margin: 0;
  font-family: var(--action-font);
  font-size: 1.15rem;
  color: #231a00;
}

.pirate-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pirate-status.is-active {
  background: #1f5130;
  color: #ddf6e5;
}

.pirate-status.is-finished {
  background: #3a2f12;
  color: #ffe9a8;
}

.pirate-meta {
  margin: 0;
  color: #2f2200;
  font-weight: 700;
  font-size: 0.92rem;
}

.player-row {
  border: 1px solid var(--border);
  background: var(--surface-alt);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  grid-template-columns: minmax(130px, 1.4fr) repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
}

.player-name {
  font-weight: 700;
  font-size: 1.05rem;
  align-self: center;
}

.number-stepper {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 56px;
  /*! gap: 8px; */
  align-items: center;
}

.step-btn {
  min-height: 52px;
  padding: 0;
  border-radius: 60px;
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  touch-action: manipulation;
  user-select: none;
}

.value-btn {
  min-width: 0;
  font-size: 1.2rem;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  padding-left: 56px;
}

.minus-btn {
  font-size: 1.3rem;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: 1px solid #b39333;
}

.table-wrap {
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
  background: #0f0f0f;
}

th,
td {
  border-bottom: 1px solid #232323;
  padding: 9px 10px;
  text-align: center;
  font-size: 0.95rem;
}

thead th {
  background: #1a1a1a;
  color: var(--primary-strong);
}

td:first-child,
th:first-child {
  text-align: left;
}

.scores-table th:first-child,
.scores-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #121212;
}

.scores-table thead th:first-child {
  z-index: 3;
  background: #1a1a1a;
}

.leader-row td {
  background: rgba(212, 175, 55, 0.12);
}

.leader-row td:first-child {
  background: rgba(212, 175, 55);
  color: var(--border);
  font-weight: 700;
}

.score-negative {
  color: #ef6b62;
  font-weight: 700;
}

.site-footer {
  max-width: 1060px;
  margin: 18px auto;
  padding: 10px 16px 20px;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 760px) {
  .skull-header {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }

  .skull-header__title {
    justify-content: center;
    text-align: center;
  }

  .skull-header__actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .skull-header__button {
    justify-content: flex-start;
    width: 100%;
  }

  .game-config-row {
    grid-template-columns: 1fr;
  }

  .player-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }

  .player-list li {
    align-items: flex-start;
    flex-direction: column;
  }

  .field {
    width: 100%;
  }
  
  .player-name {
    text-align: center;
  }
  
  .number-stepper {
    grid-template-columns: minmax(0, 1fr) 60px;
  }

  .step-btn {
    min-height: 56px;
    font-size: 1.9rem;
  }

  .value-btn {
    font-size: 1.25rem;
  }
}
