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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #0d0d0d;
  color: #e8e8e8;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

header {
  background: #111;
  border-bottom: 1px solid #1e1e1e;
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

nav {
  display: flex;
  gap: 20px;
}

nav a {
  font-size: 13px;
  font-weight: 500;
  color: #555;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s;
}

nav a:hover {
  color: #e8e8e8;
}

nav a svg {
  flex-shrink: 0;
}

main {
  flex: 1;
  max-width: 1180px;
  margin: 0 auto;
  width: 100%;
  padding: 48px 28px;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 48px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 86px;
  max-height: calc(100vh - 110px);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.sidebar-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #555;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.search-wrap {
  position: relative;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: #444;
  pointer-events: none;
}

#search-input {
  width: 100%;
  height: 36px;
  background: #161616;
  border: 1px solid #222;
  border-radius: 7px;
  padding: 0 12px 0 32px;
  font-size: 13px;
  font-family: inherit;
  color: #e8e8e8;
  outline: none;
  transition: border-color 0.15s;
}

#search-input::placeholder {
  color: #333;
}

#search-input:focus {
  border-color: #333;
}

#polls-list {
  overflow-y: auto;
  flex: 1;
  padding-right: 2px;
}

#polls-list::-webkit-scrollbar {
  width: 3px;
}

#polls-list::-webkit-scrollbar-track {
  background: transparent;
}

#polls-list::-webkit-scrollbar-thumb {
  background: #222;
  border-radius: 2px;
}

.empty-state {
  font-size: 13px;
  color: #333;
  padding: 16px 0;
}

.poll-card {
  background: #141414;
  border: 1px solid #1e1e1e;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 6px;
}

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

.card-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.expand-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid #2a2a2a;
  background: #1a1a1a;
  color: #555;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}

.expand-btn:hover {
  border-color: #444;
  color: #ccc;
}

.poll-type-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #444;
}

.poll-time {
  font-size: 11px;
  color: #333;
}

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

.poll-player-row:last-of-type {
  margin-bottom: 0;
}

.num-badge-sm {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: #1e1e1e;
  color: #666;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.poll-player-name {
  font-size: 12px;
  font-weight: 500;
  color: #ccc;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vote-section {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 60px;
}

.vote-bar-bg {
  flex: 1;
  height: 2px;
  background: #222;
  border-radius: 1px;
  overflow: hidden;
}

.vote-bar-fill {
  height: 100%;
  background: #3a3a3a;
  border-radius: 1px;
  transition: width 0.6s ease;
}

.vote-bar-fill.leading {
  background: #fff;
}

.vote-num {
  font-size: 11px;
  color: #444;
  min-width: 18px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.vote-num.has-votes {
  color: #888;
}

.poll-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid #1a1a1a;
}

.platform-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.platform-badge.both {
  background: #0a1a10;
  color: #4ade80;
}

.platform-badge.discord {
  background: #0f1230;
  color: #818cf8;
}

.platform-badge.telegram {
  background: #081520;
  color: #38bdf8;
}

.platform-badge svg {
  flex-shrink: 0;
}

.no-results {
  font-size: 13px;
  color: #333;
  padding: 12px 0;
}

.content {
  display: flex;
  justify-content: center;
}

.form-wrap {
  width: 100%;
  max-width: 420px;
}

.form-header {
  margin-bottom: 20px;
}

.form-header h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
}

.mode-group {
  display: flex;
  border: 1px solid #222;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 28px;
}

.mode-btn {
  flex: 1;
  height: 38px;
  border: none;
  border-right: 1px solid #222;
  background: #141414;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  color: #555;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}

.mode-btn:last-child {
  border-right: none;
}

.mode-btn:hover:not(.active) {
  background: #1a1a1a;
  color: #aaa;
}

.mode-btn.active {
  background: #fff;
  color: #111;
  font-weight: 600;
}

.player-field {
  margin-bottom: 12px;
}

.player-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #444;
  margin-bottom: 7px;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #141414;
  border: 1px solid #222;
  border-radius: 8px;
  padding: 0 14px;
  transition: border-color 0.15s;
}

.input-row:focus-within {
  border-color: #383838;
}

.num-badge {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: #1e1e1e;
  color: #666;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.field-icon {
  color: #3a3a3a;
  flex-shrink: 0;
}

