#clp-app {
  --clp-bg-soft: linear-gradient(135deg, #e9f5ef 0%, #f1f6e5 100%);
  --clp-surface: rgba(255, 255, 255, 0.92);
  --clp-surface-strong: #ffffff;
  --clp-surface-muted: rgba(247, 248, 243, 0.94);
  --clp-border: rgba(74, 112, 65, 0.12);
  --clp-border-strong: rgba(74, 112, 65, 0.18);
  --clp-shadow: 0 16px 36px rgba(42, 61, 32, 0.08);
  --clp-shadow-strong: 0 24px 60px rgba(42, 61, 32, 0.11);
  --clp-text: #33431e;
  --clp-text-soft: #635b52;
  --clp-text-muted: #7a7368;
  --clp-accent: #6b7f3d;
  --clp-accent-deep: #566730;
  --clp-accent-warm: #8a5a26;
  --clp-success-bg: #eef5e8;
  --clp-success-border: rgba(107, 127, 61, 0.18);
  --clp-radius-xl: 28px;
  --clp-radius-lg: 22px;
  --clp-radius-md: 18px;
  --clp-radius-sm: 14px;
  color: var(--clp-text);
  font: inherit;
}

#clp-app textarea,
#clp-app button,
#clp-app input,
#clp-app select {
  font: inherit;
}

.clp-practice-shortcut-hint {
  margin-top: 10px;
  margin-bottom: 20px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--clp-surface);
  border: 0px solid var(--clp-border);
  font-size: 13px;
  color: var(--clp-text-soft);
  text-align: center;
}


.clp-wrapper {
  width: 100%;
  margin: 18px auto 24px;
}

.clp-flow-shell {
  position: relative;
  max-width: 920px;
  margin: 0 auto;
  overflow: visible;
}

.clp-card {
  max-width: 920px;
  margin: 0 auto;
  border: 0px solid var(--clp-border);
  border-radius: 26px;
  padding: 32px;
  box-shadow: var(--clp-shadow-strong);
}

.clp-floating-mascot {
  position: absolute;
  top: 0;
  right: 1px;
  z-index: 5;
  width: min(250px, 22vw);
  pointer-events: none;
  transform: translateY(-52%);
}

.clp-floating-mascot-image {
  width: 100%;
  display: block;
  filter: drop-shadow(0 18px 24px rgba(73, 50, 18, 0.12));
}

#clp-app[data-current-step="4"] .clp-floating-mascot {
  display: none;
}

.clp-step-title {
  margin: 0;
  font-size: 34px;
  line-height: 1.15;
  font-weight: 700;
  color: var(--clp-accent-warm);
}

.clp-step-head-entry {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.clp-step-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.clp-step-badge {
  margin-bottom: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: #eb8b00;
  color: #fffdf7;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.clp-step-microcopy {
  color: var(--clp-text-muted);
  font-size: 15px;
  line-height: 1.5;
}

.clp-step-description {
  max-width: 760px;
  margin: 0;
  font-size: 18px;
  line-height: 1.7;
  color: var(--clp-text-soft);
}

.clp-title {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.3;
  font-weight: 700;
  color: var(--clp-text);
}


.clp-input-section,
.clp-editor-section,
.clp-practice-section,
.clp-summary-section {
  margin-top: 2px;
}

.clp-entry-card .clp-input-section {
  margin-top: 0;
}

.clp-entry-kicker {
  margin-bottom: 22px;
}

.clp-input-section label {
  display: block;
  margin-bottom: 0;
  font-weight: 600;
  color: var(--clp-text);
}

.clp-entry-highlights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.clp-entry-pill {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 100%;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--clp-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.clp-entry-pill strong {
  font-size: 15px;
  line-height: 1.4;
  color: var(--clp-text);
}

.clp-entry-pill span {
  font-size: 14px;
  line-height: 1.6;
  color: var(--clp-text-soft);
}

.clp-input-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.clp-input-tip {
  font-size: 14px;
  line-height: 1.5;
  color: var(--clp-text-muted);
}

.clp-source-box {
  border: 0px solid var(--clp-border);
}

.clp-source-box-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.clp-source-box-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--clp-text);
}

