/* css/components/tools.css */

/* ── Duolingo-style tool palette (Sune brand) ── */
:root {
  --tool-duo-orange: #f47417;
  --tool-duo-orange-dark: #d46110;
  --tool-duo-orange-hover: #ff8533;
  --tool-duo-orange-light: #fff4eb;
  --tool-duo-blue: #1cb0f6;
  --tool-duo-blue-dark: #1490c7;
  --tool-duo-blue-light: #ddf4ff;
  --tool-duo-border: #e5e5e5;
  --tool-duo-border-dark: #d1d1d1;
  --tool-duo-text: #4b4b4b;
  --tool-duo-text-muted: #777;
  --tool-duo-card-shadow: 0 2px 0 var(--tool-duo-border);
  --tool-duo-btn-shadow: 0 3px 0 var(--tool-duo-orange-dark);
  --tool-duo-blue-btn-shadow: 0 3px 0 var(--tool-duo-blue-dark);
}

/* =============================================
   EXERCISE PAGE WRAPPER
   ============================================= */
.exercise-page-wrapper {
  display: flex;
  gap: 4px;
  align-items: flex-start;
  transition: margin 0.35s cubic-bezier(.4,0,.2,1);
}

.exercise-page-wrapper.no-sidebar .exercise-container {
  width: 100%;
}

.exercise-page-wrapper .exercise-container {
  flex: 1;
  min-width: 0;
  transition: all 0.35s cubic-bezier(.4,0,.2,1);
}

/* =============================================
   FLOATING BOTTOM TOOLS BAR
   ============================================= */
.tools-sidebar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  margin: 20px -30px -30px -30px;
  border-radius: 0 0 27px 27px;
  overflow: hidden;
}

.sidebar-rail {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  background: linear-gradient(135deg, rgba(241, 245, 249, 0.95), rgba(226, 232, 240, 0.9));
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

.sidebar-tools-list {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

/* Remove the divider pseudo-element */
.sidebar-tools-list::before {
  display: none;
}

.sidebar-tool-btn {
  height: 36px;
  border-radius: 18px;
  border: none;
  background: white;
  cursor: pointer;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  font-size: 0.82rem;
  color: var(--text-medium);
  transition: all 0.25s cubic-bezier(.4,0,.2,1);
  position: relative;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  white-space: nowrap;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.sidebar-tool-btn .tool-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.sidebar-tool-btn:hover {
  background: rgba(255, 255, 255, 0.95);
  color: var(--tool-duo-orange);
  transform: scale(1.05);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.sidebar-tool-btn:hover .tool-label {
  color: var(--tool-duo-orange);
}

.sidebar-tool-btn.active {
  background: var(--tool-duo-orange);
  color: white;
  box-shadow: var(--tool-duo-btn-shadow);
}

.sidebar-tool-btn.active:hover {
  background: var(--tool-duo-orange-hover);
  color: white;
  transform: scale(1.05);
}

/* =============================================
   TOOLS PANEL (expanded content above rail)
   ============================================= */
.sidebar-panel {
  display: none;
  width: 100%;
  background: rgba(248, 250, 252, 0.92);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.06);
  overflow-y: auto;
  max-height: 45vh;
  flex-shrink: 0;
  animation: toolsPanelIn 0.3s cubic-bezier(.4,0,.2,1);
}

.tools-sidebar.open .sidebar-panel {
  display: block;
}

@keyframes toolsPanelIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.sidebar-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-panel-title {
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--tool-duo-orange);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-panel-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.05);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--text-light);
  transition: all 0.2s;
}

.sidebar-panel-close:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--incorrect);
}

/* On/Off toggle for selection-based tools */
.tool-toggle-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 4px 16px 4px;
  font-size: 0.75rem;
  color: var(--text-light);
}

.tool-toggle-label {
  font-weight: 600;
  letter-spacing: 0.02em;
  user-select: none;
}

.tool-toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.tool-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.tool-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 20px;
  transition: background 0.25s ease;
}

.tool-toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  bottom: 2px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform 0.25s ease;
}

.tool-toggle-switch input:checked + .tool-toggle-slider {
  background: var(--tool-duo-orange);
}

.tool-toggle-switch input:checked + .tool-toggle-slider::before {
  transform: translateX(16px);
}

/* Active tool content inside tools bar */
.tools-sidebar .active-tool-content {
  padding: 16px 24px;
  margin-top: 0;
  background: transparent;
  border: none;
  min-height: 80px;
  border-radius: 0;
}

