:root {
  --primary: #0d6efd;
  --primary-dark: #0b5ed7;
  --page: #f6f7fb;
  /* Solid page background fixes the "column" */
  --card-bg: #ffffff;
  --radius: 16px;
  --transition: 0.25s ease;
}

/* Reset & base */
* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  min-height: 100svh;
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--page);
  display: grid;
  place-items: center;
  /* centers the card */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* When the main app shell is shown, use a top layout instead of full-center */
body.has-app {
  display: block;
  padding: 32px 0 40px;
}

/* --- Home page shell (wrapper around textarea + recent links) --- */
.app-shell {
  width: min(1100px, 96vw);
  margin: 0 auto;
  padding: 24px 24px 22px;
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.10);
}

/* Header on top of the textarea */
.app-header {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.app-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #111827;
}

.app-subtitle {
  margin: 0;
  font-size: 0.92rem;
  color: #6b7280;
}

.app-subtitle strong {
  font-weight: 600;
  color: #111827;
}

@media (max-width: 640px) {
  .app-shell {
    padding: 18px 16px 18px;
    border-radius: 18px;
  }

  .app-title {
    font-size: 1.2rem;
  }
}


/* ---------- Card ---------- */
.card {
  width: 100%;
  max-width: 420px;
  padding: 32px 28px 36px;
  background: var(--card-bg);
  /* solid white, no frosted blur */
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(16, 24, 40, 0.08);
  text-align: center;
  animation: fade-in 0.45s ease both;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.logo {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--primary);
}

.subtitle {
  font-size: 0.95rem;
  color: #6b7280;
  margin-bottom: 24px;
}

/* ---------- Form ---------- */
.field {
  position: relative;
  margin-bottom: 14px;
}

.field input {
  width: 100%;
  padding: 14px 44px 14px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.field input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.12);
}

.toggle-password {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1rem;
  color: #9ca3af;
  padding: 2px 6px;
  border-radius: 8px;
}

.toggle-password:hover {
  color: var(--primary);
}

/* ---------- Button ---------- */
.btn {
  width: 100%;
  padding: 14px;
  margin-top: 6px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--transition), transform 0.05s ease;
}

.btn:hover,
.btn:focus-visible {
  background: var(--primary-dark);
}

.btn:active {
  transform: translateY(1px);
}

/* ---------- Messages ---------- */
#message {
  margin-top: 14px;
  font-size: 0.93rem;
  font-weight: 500;
  min-height: 1.2em;
}

.error {
  color: #d52731;
}

.success {
  color: #269f53;
}

/* ---------- Logout button ---------- */
/* Tiny logout icon (top-left of the page) */
.logout-icon {
  position: fixed;
  top: 12px;
  left: 12px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(16, 24, 40, 0.12);
  transition: background var(--transition), transform 0.05s ease;
  z-index: 1000;
}

.logout-icon i {
  font-size: 14px;
  /* slightly larger than before */
  line-height: 1;
}

.logout-icon:hover {
  background: var(--primary-dark);
}

.logout-icon:active {
  transform: translateY(1px);
}


/* ---------- Hero Input (70/30 layout ready) ---------- */
:root {
  --input-h: 64px;
}

.toolbar {
  /* 70/30 grid */
  width: min(1200px, 92vw);
  margin: 24px auto;
  display: grid;
  grid-template-columns: 7fr 3fr;
  /* 70% / 30% */
  gap: 16px;
  align-items: center;
}

.hero-input {
  position: relative;
}

.hero-input input {
  width: 100%;
  height: var(--input-h);
  padding: 0 56px 0 52px;
  /* room for icon + clear */
  border: 1.5px solid #e5e7eb;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fafafa 0%, #ffffff 100%);
  box-shadow:
    0 6px 18px rgba(16, 24, 40, 0.06),
    inset 0 1px 0 #fff;
  font-size: 1.05rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.hero-input input::placeholder {
  color: #9ca3af;
}

.hero-input input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow:
    0 0 0 4px rgba(13, 110, 253, 0.12),
    0 8px 22px rgba(16, 24, 40, 0.10);
}

