:root {
  --rv-bg: #f4f6fb;
  --rv-ink: #0f172a;
  --rv-muted: #64748b;
  --rv-accent: #4f46e5;
  --rv-accent-soft: rgba(79, 70, 229, 0.12);
  --rv-card: #ffffff;
  --rv-radius: 20px;
  --rv-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 12px 40px rgba(79, 70, 229, 0.08);
}

html.rv-page,
body.rv-page {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(1200px 600px at 50% -10%, #e0e7ff 0%, var(--rv-bg) 55%);
  color: var(--rv-ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Inter, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.rv-page .v1-global-bar {
  position: sticky;
  top: 0;
  z-index: 100;
}

.rv-shell {
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 18px 32px;
  padding-bottom: max(32px, env(safe-area-inset-bottom, 16px));
  box-sizing: border-box;
}

.rv-brand {
  text-align: center;
  margin-bottom: 22px;
}

.rv-brand h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.rv-brand p {
  margin: 6px 0 0;
  font-size: 0.88rem;
  color: var(--rv-muted);
}

.rv-login-banner {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #92400e;
  font-size: 0.9rem;
  text-align: center;
}

.rv-login-banner[hidden] {
  display: none !important;
}

.rv-login-banner a {
  color: #b45309;
  font-weight: 700;
}

.rv-capture:disabled {
  opacity: 0.55;
  cursor: wait;
}

.rv-capture {
  display: block;
  width: 100%;
  border: none;
  border-radius: var(--rv-radius);
  background: var(--rv-card);
  box-shadow: var(--rv-shadow);
  padding: 28px 20px;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  overflow: hidden;
}

.rv-capture::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--rv-accent-soft), transparent 60%);
  pointer-events: none;
}

.rv-capture:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.08), 0 16px 48px rgba(79, 70, 229, 0.14);
}

.rv-capture:active {
  transform: translateY(0);
}

.rv-capture__icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: linear-gradient(145deg, #6366f1, #4f46e5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.35);
  position: relative;
  z-index: 1;
}

.rv-capture__title {
  display: block;
  font-size: 1.12rem;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

.rv-capture__hint {
  display: block;
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--rv-muted);
  position: relative;
  z-index: 1;
}

.rv-search-wrap {
  margin-top: 22px;
}

.rv-search-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.rv-search {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  padding: 14px 16px 14px 44px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: var(--rv-card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Ccircle cx='9' cy='9' r='6'/%3E%3Cpath d='M14 14l4 4'/%3E%3C/svg%3E") 14px center no-repeat;
  font: inherit;
  font-size: 1rem;
  color: var(--rv-ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.rv-voice {
  flex-shrink: 0;
  width: 52px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: var(--rv-card);
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.rv-voice.is-active {
  border-color: #818cf8;
  background: var(--rv-accent-soft);
}

.rv-voice[hidden] {
  display: none !important;
}

.rv-search:focus {
  outline: none;
  border-color: #a5b4fc;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.rv-status {
  min-height: 1.25rem;
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--rv-muted);
  text-align: center;
}

.rv-status.is-ok {
  color: #059669;
}

.rv-status.is-err {
  color: #dc2626;
}

.rv-results {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rv-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: none;
  border-radius: 12px;
  background: var(--rv-card);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--rv-ink);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.rv-row:active {
  transform: scale(0.99);
}

.rv-row__date {
  flex: 0 0 auto;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--rv-muted);
  min-width: 4.5rem;
}

.rv-row__words {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  min-width: 0;
}

.rv-row__chip {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--rv-ink);
}

.rv-row__chip--muted {
  font-weight: 500;
  color: var(--rv-muted);
}

.rv-row__sep {
  color: #cbd5e1;
  font-weight: 700;
}

.rv-row__badge {
  flex: 0 0 100%;
  font-size: 0.72rem;
  color: var(--rv-muted);
}

.rv-results--admin .rv-row {
  padding: 10px 12px;
}

.rv-results--admin .rv-row__chip {
  font-size: 0.86rem;
}

.rv-empty {
  text-align: center;
  padding: 24px 12px;
  color: var(--rv-muted);
  font-size: 0.9rem;
}

.rv-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(15, 23, 42, 0.92);
  display: none;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
}

.rv-modal.is-open {
  display: flex;
}

.rv-modal__img-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  min-height: 0;
}

.rv-modal__img-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.rv-modal__bar {
  display: flex;
  gap: 10px;
  padding: 12px 16px max(16px, env(safe-area-inset-bottom, 12px));
  background: #0f172a;
}

.rv-modal__bar button {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  border: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.rv-btn-close {
  background: #334155;
  color: #f8fafc;
}

.rv-btn-delete {
  background: #fee2e2;
  color: #b91c1c;
}

.rv-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* My page embed */
.rv-embed .rv-shell {
  max-width: 100%;
  padding: 0;
}

.rv-embed .rv-brand h1 {
  font-size: 1.15rem;
}
