/* === Shared Session — Styles used by both Practice and Learn modes ======== */

/* --- Reset & Base --------------------------------------------------------- */

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

body {
  font-family: var(--font-family);
  background: #f5f5f5;
  color: var(--text-body);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* .hidden is in shared/settings.css */

.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- App Bar (session-screen functional header) --------------------------- */

.app-bar {
  background: white;
  color: var(--text-heading);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.10);
  flex-shrink: 0;
  font-family: var(--font-family);
}

.app-bar-logo {
  height: 28px;
  width: auto;
  flex-shrink: 0;
  margin-right: 4px;
}

.app-bar h1 {
  font-size: 1.15rem;
  font-weight: 700;
}

.app-bar-mode {
  color: var(--brand-primary, #9245e3);
  margin-right: 2px;
}

.app-bar-mode::after {
  content: " \2014 ";
  color: #ccc;
}

/* .icon-btn and .badge-dot are in shared/settings.css */

.progress-counter {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
}

/* --- Buttons -------------------------------------------------------------- */

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--btn-radius);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--brand-gradient); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--brand-primary-dark); }

.btn-secondary { background: #e0e0e0; color: #333; }
.btn-secondary:hover:not(:disabled) { background: #d0d0d0; }

.btn-ghost { background: transparent; color: #666; }
.btn-ghost:hover { background: #eee; }

.btn-danger { background: #e53935; color: white; }
.btn-danger:hover:not(:disabled) { background: #c62828; }

.btn-small { padding: 6px 14px; font-size: 0.8rem; }
.btn-large { padding: 14px 32px; font-size: 1rem; }

/* .seg-control and .seg-btn are in shared/settings.css */

/* --- Home Screen ---------------------------------------------------------- */

.home-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 16px;
}

.mode-card {
  background: white;
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 420px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
  border: 1px solid #e8e8e8;
}

.mode-card:hover:not(.disabled) {
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  transform: translateY(-1px);
}

.mode-card.disabled {
  opacity: 0.5;
  cursor: default;
}

.mode-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mode-text h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.mode-text p {
  font-size: 0.85rem;
  color: #888;
}

.arrow-icon {
  flex-shrink: 0;
  margin-left: auto;
}

/* --- Phases (session screen content) -------------------------------------- */

.phase {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.center-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  gap: 16px;
}

/* --- Word Prompt ---------------------------------------------------------- */

.word-prompt-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  gap: 24px;
}

.word-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 500px;
}

.nav-arrow {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.nav-arrow:hover:not(:disabled) {
  background: #eee;
  color: #333;
}

.nav-arrow:disabled {
  opacity: 0.3;
  cursor: default;
}

.word-card {
  flex: 1;
  background: white;
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.2s;
  border: 3px solid transparent;
  position: relative;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.word-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.word-card.outcome-passed  { border-color: #43a047; }
.word-card.outcome-failed  { border-color: #e53935; }
.word-card.outcome-skipped { border-color: #fb8c00; }

.category-chip {
  display: inline-block;
  padding: 3px 12px;
  background: var(--brand-primary-light);
  color: var(--brand-primary);
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.word-text {
  font-size: 2rem;
  font-weight: 700;
  color: #1a1a1a;
}

.word-translation {
  font-size: 1.1rem;
  color: #666;
}

/* --- Sentence Context Button ---------------------------------------------- */

.sentence-context-btn {
  background: var(--brand-primary-light);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  margin-top: 4px;
}

.sentence-context-btn:hover {
  background: #e1bee7;
}

.tap-hint {
  color: #bbb;
  font-size: 0.8rem;
  margin-top: 4px;
}

/* --- GIF Carousel (shared between hint dialog, result, and learn) --------- */

.ref-carousel {
  position: relative;
  min-height: 180px;
  background: #fafafa;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ref-carousel .ref-loading {
  color: #bbb;
  font-size: 0.85rem;
}

.ref-carousel img {
  width: 100%;
  max-height: 240px;
  border-radius: 8px;
  object-fit: contain;
  background: #fafafa;
}

.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
}

.carousel-btn {
  background: none;
  border: 1px solid #ddd;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  color: #666;
  transition: background 0.15s;
}

.carousel-btn:hover { background: #f0f0f0; }

.carousel-dots {
  display: flex;
  gap: 4px;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ddd;
}

.carousel-dot.active {
  background: var(--brand-primary);
}

/* --- Hint Dialog ---------------------------------------------------------- */

.dialog-hint {
  max-width: 400px;
}

.hint-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  gap: 8px;
  min-height: 200px;
}

.hint-img {
  max-width: 280px;
  max-height: 320px;
  border-radius: 8px;
  object-fit: contain;
}

.carousel-arrow-btn {
  background: none;
  border: 1px solid #ddd;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  color: #666;
  transition: background 0.15s;
}

.carousel-arrow-btn:hover { background: #f0f0f0; }
.carousel-arrow-btn:disabled { opacity: 0.3; cursor: default; }

/* --- Sentence Context Dialog ---------------------------------------------- */

.dialog-sentence {
  max-width: 420px;
}

.sentence-entry {
  padding: 8px 0;
}

.sentence-english {
  font-size: 1rem;
  font-style: italic;
  color: #333;
  margin-bottom: 4px;
}

.sentence-gloss {
  font-size: 0.85rem;
  color: #888;
}

.sentence-divider {
  border: none;
  border-top: 1px solid #eee;
  margin: 8px 0;
}

/* --- Summary -------------------------------------------------------------- */

.trophy-svg {
  margin-bottom: 8px;
}

.stat-badges {
  display: flex;
  gap: 16px;
  margin: 16px 0;
}

.stat-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 24px;
  border-radius: 12px;
  min-width: 80px;
}

.stat-passed  { background: #e8f5e9; }
.stat-failed  { background: #fce4ec; }
.stat-skipped { background: #fff3e0; }

.stat-num {
  font-size: 1.8rem;
  font-weight: 700;
}

.stat-passed .stat-num  { color: #2e7d32; }
.stat-failed .stat-num  { color: #c62828; }
.stat-skipped .stat-num { color: #e65100; }

.stat-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: #666;
  margin-top: 2px;
}

.summary-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

/* --- Picker --------------------------------------------------------------- */

.picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

.picker-row.clickable {
  cursor: pointer;
  transition: background 0.15s;
  margin: 0 -20px;
  padding: 12px 20px;
  border-bottom: 1px solid #f0f0f0;
}

.picker-row.clickable:hover {
  background: #f8f8f8;
}

.picker-label {
  flex: 1;
  font-weight: 500;
}

.picker-meta {
  font-size: 0.8rem;
  color: #999;
}

.picker-divider {
  height: 1px;
  background: #eee;
  margin: 8px -20px;
}

.picker-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 12px 0 8px;
}

.picker-cat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  cursor: pointer;
  transition: background 0.15s;
  margin: 0 -20px;
  padding: 10px 20px;
  border-bottom: 1px solid #f5f5f5;
}

.picker-cat-row:hover { background: #f8f8f8; }

.picker-cat-name {
  flex: 1;
  font-size: 0.9rem;
  text-transform: capitalize;
}

.picker-cat-count {
  font-size: 0.8rem;
  color: #999;
}

.picker-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 16px;
  color: #888;
  font-size: 0.9rem;
}

.picker-empty {
  text-align: center;
  padding: 32px 16px;
  color: #666;
}

.picker-empty p { margin-bottom: 8px; }
.picker-empty-sub { font-size: 0.85rem; color: #777; }

/* --- Inline Picker (shared by Learn & Practice home screens) -------------- */

.learn-home {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 16px;
}

.learn-picker {
  width: 100%;
  max-width: 720px;
}

.picker-quick-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border: 1px solid #e8e8e8;
}

/* --- Pack Card Grid (shared swatch layout) -------------------------------- */

.learn-pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.learn-pack-card {
  background: white;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border: 1px solid #e8e8e8;
  border-left: 4px solid #bdbdbd;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
}

.learn-pack-card[data-pack-type="public"] {
  border-left-color: #00897b;
}

.learn-pack-card[data-pack-type="shared"] {
  border-left-color: #3f51b5;
}

.learn-pack-card .pack-icon {
  margin-right: 4px;
}

.learn-pack-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  transform: translateY(-1px);
}

.learn-pack-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 4px;
  text-transform: capitalize;
}

.learn-pack-card .meta {
  font-size: 0.8rem;
  color: #888;
}

.shared-icon {
  color: #3f51b5;
  cursor: default;
  display: inline-flex;
  align-items: center;
  position: relative;
  margin-left: 4px;
}

.shared-icon .shared-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
}

.shared-icon:hover .shared-tooltip {
  display: block;
}

#picker-categories {
  display: contents;
}

/* --- Block List Screen ----------------------------------------------------- */

.block-list-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 16px;
}

.block-list-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 20px;
}

.block-list-grid {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.block-list-card {
  background: white;
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  border: 1px solid #e8e8e8;
  border-left: 4px solid var(--brand-primary);
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
}

.block-list-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  transform: translateY(-1px);
}

.block-list-card.border-red    { border-left-color: #f44336; }
.block-list-card.border-orange { border-left-color: #ff9800; }
.block-list-card.border-green  { border-left-color: #4caf50; }
.block-list-card.border-gray   { border-left-color: #9e9e9e; }

.block-card-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.block-card-content { flex: 1; min-width: 0; }

.block-list-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 2px;
}

.block-list-card .block-desc {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.block-list-card .block-meta {
  font-size: 0.8rem;
  color: #999;
}

.block-detail-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--brand-primary, #9245E3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.block-detail-btn:hover {
  background: rgba(0,0,0,0.06);
}

/* --- Spinner -------------------------------------------------------------- */

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e0e0e0;
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner.large {
  width: 56px;
  height: 56px;
  border-width: 5px;
}

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

/* --- Responsive (shared) -------------------------------------------------- */

@media (max-width: 480px) {
  .word-text { font-size: 1.6rem; }
  .word-card { padding: 24px 16px; min-height: 150px; }
  .stat-badges { gap: 10px; }
  .stat-badge { padding: 12px 16px; min-width: 64px; }
  .stat-num { font-size: 1.4rem; }
  .dialog { max-height: 90vh; }
  .hint-img { max-width: 220px; }
}

/* --- Progress Tracking (F11) --------------------------------------------- */

/* Per-sign progress dot */
.progress-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-left: 6px;
  vertical-align: middle;
}

.progress-green  { background-color: #4caf50; }
.progress-orange { background-color: #ff9800; }
.progress-red    { background-color: #f44336; }
.progress-blue   { background-color: #42a5f5; }
.progress-gray   { background-color: #9e9e9e; }

/* Pack/block progress bar */
.pack-progress-bar {
  display: flex;
  height: 4px;
  border-radius: 2px;
  background: #e0e0e0;
  overflow: hidden;
  margin: 6px 0 2px;
}

.pack-progress-fill {
  height: 100%;
  transition: width 0.3s ease;
}

.pack-progress-label {
  font-size: 0.7rem;
  color: var(--text-secondary, #666);
  margin-bottom: 2px;
}

/* Block detail popup */
.block-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}
.block-detail-overlay.visible { opacity: 1; }
.block-detail-modal {
  background: white;
  border-radius: 14px;
  width: 90%;
  max-width: 420px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}
.block-detail-overlay.visible .block-detail-modal {
  transform: scale(1);
  opacity: 1;
}
.block-detail-modal-header {
  display: flex;
  align-items: center;
  padding: 16px 20px 0;
  gap: 8px;
}
.block-detail-modal-header h3 {
  flex: 1;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-heading);
  margin: 0;
}
.block-detail-modal-header span {
  font-size: 0.8rem;
  color: #666;
  flex-shrink: 0;
}
.block-detail-modal .pack-progress-bar {
  margin: 6px 20px 4px;
  height: 6px;
  border-radius: 3px;
}
.block-detail-modal .btn-review {
  display: block;
  width: calc(100% - 40px);
  margin: 4px 20px 8px;
}
.btn-review {
  background: var(--brand-primary, #9245E3);
  color: white;
  border: none;
  border-radius: 16px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  text-align: center;
}
.btn-review:hover { opacity: 0.85; }
.block-detail-divider {
  height: 1px;
  background: #eee;
  margin: 0;
  border: none;
}
.block-detail-groups {
  flex: 1;
  overflow-y: auto;
  padding: 4px 12px 16px;
}
.block-detail-group {
  margin-bottom: 2px;
}
.block-detail-header {
  font-size: 0.82rem;
  font-weight: 600;
  color: #555;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 8px 8px;
  border-radius: 8px;
  transition: background 0.1s;
  user-select: none;
}
.block-detail-header:hover { background: rgba(0,0,0,0.04); }
.block-detail-header .progress-dot {
  width: 10px;
  height: 10px;
  margin-left: 0;
}
.block-detail-chevron {
  font-size: 0.7rem;
  color: #999;
  margin-left: auto;
}
.block-detail-signs {
  padding: 2px 8px 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.block-sign-chip {
  font-size: 0.8rem;
  padding: 4px 12px;
  color: #444;
  background: #f3f3f3;
  border-radius: 16px;
  cursor: pointer;
  border: 1px solid #e0e0e0;
  transition: background 0.1s, color 0.1s;
}
.block-sign-chip:hover {
  background: #e8e0f4;
  color: var(--brand-primary, #9245E3);
  border-color: var(--brand-primary, #9245E3);
}
.block-detail-separator {
  height: 1px;
  background: #eee;
  margin: 0 8px;
}