.hero-input .icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: #9ca3af;
  pointer-events: none;
}

.hero-input .clear-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  height: 40px;
  min-width: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), transform 0.05s ease;
  visibility: hidden;
  /* only show when useful */
}

.hero-input .clear-btn:hover {
  background: #f3f4f6;
  color: var(--primary);
}

.hero-input .clear-btn:active {
  transform: translateY(1px);
}

/* Show the clear button when there is input (or when focused) */
.hero-input input:not(:placeholder-shown)~.clear-btn,
.hero-input input:focus~.clear-btn {
  visibility: visible;
}

/* Placeholder for your future right-side controls */
.right-controls {
  min-height: var(--input-h);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* Optional: stack on small screens */
@media (max-width: 900px) {
  .toolbar {
    grid-template-columns: 1fr;
  }

  .right-controls {
    justify-content: flex-start;
  }
}


/* ---------- Big multiline input + Send button ---------- */
:root {
  --ta-h: 420px; /* smaller textarea height */
}

/* Toolbar: single big textarea that spans the card width */
.toolbar {
  width: 100%;
  margin-top: 12px;
}


/* Left: pretty textarea */
.hero-textarea {
  position: relative;
}

.hero-textarea textarea {
  width: 100%;
  min-height: var(--ta-h);
  height: var(--ta-h);
  padding: 18px 56px 82px 22px;
  /* room for clear + Send button at bottom (no icon on the left) */
  border: 1.5px solid #e5e7eb;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fafafa 0%, #ffffff 100%);
  box-shadow:
    0 10px 26px rgba(16, 24, 40, 0.08),
    inset 0 1px 0 #fff;
  font-size: 1.05rem;
  line-height: 1.55;
  resize: vertical;
  /* you can stretch if needed */
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}



.hero-textarea textarea::placeholder {
  color: #9ca3af;
}

.hero-textarea textarea:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow:
    0 0 0 4px rgba(13, 110, 253, 0.12),
    0 14px 30px rgba(16, 24, 40, 0.12);
}



.hero-textarea .clear-btn {
  position: absolute;
  right: 12px;
  top: 10px;
  height: 36px;
  min-width: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), transform 0.05s ease;
  visibility: hidden;
  /* only show when useful */
}

.hero-textarea .clear-btn:hover {
  background: #f3f4f6;
  color: var(--primary);
}

.hero-textarea .clear-btn:active {
  transform: translateY(1px);
}

/* show "clear" when there is text or focus */
.hero-textarea textarea:not(:placeholder-shown)~.clear-btn,
.hero-textarea textarea:focus~.clear-btn {
  visibility: visible;
}

.speech-link {
  margin-top: 8px;
  font-size: 0.9rem;
  color: #111827;
  word-break: break-all;
  /* so the long URL wraps */
}


/* Send button floats inside the textarea box (bottom-right) */
.right-controls {
  display: none; /* we no longer use the separate right column */
}

.hero-textarea .send-btn {
  position: absolute;
  right: 22px;
  bottom: 22px;
  height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #0d6efd, #2563eb);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.98rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 22px rgba(13, 110, 253, 0.28);
  transition: filter var(--transition), transform 0.05s ease;
}

.hero-textarea .send-btn i {
  font-size: 18px;
}

/* Hover / active / disabled states */
.hero-textarea .send-btn:hover {
  filter: brightness(1.05);
}

.hero-textarea .send-btn:active {
  transform: translateY(1px);
}

.hero-textarea .send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

/* On small screens: still keep it inside, but a bit closer */
@media (max-width: 900px) {
  .hero-textarea .send-btn {
    right: 18px;
    bottom: 18px;
    height: 44px;
    padding: 0 14px;
    font-size: 0.95rem;
  }
}


/* Mobile: full-width, normal-height button under textarea */
@media (max-width: 900px) {
  .toolbar {
    grid-template-columns: 1fr;
  }

  .right-controls {
    justify-content: flex-start;
  }

  .send-btn {
    max-width: none;
    width: 100%;
    min-height: 56px;
    height: 56px;
    padding: 0 16px;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
  }
}