.clp-source-cache-btn {
  border: 1px solid var(--clp-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--clp-text);
  width: 40px;
  height: 40px;
  padding: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  position: relative;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, opacity 0.18s ease;
}

.clp-source-cache-btn:hover:not(:disabled) {
  background: var(--clp-surface-muted);
  border-color: var(--clp-border-strong);
}

.clp-source-cache-btn svg {
  width: 18px;
  height: 18px;
  display: block;
  pointer-events: none;
}

.clp-source-cache-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 12;
  width: 220px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(116, 145, 73, 0.18);
  box-shadow: 0 16px 28px rgba(42, 61, 32, 0.12);
  color: var(--clp-text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
  pointer-events: none;
}

.clp-source-cache-btn:hover:not(:disabled)::after,
.clp-source-cache-btn:focus-visible:not(:disabled)::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.clp-source-cache-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.clp-source-box-tip {
  font-size: 14px;
  line-height: 1.5;
  color: var(--clp-text-soft);
}

.clp-source-box-inner {
  position: relative;
}

#clp-app #clp-source-text,
#clp-app #clp-level,
#clp-app .clp-chunk-textarea,
#clp-app .clp-answer-input,
#clp-app .clp-chunk-inline-editor,
#clp-app .clp-practice-input,
#clp-app .clp-speed-select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--clp-border-strong);
  border-radius: 16px;
  padding: 8px 20px;
  font-size: 16px;
  line-height: 1.6;
  background: rgba(255, 255, 255, 0.96);
  color: var(--clp-text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

#clp-app #clp-source-text:focus,
#clp-app #clp-level:focus,
#clp-app .clp-chunk-textarea:focus,
#clp-app .clp-answer-input:focus,
#clp-app .clp-chunk-inline-editor:focus,
#clp-app .clp-practice-input:focus,
#clp-app .clp-speed-select:focus {
  outline: none;
  border-color: rgba(107, 127, 61, 0.55);
  box-shadow: 0 0 0 4px rgba(107, 127, 61, 0.12);
  background: #ffffff;
}

#clp-app #clp-source-text {
  height: auto;
  min-height: 420px;
  resize: vertical;
  margin-bottom: 0;
  position: relative;
  z-index: 1;
}

.clp-source-guide {
  position: absolute;
  inset: 16px;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
  pointer-events: none;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}

.clp-source-guide-copy {
  display: grid;
  gap: 16px;
}

.clp-source-guide .chunking-guide {
  gap: 16px;
}

.clp-source-guide .chunking-guide-title {
  font-size: clamp(1.5rem, 2.2vw, 2.2rem) !important;
}

.clp-source-guide .chunking-guide-description {
  font-size: 16px;
  line-height: 1.6 !important;
}

.clp-source-guide .chunking-guide-highlights {
  width: 100%;
}

.clp-source-guide-note,
.clp-source-guide-tip {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--clp-text-soft);
}

.clp-source-guide-highlight {
  color: #d96f14;
  font-weight: 700;
}

.clp-source-guide-tip {
  color: var(--clp-accent-warm);
  font-weight: 600;
}

.clp-source-box:focus-within .clp-source-guide,
.clp-source-box-inner.has-content .clp-source-guide,
#clp-app #clp-source-text:not(:placeholder-shown) + .clp-source-guide {
  opacity: 0;
  visibility: hidden;
}

#clp-app #clp-level {
  height: 50px;
  margin-bottom: 16px;
  background: #fff;
}

#clp-app .clp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 25px;
  padding: 12px 18px;
  font-size: 16px;
  line-height: 1.4;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

#clp-app .clp-btn:hover {
  transform: translateY(-1px);
}

#clp-app .clp-btn-primary {
  background: var(--clp-accent);
  border-color: var(--clp-accent);
  color: #fff;
  box-shadow: 0 12px 24px rgba(107, 127, 61, 0.2);
}

