*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #f0f4ff 0, #f9fafb 45%, #edf2ff 100%);
  color: #111827;
}

body {
  display: flex;
  justify-content: center;
  align-items: stretch;
}

.app-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1200px;
  height: 100vh;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 60px rgba(15, 23, 42, 0.25);
  border-radius: 18px;
  margin: 12px;
  overflow: hidden;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.4);
  /* Vibrant semi-transparent gradient over the background image */
  background: linear-gradient(
    to right,
    rgba(37, 99, 235, 0.85),
    rgba(147, 51, 234, 0.8)
  );
  color: #f9fafb;
}

.simple-nav .nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 500;
  color: #0b1120;
  text-decoration: none;
  background: linear-gradient(to right, #fbbf24, #f97316);
  box-shadow: 0 6px 18px rgba(248, 181, 0, 0.6);
  border: none;
}

.simple-nav .nav-link:hover {
  filter: brightness(1.05);
  box-shadow: 0 8px 22px rgba(248, 181, 0, 0.8);
}

.gallery-cta {
  margin-top: 14px;
  display: flex;
  justify-content: center;
}

.gallery-cta .nav-link {
  font-size: 18px;
}

.brand-title {
  font-weight: 650;
  letter-spacing: 0.03em;
  font-size: 30px;
}

.brand-subtitle {
  display: block;
  font-size: 23px;
  opacity: 0.8;
  margin-top: 2px;
}

.voice-settings {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 23px;
}

.voice-settings label {
  font-weight: 500;
}

select {
  font: inherit;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.75);
  padding: 6px 20px 6px 10px;
  background: rgba(15, 23, 42, 0.1);
  color: inherit;
  outline: none;
}

select:focus-visible {
  border-color: #6366f1;
  box-shadow: 0 0 0 1px #6366f1;
}

.app-main {
  display: grid;
  /* Widened left sidebar so larger text and numbers fit comfortably */
  grid-template-columns: minmax(260px, 340px) 1fr;
  flex: 1;
  min-height: 0;
}

.topic-sidebar {
  border-right: 1px solid rgba(148, 163, 184, 0.3);
  padding: 14px 0;
  /* Vibrant dark gradient with some transparency over the background */
  background: linear-gradient(
    to bottom,
    rgba(15, 23, 42, 0.9),
    rgba(37, 99, 235, 0.75)
  );
  color: #e5e7eb;
  overflow-y: auto;
}

.topic-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 10px;
  font-size: 23px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #9ca3af;
}

.topic-count {
  font-size: 20px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
}

.topic-list {
  list-style: none;
  margin: 0;
  padding: 0 6px 6px;
}

.topic-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  margin: 2px 4px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 23px;
  color: #111827;
  border: 1px solid transparent;
}

.topic-item span.topic-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  font-size: 20px;
  color: #9ca3af;
}

.topic-item span.topic-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topic-item:hover {
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(148, 163, 184, 0.7);
  color: #f9fafb;
}

.topic-item.active {
  background: radial-gradient(circle at top left, #4f46e5, #7c3aed);
  border-color: rgba(191, 219, 254, 0.9);
  color: #f9fafb;
}

.content {
  padding: 16px 20px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* 65% opaque white panel over the page background */
  background: rgba(255, 255, 255, 0.65);
}

.topic-selector-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 23px;
  color: #4b5563;
}

.topic-selector-bar select {
  background: white;
  color: #111827;
}

.topic-details {
  margin-top: 4px;
}

.topic-title {
  font-size: 40px;
  margin: 0 0 4px;
  color: #111827;
}

.topic-description {
  margin: 0;
  font-size: 23px;
  color: #6b7280;
}

.phrase-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.phrase-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(209, 213, 219, 0.9);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.landscape-thumb {
  width: 160px;
  height: 120px;
  object-fit: cover;
  border-radius: 10px;
}

.phrase-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.play-btn {
  border-radius: 999px;
  border: none;
  padding: 5px 12px 5px 9px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  background: linear-gradient(to right, #2563eb, #4f46e5);
  color: white;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.4);
}

.play-btn span.icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.35);
  font-size: 10px;
}

.play-btn.paused {
  background: linear-gradient(to right, #6b7280, #4b5563);
  box-shadow: 0 4px 10px rgba(55, 65, 81, 0.4);
}

.phrase-index {
  font-size: 20px;
  color: #9ca3af;
}

.phrase-texts {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.phrase-fr {
  font-size: 25px;
  font-weight: 550;
  color: #111827;
}

.phrase-en {
  font-size: 23px;
  color: #6b7280;
}

.global-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.primary-btn,
.ghost-btn {
  border-radius: 999px;
  font-size: 23px;
  padding: 7px 14px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.primary-btn {
  background: linear-gradient(to right, #2563eb, #4f46e5);
  color: white;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.4);
}

.ghost-btn {
  background: rgba(15, 23, 42, 0.03);
  color: #374151;
  border-color: rgba(148, 163, 184, 0.7);
}

.hint {
  font-size: 22px;
  color: #9ca3af;
  margin-top: 2px;
}

.image-gallery {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.4);
}

.gallery-title {
  font-size: 24px;
  margin: 0 0 10px;
  color: #111827;
}

.thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.thumbnail-button {
  border: none;
  padding: 0;
  background: none;
  cursor: pointer;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
}

.thumbnail-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

.image-modal.open {
  display: flex;
}

.image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
}

.image-modal-dialog {
  position: relative;
  z-index: 41;
  max-width: 900px;
  width: 90%;
  max-height: 90vh;
  background: #0b1120;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.7);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.image-modal-img {
  max-width: 100%;
  max-height: 65vh;
  border-radius: 12px;
  object-fit: contain;
}

.image-modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.image-modal-actions .ghost-btn {
  background: rgba(255, 255, 255, 0.7);
  color: #111827;
  border-color: transparent;
}

.image-modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: transparent;
  color: #e5e7eb;
  font-size: 26px;
  cursor: pointer;
}

@media (max-width: 800px) {
  .app-main {
    grid-template-columns: 1fr;
  }

  .topic-sidebar {
    display: none;
  }
}

@media (max-width: 540px) {
  .app-shell {
    border-radius: 0;
    margin: 0;
    height: 100vh;
    max-width: none;
  }

  .app-header {
    padding-inline: 14px;
  }

  .content {
    padding-inline: 14px;
  }

  .phrase-card {
    grid-template-columns: 1fr;
  }
}


