/* =================================================================== */
/* BLOCKS SECTION LAYOUT */
/* =================================================================== */

.blocks-section {
  margin-top: 2rem;
  padding-bottom: 2rem;
  max-width: 56rem;
  margin-left: auto;
  margin-right: auto;
}

.blocks-section h2 {
  margin-bottom: 1rem;
  color: var(--sepia-text);
}

.block-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  margin-bottom: 1.5rem;
}

.blocks-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* =================================================================== */
/* DESK BLOCKS */
/* =================================================================== */

/* Alternating background for unscored blocks */
.desk-block:nth-child(odd) .desk-block-line:not(.block-fully-accepted):not(:has(strong)) {
  background: #e8e8e8 !important;
}

.desk-block-container {
  margin-top: 1rem;
  border-radius: 1rem;
  font-size: 1rem;
  transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.desk-container-content {
  border: 1px solid var(--sepia-border);
  border-radius: 1rem;
  min-height: 100px;
  margin: 0;
}

.desk-block-base {
  padding: 0 0.9rem;
  /* min-height: 2rem; */
  font-size: 1.125rem;
  font-family: serif;
  font-style: italic;
  line-height: 1.4;
  transition: all 0.2s ease;
  /* border: 1px solid var(--sepia-border); */
}

.desk-block-line {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.desk-block-with-blanks {
  display: block;
}

.desk-container-scorable {
  display: grid;
  gap: 1rem;
}

.desk-block-border {
}

.desk-container-scorable .desk-block-border {
  border-radius: 1rem;
  border: 1px solid var(--sepia-border);
}

.desk-container-scorable .desk-block {
  border-radius: 1rem;
}

.desk-block {
  background-color: var(--blocks-bg-light);
}

.desk-block:first-child {
  padding-top: 1rem;
  border-top-left-radius: 1rem;
  border-top-right-radius: 1rem;
}

.desk-container-examples .desk-block:last-child {
  border-bottom-left-radius: 1rem;
  border-bottom-right-radius: 1rem;
  padding-bottom: 1rem;
}

/* =================================================================== */
/* BLOCK COMPONENTS */
/* =================================================================== */

.block {
  border: 1px solid var(--sepia-border);
  border-radius: 4px;
  background-color: var(--blocks-bg-light);
  font-size: 1rem;
  transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.block-header {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 0.2rem;
  margin-top: 0.425rem;
  padding: 0 0.6rem;
  border-bottom: 1px solid var(--sepia-border);
}

.block-header-left {
  display: flex;
  width: 100%;
  align-items: center;
}

.block-header .btn-small {
  margin-left: auto;
}

/* =================================================================== */
/* BLOCK TYPES */
/* =================================================================== */

.block-type,
.container-type {
  font-size: 0.85rem;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  font-weight: 500;
}

.block-type {
  background-color: var(--sepia-bg);
  color: var(--sepia-text);
}

.container-type {
  background-color: var(--blocks-container-type-bg);
  color: var(--sepia-link);
}

/* =================================================================== */
/* CONTAINERS */
/* =================================================================== */

.block-container {
  background-color: var(--blocks-container-bg);
}

.container-content {
  padding: 0.5rem;
  border-radius: 4px;
  min-height: 100px;
}

.container-content .block {
  margin-bottom: 1.5rem;
}

.container-actions {
  margin-top: 0.75rem;
  text-align: center;
}

.container-actions .btn-small {
  font-size: 0.85rem;
}

.empty-container {
  text-align: center;
  color: var(--blocks-text-muted);
  font-style: italic;
  margin: 2rem 0;
}

/* =================================================================== */
/* TEXT CONTENT BLOCKS */
/* =================================================================== */

.text-block-inline {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.0rem 0.5rem;
}

.text-content-block {
  flex: 1;
  padding: 0.5rem;
  border-top-left-radius: 1rem;
  border-top-right-radius: 1rem;
  min-height: 2rem;
  font-style: italic;
  background-color: var(--blocks-preview-bg);
  border-color: var(--border-sepia-color);
  transition: all 0.2s ease;
  line-height: 1.4;
  display: flex;
}

.text-content-preview {
  flex: 1;
  padding: 0.5rem;
  margin-top: 0.5rem;
  border-top-left-radius: 1rem;
  border-top-right-radius: 1rem;
  min-height: 2rem;
  font-style: italic;
  background-color: var(--blocks-preview-bg);
  border-color: var(--border-sepia-color);
  transition: all 0.2s ease;
  line-height: 1.4;
}

.text-content {
  flex: 1;
  padding: 0.5rem;
  min-height: 2rem;
  border: 1px solid transparent;
  border-radius: 3px;
  transition: all 0.2s ease;
  line-height: 1.4;
}

.text-content:focus,
.text-content[contenteditable="true"] {
  outline: none;
  border-color: var(--sepia-border);
  background-color: var(--sepia-white);
}

.text-content:empty:before {
  content: attr(placeholder);
  color: var(--blocks-text-muted);
  opacity: 0.5;
  font-style: italic;
}

/* =================================================================== */
/* INTERACTIVE ELEMENTS */
/* =================================================================== */

.text-content-preview svg:hover {
  fill: aqua;
  cursor: pointer;
}

.magic:hover {
  color: #6DC6AA !important;
}

.block-text .grip-icon {
  flex-shrink: 0;
}

/* =================================================================== */
/* SORTABLE & DRAG FUNCTIONALITY */
/* =================================================================== */

.grip-icon {
  cursor: grab;
  color: var(--blocks-text-muted);
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

.grip-icon:hover {
  opacity: 1;
}

.grip-icon:active {
  cursor: grabbing;
}

.sortable-ghost {
  opacity: 0.5;
  background-color: var(--sepia-bg);
  transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.sortable-chosen {
  box-shadow: 0 2px 8px var(--blocks-shadow);
  transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* =================================================================== */
/* USER ATTEMPT STYLING */
/* =================================================================== */

.blank.accepted {
  background-color: var(--progress-green-light);
  border-color: var(--progress-green);
  color: var(--progress-green-dark);
}

.blank.accepted:disabled {
  opacity: 1;
  cursor: not-allowed;
}

/* Score-based input styling */
.blank.score-red {
  border-bottom-color: #6b7280;
  border-bottom-width: 2px;
}

.blank.score-orange {
  border-bottom-color: #a8a29e;
  border-bottom-width: 2px;
}

.blank.score-yellow {
  border-bottom-color: #eab308;
  border-bottom-width: 2px;
}

.blank.score-light-green {
  border-bottom-color: #84cc16;
  border-bottom-width: 2px;
}

.blank.score-green {
  border-bottom-color: #22c55e;
  border-bottom-width: 2px;
}

.blank.score-accepted {
  border-bottom-color: var(--progress-green);
  border-bottom-width: 2px;
}

.block-fully-accepted {
  background-color: var(--progress-green-lighter);
  border-color: var(--progress-green);
}

.block-fully-accepted .translation-toggle-btn {
  background-color: var(--progress-green-light);
  border-color: var(--progress-green);
}

.block-fully-accepted .translation-toggle-btn:hover {
  background-color: var(--progress-green-hover);
}

/* =================================================================== */
/* SIDEBAR PROGRESS CIRCLES */
/* =================================================================== */

.page-link-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-left: 0.5rem;
}

.page-progress-circle {
  position: relative;
  flex-shrink: 0;
}

.progress-ring {
  transform: rotate(-90deg);
}

.progress-ring-background {
  fill: none;
  stroke: var(--sepia-border);
  stroke-width: 2;
}

.progress-ring-progress {
  fill: none;
  stroke: var(--progress-circle);
  stroke-width: 2;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.9s ease-out;
}

.page-number {
  position: absolute;
  top: 0;
  left: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--sepia-text);
  pointer-events: none;
  letter-spacing: -0.5px;
}

.page-item {
  /* margin-bottom: 0.5rem; */
}

.page-link {
  flex: 1;
  display: block;
  padding: 0.5rem 0;
  color: var(--sepia-text);
  text-decoration: none;
  /* border-radius: 4px; */
  transition: background-color 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.page-link:hover {
  background-color: var(--sepia-bg);
}

.page-link.active {
  background-color: var(--sepia-border);
  font-weight: 400;
}

/* =================================================================== */
/* PAGE COMPLETION CELEBRATION */
/* =================================================================== */

.page-completion-celebration {
  text-align: center;
  margin-top: 3rem;
  padding: 2rem;
}

.animated-gradient-border {
  position: relative;
  background: linear-gradient(90deg, #14b8a6, #0d9488, #0f766e, #0d9488, #14b8a6);
  background-size: 200% 200%;
  animation: gradient-rotation 3s ease infinite;
  padding: 2px;
  border-radius: 0.5rem;
  box-shadow: none !important;
  filter: none !important;
  outline: none !important;
  display: inline-block;
}

.gradient-inner {
  background: var(--progress-green-light);
  border-radius: 0.375rem;
  box-shadow: none !important;
  filter: none !important;
  outline: none !important;
}

.continue-journey-button {
  box-shadow: none !important;
  text-shadow: none !important;
  filter: none !important;
  outline: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 2rem;
  font-size: 1.125rem;
  line-height: 1.75rem;
  font-weight: 600;
  color: var(--progress-green-dark);
  text-decoration: none;
  transition: color 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.continue-journey-button:hover {
  color: var(--progress-green-dark);
}

.arrow-icon {
  width: 1.25rem;
  height: 1.25rem;
  margin-left: 0.5rem;
  transition: transform 0.3s ease;
}

.continue-journey-button:hover .arrow-icon {
  animation: arrow-pulse 1s ease-in-out infinite;
}

@keyframes arrow-pulse {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(4px); }
}

@keyframes gradient-rotation {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes pulse-glow {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.02); opacity: 0.9; }
}

.celebration-emoji {
  font-size: 2rem;
  margin-bottom: 1rem;
  display: block;
}

.celebration-text {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  color: var(--sepia-text);
  font-weight: 500;
}

/* =================================================================== */
/* TRANSLATION TOGGLE */
/* =================================================================== */

.translation-toggle-container {
  /* margin-top: 1rem; */
  text-align: right;
  /* margin-top: -1rem; */
}

.translation-toggle-btn {
  background-color: var(--blocks-preview-bg);
  color: var(--sepia-text);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background-color 0.2s ease;
}

.translation-toggle-btn:hover {
  background-color: var(--sepia-border);
}

.translation-content {
  overflow: hidden;
  height: 0px;
  opacity: 0;
  transform: scaleY(0);
  transform-origin: top;
  transition: height 0.3s cubic-bezier(0.4, 0.0, 0.2, 1),
              opacity 0.3s cubic-bezier(0.4, 0.0, 0.2, 1),
              transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
  will-change: height, transform, opacity;
  text-align: left;
}

.translation-content.show {
  height: auto;
  opacity: 1;
  transform: scaleY(1);
  margin-top: 0.5rem;
}

/* =================================================================== */
/* AUDIO PLAYER */
/* =================================================================== */

.audio-player-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

.audio-play-btn {
  background: none;
  border: none;
  cursor: pointer;
  /* padding: 0.25rem; */
  border-radius: 50%;
  color: var(--sepia-text);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.audio-play-btn:hover {
  background-color: var(--sepia-bg);
  color: var(--sepia-link);
}

.audio-play-btn svg {
  width: 20px;
  height: 20px;
}

/* =================================================================== */
/* SPEECH BUTTON */
/* =================================================================== */

.speech-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 50%;
  color: var(--sepia-text);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  position: relative;
}

.speech-btn:hover {
  background-color: var(--sepia-bg);
  color: var(--sepia-link);
}

.speech-btn.loading {
  animation: pulse 1.5s ease-in-out infinite;
  pointer-events: none;
  cursor: not-allowed;
  opacity: 0.7;
}

.speech-btn.loading::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border: 2px solid transparent;
  border-radius: 50%;
  background: linear-gradient(45deg, #14b8a6, #0d9488, #0f766e, #0d9488) border-box;
  background-size: 200% 200%;
  animation: running-border 2s linear infinite;
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
}

.speech-btn svg {
  width: 16px;
  height: 16px;
  z-index: 1;
}

@keyframes running-border {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.data-main-text-block a {
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--sepia-text);
  text-decoration: dotted;
  border-bottom: 1px dotted rgba(from var(--sepia-text) r g b / 0.25);
}

.desk-block-with-blanks a {
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--sepia-text);
  text-decoration: dotted;
  border-bottom: 1px dotted rgba(from var(--sepia-text) r g b / 0.25);
}

.playing {
  color: steelblue !important;
  text-decoration: none;
  border-bottom: 1px dotted steelblue;
  cursor: pointer;
}

/* * */
/* . */
/* * */

.rarity-10 {
    background: linear-gradient(to top, #6D28D9 0%, #6D28D9 5%, transparent 5%);
    filter: drop-shadow(0 3px 12px rgba(109,40,217,0.3));
}

.rarity-50 {
    background: linear-gradient(to top, #7C3AED 0%, #7C3AED 5%, transparent 5%);
    filter: drop-shadow(0 3px 10px rgba(124,58,237,0.25));
}

.rarity-100 {
    background: linear-gradient(to top, #8B5CF6 0%, #8B5CF6 4%, transparent 4%);
    filter: drop-shadow(0 3px 8px rgba(139,92,246,0.2));
}

.rarity-500 {
    background: linear-gradient(to top, #A855F7 0%, #A855F7 4%, transparent 4%);
    filter: drop-shadow(0 3px 6px rgba(168,85,247,0.15));
}

.rarity-1000 {
    background: linear-gradient(to top, #C084FC 0%, #C084FC 3%, transparent 3%);
    filter: drop-shadow(0 3px 4px rgba(192,132,252,0.1));
}

.rarity-2000 {
    background: linear-gradient(to top, #D8B4FE 0%, #D8B4FE 3%, transparent 3%);
    filter: drop-shadow(0 3px 3px rgba(216,180,254,0.08));
}

.rarity-5000 {
    background: linear-gradient(to top, #E9D5FF 0%, #E9D5FF 3%, transparent 3%);
    filter: drop-shadow(0 3px 2px rgba(233,213,255,0.06));
}

.rarity-10000 {
    background: linear-gradient(to top, #F3E8FF 0%, #F3E8FF 3%, transparent 3%);
    filter: drop-shadow(0 3px 2px rgba(243,232,255,0.04));
}

.rarity-20000 {
    background: linear-gradient(to top, #FAF5FF 0%, #FAF5FF 3%, transparent 3%);
    filter: drop-shadow(0 3px 1px rgba(250,245,255,0.03));
}

.rarity-50000 {
    background: linear-gradient(to top, #FDFAFF 0%, #FDFAFF 2%, transparent 2%);
    filter: drop-shadow(0 3px 1px rgba(253,250,255,0.02));
}

.rarity-100000 {
    background: linear-gradient(to top, #F9FAFB 0%, #F9FAFB 2%, transparent 2%);
}

.rarity-100000-plus {
    background: linear-gradient(to top, #F3F4F6 0%, #F3F4F6 2%, transparent 2%);
}