.note-creator-card {
  background: #fff;
  border: 2px solid var(--tool-duo-border);
  border-radius: 16px;
  padding: 16px;
  margin: 12px 0 0;
  box-shadow: var(--tool-duo-card-shadow);
  width: 100%;
  box-sizing: border-box;
}

.note-creator-header {
  color: var(--tool-duo-orange);
  font-weight: 800;
  margin-bottom: 12px;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
}

.note-creator-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.color-options {
  display: flex;
  gap: 10px;
}

.color-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 0 0 1px #ddd;
  transition: all 0.2s;
}

.color-dot:hover {
  transform: scale(1.15);
}

.color-dot.active {
  box-shadow: 0 0 0 2px var(--tool-duo-orange);
}

.color-dot.yellow {
  background: #ffe59e;
}

.color-dot.green {
  background: #bbf7d0;
}

.color-dot.blue {
  background: var(--tool-duo-blue-light);
}

.color-dot.pink {
  background: #fbcfe8;
}

.btn-cancel {
  background: #fff;
  color: var(--tool-duo-text);
  border: 2px solid var(--tool-duo-border);
  padding: 8px 16px;
  border-radius: 12px;
  cursor: pointer;
  margin-right: 10px;
  font-weight: 800;
  font-size: 0.82rem;
  box-shadow: var(--tool-duo-card-shadow);
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}

.btn-cancel:hover {
  background: #fafafa;
  transform: translateY(-1px);
}

.btn-confirm {
  background: var(--tool-duo-orange);
  color: white;
  border: 2px solid var(--tool-duo-orange-dark);
  padding: 8px 20px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  font-size: 0.82rem;
  box-shadow: var(--tool-duo-btn-shadow);
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}

.btn-confirm:hover {
  background: var(--tool-duo-orange-hover);
}

.btn-confirm:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--tool-duo-orange-dark);
}

.notes-list-container {
  max-height: 300px;
  overflow-y: auto;
}

.note-item-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-radius: 12px;
  margin-bottom: 10px;
  position: relative;
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.note-item-content {
  flex: 1;
}

.note-item-phrase {
  font-weight: bold;
  display: block;
  margin-bottom: 4px;
  color: var(--text-dark);
}

.note-item-comment {
  font-size: 0.9em;
  color: var(--text-medium);
}

.note-delete {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-light);
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.note-delete:hover {
  color: #ef4444;
  background: #fee2e2;
}

/* =============================================
   NOTES CAROUSEL
   ============================================= */
.notes-carousel,
.fn-carousel {
  margin-bottom: 8px;
}

.notes-carousel-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}

.notes-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  border: 2px solid var(--tool-duo-border);
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--tool-duo-text-muted);
  font-weight: 800;
  transition: all 0.15s;
  flex-shrink: 0;
  box-shadow: var(--tool-duo-card-shadow);
}

.notes-nav-btn:hover:not(:disabled) {
  background: var(--tool-duo-blue-light);
  color: var(--tool-duo-blue);
  border-color: var(--tool-duo-blue);
  box-shadow: var(--tool-duo-blue-btn-shadow);
  transform: translateY(-1px);
}

.notes-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.notes-nav-counter {
  font-size: 0.78rem;
  color: var(--tool-duo-text-muted);
  font-weight: 800;
  min-width: 50px;
  text-align: center;
}

/* =============================================
   CHAR COUNTER
   ============================================= */
.note-input-wrapper {
  position: relative;
  margin-bottom: 10px;
}

.note-input-wrapper #note-input-field {
  width: 100%;
  border: 2px solid var(--tool-duo-border);
  padding: 10px 12px;
  border-radius: 12px;
  font-family: 'Nunito', sans-serif;
  box-sizing: border-box;
  background: #fff;
  box-shadow: var(--tool-duo-card-shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.note-input-wrapper #note-input-field:focus {
  outline: none;
  border-color: var(--tool-duo-orange);
  box-shadow: 0 2px 0 var(--tool-duo-orange-dark);
}

.char-counter {
  display: block;
  text-align: right;
  font-size: 0.72rem;
  color: var(--text-light);
  margin-top: 3px;
}

/* =============================================
   FREE NOTES REDESIGN
   ============================================= */
.fn-input-wrapper {
  margin-bottom: 12px;
}