#clp-app .clp-btn-primary:hover {
  background: var(--clp-accent-deep);
  border-color: var(--clp-accent-deep);
  box-shadow: 0 16px 28px rgba(86, 103, 48, 0.24);
}

#clp-app .clp-btn-secondary {
  background: rgba(255, 255, 255, 0.92);
  border-color: var(--clp-border-strong);
  color: var(--clp-text);
}

#clp-app .clp-btn-secondary:hover {
  background: var(--clp-surface-muted);
}

#clp-app .clp-btn-danger {
  background: #fef2f2;
  color: #b91c1c;
  border-color: rgba(185, 28, 28, 0.14);
}

.clp-btn-danger:hover {
  background: #fee2e2;
}

.clp-editor-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.clp-editor-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--clp-accent-warm);
}

.clp-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.clp-chunk-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.clp-chunk-item {
  border: 1px solid var(--clp-border);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.9);
}

.clp-chunk-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.clp-chunk-meta {
  font-size: 16px;
  color: var(--clp-text-soft);
  font-weight: 600;
}

.clp-chunk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.clp-chunk-textarea {
  min-height: 72px;
  resize: vertical;
  background: #fff;
}

.clp-empty-box,
.clp-message-box {
  border: 1px dashed var(--clp-border-strong);
  background: var(--clp-surface);
  border-radius: 16px;
  padding: 16px;
  color: var(--clp-text-soft);
  font-size: 16px;
}

.clp-helper-text {
  margin-top: 8px;
  font-size: 16px;
  color: var(--clp-text-muted);
}

.clp-hidden {
  display: none !important;
}

.clp-step-actions {
  margin-top: 18px;
}

.clp-entry-note {
  margin: 16px 0 0;
  font-size: 15px;
  line-height: 1.7;
  color: var(--clp-text-soft);
}

@media (max-width: 768px) {
  .clp-card {
    padding: 22px 18px;
    border-radius: 22px;
  }

  .clp-title {
    font-size: 24px;
  }

  .clp-step-title {
    font-size: 28px;
  }

  .clp-step-description {
    font-size: 16px;
  }

  .clp-entry-highlights {
    grid-template-columns: 1fr;
  }

  .clp-input-label-row,
  .clp-source-box-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .clp-source-cache-btn::after {
    display: none;
  }

  .clp-editor-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .clp-chunk-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .clp-btn {
    width: 100%;
  }

  #clp-source-text {
    min-height: 320px;
  }

  #clp-app #clp-source-text:placeholder-shown {
    min-height: 640px;
  }

  #clp-app #clp-source-text:not(:placeholder-shown) {
    min-height: 320px;
  }

  .clp-editor-actions,
  .clp-chunk-actions {
    width: 100%;
  }

  .clp-editor-actions .clp-btn,
  .clp-chunk-actions .clp-btn {
    flex: 1 1 100%;
  }

  .clp-source-guide {
    inset: 14px;
    padding-right: 0;
  }

  .clp-floating-mascot {
    width: min(180px, 44vw);
    margin: 0 0 12px auto;
  }

  .clp-source-guide .chunking-guide-highlights {
    grid-template-columns: 1fr;
  }
}


.clp-level-switcher {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 20px;
  margin-bottom: 20px;
}

.clp-level-btn {
  border: 1px solid var(--clp-border);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 16px;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 8px 18px rgba(42, 61, 32, 0.05);
}

.clp-level-btn:hover {
  background: #ffffff;
  border-color: var(--clp-border-strong);
}

.clp-level-btn.is-active {
  border-color: rgba(107, 127, 61, 0.46);
  box-shadow: 0 0 0 3px rgba(107, 127, 61, 0.12);
  background: linear-gradient(180deg, #ffffff, #f7faef);
}

.clp-level-btn-label {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: var(--clp-text);
}

.clp-level-btn-meta {
  display: block;
  margin-top: 4px;
  font-size: 16px;
  color: var(--clp-text-soft);
}

.clp-chunk-panel {
  border: 1px solid var(--clp-border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  padding: 16px;
  max-height: 420px;
  overflow-y: auto;
}

.clp-chunk-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.clp-chunk-panel-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--clp-text);
}