/* --- Saved link under the toolbar --- */
.saved-link {
  max-width: 960px;
  margin: 16px auto 0;
  font-size: 0.95rem;
  color: #374151;
  text-align: left;
}

/* Inside the home shell, let these stretch full width */
.app-shell .saved-link,
.app-shell .recent-links {
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}


.saved-link a {
  margin-left: 6px;
  word-break: break-all;
  text-decoration: none;
  color: var(--primary);
  font-weight: 600;
}

.saved-link a:hover {
  text-decoration: underline;
}


/* --- Recent links section on main page --- */
.recent-links {
  max-width: 960px;
  margin: 20px auto 0;
  padding: 14px 18px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
  font-size: 0.95rem;
  color: #111827;
}

.recent-links-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.recent-links-title {
  font-weight: 600;
}

.recent-links-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;

  /* NEW: show about 5 URLs and scroll for more */
  max-height: 230px;      /* about 5 rows, adjust if you want */
  overflow-y: auto;
}


.recent-link-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f9fafb;
}

.recent-link-main {
  flex: 1;
  min-width: 0;
}

.recent-link-title {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-link-meta {
  margin-top: 2px;
  font-size: 0.82rem;
  color: #6b7280;
}

.recent-link-url {
  font-size: 0.86rem;
  color: var(--primary);
  text-decoration: none;
  word-break: break-all;
}

.recent-link-url:hover {
  text-decoration: underline;
}

/* Small round copy button that appears on hover */
.recent-link-copy-btn {
  border: none;
  border-radius: 999px;
  width: 26px;
  height: 26px;
  margin-left: 4px;
  background: #e5e7eb;
  color: #4b5563;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
  opacity: 0;
  pointer-events: none;
  transform: translateY(2px);
  transition:
    opacity 0.15s ease,
    transform 0.1s ease,
    background 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

.recent-link-copy-btn i {
  pointer-events: none;
}

/* Show the copy button when hovering a row */
.recent-link-item:hover .recent-link-copy-btn {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.recent-link-copy-btn:hover {
  background: #d1d5db;
  color: #111827;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.2);
}

/* Short "copied" state color */
.recent-link-copy-btn.copied {
  background: #bbf7d0;
  color: #166534;
  box-shadow: 0 2px 5px rgba(22, 163, 74, 0.4);
}


.recent-links-more-btn {
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 500;
  background: #e5e7eb;
  color: #374151;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.recent-links-more-btn:hover {
  background: #d1d5db;
}

.recent-links-more-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.recent-links-empty {
  margin-top: 4px;
  font-size: 0.88rem;
  color: #6b7280;
}


/* --- Modal for naming the link --- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1200;
}

.modal {
  width: min(420px, 92vw);
  padding: 20px 22px 18px;
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.25);
}

.modal-title {
  margin: 0 0 6px;
  font-size: 1.15rem;
  font-weight: 600;
  color: #111827;
}

.modal-description {
  margin: 0 0 14px;
  font-size: 0.9rem;
  color: #6b7280;
}

.modal-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  font-size: 0.95rem;
  outline: none;
}

.modal-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.modal-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: none;
  font-size: 0.9rem;
  cursor: pointer;
}

.modal-btn.primary {
  background: var(--primary);
  color: #fff;
}

.modal-btn.primary:hover {
  background: var(--primary-dark);
}

.modal-btn.secondary {
  background: #e5e7eb;
  color: #374151;
}

.modal-btn.secondary:hover {
  background: #d1d5db;
}



.view-card {
  max-width: 1120px;
  /* wider card so each item is longer */
  width: 100%;
}


.view-content {
  margin-top: 16px;
  padding: 16px 20px;
  border-radius: 12px;
  background: #111827;
  color: #f9fafb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 200px;
}




/* --- View page styles for content.html (/a/:slug) --- */
.view-wrapper {
  display: flex;
  justify-content: center;
  padding: 24px 16px;
}



.view-content {
  margin-top: 16px;
  padding: 16px 20px;
  border-radius: 12px;
  background: #111827;
  color: #f9fafb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 200px;
}

.view-error {
  margin-top: 12px;
  color: #b91c1c;
  font-weight: 500;
}


/* --- Submit button on content page --- */
.view-submit-row {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  /* bottom-right inside the card */
}

.submit-result-btn {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #0d6efd, #3b82f6);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.4);
  transition:
    transform 0.05s ease,
    box-shadow 0.15s ease,
    filter 0.15s ease;
}

.submit-result-btn i {
  font-size: 16px;
}

.submit-result-btn:hover {
  filter: brightness(1.05);
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.5);
}

.submit-result-btn:active {
  transform: translateY(1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.submit-result-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

/* Small status text under the button */
.submission-status {
  margin-top: 8px;
  font-size: 0.9rem;
  text-align: right;
  color: #4b5563;
  min-height: 1.2em;
}

.submission-status-success {
  color: #16a34a;
}

.submission-status-error {
  color: #b91c1c;
}


.view-content-list {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  /* container spans full card */
}


.content-item {
  width: 100%;
  padding: 18px 22px;
  border-radius: 22px;
  background: linear-gradient(135deg, #eff6ff, #e0f2fe);
  /* bright light blue */
  color: #0f172a;

  /* vertical card: header on top, note below */
  display: flex;
  flex-direction: column;
  gap: 12px;

  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.10);
  border: 1px solid rgba(37, 99, 235, 0.18);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}



/* nice hover effect */
.content-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.16);
}



.content-item-index {
  min-width: 32px;
  height: 32px;
  border-radius: 999px;
  background: #2563eb;
  /* bright blue */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #eff6ff;
  flex-shrink: 0;
  margin-top: 0;
}

.content-item-text {
  white-space: pre-wrap;
  word-break: break-word;

  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.55;
  letter-spacing: 0.01em;

  color: #0b1f4b;
  align-self: center;

  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);

  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.06),
    inset 0 0 0 1px rgba(37, 99, 235, 0.06);
}