.fn-input {
  width: 100%;
  border: 2px solid var(--tool-duo-border);
  border-radius: 14px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  color: var(--tool-duo-text);
  box-sizing: border-box;
  padding: 10px 14px;
  resize: none;
  background: #fff;
  box-shadow: var(--tool-duo-card-shadow);
  transition: min-height 0.25s ease, border-color 0.15s, box-shadow 0.15s;
  line-height: 1.5;
  overflow: hidden;
}

.fn-input-small {
  min-height: 38px;
  max-height: 38px;
}

.fn-input-large {
  min-height: 110px;
  max-height: 200px;
  overflow-y: auto;
}

.fn-input:focus {
  outline: none;
  border-color: var(--tool-duo-orange);
  box-shadow: 0 2px 0 var(--tool-duo-orange-dark);
}

.fn-input-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  gap: 8px;
}

.fn-save-btn {
  padding: 6px 16px;
  font-size: 0.82rem;
}

.fn-note-display {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  background: #fff;
  border: 2px solid var(--tool-duo-border);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--tool-duo-card-shadow);
  gap: 8px;
}

.fn-note-text {
  flex: 1;
  font-size: 0.88rem;
  color: var(--tool-duo-text);
  line-height: 1.5;
  word-break: break-word;
}

.text-highlight {
  cursor: help;
  border-bottom: 2px solid currentColor;
  padding: 0 2px;
  border-radius: 3px;
}

.free-notes-container {
  padding: 10px;
}

#free-notes-area {
  width: 100%;
  min-height: 200px;
  padding: 15px;
  border: 2px solid var(--border-light);
  border-radius: 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  line-height: 1.6;
  resize: vertical;
  box-sizing: border-box;
}

#free-notes-area:focus {
  outline: none;
  border-color: var(--primary);
}

.small-info {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 10px;
  text-align: right;
}

.free-notes-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.free-notes-footer .small-info {
  margin-top: 0;
}

.dict-card-container {
  background: #fff;
  border: 2px solid var(--tool-duo-border);
  border-radius: 16px;
  padding: 16px;
  position: relative;
  margin-top: 12px;
  box-shadow: var(--tool-duo-card-shadow);
}

.dict-close-x {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--tool-duo-text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  transition: all 0.15s;
}

.dict-close-x:hover {
  color: var(--tool-duo-text);
  background: var(--tool-duo-orange-light);
}

.dict-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.dict-word-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--tool-duo-blue);
}

.dict-phonetic-text {
  color: var(--tool-duo-blue-dark);
  font-size: 0.95rem;
  font-weight: 600;
}

.dict-pos-badge {
  background-color: var(--tool-duo-blue-light);
  color: var(--tool-duo-blue-dark);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dict-definition-text {
  color: var(--tool-duo-text);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 12px;
}

.dict-example-box {
  border-left: 3px solid var(--tool-duo-blue);
  padding-left: 14px;
  margin-bottom: 12px;
  background: var(--tool-duo-blue-light);
  border-radius: 0 10px 10px 0;
  padding-top: 8px;
  padding-bottom: 8px;
}

.dict-example-text {
  color: var(--tool-duo-text);
  font-style: italic;
  font-size: 0.9rem;
  line-height: 1.5;
}

.dict-tags-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.dict-tag-pill {
  background-color: #fff;
  border: 2px solid var(--tool-duo-border);
  color: var(--tool-duo-blue);
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--tool-duo-card-shadow);
}

.dict-tag-pill:hover {
  background-color: var(--tool-duo-blue);
  color: white;
  border-color: var(--tool-duo-blue-dark);
  box-shadow: var(--tool-duo-blue-btn-shadow);
  transform: translateY(-1px);
}

.translator-card {
  padding: 15px;
}

.translator-card h4 {
  color: var(--primary);
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.translator-badge {
  background: var(--primary-light);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  margin-left: 8px;
}

.original-text-small {
  background: white;
  padding: 10px;
  border-radius: 8px;
  border-left: 3px solid var(--text-light);
  font-size: 0.95rem;
  color: var(--text-dark);
  margin: 10px 0;
}

.translator-card i {
  display: block;
  text-align: center;
  color: var(--primary);
  margin: 10px 0;
}

.translated-result {
  background: #e6f7e6;
  padding: 15px;
  border-radius: 8px;
  border-left: 3px solid var(--completed);
  font-weight: 500;
  color: var(--text-dark);
}

/* ── Translate Panel ─────────────────────────────────── */
.translate-panel {
  padding: 4px 2px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.translate-lang-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--tool-duo-blue-light);
  border: 2px solid var(--tool-duo-border);
  border-radius: 14px;
  padding: 8px 12px;
  font-size: 0.85rem;
  box-shadow: var(--tool-duo-card-shadow);
}

