:root {
  --primary: #6c3fc5;
  --primary-light: #8b5cf6;
  --accent: #22c55e;
  --accent-dark: #16a34a;
  --danger: #ef4444;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface2: #f7f5ff;
  --border: #e2d9f3;
  --text: #1e1b2e;
  --text-muted: #6b7280;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(108, 63, 197, 0.1);
  --shadow-lg: 0 8px 32px rgba(108, 63, 197, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

.app {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 0 40px;
}

/* Header */
.header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  padding: 28px 20px 24px;
  text-align: center;
}

.title {
  font-size: 26px;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: 0.02em;
}

.title span {
  font-size: 32px;
  display: block;
}

.subtitle {
  margin-top: 6px;
  font-size: 13px;
  opacity: 0.85;
}

/* Info bar */
.info-bar {
  background: var(--surface2);
  border-left: 4px solid var(--primary);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
}

.info-date {
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.info-content {
  color: var(--text);
}

/* Ad spaces */
.ad-space {
  background: #f0ede8;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* Main */
.main {
  padding: 16px 16px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Section */
.section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: var(--shadow);
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--primary);
}

/* Player List */
.player-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.player-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-number {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.player-input {
  flex: 1;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  background: var(--surface);
  color: var(--text);
}

.player-input:focus {
  border-color: var(--primary-light);
}

.player-remove {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

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

.player-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Filters */
.filter-group {
  margin-bottom: 12px;
}

.filter-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 15px;
}

.filter-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.filter-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.filters {
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: opacity 0.2s;
}

.filters.disabled {
  opacity: 0.35;
  pointer-events: none;
}

.filter-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.filter-label-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.btn-select-all {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.btn-select-all:hover {
  border-color: var(--primary-light);
  color: var(--primary);
  background: var(--surface2);
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 5px 12px;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text);
  font-family: inherit;
  line-height: 1.4;
}

.chip:hover {
  border-color: var(--primary-light);
  background: var(--surface2);
}

.chip.selected {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

/* Buttons */
.btn {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-accent {
  background: var(--accent);
  color: white;
}

.btn-accent:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.3);
}

.btn-secondary {
  background: var(--surface2);
  color: var(--primary);
  border: 2px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--primary-light);
  background: #ede9ff;
}

.btn-ghost {
  background: none;
  color: var(--text-muted);
  border: 2px solid var(--border);
}

.btn-ghost:hover {
  background: #f5f5f5;
}

.btn-large {
  width: 100%;
  padding: 16px;
  font-size: 17px;
  border-radius: var(--radius);
}

.btn:active {
  transform: scale(0.97);
}

/* Roulette section */
.roulette-section {
  padding: 16px;
}

/* Result */
.result-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--primary);
  animation: slideIn 0.3s ease both;
}

.result-item:nth-child(1) { animation-delay: 0.05s; }
.result-item:nth-child(2) { animation-delay: 0.1s; }
.result-item:nth-child(3) { animation-delay: 0.15s; }
.result-item:nth-child(4) { animation-delay: 0.2s; }
.result-item:nth-child(5) { animation-delay: 0.25s; }
.result-item:nth-child(6) { animation-delay: 0.3s; }
.result-item:nth-child(7) { animation-delay: 0.35s; }
.result-item:nth-child(8) { animation-delay: 0.4s; }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

.result-player {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 80px;
  flex-shrink: 0;
}

.result-weapon {
  flex: 1;
}

.result-weapon-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.result-weapon-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.result-category {
  font-size: 11px;
  background: var(--primary);
  color: white;
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.team-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: center;
}

/* Teams */
.teams {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.team-card {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.team-header {
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 700;
  color: white;
  text-align: center;
}

.team-alpha .team-header { background: #6c3fc5; }
.team-bravo .team-header { background: #16a34a; }

.team-members {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.team-member {
  background: white;
  border-radius: 6px;
  padding: 8px 10px;
}

.team-member-name {
  font-size: 13px;
  font-weight: 700;
}

.team-member-weapon {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Footer */
.footer {
  text-align: center;
  padding: 24px 16px 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 2;
}

.footer a {
  color: var(--primary);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* Error toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e1b2e;
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  z-index: 1000;
  animation: toastIn 0.25s ease;
  white-space: nowrap;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Responsive */
@media (max-width: 400px) {
  .title { font-size: 22px; }
  .title span { font-size: 26px; }
  .teams { grid-template-columns: 1fr; }
  .result-player { min-width: 64px; }
}