.clp-chunk-panel-subtitle {
  font-size: 15px;
  color: var(--clp-text-soft);
}

.clp-compact-chunk-list {
  gap: 2px;
}

.clp-chunk-row {
  border: 1px solid var(--clp-border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  padding: 12px;
}

.clp-chunk-row-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.clp-chunk-number {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 999px;
  background: #eef5e8;
  color: var(--clp-accent);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.clp-chunk-content {
  flex: 1;
  min-width: 0;
}

.clp-chunk-text {
  font-size: 16px;
  line-height: 1.7;
  color: var(--clp-text);
  word-break: break-word;
}

.clp-chunk-inline-editor {
  width: 100%;
  min-height: 84px;
  padding: 12px;
  font-size: 16px;
  line-height: 1.6;
  resize: vertical;
  box-sizing: border-box;
}

.clp-chunk-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}


.clp-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}

.clp-editor-footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

#clp-back-to-step1-btn {
  gap: 8px;
}

.clp-back-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.clp-back-btn-icon svg {
  display: block;
}

@media (max-width: 768px) {
  .clp-level-switcher {
    justify-content: center;
    display: grid;
    flex-wrap: nowrap;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .clp-level-switcher::-webkit-scrollbar {
    display: none;
  }

  .clp-level-btn {
    flex: 0 0 auto;
    min-width: max-content;
    padding: 12px 16px;
  }

  .clp-chunk-row-main {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px 12px;
    position: relative;
  }

  .clp-chunk-row-actions {
    position: absolute;
    top: 2px;
    right: 0;
    width: auto;
    justify-content: flex-end;
    gap: 4px;
    margin-left: 0;
  }

  .clp-chunk-content {
    flex: 1 1 0;
    min-width: 0;
  }

  .clp-chunk-row {
    padding: 14px;
    border-radius: 18px;
  }

  .clp-chunk-panel {
    padding: 12px;
  }

  .clp-chunk-panel-head {
    margin-bottom: 10px;
  }

  .clp-chunk-number {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
    font-size: 16px;
  }

  .clp-action-icon {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--clp-border);
    opacity: 1;
  }

  .clp-chunk-text {
    font-size: 16px;
    line-height: 1.65;
    padding-right: 68px;
  }

  .clp-chunk-inline-editor {
    padding-right: 68px;
  }

  .clp-editor-footer {
    flex-direction: row;
    align-items: stretch;
  }

  .clp-editor-footer-right {
    flex: 1 1 auto;
  }

  .clp-editor-footer-right .clp-btn,
  #clp-back-to-step1-btn {
    width: auto;
  }

  #clp-back-to-step1-btn {
    min-width: 46px;
    width: 46px;
    height: 46px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    flex: 0 0 46px;
  }

  #clp-back-to-step1-btn .clp-back-btn-label {
    display: none;
  }

  #clp-start-practice-btn {
    width: 100%;
  }
}

.clp-chunk-row-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.clp-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--clp-text-muted);
  opacity: 0.75;
  transition: opacity 0.2s ease, transform 0.15s ease, color 0.2s ease;
}

.clp-action-icon:hover {
  opacity: 1;
  transform: scale(1.08);
  color: var(--clp-text);
}

.clp-action-icon svg {
  display: block;
}

/* container vùng hover */
.clp-insert-slot{
  position: relative;
  height: 14px;
}

/* full width invisible button */
.clp-insert-chunk-btn{
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);

  display: flex;
  align-items: center;
  gap: 8px;

  padding: 0;
  margin: 0;

  border: none;
  background: none !important;

  cursor: pointer;
  opacity: 0;

  appearance: none;
  -webkit-appearance: none;
  outline: none;
  box-shadow: none !important;
  -webkit-tap-highlight-color: transparent;

  transition: opacity .15s ease;
}

/* remove any browser focus styles */
.clp-insert-chunk-btn:focus,
.clp-insert-chunk-btn:active{
  outline: none;
  box-shadow: none;
  background: none;
}