.translate-from-label {
  color: var(--tool-duo-blue-dark);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
}

.translate-arrow-lang {
  color: var(--tool-duo-orange);
  font-size: 0.8rem;
}

.translate-lang-select {
  flex: 1;
  border: 2px solid var(--tool-duo-border);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 0.85rem;
  background: white;
  color: var(--tool-duo-text);
  cursor: pointer;
  outline: none;
  font-weight: 600;
  box-shadow: var(--tool-duo-card-shadow);
}

.translate-lang-select:focus {
  border-color: var(--tool-duo-blue);
  box-shadow: 0 2px 0 var(--tool-duo-blue-dark);
}

.translate-manual-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.translate-manual-input {
  width: 100%;
  box-sizing: border-box;
  border: 2px solid var(--tool-duo-border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.88rem;
  font-family: inherit;
  resize: vertical;
  color: var(--tool-duo-text);
  background: white;
  outline: none;
  box-shadow: var(--tool-duo-card-shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.translate-manual-input:focus {
  border-color: var(--tool-duo-orange);
  box-shadow: 0 2px 0 var(--tool-duo-orange-dark);
}

.translate-manual-btn {
  align-self: flex-end;
  background: var(--tool-duo-orange);
  color: white;
  border: 2px solid var(--tool-duo-orange-dark);
  border-radius: 12px;
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: var(--tool-duo-btn-shadow);
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}

.translate-manual-btn:hover {
  background: var(--tool-duo-orange-hover);
}

.translate-manual-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--tool-duo-orange-dark);
}

.translate-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.translate-col {
  border-radius: 14px;
  padding: 10px 12px;
  min-height: 64px;
}

.translate-col-original {
  background: white;
  border: 2px solid var(--tool-duo-border);
  box-shadow: var(--tool-duo-card-shadow);
}

.translate-col-result {
  background: var(--tool-duo-blue-light);
  border: 2px solid var(--tool-duo-blue);
  box-shadow: var(--tool-duo-blue-btn-shadow);
}

.translate-col-label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tool-duo-text-muted);
  margin-bottom: 6px;
}

.translate-col-result .translate-col-label {
  color: var(--tool-duo-blue-dark);
}

.translate-col-text {
  font-size: 0.9rem;
  color: var(--tool-duo-text);
  line-height: 1.45;
  word-break: break-word;
}

.translate-col-result .translate-col-text {
  font-weight: 700;
  color: var(--tool-duo-blue-dark);
}

.translate-loading {
  text-align: center;
  padding: 12px;
  color: var(--tool-duo-blue);
  font-size: 1.1rem;
}

.translate-hint {
  font-size: 0.82rem;
  color: var(--tool-duo-text-muted);
  text-align: center;
  margin: 0;
  padding: 2px 0;
  font-weight: 600;
}

.tips-content {
  padding: 4px 2px;
}

.tips-content h4 {
  color: var(--tool-duo-orange);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 0.95rem;
}

.tips-content ul {
  list-style-type: none;
  padding: 0;
}

.tips-content li {
  padding: 12px 14px;
  margin-bottom: 8px;
  background: #fff;
  border-radius: 14px;
  border: 2px solid var(--tool-duo-border);
  border-left: 4px solid var(--tool-duo-blue);
  box-shadow: var(--tool-duo-card-shadow);
  font-size: 0.9rem;
  color: var(--tool-duo-text);
  line-height: 1.5;
  font-weight: 600;
}

.placeholder-text {
  color: var(--tool-duo-text-muted);
  text-align: center;
  padding: 40px 20px;
  font-size: 1rem;
  background: white;
  border-radius: 14px;
  border: 2px dashed var(--tool-duo-border);
  font-weight: 600;
}

.empty-msg {
  color: var(--tool-duo-text-muted);
  text-align: center;
  padding: 40px 20px;
  font-size: 1rem;
  background: white;
  border-radius: 14px;
  border: 2px solid var(--tool-duo-border);
  box-shadow: var(--tool-duo-card-shadow);
  font-weight: 600;
}

