:root {
  --bg: #ebd5ab;
  --surface: #fffdf7;
  --surface-2: #f3e8ca;
  --text: #1b211a;
  --muted: #628141;
  --accent: #628141;
  --accent-hover: #4e6933;
  --accent-soft: #8bae66;
  --border: rgba(98, 129, 65, 0.28);
  --danger: #a83b35;
  --danger-soft: #f5dedb;
  --shadow: rgba(27, 33, 26, 0.14);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Inter", sans-serif;
  background:
    radial-gradient(
      circle at 12% 8%,
      rgba(139, 174, 102, 0.22),
      transparent 30rem
    ),
    radial-gradient(
      circle at 88% 88%,
      rgba(98, 129, 65, 0.16),
      transparent 26rem
    ),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.site-header {
  width: 100%;
  background-color: #1b211a;
  border-bottom: 1px solid rgba(139, 174, 102, 0.25);
}

.site-header-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 20px;
}

.site-logo {
  color: #ebd5ab;
  font-family: "Coustard", serif;
  font-size: 1.8rem;
  font-weight: 900;
  text-decoration: none;
}

.site-logo:hover {
  color: #8bae66;
}

.app {
  width: min(100%, 780px);
  min-height: calc(100vh - 73px);
  margin: 0 auto;
  padding: 48px 18px;
  display: flex;
  align-items: center;
}

.screen {
  display: none;
  width: 100%;
}

.screen.active {
  display: block;
  animation: screen-in 180ms ease-out;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  width: 100%;
  padding: clamp(24px, 5vw, 42px);
  border: 2px solid rgba(98, 129, 65, 0.22);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.94);
  box-shadow: 0 22px 55px var(--shadow);
}

.hero-card {
  position: relative;
  overflow: hidden;
}

.hero-card::before,
.hero-card::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(139, 174, 102, 0.18);
}

.hero-card::before {
  width: 210px;
  height: 210px;
  top: -145px;
  left: -100px;
}

.hero-card::after {
  width: 210px;
  height: 210px;
  top: -145px;
  right: -100px;
}

.centered {
  text-align: center;
}

.twins-wordmark {
  display: inline-flex;
  align-items: baseline;
  margin: 4px 0 16px;
  color: var(--text);
  font-family: "Coustard", serif;
  font-size: clamp(3rem, 10vw, 5rem);
  font-weight: 400;
  letter-spacing: -0.05em;
  line-height: 0.95;
}

.twins-wordmark strong {
  color: var(--accent);
  font-weight: 900;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.13em;
}

h1,
h2,
h3 {
  color: var(--text);
  font-family: "Coustard", serif;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 7vw, 3.25rem);
  font-weight: 900;
  line-height: 1.08;
}

.subtitle {
  max-width: 620px;
  margin: 14px auto 28px;
  color: var(--muted);
  line-height: 1.6;
}

.home-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.button-stack {
  display: grid;
  gap: 11px;
}

.spaced {
  margin-top: 28px;
}

.button {
  min-height: 50px;
  padding: 13px 18px;
  border: 2px solid transparent;
  border-radius: 13px;
  font-weight: 800;
  transition:
    transform 120ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-2px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.primary {
  color: #fffdf7;
  background: var(--accent);
}

.primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.secondary {
  color: var(--text);
  background: var(--surface-2);
  border-color: rgba(98, 129, 65, 0.32);
}

.secondary:hover:not(:disabled) {
  border-color: var(--accent);
}

.ghost {
  color: var(--muted);
  background: transparent;
  border-color: rgba(98, 129, 65, 0.34);
}

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

.full {
  width: 100%;
}

.back-link {
  margin: 0 0 24px;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.back-link:hover {
  color: var(--text);
}

label {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 700;
}

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

input,
select {
  width: 100%;
  min-width: 0;
  padding: 14px 15px;
  border: 2px solid rgba(98, 129, 65, 0.25);
  border-radius: 13px;
  outline: none;
  color: var(--text);
  background: var(--surface);
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(98, 129, 65, 0.1);
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 30px 0 12px;
}

.section-heading h2 {
  font-size: 1rem;
}

.counter {
  min-width: 27px;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--text);
  background: var(--surface-2);
  font-size: 0.75rem;
  font-weight: 800;
  text-align: center;
}

.player-list {
  display: grid;
  gap: 9px;
  margin-bottom: 24px;
}

.player-list.empty {
  padding: 17px;
  border: 2px dashed rgba(98, 129, 65, 0.28);
  border-radius: 13px;
  color: var(--muted);
  text-align: center;
}

.player-list.empty p {
  margin: 0;
}

.player-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px 11px 15px;
  border: 1px solid rgba(98, 129, 65, 0.25);
  border-radius: 13px;
  background: var(--surface-2);
}

.remove-player {
  width: 35px;
  height: 35px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
}

.remove-player:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.setup-options {
  display: grid;
  gap: 14px;
  margin: 28px 0;
}

.option-field,
.impostor-summary,
.toggle-row {
  padding: 18px;
  border: 1px solid rgba(98, 129, 65, 0.25);
  border-radius: 15px;
  background: rgba(235, 213, 171, 0.32);
}

.option-field p,
.impostor-summary p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.option-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.impostor-summary strong {
  display: block;
  color: var(--accent);
  font-family: "Coustard", serif;
  font-size: 2.2rem;
}

.toggle-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  margin: 0;
  cursor: pointer;
}

.toggle-row strong,
.toggle-row small {
  display: block;
}

.toggle-row small {
  margin-top: 4px;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.45;
}

