:root {
  --bg-page: #f1f5f9;
  --bg-card: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --ua-blue: #0057b7;
  --ua-gold: #ffd700;
  --ru-red: #d52b1e;
  --ru-blue: #0039a6;
  --green: #059669;
  --amber: #d97706;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  font-size: 15px;
}

.hidden {
  display: none !important;
}

/* App Shell */
.app-shell {
  max-width: 540px;
  margin: 0 auto;
  padding: 14px 14px 36px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Header */
.app-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  padding: 18px 16px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #94a3b8;
}

.live-dot {
  width: 8px;
  height: 8px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.85; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.85; }
}

.lang-switcher {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.1);
  padding: 3px;
  border-radius: 8px;
}

.lang-btn {
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lang-btn.active {
  background: #ffffff;
  color: #0f172a;
}

.main-title {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 13px;
  color: #cbd5e1;
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

/* Hero Stats */
.stats-hero {
  text-align: center;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.total-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.total-number {
  font-size: 32px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.split-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 6px;
  flex-wrap: wrap;
  gap: 4px;
}

.ua-text { color: var(--ua-blue); }
.ru-text { color: var(--ru-red); }

.progress-track {
  display: flex;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: #e2e8f0;
}

.progress-fill {
  height: 100%;
  transition: width 0.4s ease;
}

.ua-fill { background-color: var(--ua-blue); }
.ru-fill { background-color: var(--ru-red); }
.green-fill { background-color: var(--green); }
.amber-fill { background-color: var(--amber); }

/* Device Notice */
.device-notice {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.device-notice.android-warn {
  background: #fef3c7;
  border-color: #fde68a;
  color: #92400e;
}

/* Form Elements */
.section-heading {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.form-group {
  margin-bottom: 14px;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 7px;
}

.radio-grid.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.radio-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-card {
  position: relative;
  display: block;
  cursor: pointer;
}

.radio-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-content {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  background: #ffffff;
  transition: all 0.15s ease;
}

.radio-card input[type="radio"]:checked + .radio-content {
  border-color: var(--primary);
  background: #eff6ff;
  color: #1e3a8a;
  font-weight: 600;
}

.flag-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 18px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.flag-badge.ua {
  background: linear-gradient(180deg, #0057b7 50%, #ffd700 50%);
  color: #0f172a;
  text-shadow: 0 0 2px #fff;
}

.flag-badge.ru {
  background: linear-gradient(180deg, #ffffff 33%, #0039a6 33%, #0039a6 66%, #d52b1e 66%);
  border: 1px solid #cbd5e1;
  color: #0f172a;
}

textarea {
  width: 100%;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  resize: none;
  color: var(--text-primary);
}

textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease;
}

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

.btn-primary:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}

.full-width {
  width: 100%;
}

.feedback-msg {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.feedback-msg.success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.feedback-msg.error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* Analytics */
.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.section-header-row .section-heading {
  margin-bottom: 0;
}

.filter-pills {
  display: flex;
  gap: 4px;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 8px;
}

.pill-btn {
  border: none;
  background: transparent;
  padding: 5px 9px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
}

.pill-btn.active {
  background: #ffffff;
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.metric-block {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.metric-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.bar-item {
  margin-bottom: 10px;
}

.bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  margin-bottom: 4px;
  gap: 8px;
}

.bar-num {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bar-track {
  height: 9px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.35s ease;
}

/* Discussion Board */
.badge-count {
  font-size: 11.5px;
  font-weight: 700;
  background: #f1f5f9;
  color: var(--text-secondary);
  padding: 3px 8px;
  border-radius: 999px;
}

.comments-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 2px;
}

.comment-card {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 11px 12px;
}

.comment-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12px;
}

.comment-author {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--text-primary);
}

.comment-time {
  color: var(--text-muted);
  font-size: 11px;
}

.comment-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.tag-chip {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: #e2e8f0;
  color: #334155;
}

.comment-body {
  font-size: 13.5px;
  color: #1e293b;
  word-break: break-word;
}

/* Overlays & Modals */
.overlay-screen {
  position: fixed;
  inset: 0;
  background: #0f172a;
  color: #ffffff;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
}

.overlay-card, .modal-card {
  background: #ffffff;
  color: var(--text-primary);
  max-width: 400px;
  width: 100%;
  border-radius: 20px;
  padding: 26px 22px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(4px);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

/* iOS 30s verification loading overlay: light black veil + small white card */
.loading-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.28);
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-width: 142px;
  padding: 20px 24px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(29, 78, 216, 0.18);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

/* Vote success overlay: animated checkmark, auto dismiss after 2s */
.success-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.28);
  z-index: 9600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  opacity: 1;
  transition: opacity 0.25s ease;
}

.success-backdrop.fade-out {
  opacity: 0;
}

.success-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 150px;
  padding: 22px 28px 18px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  animation: success-pop 0.34s cubic-bezier(0.2, 0.9, 0.3, 1.35);
}

@keyframes success-pop {
  from { transform: scale(0.82); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.success-check {
  width: 64px;
  height: 64px;
  color: var(--green);
}

.success-circle {
  fill: #ecfdf5;
  stroke: #a7f3d0;
  stroke-width: 2;
}

.success-tick {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: success-draw 0.5s 0.12s ease-out forwards;
}

@keyframes success-draw {
  to { stroke-dashoffset: 0; }
}

.success-text {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

.icon-badge {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.icon-badge.warning {
  background: #fef2f2;
  color: #dc2626;
}

.icon-badge.android {
  background: #ecfdf5;
  color: #059669;
}

.overlay-card h2, .modal-card h3 {
  font-size: 19px;
  font-weight: 800;
  margin-bottom: 8px;
}

.overlay-card p, .modal-card p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 18px;
}

.lang-mini-bar {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.lang-mini-bar .lang-btn {
  background: #f1f5f9;
  color: #0f172a;
  padding: 6px 12px;
}

.app-footer {
  text-align: center;
  font-size: 11.5px;
  color: var(--text-muted);
  padding-top: 6px;
}
