#mode-hiw {
  --hiw-paper: #f4f7fc;
  --hiw-ink: #1e293b;
  --hiw-muted: #64748b;
  --hiw-border: rgba(37, 99, 235, 0.15);
  --hiw-accent: #2563eb;
  --hiw-accent-hover: #1d4ed8;
  --hiw-accent-soft: rgba(37, 99, 235, 0.08);
  --hiw-success: #16a34a;
  --hiw-success-bg: rgba(22, 163, 74, 0.06);
  --hiw-success-border: rgba(22, 163, 74, 0.4);
  --hiw-danger: #dc2626;
  --hiw-danger-bg: rgba(220, 38, 38, 0.06);
  --hiw-danger-border: rgba(220, 38, 38, 0.4);
  
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.1), transparent 35%),
    radial-gradient(circle at left bottom, rgba(59, 130, 246, 0.08), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  padding: 8px 2px 18px;
}

.hiw-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

.hiw-split-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-bottom: 20px;
  align-items: stretch;
}

.hiw-audio-card,
.hiw-text-card,
.hiw-explanation-card {
  border: none;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
}

.hiw-card-header {
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(37, 99, 235, 0.08);
  padding-bottom: 12px;
}

.hiw-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--hiw-accent);
  font-weight: 700;
}

/* Premium Audio Player Island */
.hiw-audio-player-card {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(37, 99, 235, 0.1);
  border-radius: 24px;
  padding: 30px;
  box-shadow: 0 10px 30px -10px rgba(37, 99, 235, 0.06);
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: stretch;
  margin-top: 8px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.hiw-audio-player-card:hover {
  border-color: rgba(37, 99, 235, 0.18);
  box-shadow: 0 12px 36px -8px rgba(37, 99, 235, 0.1);
}

/* Visualizer Bars */
.hiw-visualizer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  height: 48px;
  margin: 10px 0;
}

.hiw-vis-bar {
  width: 4px;
  height: 8px;
  background-color: var(--hiw-accent);
  border-radius: 2px;
  opacity: 0.3;
  transition: height 0.15s ease, opacity 0.15s ease;
}

.hiw-visualizer.is-playing .hiw-vis-bar {
  opacity: 0.85;
  animation: hiw-bounce 1s ease-in-out infinite alternate;
}

.hiw-vis-bar:nth-child(1) { animation-delay: 0.1s; }
.hiw-vis-bar:nth-child(2) { animation-delay: 0.3s; }
.hiw-vis-bar:nth-child(3) { animation-delay: 0.5s; }
.hiw-vis-bar:nth-child(4) { animation-delay: 0.2s; }
.hiw-vis-bar:nth-child(5) { animation-delay: 0.4s; }
.hiw-vis-bar:nth-child(6) { animation-delay: 0.6s; }
.hiw-vis-bar:nth-child(7) { animation-delay: 0.15s; }

@keyframes hiw-bounce {
  0% { height: 8px; }
  100% { height: 36px; }
}

/* Audio Controls */
.hiw-audio-controls-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Play Button */
.hiw-play-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--hiw-accent) 0%, #1d4ed8 100%);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.35);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.hiw-play-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
}

.hiw-play-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

.hiw-play-btn:active {
  transform: scale(0.96);
}

.hiw-play-btn svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* Progress Area */
.hiw-progress-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
}

.hiw-timeline-wrapper {
  position: relative;
  height: 16px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.hiw-timeline {
  width: 100%;
  height: 6px;
  background: rgba(37, 99, 235, 0.1);
  border-radius: 3px;
  position: relative;
  overflow: visible;
}

.hiw-timeline-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--hiw-accent) 0%, #3b82f6 100%);
  border-radius: 3px;
  pointer-events: none;
}

.hiw-timeline-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 12px;
  height: 12px;
  background: #ffffff;
  border: 2px solid var(--hiw-accent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  transition: transform 0.1s ease;
}

.hiw-timeline-wrapper:hover .hiw-timeline-thumb {
  transform: translate(-50%, -50%) scale(1.3);
}

.hiw-time-display {
  display: flex;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--hiw-muted);
  font-weight: 500;
}

/* Selector settings */
.hiw-settings-row {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: center;
  border-top: 1px solid rgba(37, 99, 235, 0.08);
  padding-top: 18px;
}

.hiw-setting-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
  min-width: 140px;
}

.hiw-setting-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--hiw-muted);
  font-weight: 700;
}

/* Voice Dropdown Picker */
.hiw-voice-select-wrapper {
  position: relative;
  width: 100%;
}

.hiw-voice-select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  padding: 10px 16px;
  padding-right: 40px;
  border-radius: 12px;
  border: 1px solid rgba(37, 99, 235, 0.15);
  background-color: #ffffff;
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  color: var(--hiw-ink);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hiw-voice-select:hover {
  border-color: var(--hiw-accent);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.06);
}