.content-item-actions {
  display: flex;
  align-items: center;
  justify-content: center;
}


/* Top row: index | text | button */
.content-item-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 16px;
}

.pronounce-btn {
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  background: #1d4ed8;
  color: #eff6ff;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
  /* for the glowing ring */
  overflow: visible;
  /* allow ring to go outside */
  transition:
    transform 0.05s ease,
    box-shadow 0.2s ease,
    filter 0.15s ease;
}



/* Recording state: red button */
.pronounce-btn.is-recording {
  background: #dc2626;
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.45);
}


/* Glowing ring around the red button while recording */
.pronounce-btn.is-recording::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  border: 2px solid rgba(248, 113, 113, 0.95);
  box-shadow: 0 0 0 4px rgba(254, 226, 226, 0.9);
  opacity: 0;
  pointer-events: none;
  animation: mic-ring 1.1s ease-out infinite;
}

/* Little bounce on the mic icon while recording */
.pronounce-btn.is-recording i {
  animation: mic-bounce 0.8s ease-in-out infinite;
  transform-origin: center;
}


/* Processing state: purple-ish + slightly dimmed */
.pronounce-btn.is-processing {
  background: #6b21a8;
  opacity: 0.9;
}

/* Disabled look */
.pronounce-btn[disabled] {
  cursor: default;
  opacity: 0.6;
}


.pronounce-btn i {
  font-size: 14px;
}

.pronounce-btn:hover {
  filter: brightness(1.05);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.45);
}

.pronounce-btn:active {
  transform: translateY(1px);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
}


@keyframes mic-ring {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }

  100% {
    transform: scale(1.25);
    opacity: 0;
  }
}

@keyframes mic-bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-2px);
  }
}


/* Right-side input wrapper for each content section */
.content-item-note-wrapper {
  position: relative;
  width: 100%;
  align-self: stretch;
}