.input-row input[type="text"] {
  flex: 1;
  height: 44px;
  border: none;
  background: transparent;
  padding: 0;
  font-size: 14px;
  font-family: inherit;
  color: #e8e8e8;
  outline: none;
}

.input-row input[type="text"]::placeholder {
  color: #2e2e2e;
}

.remove-btn {
  background: none;
  border: none;
  color: #2e2e2e;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.remove-btn:hover {
  color: #888;
  background: #1e1e1e;
}

#add-player-btn {
  width: 100%;
  height: 40px;
  background: transparent;
  border: 1px dashed #222;
  border-radius: 8px;
  color: #444;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: border-color 0.15s, color 0.15s;
  margin-top: 4px;
  margin-bottom: 28px;
}

#add-player-btn:hover {
  border-color: #333;
  color: #888;
}

#add-player-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.single-hint {
  font-size: 12px;
  color: #333;
  margin-top: 10px;
}

.divider {
  height: 1px;
  background: #1a1a1a;
  margin-bottom: 24px;
}

.field {
  margin-bottom: 22px;
}

.field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #444;
  margin-bottom: 8px;
}

.platform-group {
  display: flex;
  border: 1px solid #222;
  border-radius: 8px;
  overflow: hidden;
}

.platform-btn {
  flex: 1;
  height: 40px;
  border: none;
  border-right: 1px solid #222;
  background: #141414;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  color: #555;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
  padding: 0 8px;
}

.platform-btn:last-child {
  border-right: none;
}

.platform-btn:hover:not(.active) {
  background: #1a1a1a;
  color: #aaa;
}

.platform-btn.active {
  background: #fff;
  color: #111;
  font-weight: 600;
}

#submit-btn {
  width: 100%;
  height: 46px;
  background: #fff;
  color: #111;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s;
  letter-spacing: -0.01em;
}

#submit-btn:hover {
  opacity: 0.88;
}

#submit-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.status {
  margin-top: 14px;
  font-size: 13px;
  padding: 11px 14px;
  border-radius: 7px;
  line-height: 1.5;
}

.status[hidden] {
  display: none;
}

.status.success {
  background: #0a1f12;
  color: #4ade80;
  border: 1px solid #14532d;
}

.status.error {
  background: #1f0a0a;
  color: #f87171;
  border: 1px solid #7f1d1d;
}

.status.warning {
  background: #1f1700;
  color: #fbbf24;
  border: 1px solid #78350f;
}

footer {
  border-top: 1px solid #1a1a1a;
  background: #111;
  padding: 18px 28px;
  text-align: center;
  font-size: 12px;
  color: #333;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

footer a {
  color: #444;
  text-decoration: none;
  transition: color 0.15s;
}

footer a:hover {
  color: #e8e8e8;
}

.sep {
  color: #222;
}

.owners {
  color: #2a2a2a;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.modal-box {
  position: relative;
  background: #141414;
  border: 1px solid #252525;
  border-radius: 12px;
  width: 100%;
  max-width: 420px;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid #1e1e1e;
}

.modal-title {
  font-size: 13px;
  font-weight: 600;
  color: #ccc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 320px;
}

.modal-close {
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s;
  flex-shrink: 0;
}

.modal-close:hover {
  color: #ccc;
}

#modal-body {
  padding: 20px 18px;
}

.modal-alias {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  word-break: break-word;
  margin-bottom: 20px;
}

.modal-votes {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.modal-vote-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-num {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: #1e1e1e;
  color: #666;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-vote-label {
  font-size: 14px;
  font-weight: 500;
  color: #ddd;
  flex: 1;
  word-break: break-word;
}

.modal-bar-bg {
  width: 80px;
  height: 3px;
  background: #222;
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}

.modal-bar-fill {
  height: 100%;
  background: #333;
  border-radius: 2px;
  transition: width 0.5s ease;
}

.modal-bar-fill.leading {
  background: #fff;
}

.modal-vote-num {
  font-size: 13px;
  font-weight: 600;
  color: #888;
  min-width: 24px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.modal-meta {
  font-size: 11px;
  color: #444;
  padding-top: 14px;
  border-top: 1px solid #1e1e1e;
}

@media (max-width: 860px) {
  main {
    grid-template-columns: 1fr;
    padding: 32px 20px;
    gap: 36px;
  }

  .sidebar {
    position: static;
    max-height: none;
    order: 2;
  }

  .content {
    order: 1;
  }
}