.hiw-voice-select:focus {
  outline: none;
  border-color: var(--hiw-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.hiw-voice-select-wrapper::after {
  content: "\25BE";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.65rem;
  color: var(--hiw-muted);
  pointer-events: none;
}

/* Speed Button Group */
.hiw-speed-group {
  display: flex;
  background: rgba(37, 99, 235, 0.05);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid rgba(37, 99, 235, 0.05);
  align-self: flex-start;
}

.hiw-speed-btn {
  border: none;
  background: transparent;
  color: var(--hiw-muted);
  padding: 6px 12px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.hiw-speed-btn:hover {
  color: var(--hiw-accent);
}

.hiw-speed-btn.is-active {
  background: #ffffff;
  color: var(--hiw-accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

/* Volume Control */
.hiw-volume-container {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(37, 99, 235, 0.04);
  padding: 6px 14px;
  border-radius: 12px;
  border: 1px solid rgba(37, 99, 235, 0.06);
  height: 38px;
  box-sizing: border-box;
}

.hiw-volume-icon {
  font-size: 1.1rem;
  cursor: pointer;
  user-select: none;
  transition: transform 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hiw-volume-icon:hover {
  transform: scale(1.15);
}

.hiw-volume-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  border-radius: 3px;
  background: rgba(37, 99, 235, 0.12);
  outline: none;
  width: 90px;
  cursor: pointer;
  transition: background 0.15s ease;
  padding: 0;
  margin: 0;
}

.hiw-volume-slider:hover {
  background: rgba(37, 99, 235, 0.2);
}

.hiw-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--hiw-accent);
  border: 2px solid #ffffff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.hiw-volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

.hiw-volume-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--hiw-muted);
  font-weight: 600;
  min-width: 38px;
  text-align: right;
}

/* Passage & Interactive Words */
.hiw-passage-container {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.25rem;
  line-height: 2.1;
  color: var(--hiw-ink);
  background: #ffffff;
  border: 1px solid rgba(37, 99, 235, 0.08);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.01);
  margin-top: 8px;
}

.hiw-word {
  display: inline-block;
  cursor: pointer;
  border-radius: 4px;
  padding: 0 3px;
  margin: 0 1px;
  transition: all 0.15s ease;
  background-color: transparent;
  user-select: none;
}

.hiw-word:hover {
  background-color: rgba(37, 99, 235, 0.08);
  color: var(--hiw-accent);
}

/* Interactive Click Yellow Highlight */
.hiw-word.is-selected {
  background-color: #fef08a; /* Yellow 200 */
  border-bottom: 2px solid #eab308; /* Yellow 500 */
  color: #854d0e; /* Yellow 800 */
}

/* Post-submission correction states */
.hiw-word.is-correct-click {
  background-color: #dcfce7 !important; /* Green 100 */
  border: 1px solid #16a34a !important; /* Green 600 */
  border-bottom-width: 2px !important;
  color: #14532d !important; /* Green 900 */
  pointer-events: none;
}

.hiw-word.is-incorrect-click {
  background-color: #fee2e2 !important; /* Red 100 */
  border: 1px solid #dc2626 !important; /* Red 600 */
  border-bottom-width: 2px !important;
  color: #7f1d1d !important; /* Red 900 */
  pointer-events: none;
}

.hiw-word.is-missed {
  background-color: #ffedd5 !important; /* Orange 100 */
  border: 1px dashed #ea580c !important; /* Orange 600 */
  border-bottom-width: 2px !important;
  color: #7c2d12 !important; /* Orange 900 */
  pointer-events: none;
}

.hiw-word.is-disabled {
  pointer-events: none;
  opacity: 0.85;
}

/* Actions footer */
.hiw-footer-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 10px;
}

.hiw-buttons-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Result banner */
.hiw-result-box {
  padding: 16px 20px;
  border-radius: 18px;
  border: 1px solid var(--hiw-border);
  background: rgba(255, 255, 255, 0.88);
  display: flex;
  flex-direction: column;
  margin-top: 8px;
}

.hiw-result-header {
  font-weight: 800;
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.hiw-result-header.has-score {
  color: var(--hiw-accent);
}

.hiw-result-desc {
  font-size: 0.92rem;
  color: var(--hiw-muted);
}

/* Explanation Panel */
.hiw-explanation-panel {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.hiw-explanation-card {
  padding: 24px;
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.02);
}

.hiw-explanation-header {
  font-weight: 700;
  color: var(--hiw-accent);
  font-size: 0.96rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  border-bottom: 1px dashed rgba(37, 99, 235, 0.2);
  padding-bottom: 6px;
}

.hiw-explanation-content {
  font-size: 0.96rem;
  color: var(--hiw-ink);
  line-height: 1.65;
}

.hiw-explanation-content p {
  margin: 0 0 12px 0;
}

.hiw-explanation-content strong {
  color: var(--hiw-accent);
}

/* Responsive design */
@media (max-width: 900px) {
  .hiw-split-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .hiw-audio-player-card {
    padding: 20px;
  }
}

@media (max-width: 640px) {
  #mode-hiw {
    padding-inline: 0;
  }
  
  .hiw-audio-card,
  .hiw-text-card,
  .hiw-explanation-card {
    padding: 12px 0;
  }
  
  .hiw-result-box {
    border-radius: 16px;
    padding: 16px;
  }
  
  .hiw-settings-row {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
}