.toggle-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.toggle-control {
  position: relative;
  width: 50px;
  height: 28px;
  border-radius: 999px;
  background: #b9b9ae;
  transition: background-color 160ms ease;
}

.toggle-control::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  top: 3px;
  left: 3px;
  border-radius: 50%;
  background: white;
  transition: transform 160ms ease;
}

.toggle-row input:checked + .toggle-control {
  background: var(--accent);
}

.toggle-row input:checked + .toggle-control::after {
  transform: translateX(22px);
}

.round-player-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.round-player-button {
  min-height: 78px;
  padding: 14px;
  border: 2px solid rgba(98, 129, 65, 0.26);
  border-radius: 14px;
  color: var(--text);
  background: var(--surface-2);
  font-size: 1rem;
  font-weight: 800;
  text-align: left;
}

.round-player-button:hover {
  border-color: var(--accent);
}

.round-player-button.seen {
  color: var(--muted);
  opacity: 0.68;
}

.round-player-button.seen::after {
  content: "Visto neste dispositivo";
  display: block;
  margin-top: 5px;
  color: var(--accent);
  font-size: 0.7rem;
}

.role-card {
  margin: 30px 0 22px;
  padding: 34px 20px;
  border: 2px solid rgba(98, 129, 65, 0.22);
  border-radius: 17px;
  background: var(--surface-2);
}

.role-card.impostor {
  border-color: rgba(168, 59, 53, 0.55);
  background: var(--danger-soft);
}

.role-label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.11em;
}

.role-card h2 {
  font-size: clamp(2rem, 8vw, 3rem);
}

.role-card p {
  color: var(--muted);
  line-height: 1.55;
}

.other-impostor {
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid rgba(168, 59, 53, 0.25);
  color: var(--danger) !important;
  font-weight: 800;
}

.starter-badge {
  width: 108px;
  height: 108px;
  margin: 30px auto;
  display: grid;
  place-items: center;
  border: 3px solid var(--accent-soft);
  border-radius: 50%;
  color: var(--accent);
  background: var(--surface-2);
  font-family: "Coustard", serif;
  font-size: 3.4rem;
  font-weight: 900;
}

.result-section {
  margin-top: 28px;
}

.result-section h2 {
  margin-bottom: 12px;
  font-size: 1.25rem;
}

.impostor-result-list,
.pairs-result-list {
  display: grid;
  gap: 10px;
}

.impostor-result {
  padding: 18px;
  border: 2px solid rgba(168, 59, 53, 0.5);
  border-radius: 14px;
  color: var(--danger);
  background: var(--danger-soft);
  font-family: "Coustard", serif;
  font-size: 1.55rem;
  font-weight: 900;
  text-align: center;
}

.result-theme {
  margin: -4px 0 14px;
  color: var(--muted);
}

.pair-result {
  padding: 16px;
  border: 1px solid rgba(98, 129, 65, 0.25);
  border-radius: 14px;
  background: var(--surface-2);
}

.pair-result strong {
  display: block;
  margin-bottom: 5px;
  font-family: "Coustard", serif;
  font-size: 1.15rem;
}

.pair-result span {
  color: var(--muted);
}

.dialog {
  width: min(calc(100% - 32px), 480px);
  padding: 0;
  border: 2px solid rgba(98, 129, 65, 0.28);
  border-radius: 17px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 30px 80px rgba(27, 33, 26, 0.32);
}

.dialog::backdrop {
  background: rgba(27, 33, 26, 0.72);
  backdrop-filter: blur(3px);
}

.dialog-content {
  padding: 25px;
}

.dialog-content h2 {
  font-size: 1.35rem;
}

.dialog-content p {
  color: var(--muted);
  line-height: 1.55;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

@media (max-width: 520px) {
  .site-header-container {
    padding: 14px 16px;
  }

  .site-logo {
    font-size: 1.55rem;
  }

  .app {
    min-height: calc(100vh - 61px);
    align-items: stretch;
    padding: 0;
  }

  .card {
    min-height: calc(100vh - 61px);
    padding: 30px 18px;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .input-row {
    flex-direction: column;
  }

  .round-player-list {
    grid-template-columns: 1fr;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-actions .button {
    width: 100%;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b211a;
    --surface: #293027;
    --surface-2: #343d30;
    --text: #ebd5ab;
    --muted: #a9c28e;
    --accent: #8bae66;
    --accent-hover: #9cbe78;
    --accent-soft: #628141;
    --border: rgba(139, 174, 102, 0.3);
    --danger: #dc7770;
    --danger-soft: #4b2d29;
    --shadow: rgba(0, 0, 0, 0.28);
  }

  body {
    background:
      radial-gradient(
        circle at 12% 8%,
        rgba(139, 174, 102, 0.11),
        transparent 30rem
      ),
      radial-gradient(
        circle at 88% 88%,
        rgba(98, 129, 65, 0.1),
        transparent 26rem
      ),
      var(--bg);
  }

  .card {
    background: rgba(41, 48, 39, 0.96);
  }

  .primary {
    color: #1b211a;
  }

  .option-field,
  .impostor-summary,
  .toggle-row {
    background: rgba(98, 129, 65, 0.08);
  }
}

.theme-preview {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(98, 129, 65, 0.22);
}

.theme-preview h3 {
  margin: 0 0 10px;
  font-size: 0.9rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-height: 190px;
  overflow: auto;
  padding-right: 4px;
}

.tag {
  padding: 7px 10px;
  border: 1px solid rgba(98, 129, 65, 0.28);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-size: 0.77rem;
}

.stacked-dialog-actions {
  display: grid;
  grid-template-columns: 1fr;
}