/* show button when hovering slot */
.clp-insert-slot:hover .clp-insert-chunk-btn{
  opacity: 1;
}

/* horizontal line */
.clp-insert-line{
  flex: 1;
  height: 1px;
  background: rgba(107, 127, 61, 0.46);
}

/* plus icon */
.clp-insert-plus{
  width: 20px;
  height: 20px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;
  border: 2px solid var(--clp-accent);
  color: var(--clp-accent);
  font-size: 13px;
  font-weight: 600;

  background: #fff;
  flex-shrink: 0;

  transition: all .15s ease;
}

/* hover animation */
.clp-insert-chunk-btn:hover .clp-insert-plus{
  background: var(--clp-accent);
  color: white;
  transform: scale(1.05);
}

.clp-practice-section {
  max-width: 920px;
  margin: 0 auto;
  border: 1px solid var(--clp-border);
  border-radius: 26px;
  padding: 24px;
  box-shadow: var(--clp-shadow);
}


.clp-practice-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 8px 0 20px;
}

.clp-practice-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.clp-practice-title {
  margin: 8px 0 4px;
  font-size: 28px;
  font-weight: 800;
  color: var(--clp-accent-warm);
}

.clp-practice-subtitle {
  font-size: 16px;
  color: var(--clp-text-soft);
}

.clp-practice-progress-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(107, 127, 61, 0.12);
  overflow: hidden;
  margin-bottom: 20px;
}