/* The textarea itself */
.content-item-note {
  width: 100%;
  min-height: 68px;
  max-height: 500px;
  /* grow up to 500px */
  padding: 12px 38px 12px 14px;
  /* extra right space for clear icon */

  border-radius: 18px;
  border: 1px dashed rgba(37, 99, 235, 0.5);
  background: linear-gradient(180deg, #f9fbff 0%, #ffffff 100%);

  font-size: 0.98rem;
  line-height: 1.6;
  color: #0f172a;

  resize: none;
  /* we resize with JS */
  overflow-y: auto;
  /* scroll only after 500px */
  outline: none;

  box-shadow:
    0 6px 20px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}


/* Comparison result wrapper – new card look */
.compare-result {
  margin-top: 10px;
  padding: 14px 16px 12px;
  border-radius: 18px;
  background: linear-gradient(135deg, #e0f2fe, #dcfce7);
  color: #064e3b;
  font-size: 0.9rem;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.compare-result-overall {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  margin: -4px -6px 6px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.45);
}


.compare-result-score {
  font-weight: 800;
  font-size: 1.05rem;
}

.compare-result-meta {
  font-size: 0.8rem;
  opacity: 0.9;
}


/* Row that holds the two sections side–by–side */
.compare-sections-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 640px) {
  .compare-sections-row {
    grid-template-columns: 1fr;
  }
}

.compare-result-section {
  padding: 8px 10px 6px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  border: 2px dotted rgba(148, 163, 184, 0.6);
  /* dotted border */
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}


.compare-result-section-wrong {
  border-color: rgba(239, 68, 68, 0.95);
  /* red dotted border */
}

.compare-result-section-miss {
  border-color: #db2777;
  /* magenta / fuchsia dotted border */
}


.compare-result-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #0f172a;
  opacity: 0.85;
}

.compare-result-body {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* Chips for words */
.compare-chip {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid rgba(148, 163, 184, 0.6);
  white-space: nowrap;
}

.compare-chip-wrong {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.35);
  color: #b91c1c;
}

.compare-chip-miss {
  background: rgba(234, 179, 8, 0.08);
  border-color: rgba(234, 179, 8, 0.35);
  color: #92400e;
}

.compare-chip-ok {
  background: rgba(22, 163, 74, 0.12);
  border-color: rgba(22, 163, 74, 0.4);
  color: #166534;
}




/* Tiny clear button inside the note (bottom-right) */
.note-clear-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: none;
  background: rgba(15, 23, 42, 0.06);
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.15s ease,
    background 0.15s ease,
    transform 0.05s ease;
}

/* Show the clear button only when hovering the box */
.content-item-note-wrapper:hover .note-clear-btn {
  opacity: 1;
  pointer-events: auto;
}

.note-clear-btn:hover {
  background: rgba(15, 23, 42, 0.10);
  color: #111827;
}

.note-clear-btn:active {
  transform: translateY(1px);
}

/* Mobile layout for each content card */
@media (max-width: 900px) {
  .content-item {
    padding: 14px 14px;
    border-radius: 20px;
  }

  .content-item-header {
    grid-template-columns: auto minmax(0, 1fr);
    row-gap: 8px;
  }

  .content-item-actions {
    justify-content: flex-start;
  }
}


/* Focus state: bright blue glow */
.content-item-note:focus {
  border-style: solid;
  border-color: #2563eb;
  box-shadow:
    0 0 0 3px rgba(37, 99, 235, 0.25),
    0 8px 18px rgba(37, 99, 235, 0.20);
}

.content-item-note::placeholder {
  color: #9ca3af;
  font-style: italic;
}


/* --- Tiny speech notice popup (bottom center) --- */
.speech-notice {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%) translateY(20px);
  padding: 10px 16px;
  border-radius: 999px;
  background: #111827;
  color: #e5e7eb;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.55);
  z-index: 1400;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.speech-notice i {
  font-size: 14px;
}