.loading-mini {
  text-align: center;
  color: var(--text-light);
  padding: 32px 20px;
  font-size: 1rem;
}

.loading-mini .app-loading-paws {
  margin: 0 auto;
}

.loading-mini i {
  margin-right: 8px;
  animation: spin 1s linear infinite;
}

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

.transcript-content {
  padding: 10px;
}

.transcript-content h4 {
  color: var(--primary);
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.transcript-extract {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  border-left: 4px solid #0ea5e9;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.transcript-extract-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-weight: 600;
  color: var(--text-dark);
}

.transcript-extract-number {
  background: #0ea5e9;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.transcript-text {
  font-size: 0.93rem;
  line-height: 1.7;
  color: var(--text-medium);
  padding: 12px;
  background: #f8fafc;
  border-radius: 8px;
  text-align: justify;
  hyphens: auto;
}

/* =============================================
   DICTIONARY SEARCH BOX
   ============================================= */
.dict-search-wrapper {
  margin-bottom: 12px;
}

.dict-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 2px solid var(--tool-duo-border);
  border-radius: 14px;
  padding: 6px 10px;
  box-shadow: var(--tool-duo-card-shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.dict-search-box:focus-within {
  border-color: var(--tool-duo-blue);
  box-shadow: 0 2px 0 var(--tool-duo-blue-dark);
}

.dict-search-box i {
  color: white;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.dict-search-box input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  color: var(--tool-duo-text);
  outline: none;
  padding: 6px 0;
  min-width: 0;
  font-weight: 600;
}

.dict-search-box input::placeholder {
  color: var(--tool-duo-text-muted);
  font-weight: 500;
}

.dict-search-go {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  border: 2px solid var(--tool-duo-blue-dark);
  background: var(--tool-duo-blue);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: all 0.15s;
  flex-shrink: 0;
  box-shadow: var(--tool-duo-blue-btn-shadow);
}

.dict-search-go:hover {
  background: #2eb8f7;
  transform: translateY(-1px);
}

.dict-search-go:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--tool-duo-blue-dark);
}

.dict-help-text {
  color: var(--text-light);
  font-size: 0.8rem;
  margin-top: 8px;
  text-align: center;
}

.dict-not-found {
  color: var(--text-medium);
  text-align: center;
  padding: 20px 10px;
  font-size: 0.9rem;
}

.dict-meaning-block {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.dict-meaning-block:last-of-type {
  border-bottom: none;
  margin-bottom: 4px;
}

/* Sidebar-specific adjustments for smaller containers */
.tools-sidebar .dict-card-container {
  margin-top: 8px;
  padding: 14px;
  font-size: 0.9rem;
}

.tools-sidebar .dict-word-title {
  font-size: 1.2rem;
}

.tools-sidebar .dict-definition-text {
  font-size: 0.88rem;
  margin-bottom: 8px;
}

.tools-sidebar .dict-example-text {
  font-size: 0.85rem;
}

.tools-sidebar .notes-list-container {
  max-height: none;
}

.tools-sidebar .placeholder-text {
  padding: 24px 14px;
  font-size: 0.9rem;
}

.tools-sidebar .empty-msg {
  padding: 24px 14px;
  font-size: 0.9rem;
}

.tools-sidebar .translator-card {
  padding: 10px;
}

.tools-sidebar .tips-content li {
  font-size: 0.88rem;
  padding: 8px 12px;
}

.tools-sidebar .transcript-extract {
  padding: 12px;
}

.tools-sidebar .transcript-text {
  font-size: 0.85rem;
  padding: 10px;
}

.sidebar-tool-btn {
  width: 38px;
  min-width: 38px;
  padding: 0;
  border-radius: 14px;
}

.sidebar-tool-btn .tool-label {
  display: none;
}

.sidebar-tool-btn i {
  margin: 0;
  font-size: 0.98rem;
}

@media (max-width: 768px), (max-height: 520px) and (orientation: landscape) and (max-width: 1024px) {
  .tools-sidebar {
    margin: 14px -14px -14px;
  }

  .sidebar-rail {
    padding: 8px 10px;
  }

  .sidebar-tools-list {
    gap: 6px;
  }
}

/* =============================================
   RIGHT COLUMN TOOLS (test exercise sidebar)
   ============================================= */
.tools-sidebar--right-column {
  position: static;
  bottom: auto;
  margin: 0;
  border-radius: 16px;
  overflow: hidden;
  border: none;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.55);
  min-height: 320px;
  height: 100%;
  flex-direction: column;
}

