:root {
  --grad-start: #4338ca;
  --grad-mid: #9333ea;
  --grad-end: #c026d3;
  --brand-gradient: linear-gradient(90deg, var(--grad-start), var(--grad-mid), var(--grad-end));
  --bg: #f7f6fb;
  --card-bg: #ffffff;
  --text: #1a1625;
  --muted: #6b6478;
  --border: #e4e1ec;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #b45309;
  --radius: 18px;
}

:root[data-theme="dark"] {
  --bg: #15121e;
  --card-bg: #211d2e;
  --text: #f2f0f7;
  --muted: #a89fc0;
  --border: #38324a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background .2s, color .2s;
}

.hidden { display: none !important; }

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  padding-bottom: 96px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
}

.brand-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.lang-toggle {
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
}

.brand-logo {
  height: 26px;
  width: auto;
  border-radius: 6px;
}

.state-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 80px 20px;
  color: var(--muted);
  text-align: center;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--grad-mid);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.event-hero {
  padding: 0 16px;
  text-align: center;
}

.event-photo {
  width: 100%;
  aspect-ratio: 2.1 / 1;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--border);
  display: block;
}

.event-hero h1 {
  margin: 12px 0 2px;
  font-size: 1.25rem;
}

.event-hero .subtitle {
  margin: 0;
  color: var(--muted);
  font-size: .88rem;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin: 14px 16px 0;
  box-shadow: 0 2px 14px rgba(31, 26, 46, .06);
}

.gate-card {
  text-align: center;
}

.gate-divider {
  width: 46px;
  height: 3px;
  border-radius: 999px;
  background: var(--brand-gradient);
  margin: 0 auto 18px;
}

.gradient-text {
  margin: 0 0 8px;
  font-size: 1.2rem;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hint {
  color: var(--muted);
  font-size: .88rem;
  margin: 0 0 14px;
}

.hint-small {
  font-size: .78rem;
  margin: 4px 0 0;
  color: var(--muted);
}

.otp-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
}

.otp-box {
  width: 50px;
  height: 58px;
  text-align: center;
  font-size: 1.6rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
}

.otp-box:focus {
  outline: 2px solid var(--grad-mid);
  outline-offset: -1px;
}

.otp-error {
  color: var(--danger);
  font-size: .85rem;
  margin: 6px 0 14px;
}

.btn-gradient {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 999px;
  background: var(--brand-gradient);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin: 6px 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity .15s;
}

.btn-gradient:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.ai-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f1eefb;
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: .8rem;
  color: var(--text);
}

:root[data-theme="dark"] .ai-notice {
  background: #2a2440;
}

.ai-icon {
  width: 26px;
  height: 26px;
  color: var(--grad-mid);
  flex-shrink: 0;
}

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 22px 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.drop-zone.drag-over {
  border-color: var(--grad-mid);
  background: #f4effe;
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.drop-icon {
  width: 44px;
  height: 44px;
  color: var(--grad-mid);
  margin-bottom: 8px;
}

.drop-zone-content p:first-of-type {
  font-weight: 600;
  color: var(--text);
  font-size: 1rem;
  margin: 0;
}

.file-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 232px;
  overflow-y: auto;
  position: relative;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.file-list:empty {
  display: none;
  margin: 0;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: .82rem;
  flex-shrink: 0;
}

[dir="rtl"] .file-row .file-name { text-align: right; }
[dir="ltr"] .file-row .file-name { text-align: left; }

.file-row .file-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row .file-size {
  color: var(--muted);
  font-size: .78rem;
  white-space: nowrap;
}

.file-row .file-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .78rem;
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f1eefb;
  color: var(--grad-mid);
}

.file-row .file-status.done { background: #e7f7ec; color: var(--success); }
.file-row .file-status.error { background: #fdeceb; color: var(--danger); }
.file-row .file-status.duplicate { background: #fdf3e0; color: var(--warning); }

.file-row .remove-btn {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 2px 6px;
}

.spinner-sm {
  width: 13px;
  height: 13px;
  border: 2px solid var(--border);
  border-top-color: var(--grad-mid);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

.spinner-sm.on-primary {
  border-color: rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
}

.upload-progress {
  margin-top: 16px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--brand-gradient);
  transition: width .2s;
}

.upload-progress p {
  margin: 8px 0 0;
  font-size: .85rem;
  color: var(--muted);
  text-align: center;
}

.upload-summary {
  margin-top: 16px;
  padding: 14px;
  border-radius: 12px;
  background: #f4effe;
  font-size: .9rem;
}

:root[data-theme="dark"] .upload-summary { background: #2a2440; }

.upload-summary.has-errors { background: #fdf3ec; }
:root[data-theme="dark"] .upload-summary.has-errors { background: #3a2a20; }

.upload-summary .summary-title {
  font-weight: 600;
  margin: 0 0 6px;
}

.upload-summary ul {
  margin: 6px 0 0;
  padding-inline-start: 18px;
  color: var(--danger);
  font-size: .8rem;
}

.disclaimer {
  margin: 14px 0 0;
  font-size: .72rem;
  color: var(--muted);
  line-height: 1.5;
  text-align: center;
}

.page-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 16px 16px 0;
}

.gallery-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 999px;
  border: 2px solid transparent;
  background:
    linear-gradient(var(--card-bg), var(--card-bg)) padding-box,
    var(--brand-gradient) border-box;
  color: var(--text);
  font-weight: 700;
  font-size: .92rem;
  text-decoration: none;
}

.gallery-btn-icon {
  width: 20px;
  height: 20px;
  color: var(--grad-mid);
}

.faq-link {
  color: var(--grad-mid);
  font-size: .85rem;
  text-decoration: none;
  font-weight: 600;
}

.theme-toggle {
  position: fixed;
  bottom: 18px;
  left: 18px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(31, 26, 46, .1);
  z-index: 20;
}

.theme-icon {
  width: 20px;
  height: 20px;
}

.drop-zone.compact {
  padding: 10px 14px;
}

.drop-zone.compact .drop-zone-content {
  flex-direction: row;
  justify-content: center;
  gap: 10px;
}

.drop-zone.compact .drop-icon {
  width: 24px;
  height: 24px;
  margin: 0;
}

.drop-zone.compact .hint-small {
  display: none;
}

.drop-zone.compact .drop-zone-content p:first-of-type {
  font-size: .9rem;
}