.speech-notice.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* --- Recording reminder toast (bottom-left on content page) --- */
.recording-reminder-toast {
  position: fixed;
  left: 16px;
  bottom: 16px;
  max-width: 380px;
  padding: 14px 16px 14px 14px;
  border-radius: 18px;

  /* lighter, brighter card */
  background: linear-gradient(135deg, #ffffff, #e0f2fe);
  border: 1px solid rgba(37, 99, 235, 0.35);
  border-left-width: 4px;         /* blue stripe on the left */

  color: #0f172a;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.95rem;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  z-index: 1500;
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Only show it when JS adds the "show" class */
.recording-reminder-toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.recording-reminder-icon {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #e0f2fe;        /* light blue circle */
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #1d4ed8;             /* blue icon */
}

.recording-reminder-icon i {
  font-size: 16px;
}

.recording-reminder-text {
  flex: 1;
  min-width: 0;
}

.recording-reminder-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 4px;
  color: #1d4ed8;             /* blue title to stand out */
}

.recording-reminder-body {
  font-size: 0.85rem;
  line-height: 1.5;
}

/* Small close button in the corner */
.recording-reminder-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: none;
  background: #e5e7eb;
  color: #374151;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
  padding: 0;
}

.recording-reminder-close:hover {
  background: #d1d5db;
}

/* Hide the toast when taking HTML snapshot images */
body.snapshot-mode .recording-reminder-toast {
  display: none !important;
}



/* Optional: shown if there is no content */
.view-empty {
  padding: 12px 14px;
  border-radius: 12px;
  background: #f3f4f6;
  color: #6b7280;
  font-size: 0.95rem;
}


/* Trên trang content (/a/:slug) ẩn hẳn layout 70/30 & nút Send cao */
.content-page .toolbar,
.content-page .send-btn {
  display: none !important;
}

/* --- Overall result summary card on content page --- */
/* --- Overall result summary card on content page --- */
.overall-result {
  margin-top: 10px;
  margin-bottom: 18px;
  display: flex;
  justify-content: center;
  /* center the card inside the view-card */
}


/* Card container */
.overall-result-card {
  padding: 14px 16px 12px;
  border-radius: 18px;
  background: linear-gradient(135deg, #eef2ff, #dcfce7);
  border: 1px solid rgba(37, 99, 235, 0.2);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.1);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  /* <-- add this */

  /* Gọn hơn, không “giãn” width tổng thể */
  width: min(760px, 100%);
  position: relative;
  /* ⬅️ add this */

}


/* In snapshot mode, keep it flat so it looks cleaner */
body.snapshot-mode .overall-logo {
  box-shadow: none;
}


/* Raw logo (no box) at top-right of overall card */
.overall-logo {
  position: absolute;
  top: 6px;
  right: 10px;
  width: 56px;
  height: 56px;
  object-fit: contain;
  pointer-events: none;  /* don’t block clicks on the card */

  /* override old box styles */
  background: transparent;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}


/* Slightly smaller on very small screens (optional) */
@media (max-width: 640px) {
  .overall-logo {
    width: 48px;
    height: 48px;
    top: 4px;
    right: 6px;
  }
}


/* Slightly smaller on very small screens (optional) */
@media (max-width: 640px) {
  .overall-logo {
    width: 34px;
    height: 34px;
    top: 8px;
    right: 8px;
  }
}

/* Top row: chart + text */
.overall-result-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

/* Small ring chart using SVG (works in screenshot) */
.overall-chart {
  position: relative;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* The SVG circle ring */
.overall-chart-svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
  /* so the ring starts at the top */
}

.overall-chart-track,
.overall-chart-value {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
}

.overall-chart-track {
  stroke: #e5e7eb;
  /* grey background ring */
}

.overall-chart-value {
  stroke: #22c55e;
  /* green progress ring */
}

/* Inner white circle with the percentage text */
.overall-chart-inner {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: #16a34a;
}


/* Text summary */
.overall-summary {
  flex: 1;
  text-align: left;
}

.overall-summary-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 2px;
}

.overall-summary-meta {
  font-size: 0.8rem;
  color: #4b5563;
}

/* Pills for each sentence */
.overall-sentences {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.overall-sentence-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(255, 255, 255, 0.9);
  color: #0f172a;
}

/* Color tiers */
.overall-sentence-pill-good {
  background: rgba(22, 163, 74, 0.12);
  border-color: rgba(22, 163, 74, 0.4);
  color: #166534;
}