.tools-sidebar--right-column .sidebar-rail {
  flex-direction: row;
  align-items: center;
  justify-content: stretch;
  gap: 0;
  padding: 12px 8px;
  background: transparent;
  border-top: none;
  border-bottom: 1px solid color-mix(in srgb, var(--tool-duo-orange) 18%, transparent);
  width: 100%;
  flex-shrink: 0;
}

.tools-sidebar--right-column .sidebar-tools-list {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 0;
  width: 100%;
}

.tools-sidebar--right-column .sidebar-tool-btn {
  width: 44px;
  min-width: 44px;
  height: 44px;
  border-radius: 14px;
  padding: 0;
  background: rgba(255, 255, 255, 0.95);
  color: #4b4b4b;
  box-shadow: 0 2px 0 rgba(45, 46, 95, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.9);
}

.tools-sidebar--right-column .sidebar-tool-btn i {
  color: inherit;
}

.tools-sidebar--right-column .sidebar-tool-btn:hover {
  background: #fff;
  color: var(--tool-duo-orange);
  transform: translateY(-1px);
  box-shadow: 0 3px 0 rgba(45, 46, 95, 0.1);
}

.tools-sidebar--right-column .sidebar-tool-btn.active {
  background: var(--tool-duo-orange);
  color: #fff;
  border-color: var(--tool-duo-orange-dark);
  box-shadow: var(--tool-duo-btn-shadow);
}

.tools-sidebar--right-column .sidebar-tool-btn.active i {
  color: #fff;
}

.tools-sidebar--right-column .sidebar-tool-btn.active:hover {
  background: var(--tool-duo-orange-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--tool-duo-btn-shadow);
}

.tools-sidebar--right-column .sidebar-tool-btn .tool-label {
  display: none;
}

.tools-sidebar--right-column .sidebar-panel {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-height: none;
  border: none;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  background: transparent;
  border-radius: 0;
  margin: 0;
}

.tools-sidebar--right-column.open .sidebar-panel,
.tools-sidebar--right-column .sidebar-panel {
  display: flex;
}

.tools-sidebar--right-column .active-tool-content {
  flex: 1;
  overflow-y: auto;
  max-height: calc(100vh - var(--dashboard-top-spacing, 28px) - 120px);
  padding: 12px 4px 16px;
}

/* Duolingo-style tool content in right column */
.tools-sidebar--right-column .placeholder-text,
.tools-sidebar--right-column .empty-msg,
.tools-sidebar--right-column .fn-empty-msg {
  padding: 12px 4px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--tool-duo-text-muted);
  text-align: center;
}

.tools-sidebar--right-column .free-notes-container {
  padding: 0;
}

.tools-sidebar--right-column #free-notes-area {
  min-height: 160px;
  padding: 14px;
  border: 2px solid var(--tool-duo-border);
  border-radius: 14px;
  background: #fff;
  font-size: 0.92rem;
  box-shadow: var(--tool-duo-card-shadow);
}

.tools-sidebar--right-column #free-notes-area:focus {
  border-color: var(--tool-duo-orange);
  box-shadow: 0 2px 0 var(--tool-duo-orange-dark);
}

.tools-sidebar--right-column .note-creator-card,
.tools-sidebar--right-column .notes-list-container,
.tools-sidebar--right-column .dict-card-container,
.tools-sidebar--right-column .translator-card,
.tools-sidebar--right-column .fn-note-display,
.tools-sidebar--right-column .translate-col-original {
  background: #fff;
  border: 2px solid var(--tool-duo-border);
  border-radius: 14px;
  box-shadow: var(--tool-duo-card-shadow);
}

.tools-sidebar--right-column .note-creator-header {
  font-size: 0.88rem;
}

.tools-sidebar--right-column .fn-input,
.tools-sidebar--right-column .note-input-wrapper #note-input-field,
.tools-sidebar--right-column .translate-manual-input {
  border-radius: 14px;
}

.tools-sidebar--right-column .dict-search-box {
  border-radius: 14px;
  padding: 5px 8px;
}

.tools-sidebar--right-column .translate-col-result {
  background: var(--tool-duo-blue-light);
  border: 2px solid var(--tool-duo-blue);
  border-radius: 14px;
  box-shadow: var(--tool-duo-blue-btn-shadow);
}

