:root {
  --bg: #081018;
  --bg-soft: #0c1722;
  --panel: rgba(12, 23, 34, 0.88);
  --panel-strong: rgba(18, 31, 45, 0.95);
  --border: rgba(153, 196, 255, 0.16);
  --text: #f3f7fb;
  --muted: #9eb1c4;
  --accent: #5ac8a8;
  --accent-strong: #2ed3a0;
  --accent-warm: #f0a14b;
  --danger: #ff7e74;
  --warning: #f7cf65;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font-body: "Aptos", "Segoe UI", "Helvetica Neue", sans-serif;
  --font-title: "Bahnschrift", "Aptos", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top, rgba(90, 200, 168, 0.12), transparent 32%),
    linear-gradient(180deg, #09111a 0%, #071018 100%);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  border: none;
}

.background-glow {
  position: fixed;
  inset: auto;
  pointer-events: none;
  filter: blur(28px);
  opacity: 0.38;
  z-index: 0;
}

.background-glow-a {
  top: 4%;
  right: -8%;
  width: 14rem;
  height: 14rem;
  background: rgba(46, 211, 160, 0.24);
  border-radius: 50%;
}

.background-glow-b {
  bottom: 12%;
  left: -8%;
  width: 16rem;
  height: 16rem;
  background: rgba(240, 161, 75, 0.16);
  border-radius: 42% 58% 60% 40%;
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
}

.screen {
  width: min(100%, 540px);
  margin: 0 auto;
  animation: card-in 240ms ease-out;
}

.card {
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-strong) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 22px 18px;
  backdrop-filter: blur(18px);
}

.hero-card {
  padding-top: 28px;
  padding-bottom: 28px;
}

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

.title {
  margin: 0;
  font-family: var(--font-title);
  font-size: clamp(2rem, 6vw, 2.8rem);
  line-height: 0.96;
  letter-spacing: 0.02em;
}

