:root {
  --mb-panel: #ffffff;
  --mb-line: #dce4f3;
  --mb-text: #2d2f3f;
  --mb-muted: #6c7288;
  --mb-lime: #ddff1f;
  --mb-danger: #ff6e7c;
}

.memory-wrap,
.memory-wrap h1,
.memory-wrap h2,
.memory-wrap h3,
.memory-wrap p,
.memory-wrap label,
.memory-wrap span,
.memory-wrap strong,
.memory-wrap a {
  color: var(--mb-text);
}

.memory-wrap .product-meta,
.memory-wrap .subtitle,
.memory-wrap .empty-state,
.memory-wrap .gallery-head p {
  color: var(--mb-muted);
}

.shell {
  max-width: 1080px;
  margin: 1rem auto;
  padding: 0 1rem 2rem;
}

.hero {
  animation: fade-up 0.42s ease-out;
}

.pill {
  display: inline-block;
  margin: 0;
  padding: 0.34rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--mb-line);
  color: var(--mb-text);
  font-size: 0.68rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  font-weight: 700;
}

h1 {
  margin: 0.72rem 0 0.35rem;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4.2vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--mb-text);
}

.memory-brand-heading {
  margin: 0.72rem 0 0.35rem;
  line-height: 1;
}

.memory-brand-logo {
  display: block;
  height: clamp(56px, 9vw, 92px);
  width: auto;
  object-fit: contain;
}

.subtitle {
  margin: 0;
  max-width: 760px;
  color: var(--mb-muted);
  font-size: 0.93rem;
}

.panel,
.result {
  margin-top: 1rem;
  padding: 0.9rem;
  border: 1px solid var(--mb-line);
  border-radius: 14px;
  background: var(--mb-panel);
  box-shadow: 0 10px 28px rgba(26, 22, 14, 0.08);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.file-label {
  position: relative;
  border-radius: 10px;
  border: 1px solid var(--mb-line);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: #fffdf8;
  color: var(--mb-text);
  padding: 0.56rem 0.82rem;
  cursor: pointer;
}

.file-label input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.btn {
  border-radius: 10px;
  border: 1px solid var(--mb-line);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.54rem 0.82rem;
  cursor: pointer;
  color: var(--mb-text);
  background: #fffdf8;
  transition: transform 0.1s ease, border-color 0.1s ease;
}

.btn.primary {
  background: linear-gradient(180deg, #dbff2f 0%, #c7ed14 100%);
  color: #101419;
  border-color: #a8cb12;
  box-shadow: 0 8px 18px rgba(170, 209, 18, 0.28);
  margin-left: auto;
}

.btn:hover,
.file-label:hover {
  transform: translateY(-1px);
  border-color: var(--mb-lime);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.camera {
  margin-top: 1rem;
  border: 1px dashed var(--mb-line);
  border-radius: 12px;
  background: #f3f8ff;
  overflow: hidden;
}

#cameraPreview {
  width: 100%;
  max-height: 360px;
  display: block;
  object-fit: cover;
}

.gallery-wrap {
  margin-top: 0.85rem;
}

.gallery-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.gallery-head h2,
.result h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--mb-text);
}

.gallery-head p {
  margin: 0;
  color: var(--mb-muted);
}

.preview-grid {
  margin-top: 0.65rem;
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.preview-card {
  border-radius: 10px;
  border: 1px solid var(--mb-line);
  background: #fffdf8;
  padding: 0.38rem;
  display: grid;
  gap: 0.35rem;
}

.preview-card img,
.preview-card video {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 8px;
  background: #eef5ff;
}

.preview-meta {
  font-size: 0.79rem;
  color: var(--mb-muted);
  line-height: 1.35;
  word-break: break-word;
}

.remove-btn {
  border: 1px solid #d4b8be;
  border-radius: 7px;
  padding: 0.38rem 0.58rem;
  background: #fff5f6;
  color: #a13a4f;
  font-weight: 700;
  cursor: pointer;
}

.empty-state {
  margin: 0.8rem 0 0;
  color: var(--mb-muted);
}

.status {
  margin: 0.8rem 0 0;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--mb-text);
}

.status-progress {
  margin: 0.8rem 0 0;
}

.status-progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  border: 1px solid var(--mb-line);
  background: #eef2fb;
  overflow: hidden;
}

.status-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8bc34a, #dbff2f);
  transition: width 420ms ease;
}

.ocr-edit-actions {
  display: flex;
  gap: 0.5rem;
  margin: 0.65rem 0;
  flex-wrap: wrap;
}

pre,
.ocr-editor {
  margin: 0;
  padding: 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--mb-line);
  background: #f9f5ec;
  color: var(--mb-text);
  max-height: 300px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
}

.ocr-editor {
  width: 100%;
  min-height: 220px;
  line-height: 1.4;
  resize: vertical;
}

.download-actions {
  margin-top: 0.7rem;
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.download-icon-btn {
  width: 52px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  padding: 0;
}

.file-icon-word,
.file-icon-pdf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.file-icon-word {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  font-size: 0.88rem;
  font-weight: 800;
  background: linear-gradient(180deg, #2563eb, #123ca4);
}

.file-icon-pdf {
  width: 30px;
  height: 22px;
  border-radius: 5px;
  font-size: 0.66rem;
  font-weight: 800;
  background: linear-gradient(180deg, #ef4444, #b91c1c);
}

.word-btn,
.pdf-btn {
  border-color: var(--mb-line);
}

.hidden {
  display: none;
}

.hidden-input {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  left: -10000px;
  top: -10000px;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 860px) {
  .btn.primary {
    margin-left: 0;
  }
}

@media (max-width: 680px) {
  .shell {
    margin-top: 0.55rem;
    padding: 0 0.72rem 1.2rem;
  }

  .panel,
  .result {
    border-radius: 10px;
    padding: 0.72rem;
  }

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

  .file-label,
  .btn {
    text-align: center;
    padding: 0.5rem 0.64rem;
    font-size: 0.78rem;
    border-radius: 8px;
  }

  .btn.primary {
    grid-column: 1 / -1;
  }

  .preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .preview-card img,
  .preview-card video {
    aspect-ratio: 3 / 4;
  }
}