.overall-sentence-pill-ok {
  background: rgba(234, 179, 8, 0.12);
  border-color: rgba(234, 179, 8, 0.45);
  color: #92400e;
}

.overall-sentence-pill-low {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.45);
  color: #b91c1c;
}

.overall-sentence-pill-unknown {
  opacity: 0.7;
}

/* Mobile: stack tighter if needed */
@media (max-width: 640px) {
  .overall-result-main {
    align-items: center;
    gap: 10px;
  }
}

/* Snapshot mode: flatten overall result for cleaner screenshots */
body.snapshot-mode .overall-result-card {
  background: #bbf7d0 !important;
  box-shadow: none !important;
}


body.snapshot-mode .overall-chart-inner {
  background: #ffffff !important;
}


/* --- Snapshot mode: stronger, flatter export for html2canvas --- */
body.snapshot-mode {
  background: #ffffff;
}

/* No animation, fully opaque */
body.snapshot-mode .card,
body.snapshot-mode .view-card {
  animation: none !important;
  opacity: 1 !important;
}

/* Remove outer drop-shadow so edges are clean */
body.snapshot-mode .card.view-card {
  box-shadow: none !important;
}

/* Practice item: solid light blue, no gradient, no shadow */
body.snapshot-mode .content-item {
  background: #dbeafe !important;
  /* light blue */
  border-color: rgba(37, 99, 235, 0.9) !important;
  box-shadow: none !important;
}

/* Textarea: solid white, no inner shadow / gradient */
body.snapshot-mode .content-item-note {
  background: #ffffff !important;
  box-shadow: none !important;
}

/* Accuracy row: solid light green, no gradient/shadow */
body.snapshot-mode .compare-result {
  background: #bbf7d0 !important;
  /* light green */
  box-shadow: none !important;
}

/* Detail sections: solid white boxes */
body.snapshot-mode .compare-result-section {
  background: #ffffff !important;
  border-color: rgba(148, 163, 184, 0.9) !important;
}

/* Chips: solid white so they’re crisp */
body.snapshot-mode .compare-chip {
  background: #ffffff !important;
}

/* Darker text while capturing for readability */
body.snapshot-mode .content-item-text,
body.snapshot-mode .compare-result,
body.snapshot-mode .compare-result-section,
body.snapshot-mode .compare-chip {
  color: #0f172a !important;
}


/* Flatten the header pill ("one") so it looks cleaner in screenshots */
body.snapshot-mode .content-item-text {
  background: #ffffff !important;
  box-shadow: none !important;
}

/* Optional: hide the live status line while capturing so image is cleaner */
body.snapshot-mode .submission-status {
  visibility: hidden !important;
}


/* FINAL override: on content page, kill the big 70/30 Send button if it exists */
body.content-page .send-btn {
  display: none !important;
  visibility: hidden !important;
  width: 0 !important;
  height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* When a note is disabled because another section is recording */
.content-item-note[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Optional: a softer look when a whole item is "locked" */
.content-item.is-disabled {
  opacity: 0.7;
}


/* Remove only the logo in the summary card */
body.content-page .overall-logo {
  display: none !important;
}



/* --- Screenshot link row (bottom-left) --- */
.snapshot-link-row {
  margin-top: 6px;
  display: none; /* shown via JS */
  align-items: center;
  justify-content: flex-start; /* bottom-left inside the card */
  gap: 8px;
  font-size: 0.86rem;
  color: #374151;
}

.snapshot-link-row span {
  font-weight: 500;
}

.snapshot-link-row a {
  color: var(--primary);
  text-decoration: none;
  word-break: break-all;
}

.snapshot-link-row a:hover {
  text-decoration: underline;
}

/* Small round copy button */
.snapshot-copy-btn {
  border: none;
  background: #e5e7eb;
  border-radius: 999px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  color: #374151;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.15);
  transition:
    background 0.15s ease,
    transform 0.05s ease,
    box-shadow 0.15s ease;
}

.snapshot-copy-btn:hover {
  background: #d1d5db;
  box-shadow: 0 3px 6px rgba(15, 23, 42, 0.2);
}

.snapshot-copy-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.15);
}
