:root {
  --bg: #101114;
  --surface: #191b21;
  --surface-2: #22252d;
  --text: #f6f2e8;
  --muted: #b6ad9c;
  --hint: #80796e;
  --gold: #d6a642;
  --red: #d94848;
  --green: #3ec77b;
  --blue: #4d8cff;
  --border: rgba(246, 242, 232, 0.13);
  --shadow: rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Segoe UI, Roboto, Arial, sans-serif;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background: var(--global-bg-image, none) center/cover no-repeat fixed;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(0, 0, 0, 0.72);
  pointer-events: none;
}

button, input, textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.hero {
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: #15120f center/cover no-repeat;
}

.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
}

.hero-content {
  position: relative;
  z-index: 1;
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 18px 20px 28px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.topbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: rgba(25, 27, 33, 0.82);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--red);
}

.dot.connected {
  background: var(--green);
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  background: rgba(25, 27, 33, 0.72);
  color: var(--text);
  border-radius: 8px;
}

.logo {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  margin-top: 46px;
  border: 3px solid rgba(214, 166, 66, 0.5);
  box-shadow: 0 0 34px rgba(214, 166, 66, 0.28);
  object-fit: cover;
  background: rgba(214, 166, 66, 0.14);
}

.logo-placeholder {
  display: grid;
  place-items: center;
  color: var(--gold);
  font-size: 54px;
  font-weight: 800;
}

h1 {
  margin: 30px 0 8px;
  text-align: center;
  font-size: clamp(28px, 6vw, 48px);
  line-height: 1.08;
  max-width: 820px;
}

.subtitle {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
}

.hero-actions {
  margin-top: auto;
  width: min(460px, 100%);
  display: grid;
  gap: 12px;
}

.btn {
  border: 0;
  border-radius: 8px;
  min-height: 52px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 800;
  color: #101114;
  background: var(--gold);
}

.btn.secondary {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
}

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

.btn.small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

.count {
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  padding-top: 8px;
}

.page {
  min-height: 100vh;
  background: transparent;
}

.appbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: rgba(16, 17, 20, 0.96);
  border-bottom: 1px solid var(--border);
}

.appbar-title {
  font-size: 18px;
  font-weight: 800;
}

.content {
  width: min(880px, 100%);
  margin: 0 auto;
  padding: 18px 16px 34px;
}

.success-popup {
  text-align: center;
}

.success-popup h2 {
  color: var(--gold);
  font-size: 24px;
  margin-bottom: 8px;
}

.range-row {
  display: grid;
  grid-template-columns: 1fr 54px;
  gap: 12px;
  align-items: center;
  margin-top: 10px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--gold);
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.input, .textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 13px 14px;
  outline: none;
}

.textarea {
  min-height: 92px;
  resize: vertical;
}

.input:focus, .textarea:focus {
  border-color: var(--gold);
}

.section-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  margin: 24px 0 10px;
}

.candidate-list {
  display: grid;
  gap: 10px;
}

.candidate {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
  color: var(--text);
  display: grid;
  grid-template-columns: 58px 1fr auto;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.candidate.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(214, 166, 66, 0.16);
}

.avatar {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(214, 166, 66, 0.13);
  display: grid;
  place-items: center;
  color: var(--gold);
  font-weight: 800;
}

.candidate h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.candidate p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.result-meta {
  text-align: right;
  min-width: 74px;
}

.result-meta strong {
  display: block;
  color: var(--gold);
  font-size: 22px;
}

.progress {
  height: 7px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 8px;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--gold);
}

.empty {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 32px 16px;
  color: var(--muted);
  text-align: center;
}

.notice {
  margin: 14px 0;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
}

.notice.error {
  color: #ffdada;
  border-color: rgba(217, 72, 72, 0.45);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  min-height: 48px;
  font-weight: 800;
  border-bottom: 2px solid transparent;
}

.tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.admin-header {
  background: var(--surface);
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.admin-header h2 {
  margin: 0;
  font-size: 18px;
  color: var(--gold);
}

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

.card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 14px;
}

.candidate-actions {
  display: inline-flex;
  gap: 8px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal {
  width: min(520px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 20px 60px var(--shadow);
}

.modal h2 {
  margin: 0 0 16px;
  color: var(--gold);
  font-size: 20px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.file-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: center;
}

.hidden {
  display: none !important;
}

svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

@media (max-width: 640px) {
  .tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .candidate {
    grid-template-columns: 48px 1fr;
  }

  .candidate .avatar {
    width: 48px;
    height: 48px;
  }

  .result-meta, .candidate-actions {
    grid-column: 1 / -1;
    text-align: left;
  }
}