.clp-practice-progress-fill {
  height: 100%;
  background: var(--clp-accent);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.clp-practice-hero-box {
  min-height: 100px;
  border: 0px solid rgba(107, 127, 61, 0.14);
  border-radius: 20px;
  
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  margin-bottom: 14px;
  transition: all 0.2s ease;
  box-shadow: 0 16px 34px rgba(68, 88, 44, 0.12);
}

.clp-practice-hero-box.is-excellent {
  background:
    radial-gradient(circle at 16% 18%, rgba(147, 213, 111, 0.34), transparent 28%),
    linear-gradient(135deg, #d8efc9 0%, #eef9e3 50%, #dcefc7 100%);
  border-color: rgba(94, 145, 49, 0.28);
  box-shadow: 0 18px 36px rgba(83, 128, 46, 0.16);
}

.clp-practice-hero-box.is-good {
  background:
    radial-gradient(circle at 16% 18%, rgba(181, 214, 116, 0.28), transparent 28%),
    linear-gradient(135deg, #e1efd0 0%, #f5fae7 48%, #e7f0d5 100%);
  border-color: rgba(107, 127, 61, 0.24);
  box-shadow: 0 18px 34px rgba(107, 127, 61, 0.14);
}

.clp-practice-hero-box.is-fair {
  background:
    radial-gradient(circle at 16% 18%, rgba(245, 191, 96, 0.22), transparent 28%),
    linear-gradient(135deg, #f9e7c9 0%, #fff7ea 50%, #fdeed3 100%);
  border-color: rgba(185, 125, 47, 0.24);
  box-shadow: 0 18px 34px rgba(171, 116, 43, 0.14);
}

.clp-practice-hero-box.is-low {
  background:
    radial-gradient(circle at 16% 18%, rgba(234, 140, 92, 0.22), transparent 28%),
    linear-gradient(135deg, #f7dece 0%, #fff1e8 50%, #f9e2d4 100%);
  border-color: rgba(176, 98, 63, 0.24);
  box-shadow: 0 18px 34px rgba(160, 82, 45, 0.14);
}

.clp-practice-hero-instruction,
.clp-practice-hero-score {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.clp-practice-hero-mascot {
  object-fit: contain;
  height: 120px;
  flex: 0 0 74px;
  filter: drop-shadow(0 8px 12px rgba(128, 92, 38, 0.14));
}

.clp-practice-hero-text,
.clp-practice-hero-score-text {
  font-size: 16px;
  font-weight: 500;
  color: var(--clp-text);
}

.clp-practice-hero-score {
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.clp-practice-hero-score-text {
  font-size: 18px;
  font-weight: 700;
  color: #6f471c;
}



.clp-practice-original-toggle-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.clp-text-toggle-btn{
  background: none !important;
  border: none;
  padding: 0;
  margin: 0;
  font-style: italic;
  color: var(--clp-accent);
  font-size: 15px;
  font-weight: 400;

  cursor: pointer;

  appearance: none;
  -webkit-appearance: none;

  box-shadow: none !important;
  outline: none;

  opacity: 1;
  -webkit-tap-highlight-color: transparent;
}

/* remove any hover / focus background */
.clp-text-toggle-btn:hover,
.clp-text-toggle-btn:focus,
.clp-text-toggle-btn:active{
	background: none !important;
  box-shadow: none !important;
  font-style: italic;
  color: var(--clp-accent);
  outline: none;
  opacity: 1;
}

.clp-practice-original {
  border: 1px solid var(--clp-success-border);
  background: var(--clp-success-bg);
  color: var(--clp-text);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 14px;
  line-height: 1.7;
}


.clp-practice-input-wrap {
  margin-bottom: 18px;
}

.clp-practice-input {
  height: 70px;
  min-height: 70px;
  width: 100%;
  box-sizing: border-box;
  padding: 16px 18px;
  font-size: 17px;
  line-height: 1.6;
  color: var(--clp-text);
  resize: none;
}

.clp-practice-input:focus {
  outline: none;
}

.clp-practice-action-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 18px;
}

.clp-practice-main-btn {
  min-width: 120px;
  border: none;
  border-radius: 25px;
  padding: 8px 20px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.clp-practice-main-btn:hover {
  transform: translateY(-1px);
}

.clp-practice-main-btn.is-play {
  background: var(--clp-accent);
  color: #fff;
  box-shadow: 0 10px 24px rgba(107, 127, 61, 0.2);
}

.clp-practice-main-btn.is-submit {
  background: #3ba531;
  color: #fff;
  box-shadow: 0 10px 24px rgba(107, 127, 61, 0.2);
}

.clp-practice-main-btn.is-skip {
  background: rgba(255, 255, 255, 0.92);
  color: var(--clp-text);
  border: 1px solid var(--clp-border-strong);
}

.clp-speed-select {
  width: auto !important;
  min-width: 0;
  padding: 0 22px 0 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--clp-text-soft);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  text-align: right;
  background-image: none !important;
}

.clp-practice-speed-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
  text-align: right;
  position: relative;
  z-index: 5;
}

.clp-speed-select:focus {
  outline: none;
}



@media (max-width: 768px) {
  .clp-practice-header {
    flex-direction: row;
    align-items: flex-start;
  }

  .clp-practice-title {
    font-size: 24px;
  }

  .clp-practice-header-left {
    flex: 1 1 auto;
    min-width: 0;
  }

  .clp-practice-header-right {
    flex: 0 0 auto;
  }

  #clp-back-to-editor-btn {
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 999px;
    font-size: 0;
    line-height: 0;
    position: relative;
    color: transparent;
    text-indent: 100%;
    overflow: hidden;
    white-space: nowrap;
  }

  #clp-back-to-editor-btn::before {
    content: "←";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    line-height: 1;
    color: var(--clp-text);
    text-indent: 0;
  }

  .clp-practice-hero-box {
    min-height: 120px;
    padding: 18px;
  }

  .clp-practice-hero-text,
  .clp-practice-hero-score-text {
    font-size: 16px;
  }

  .clp-practice-hero-mascot {
    width: 64px;
    height: 64px;
    flex-basis: 64px;
  }

  .clp-practice-action-row {
    flex-direction: row;
    justify-content: center;
    gap: 10px;
  }

  .clp-practice-original-toggle-row {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .clp-practice-speed-wrap {
    width: 100%;
    justify-content: flex-start;
  }

  .clp-practice-main-btn {
    width: 48px;
    min-width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 999px;
    font-size: 0;
    line-height: 0;
    flex: 0 0 48px;
    color: transparent;
    text-indent: 100%;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
  }

  .clp-practice-input {
    font-size: 16px;
  }

  .clp-practice-main-btn::before {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    line-height: 1;
    text-indent: 0;
  }

  .clp-practice-main-btn.is-play::before {
    content: "▶";
  }

  .clp-practice-main-btn.is-submit::before {
    content: "✓";
  }

  .clp-practice-main-btn.is-skip::before {
    content: "→";
    color: var(--clp-text);
  }
}

.clp-summary-shell {
  max-width: 980px;
  margin: 0 auto;
}

.clp-summary-header {
  position: relative;
  margin-bottom: 18px;
  min-height: 120px;
}

.clp-summary-header-copy {
  max-width: calc(100% - 260px);
}

.clp-summary-header-visual {
  position: absolute;
  right: 8px;
  bottom: -34px;
  pointer-events: none;
}

.clp-summary-header-mascot {
  display: block;
  width: clamp(190px, 24vw, 280px);
  height: auto;
}

.clp-summary-title {
  margin: 0 0 6px;
  font-size: 30px;
  line-height: 1.2;
  font-weight: 800;
  color: var(--clp-accent-warm);
}

.clp-summary-subtitle {
  font-size: 15px;
  line-height: 1.6;
  color: var(--clp-text-soft);
}

.clp-summary-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.clp-summary-stat-card {
  border: 1px solid var(--clp-border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.94);
  padding: 18px 16px;
  text-align: center;
  box-shadow: 0 10px 20px rgba(42, 61, 32, 0.05);
}

.clp-summary-stat-value {
  font-size: 34px;
  line-height: 1;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--clp-text);
}

.clp-summary-stat-value.is-excellent {
  color: #16a34a;
}

.clp-summary-stat-value.is-good {
  color: var(--clp-accent);
}

.clp-summary-stat-value.is-fair {
  color: var(--clp-accent-warm);
}

.clp-summary-stat-value.is-low {
  color: #dc2626;
}

.clp-summary-stat-label {
  font-size: 14px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--clp-text-soft);
  text-transform: none;
  letter-spacing: 0;
  margin-top: 0;
}

.clp-summary-extra {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 30px;
}

.clp-summary-extra-item {
  gap: 6px;
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--clp-border);
  color: var(--clp-text-soft);
  font-size: 14px;
  line-height: 1.4;
}

.clp-summary-focus {
  margin-bottom: 22px;
  padding: 18px 18px 16px;
  border-radius: 22px;
  background: linear-gradient(135deg, #fff8ee 0%, #f8f1e2 100%);
  border: 1px solid rgba(138, 90, 38, 0.14);
  box-shadow: 0 10px 22px rgba(138, 90, 38, 0.06);
}

.clp-summary-focus-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  margin-bottom: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(138, 90, 38, 0.14);
  color: var(--clp-accent-warm);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.clp-summary-focus-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.clp-summary-focus-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid rgba(138, 90, 38, 0.2);
  color: var(--clp-accent-warm);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 6px 12px rgba(138, 90, 38, 0.04);
}

.clp-summary-focus-item strong {
  color: var(--clp-text);
}

.clp-summary-focus-item span {
  color: var(--clp-text-soft);
}

.clp-summary-results-title {
  font-size: 18px;
  line-height: 1.4;
  font-weight: 800;
  color: var(--clp-text);
  text-transform: none;
  letter-spacing: 0;
  margin: 0 0 10px;
}

.clp-diff-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--clp-border);
}