.subtitle {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.stack {
  display: grid;
  gap: 16px;
}

.compact-stack {
  display: grid;
  gap: 10px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
}

.section-title h2,
.section-title h3 {
  margin: 0;
  font-size: 1.08rem;
}

.muted {
  color: var(--muted);
}

.pill-row,
.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill,
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(153, 196, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.92rem;
}

.pill.highlight,
.stat-pill.highlight {
  border-color: rgba(90, 200, 168, 0.28);
  background: rgba(90, 200, 168, 0.1);
}

.field-group {
  display: grid;
  gap: 8px;
}

.field-label {
  font-size: 0.9rem;
  font-weight: 600;
}

.text-input,
.number-input {
  width: 100%;
  min-height: 52px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(153, 196, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
}

.text-input:focus,
.number-input:focus {
  border-color: rgba(90, 200, 168, 0.5);
  box-shadow: 0 0 0 4px rgba(90, 200, 168, 0.12);
}

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

.button-row {
  display: grid;
  gap: 10px;
}

.btn {
  min-height: 54px;
  border-radius: 18px;
  padding: 13px 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.btn:active {
  transform: translateY(1px) scale(0.995);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #072019;
  box-shadow: 0 12px 28px rgba(46, 211, 160, 0.22);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  border: 1px solid rgba(153, 196, 255, 0.12);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px dashed rgba(153, 196, 255, 0.16);
}

.btn-danger {
  background: rgba(255, 126, 116, 0.12);
  color: #ffd3ce;
  border: 1px solid rgba(255, 126, 116, 0.2);
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.player-list,
.role-list,
.summary-list,
.target-list {
  display: grid;
  gap: 10px;
}

.player-item,
.role-item,
.summary-item,
.target-option {
  border-radius: var(--radius-md);
  border: 1px solid rgba(153, 196, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
}

.player-item,
.summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
}

.player-name {
  font-weight: 700;
}

.role-item {
  padding: 14px;
}

.role-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.role-title {
  margin: 0;
  font-size: 1rem;
}

.role-description {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.role-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.check-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.checkbox {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.quantity-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.quantity-box span {
  color: var(--muted);
  font-size: 0.88rem;
}

.number-input {
  width: 84px;
}

.info-box,
.error-box,
.success-box {
  border-radius: var(--radius-md);
  padding: 14px;
  line-height: 1.5;
}

.info-box {
  background: rgba(90, 200, 168, 0.08);
  border: 1px solid rgba(90, 200, 168, 0.16);
}

.error-box {
  background: rgba(255, 126, 116, 0.09);
  border: 1px solid rgba(255, 126, 116, 0.18);
  color: #ffd8d4;
}

.success-box {
  background: rgba(247, 207, 101, 0.08);
  border: 1px solid rgba(247, 207, 101, 0.18);
  color: #ffe7a9;
}

.note-list,
.clean-list {
  margin: 0;
  padding-left: 18px;
}

.clean-list li + li,
.note-list li + li {
  margin-top: 6px;
}

.screen-header {
  margin-bottom: 18px;
}

.screen-title {
  margin: 0;
  font-family: var(--font-title);
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  line-height: 1.05;
}

.screen-text {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(153, 196, 255, 0.16) 12%, rgba(153, 196, 255, 0.16) 88%, transparent 100%);
}

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

.secret-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(90, 200, 168, 0.06), transparent 38%, rgba(240, 161, 75, 0.05));
  pointer-events: none;
}

.role-reveal {
  padding: 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(90, 200, 168, 0.14);
}

.role-name {
  margin: 0;
  font-size: 1.28rem;
}

.role-goal {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.lover-notice {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 126, 116, 0.18);
  background: rgba(255, 126, 116, 0.08);
  color: #ffe1dd;
  line-height: 1.5;
}

.target-option {
  position: relative;
  display: block;
  padding: 0;
  overflow: hidden;
}

.target-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.target-option span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  min-height: 60px;
}

.target-option em {
  color: var(--muted);
  font-style: normal;
  font-size: 0.88rem;
}

.target-option input:checked + span {
  background: rgba(90, 200, 168, 0.14);
  border-color: rgba(90, 200, 168, 0.32);
  color: var(--text);
}

.camp-thread {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(153, 196, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
}

.camp-thread.village {
  border-color: rgba(90, 200, 168, 0.22);
}

.camp-thread.wolves {
  border-color: rgba(240, 161, 75, 0.24);
}

.camp-thread-description {
  margin: -4px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.camp-thread-feed {
  display: grid;
  gap: 10px;
  max-height: 240px;
  padding-right: 4px;
  overflow-y: auto;
}

.camp-thread-empty {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(153, 196, 255, 0.14);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.camp-thread-message {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(153, 196, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
}

.camp-thread-message.village {
  border-color: rgba(90, 200, 168, 0.14);
}

.camp-thread-message.wolves {
  border-color: rgba(240, 161, 75, 0.16);
}

.camp-thread-author {
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--warning);
}

.camp-thread-text {
  margin: 0;
  line-height: 1.5;
  word-break: break-word;
}

.message-input {
  width: 100%;
  min-height: 96px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(153, 196, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  resize: vertical;
  outline: none;
}

.message-input:focus {
  border-color: rgba(90, 200, 168, 0.5);
  box-shadow: 0 0 0 4px rgba(90, 200, 168, 0.12);
}

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

.two-column {
  display: grid;
  gap: 10px;
}

.summary-grid {
  display: grid;
  gap: 14px;
}

.name-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.name-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(153, 196, 255, 0.12);
  font-size: 0.92rem;
}

.name-chip.dead {
  color: #c3d2e2;
  background: rgba(255, 126, 116, 0.08);
  border-color: rgba(255, 126, 116, 0.14);
  text-decoration: line-through;
}

.history-card {
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(153, 196, 255, 0.1);
}

.history-card h3 {
  margin: 0 0 10px;
  font-size: 0.98rem;
}

.history-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

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

.final-player {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(153, 196, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
}

.final-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  background: rgba(90, 200, 168, 0.12);
  border: 1px solid rgba(90, 200, 168, 0.18);
  color: #b4f6df;
}

.badge.dead {
  background: rgba(255, 126, 116, 0.1);
  border-color: rgba(255, 126, 116, 0.16);
  color: #ffd8d4;
}

.footer-actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.fallback-card {
  width: min(100%, 420px);
  margin: 48px auto;
  padding: 24px;
  border-radius: var(--radius-lg);
  background: var(--panel-strong);
  border: 1px solid var(--border);
  color: var(--text);
}

@media (min-width: 560px) {
  .app-shell {
    padding-top: 28px;
  }

  .card {
    padding: 26px 24px;
  }

  .input-row,
  .two-column,
  .button-row {
    grid-template-columns: 1fr auto;
  }

  .button-row .btn,
  .input-row .btn {
    min-width: 170px;
  }

  .footer-actions {
    grid-template-columns: 1fr 1fr;
  }
}

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

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