:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #18181b;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --success: #15803d;
  --success-bg: #f0fdf4;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

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

.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 1rem;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-inner {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.05rem;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.lang-select {
  padding: 0.38rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
}

.main-content {
  padding-top: 2rem;
  padding-bottom: 3.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.poll-cover-wrap {
  margin: -1.75rem -1.75rem 1.5rem -1.75rem;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
  max-height: 280px;
}

.poll-cover-wrap img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  display: block;
}

.poll-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
}

.badge-open {
  background: var(--success-bg);
  color: var(--success);
}

.badge-closed {
  background: var(--danger-bg);
  color: var(--danger);
}

.meta-text {
  font-size: 0.82rem;
  color: var(--muted);
}

.poll-title {
  margin: 0 0 0.45rem 0;
  font-size: 1.45rem;
  line-height: 1.3;
}

.poll-desc {
  margin: 0 0 1.4rem 0;
  color: var(--muted);
  font-size: 0.96rem;
}

.options-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.options-grid.is-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1rem;
}

.option-item {
  border: 1.5px solid var(--border);
  border-radius: 9px;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
  background: #fff;
}

.option-item:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.option-item.selected {
  border-color: var(--primary);
  background: #eff6ff;
}

.option-item.card-layout {
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  overflow: hidden;
}

.option-item.card-layout img {
  width: 100%;
  height: 155px;
  object-fit: cover;
  border-bottom: 1px solid var(--border);
}

.option-item.card-layout .option-body {
  padding: 0.8rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.option-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.option-label {
  font-weight: 500;
  font-size: 0.98rem;
}

.rating-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.rating-btn {
  flex: 1;
  min-width: 54px;
  padding: 0.85rem 0.5rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  text-align: center;
}

.rating-btn.selected {
  border-color: var(--primary);
  background: #eff6ff;
  color: var(--primary);
}

.form-footer {
  margin-top: 1.5rem;
  display: flex;
  justify-content: flex-end;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.62rem 1.15rem;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

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

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

.btn-secondary {
  background: #f1f5f9;
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  background: #f8fafc;
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #fecaca;
}

.btn-danger:hover {
  background: #fee2e2;
}

.btn-sm {
  padding: 0.42rem 0.8rem;
  font-size: 0.83rem;
}

.voted-box {
  text-align: center;
  padding: 2rem 1rem;
}

.check-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--success-bg);
  color: var(--success);
  font-weight: 700;
  font-size: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tab-btn {
  padding: 0.52rem 0.95rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 600px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.field-label {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.input {
  width: 100%;
  padding: 0.58rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 0.93rem;
  font-family: inherit;
  background: #fff;
}

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

.key-upload-box {
  padding: 0.85rem;
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  background: #f8fafc;
}

.inline-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.editor-option-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

@media (max-width: 640px) {
  .editor-option-row {
    grid-template-columns: 1fr;
  }
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.result-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem 1rem;
}

.result-top {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  font-size: 0.93rem;
  margin-bottom: 0.45rem;
}

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

.bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.response-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.response-list li {
  padding: 0.65rem 0.85rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 0.92rem;
}

.info-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}

.danger-zone {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid #fecaca;
  background: #fffafa;
  border-radius: 8px;
}

.steps-list {
  padding-left: 1.25rem;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.92rem;
}

.alert {
  padding: 0.8rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.92rem;
  font-weight: 500;
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
}

.alert-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #bbf7d0;
}

.muted {
  color: var(--muted);
  margin: 0.25rem 0;
}

.small {
  font-size: 0.84rem;
}

.hidden {
  display: none !important;
}