.clp-diff-legend span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid rgba(74, 112, 65, 0.1);
  font-size: 13px;
  font-weight: 700;
}

.clp-summary-results-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 560px;
  overflow-y: auto;
  padding-right: 4px;
}

.clp-result-card {
  border: 1px solid var(--clp-border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  padding: 14px 16px;
  box-shadow: 0 6px 14px rgba(42, 61, 32, 0.04);
}

.clp-result-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 12px;
}

.clp-result-chunk-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 800;
  color: var(--clp-text);
}

.clp-result-chunk-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(107, 127, 61, 0.1);
  color: var(--clp-accent);
  font-size: 12px;
  font-weight: 700;
}

.clp-result-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(248, 249, 244, 0.92);
  border: 1px solid rgba(74, 112, 65, 0.08);
}

.clp-result-side-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.clp-result-replay {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(247, 248, 243, 0.96);
  border: 1px solid var(--clp-border);
  font-size: 13px;
  color: var(--clp-text-soft);
}

.clp-result-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  font-size: 15px;
  font-weight: 800;
  border: 1px solid var(--clp-border);
}

.clp-result-score.is-excellent {
  color: #16a34a;
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.clp-result-score.is-good {
  color: var(--clp-accent);
  background: #f2f7eb;
  border-color: rgba(107, 127, 61, 0.2);
}

.clp-result-score.is-fair {
  color: var(--clp-accent-warm);
  background: #fbf3e7;
  border-color: rgba(138, 90, 38, 0.18);
}

.clp-result-score.is-low {
  color: #dc2626;
  background: #fef2f2;
  border-color: #fecaca;
}

.clp-result-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.clp-result-row {
  display: block;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(248, 249, 244, 0.92);
  border: 0px solid rgba(74, 112, 65, 0.08);
  font-size: 15px;
  line-height: 1.65;
  color: var(--clp-text-soft);
}

.clp-result-row strong {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #443f38;
}

.clp-result-row > span {
  display: inline;
}

.clp-summary-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

.clp-summary-actions .clp-btn {
  min-width: 180px;
}


@media (max-width: 900px) {
  .clp-summary-header {
    min-height: 104px;
  }

  .clp-summary-header-visual {
    right: 0;
    bottom: -18px;
  }

  .clp-summary-header-copy {
    max-width: calc(100% - 220px);
  }

  .clp-summary-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .clp-summary-header {
    min-height: 0;
    margin-bottom: 18px;
  }

  .clp-summary-header-visual {
    position: static;
    pointer-events: none;
    margin-top: 12px;
    text-align: center;
  }

  .clp-summary-header-copy {
    max-width: none;
  }

  .clp-summary-title {
    font-size: 24px;
  }

  .clp-summary-stats {
    grid-template-columns: 1fr;
  }

  .clp-result-layout {
    grid-template-columns: 1fr;
  }

  .clp-result-row {
    min-height: 0;
  }

  .clp-summary-actions {
    flex-direction: column;
  }

  .clp-summary-actions .clp-btn {
    width: 100%;
  }
}

.clp-diff-word{
  display:inline-block;
  margin:2px 4px 2px 0;
  line-height:1.6;
  font-weight:500;
}

/* đúng */
.clp-diff-word.is-correct{
  color:#16a34a;
}

/* gần đúng */
.clp-diff-word.is-near{
  color: #ff8a0b;
}

/* thừa */
.clp-diff-word.is-extra{
	text-underline-offset: 4px;
	text-decoration: underline;
  color:#ef4444;
}

.clp-diff-word.is-missing {
  text-underline-offset: 4px;
  color: var(--clp-text-muted);
  text-decoration: underline dotted;
  opacity: 0.85;
}


/* empty */
.clp-diff-empty{
  color: var(--clp-text-muted);
  font-style: italic;
}

.clp-diff-legend{
  display:flex;
  gap:18px;
  font-size:14px;
  margin-bottom:14px;
  flex-wrap:wrap;
}

.clp-diff-legend span{
  font-weight:500;
}

.clp-summary-focus-note {
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--clp-text-soft);
}

.clp-summary-focus.is-positive {
  background: linear-gradient(135deg, #f3f9ef 0%, #edf5e7 100%);
  border: 1px solid var(--clp-success-border);
  box-shadow: 0 10px 22px rgba(74, 112, 65, 0.06);
}

.clp-summary-focus.is-positive .clp-summary-focus-note {
  color: var(--clp-text);
}

.clp-summary-focus.is-positive .clp-summary-focus-kicker {
  color: var(--clp-accent);
  border-color: rgba(74, 112, 65, 0.14);
}