.tools-sidebar--right-column .tips-content h4 {
  font-size: 0.9rem;
}

.tools-sidebar--right-column .tips-content li {
  font-size: 0.85rem;
  padding: 10px 12px;
}

.tools-sidebar--right-column .notes-nav-btn,
.tools-sidebar--right-column .dict-search-go {
  border-radius: 12px;
}

.tools-sidebar--right-column .notes-nav-btn:hover:not(:disabled) {
  background: var(--tool-duo-blue-light);
  color: var(--tool-duo-blue);
  border-color: var(--tool-duo-blue);
}

.tools-sidebar--right-column .tool-toggle-row {
  background: #fff;
  border: 2px solid var(--tool-duo-border);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 10px;
  box-shadow: var(--tool-duo-card-shadow);
}

.tools-sidebar--right-column .tool-toggle-switch input:checked + .tool-toggle-slider {
  background: var(--tool-duo-orange);
}

/* ── Mobile: fixed bottom dock, panel above icons, opens upward ── */
@media (max-width: 768px), (max-height: 520px) and (orientation: landscape) and (max-width: 1024px) {
  .exercise-tools-sidebar-wrap--mobile .tools-sidebar--right-column {
    position: static;
    flex-direction: column-reverse;
    margin: 0;
    border-radius: 0;
    background: #fff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
    min-height: 0;
    height: auto;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
  }

  .exercise-tools-sidebar-wrap--mobile .tools-sidebar--right-column .sidebar-panel {
    order: 1;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0;
    border-radius: 0;
    background: #fff;
    width: 100%;
    max-width: 100%;
    flex-shrink: 0;
    box-sizing: border-box;
    border-bottom: none;
  }

  .exercise-tools-sidebar-wrap--mobile .tools-sidebar--right-column.open:has(.sidebar-tool-btn.active) .sidebar-panel {
    max-height: min(40dvh, 280px);
    overflow-y: auto;
  }

  .exercise-tools-sidebar-wrap--mobile .tools-sidebar--right-column .sidebar-rail {
    order: 2;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 100%;
    gap: 0;
    padding: 10px 16px;
    border-top: none;
    border-bottom: none;
    background: transparent;
    border-radius: 0;
    flex-shrink: 0;
    box-sizing: border-box;
  }

  .exercise-tools-sidebar-wrap--mobile .tools-sidebar--right-column .sidebar-tools-list {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    flex: 0 1 auto;
    width: auto;
    max-width: 100%;
    gap: 10px;
    padding: 0;
    margin: 0 auto;
    box-sizing: border-box;
  }

  .exercise-tools-sidebar-wrap--mobile .tools-sidebar--right-column .sidebar-tool-btn {
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #fff;
    border: 2px solid var(--ex-duo-border, #e5e5e5);
    box-shadow: 0 2px 0 #e5e5e5;
    color: #94a3b8;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    transition: color 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
    padding: 6px 4px;
  }

  .exercise-tools-sidebar-wrap--mobile .tools-sidebar--right-column .sidebar-tool-btn:hover {
    background: var(--ex-duo-orange-light, #fff0e6);
    border-color: var(--ex-duo-orange, #f47417);
    color: var(--ex-duo-orange, #f47417);
    transform: none;
    box-shadow: 0 2px 0 var(--ex-duo-orange-dark, #d45f0a);
  }

  .exercise-tools-sidebar-wrap--mobile .tools-sidebar--right-column .sidebar-tool-btn.active {
    background: var(--tool-duo-orange);
    color: #fff;
    border-color: var(--tool-duo-orange-dark);
    box-shadow: var(--tool-duo-btn-shadow);
  }

  .exercise-tools-sidebar-wrap--mobile .tools-sidebar--right-column .sidebar-tool-btn.active i {
    color: #fff;
  }

  .exercise-tools-sidebar-wrap--mobile .tools-sidebar--right-column .sidebar-tool-btn.active:hover {
    background: var(--tool-duo-orange-hover);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: var(--tool-duo-btn-shadow);
  }

  .exercise-tools-sidebar-wrap--mobile .tools-sidebar--right-column .sidebar-tool-btn i {
    font-size: 1.15rem;
  }

  .exercise-tools-sidebar-wrap--mobile .tools-sidebar--right-column .active-tool-content {
    max-height: none;
    padding: 14px 16px 12px;
    box-sizing: border-box;
  }
}
