/* Speed Reader App - Styles */

:root {
  --bg: #FDFBF7;
  --bg-alt: #F7F4EE;
  --bg-elevated: #FFFFFF;
  --text: #1A1814;
  --text-secondary: #4A4640;
  --text-muted: #8A8580;
  --accent: #2D5A4A;
  --accent-hover: #234839;
  --border: rgba(0,0,0,0.06);
  --border-strong: rgba(0,0,0,0.1);
  
  --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'Instrument Serif', Georgia, serif;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.08);
  
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  --bg: #111110;
  --bg-alt: #191918;
  --bg-elevated: #222221;
  --text: #EDEDEC;
  --text-secondary: #A1A1A0;
  --text-muted: #6B6B6A;
  --accent: #6DB89A;
  --accent-hover: #5CA889;
  --border: rgba(255,255,255,0.06);
  --border-strong: rgba(255,255,255,0.1);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.4);
}

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

/* Force pointer cursor on all clickable elements */
a, 
a:link,
a:visited,
a:hover,
a:active,
button,
[role="button"],
[onclick],
input[type="submit"],
input[type="button"],
input[type="reset"],
input[type="checkbox"],
input[type="radio"],
input[type="range"],
select,
label[for],
summary,
.btn,
.header-btn,
.user-avatar,
.nav-link,
.dropdown-item,
.clickable {
  cursor: pointer !important;
}

html, body {
  height: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* App Container */
.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  height: 56px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo svg {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.logo-text {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.15s;
  text-decoration: none;
}

.header-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.header-btn svg {
  width: 18px;
  height: 18px;
}

[data-theme="light"] .header-btn .sun { display: none; }
[data-theme="dark"] .header-btn .moon { display: none; }

/* User Menu */
.user-menu {
  position: relative;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: white;
  transition: transform 0.2s;
}

.user-avatar:hover {
  transform: scale(1.05);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 160px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px;
  display: none;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
}

.user-dropdown.show {
  display: block;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}

.dropdown-item:hover {
  background: var(--bg-alt);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

/* Main */
.main {
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* Views */
.view {
  height: 100%;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.view.hidden {
  display: none;
}

/* Home View */
.view--home {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 0;
  height: 100%;
  min-height: 0;
}

/* Panels */
.panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.panel--input {
  border-right: 1px solid var(--border);
}

.panel--controls {
  padding: 24px;
  background: var(--bg-alt);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel--controls-content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.panel-header {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.mode-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
}

.mode-tab {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.mode-tab:hover {
  color: var(--text);
}

.mode-tab.active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.panel-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.input-area {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.input-area.hidden {
  display: none;
}

/* Custom scrollbar for scrollable areas */
.input-area::-webkit-scrollbar,
.panel--controls-content::-webkit-scrollbar {
  width: 6px;
}

.input-area::-webkit-scrollbar-track,
.panel--controls-content::-webkit-scrollbar-track {
  background: transparent;
}

.input-area::-webkit-scrollbar-thumb,
.panel--controls-content::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

.input-area::-webkit-scrollbar-thumb:hover,
.panel--controls-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.text-input {
  width: 100%;
  height: 100%;
  flex: 1;
  min-height: 0;
  padding: 24px;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: transparent;
  border: none;
  resize: none;
  outline: none;
}

.text-input::placeholder {
  color: var(--text-muted);
}

/* Story Categories */
.story-categories {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
}

.story-category {
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  border: 1px solid var(--border);
}

.story-category-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  font-family: inherit;
  text-align: left;
  transition: border-color 0.2s ease;
}

.story-category-header:hover {
  border-left-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

.story-category.open .story-category-header {
  border-left-color: var(--accent);
}

.story-category-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.story-category-title span {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.story-category-title small {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.story-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              color 0.2s ease;
  flex-shrink: 0;
}

.story-category-header:hover .story-chevron {
  color: var(--text-secondary);
}

.story-category.open .story-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

.story-list {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg-alt);
}

.story-list-inner {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 14px 16px;
}

.story-card {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s ease,
              box-shadow 0.15s ease;
}

.story-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.story-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

.story-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
  line-height: 1.3;
}

.story-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.story-meta {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-alt);
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}

.panel-footer {
  padding: 16px 24px;
  display: flex;
  gap: 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
  z-index: 10;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
}

.stat-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Control Cards */
.control-card {
  padding: 14px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
}

.control-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.control-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.speed-badge {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.speed-num {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.speed-unit {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Sliders */
.speed-slider,
.mini-slider,
.live-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--border-strong);
  border-radius: 3px;
  cursor: pointer;
}

.speed-slider::-webkit-slider-thumb,
.mini-slider::-webkit-slider-thumb,
.live-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 50%;
  cursor: grab;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 30%, transparent);
  border: 3px solid var(--bg-elevated);
}

.speed-slider::-webkit-slider-thumb:hover,
.mini-slider::-webkit-slider-thumb:hover,
.live-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 40%, transparent);
}

.speed-slider::-webkit-slider-thumb:active,
.mini-slider::-webkit-slider-thumb:active,
.live-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.1);
}

.speed-hints {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Training Toggle */
.training-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.training-toggle input {
  display: none;
}

.training-switch {
  width: 44px;
  height: 24px;
  background: var(--border-strong);
  border-radius: 12px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.training-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s var(--ease-out);
  box-shadow: var(--shadow-sm);
}

.training-toggle input:checked + .training-switch {
  background: var(--accent);
}

.training-toggle input:checked + .training-switch::after {
  transform: translateX(20px);
}

.training-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.training-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.training-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.training-config {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.training-config.hidden {
  display: none;
}

.training-range {
  display: flex;
  align-items: center;
  gap: 12px;
}

.range-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.range-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.range-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
}

.range-arrow {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Start Button */
.btn-start {
  width: 100%;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  color: white;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  box-shadow: var(--shadow-md);
}

.btn-start:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-start:active {
  transform: translateY(0);
}

.btn-start svg {
  width: 18px;
  height: 18px;
}

.shortcut-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

.shortcut-hint kbd {
  padding: 3px 6px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
}

/* Settings Info Box */
.settings-info {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.settings-info-icon {
  flex-shrink: 0;
  color: var(--accent);
  margin-top: 1px;
}

.settings-info-text {
  flex: 1;
}

.settings-info-text strong {
  color: var(--text-primary);
  font-weight: 600;
}

.settings-info-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.settings-info-link:hover {
  text-decoration: underline;
}

/* Extension Banner */
.extension-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-top: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all 0.2s;
  flex-shrink: 0;
}

.extension-banner:hover {
  border-color: var(--accent);
}

.extension-icon {
  width: 36px;
  height: 36px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.extension-icon svg {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.extension-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.extension-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.extension-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.extension-arrow {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

/* Reading View */
.view--read {
  flex-direction: column;
  background: var(--bg);
}

.read-top {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

.read-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
  margin-bottom: 12px;
}

.read-stat {
  text-align: center;
}

.read-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.read-stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.read-progress {
  height: 3px;
  background: var(--border-strong);
  border-radius: 2px;
  overflow: hidden;
}

.read-progress-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.1s linear;
}

.read-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.word-display {
  position: relative;
  padding: 48px 24px;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

/* Focal Line - always centered, ORP aligns with this */
.focus-line {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  width: 1px;
  height: 80px;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    var(--accent) 30%,
    var(--accent) 70%,
    transparent 100%
  );
  opacity: 0.3;
  z-index: 1;
}

.word-container {
  font-size: clamp(48px, 8vw, 72px);
  font-weight: 500;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  font-family: var(--font-sans);
  width: 100%;
}

/* ORP stays fixed in center - word flows around it */
.word-before {
  flex: 1;
  text-align: right;
  overflow: hidden;
  white-space: nowrap;
}

.word-focus {
  color: var(--accent);
  font-weight: 600;
  flex-shrink: 0;
}

.word-after {
  flex: 1;
  text-align: left;
  overflow: hidden;
  white-space: nowrap;
}

.read-bottom {
  padding: 32px 24px;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
}

/* Speed Control Row */
.read-speed-control {
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 480px;
  padding: 16px 20px;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.training-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--accent);
  border-radius: var(--radius-md);
  font-size: 11px;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.training-indicator.hidden {
  display: none;
}

.training-indicator svg {
  width: 12px;
  height: 12px;
}

.read-speed-control .live-slider {
  flex: 1;
}

.speed-adjust {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.speed-adjust.hidden {
  display: none;
}

.speed-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.speed-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.speed-btn:active {
  transform: scale(0.95);
}

.speed-btn svg {
  width: 14px;
  height: 14px;
}

.live-speed-badge {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  min-width: 70px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.live-speed-badge span {
  color: var(--accent);
}

/* Training Range Display */
.training-range-display {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.training-range-display.hidden {
  display: none;
}

.training-current {
  color: var(--accent);
  font-weight: 700;
  font-size: 17px;
  min-width: 40px;
}

.training-range-label {
  color: var(--text);
  font-weight: 600;
  margin-right: 4px;
}

.training-range-info {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

.training-range-info span {
  color: var(--text-secondary);
}

/* Action Buttons Row */
.read-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.read-btn {
  height: 52px;
  padding: 0 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  font-size: 14px;
  font-weight: 600;
}

.read-btn:hover {
  border-color: var(--accent);
  background: var(--bg-elevated);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.read-btn:active {
  transform: translateY(0);
}

.read-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.read-btn .btn-label {
  font-size: 13px;
  font-weight: 700;
}

.read-btn--main {
  width: 72px;
  height: 72px;
  padding: 0;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  box-shadow: 0 4px 20px color-mix(in srgb, var(--accent) 40%, transparent);
}

.read-btn--main:hover {
  background: var(--accent-hover);
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 30px color-mix(in srgb, var(--accent) 50%, transparent);
}

.read-btn--main:active {
  transform: translateY(-1px) scale(0.98);
}

.read-btn--main svg {
  width: 28px;
  height: 28px;
  /* Offset play icon slightly right to appear visually centered */
  margin-left: 3px;
}

.read-btn--main.is-playing svg {
  margin-left: 0;
}

/* Focus Mode */
.view--read.focus-mode .read-top,
.view--read.focus-mode .read-bottom {
  filter: blur(8px);
  opacity: 0.3;
  pointer-events: none;
  transition: filter 0.4s var(--ease-out), opacity 0.4s var(--ease-out);
}

.view--read.focus-mode .read-center {
  position: relative;
}

/* Focus Mode vignette overlay */
.view--read.focus-mode .read-center::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 60% 50% at center,
    transparent 0%,
    rgba(0, 0, 0, 0.3) 100%
  );
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.4s var(--ease-out);
}

[data-theme="light"] .view--read.focus-mode .read-center::before {
  background: radial-gradient(
    ellipse 60% 50% at center,
    transparent 0%,
    rgba(255, 255, 255, 0.5) 100%
  );
}

/* When paused (mouse moved), remove blur */
.view--read.focus-mode.focus-paused .read-top,
.view--read.focus-mode.focus-paused .read-bottom {
  filter: none;
  opacity: 1;
  pointer-events: auto;
}

.view--read.focus-mode.focus-paused .read-center::before {
  opacity: 0;
}

/* Focus Button in read actions */
#focus-toggle-btn {
  position: relative;
}

#focus-toggle-btn svg {
  width: 20px;
  height: 20px;
}

#focus-toggle-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

#focus-toggle-btn.active:hover {
  background: var(--accent-hover);
}

/* Focus Mode indicator (legacy, now using status bar) */
.focus-mode-indicator {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: white;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 100;
  display: none; /* Hidden - using status bar instead */
}

[data-theme="light"] .focus-mode-indicator {
  background: rgba(0, 0, 0, 0.7);
}

.focus-mode-indicator.show {
  opacity: 1;
}

/* Compact Focus Toggle Row */
.focus-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
}

.focus-toggle-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.focus-toggle-info svg {
  color: var(--accent);
}

/* Compact Toggle Switch */
.compact-toggle {
  position: relative;
  cursor: pointer;
}

.compact-toggle input {
  display: none;
}

.compact-toggle-track {
  display: block;
  width: 44px;
  height: 24px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  position: relative;
  transition: all 0.2s ease;
}

.compact-toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all 0.2s ease;
}

.compact-toggle input:checked + .compact-toggle-track {
  background: var(--accent);
  border-color: var(--accent);
}

.compact-toggle input:checked + .compact-toggle-track::after {
  left: 22px;
  background: white;
}

/* Done View */
.view--done {
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.done-card {
  max-width: 380px;
  width: 100%;
  padding: 32px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.done-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 24px;
  padding: 16px;
  background: var(--bg-alt);
  border-radius: var(--radius-md);
}

.done-stat {
  text-align: center;
}

.done-stat-value {
  display: block;
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 400;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
}

.done-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Title Prompt Modal */
.modal-box--title-prompt {
  max-width: 360px;
  padding: 28px;
  text-align: center;
}

.title-prompt-header {
  margin-bottom: 20px;
}

.title-prompt-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px 0;
}

.title-prompt-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

.title-prompt-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 16px;
  color: var(--text);
  font-family: inherit;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
  margin-bottom: 20px;
}

.title-prompt-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(109, 184, 154, 0.15);
}

.title-prompt-input::placeholder {
  color: var(--text-muted);
}

.title-prompt-actions {
  display: flex;
  gap: 12px;
}

.title-prompt-btn {
  flex: 1;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  font-family: inherit;
}

.title-prompt-btn.secondary {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.title-prompt-btn.secondary:hover {
  background: var(--bg-elevated);
  color: var(--text);
}

.title-prompt-btn.primary {
  background: var(--accent);
  border: none;
  color: white;
}

.title-prompt-btn.primary:hover {
  background: var(--accent-hover);
}

/* Sign-up prompt in done view */
.done-signup-prompt {
  padding: 20px;
  background: var(--bg-alt);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.done-signup-text {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.done-signup-btn {
  width: 100%;
  justify-content: center;
  padding: 12px 20px;
  margin-bottom: 12px;
}

.done-signup-signin {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.done-signup-signin a {
  color: var(--accent);
  text-decoration: none;
}

.done-signup-signin a:hover {
  text-decoration: underline;
}

.done-actions {
  display: flex;
  gap: 12px;
}

.done-actions .btn-ghost {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.done-actions .btn-ghost:hover {
  border-color: var(--border-strong);
  background: var(--bg-alt);
}

.done-actions .btn-ghost svg {
  width: 18px;
  height: 18px;
}

.done-actions .btn-primary {
  flex: 1;
  padding: 14px 20px;
}

.btn-outline {
  flex: 1;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.btn-outline:hover {
  border-color: var(--border-strong);
  background: var(--bg-alt);
}

.btn-outline svg {
  width: 18px;
  height: 18px;
}

.btn-primary {
  flex: 1;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: white;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  text-decoration: none;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}

.modal-box {
  position: relative;
  max-width: 420px;
  width: 100%;
  padding: 32px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--bg-alt);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.modal-close:hover {
  color: var(--text);
  background: var(--border-strong);
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  background: var(--accent);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-icon svg {
  width: 28px;
  height: 28px;
  color: white;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
  margin-bottom: 24px;
}

.modal-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
}

.step span {
  width: 24px;
  height: 24px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.modal-btn {
  width: 100%;
  justify-content: center;
}

.modal-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.modal-shortcuts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.shortcut {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-muted);
}

.shortcut kbd {
  padding: 3px 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
.toast-container {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 420px;
  min-width: 280px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast.hide {
  opacity: 0;
  transform: translateY(-10px) scale(0.95);
}

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

.toast-icon svg {
  width: 24px;
  height: 24px;
}

/* Toast types */
.toast.info .toast-icon {
  color: var(--accent);
}

.toast.success .toast-icon {
  color: #81C784;
}

.toast.error .toast-icon {
  color: #E57373;
}

.toast.warning .toast-icon {
  color: #FFB74D;
}

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

.toast-message {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  margin: 0;
}

.toast-close {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  margin: -4px -8px -4px 0;
}

.toast-close:hover {
  background: var(--bg-alt);
  color: var(--text);
}

.toast-close svg {
  width: 16px;
  height: 16px;
}

/* Success icon */
.toast.success .toast-icon svg {
  display: none;
}

.toast.success .toast-icon::after {
  content: '';
  width: 24px;
  height: 24px;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='%2381C784' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M22 11.08V12a10 10 0 1 1-5.93-9.14'/%3E%3Cpolyline points='22 4 12 14.01 9 11.01'/%3E%3C/svg%3E");
  background-size: contain;
}

/* Error icon */
.toast.error .toast-icon svg {
  display: none;
}

.toast.error .toast-icon::after {
  content: '';
  width: 24px;
  height: 24px;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='%23E57373' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='15' y1='9' x2='9' y2='15'/%3E%3Cline x1='9' y1='9' x2='15' y2='15'/%3E%3C/svg%3E");
  background-size: contain;
}

/* Warning icon */
.toast.warning .toast-icon svg {
  display: none;
}

.toast.warning .toast-icon::after {
  content: '';
  width: 24px;
  height: 24px;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='%23FFB74D' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'/%3E%3Cline x1='12' y1='9' x2='12' y2='13'/%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'/%3E%3C/svg%3E");
  background-size: contain;
}

@media (max-width: 480px) {
  .toast-container {
    top: 16px;
    left: 16px;
    right: 16px;
    transform: none;
  }
  
  .toast {
    min-width: 0;
    width: 100%;
  }
}

/* Confirm Modal */
.modal-box--confirm {
  text-align: center;
  max-width: 360px;
}

.confirm-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirm-icon svg {
  width: 28px;
  height: 28px;
  color: var(--accent);
}

.modal-box--confirm .modal-title {
  margin-bottom: 8px;
}

.modal-box--confirm .modal-desc {
  margin-bottom: 24px;
}

#remaining-words {
  font-weight: 700;
  color: var(--accent);
}

.confirm-actions {
  display: flex;
  gap: 12px;
}

.confirm-actions .btn-outline,
.confirm-actions .btn-primary {
  flex: 1;
  justify-content: center;
}

/* Reading Complete Modal */
.modal-box--complete {
  max-width: 480px;
  padding: 28px;
}

.complete-header {
  text-align: center;
  margin-bottom: 24px;
}

.complete-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--accent) 0%, #4A9B7F 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(109, 184, 154, 0.3);
}

.complete-icon svg {
  width: 32px;
  height: 32px;
  color: white;
}

.complete-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 24px;
  padding: 16px;
  background: var(--bg-alt);
  border-radius: var(--radius-md);
}

.complete-stat {
  text-align: center;
}

.complete-stat-value {
  display: block;
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 400;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
}

.complete-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.complete-title-section {
  margin-bottom: 20px;
}

.complete-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.complete-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.complete-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(109, 184, 154, 0.15);
}

.complete-input::placeholder {
  color: var(--text-muted);
}

.complete-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.complete-action-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.complete-action-btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

.complete-action-btn.selected {
  border-color: var(--accent);
  background: rgba(109, 184, 154, 0.1);
}

.complete-action-btn.loading {
  opacity: 0.7;
  pointer-events: none;
}

.complete-action-icon {
  width: 44px;
  height: 44px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.complete-action-icon svg {
  width: 22px;
  height: 22px;
  color: var(--text-muted);
}

.complete-action-btn:hover .complete-action-icon svg,
.complete-action-btn.selected .complete-action-icon svg {
  color: var(--accent);
}

.complete-action-icon.share {
  background: linear-gradient(135deg, rgba(100, 181, 246, 0.15) 0%, rgba(66, 165, 245, 0.15) 100%);
}

.complete-action-icon.share svg {
  color: #64B5F6;
}

.complete-action-icon.summarize {
  background: linear-gradient(135deg, rgba(186, 104, 200, 0.15) 0%, rgba(171, 71, 188, 0.15) 100%);
}

.complete-action-icon.summarize svg {
  color: #BA68C8;
}

.complete-action-text {
  flex: 1;
}

.complete-action-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.complete-action-desc {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

.complete-summary {
  margin-bottom: 20px;
}

.complete-summary.hidden {
  display: none;
}

.complete-summary-text {
  padding: 16px;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  max-height: 150px;
  overflow-y: auto;
}

.complete-caption {
  margin-bottom: 20px;
}

.complete-caption.hidden {
  display: none;
}

.complete-textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.complete-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(109, 184, 154, 0.15);
}

.complete-textarea::placeholder {
  color: var(--text-muted);
}

/* Guest (non-authenticated) view */
.complete-guest {
  text-align: center;
  padding: 8px 0 0;
}

.complete-guest.hidden {
  display: none;
}

.complete-guest-message {
  margin-bottom: 24px;
}

.complete-guest-message p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.5;
}

.complete-guest-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.complete-signin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 24px;
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
}

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 14px;
  padding: 12px 20px;
  cursor: pointer;
  transition: color 0.2s;
}

.btn-ghost:hover {
  color: var(--text-secondary);
}

/* Authenticated view */
.complete-auth {
  /* inherits default display */
}

.complete-auth.hidden {
  display: none;
}

.complete-footer {
  display: flex;
  gap: 12px;
}

.complete-footer .btn-ghost {
  flex: 1;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
}

.complete-footer .btn-ghost:hover {
  background: var(--bg-elevated);
}

.complete-footer .btn-outline,
.complete-footer .btn-primary {
  flex: 1;
  justify-content: center;
  padding: 12px 20px;
}

.complete-footer .btn-primary.hidden {
  display: none;
}

/* Complete Modal Responsive */
@media (max-width: 520px) {
  .modal-box--complete {
    padding: 20px;
  }
  
  .complete-stats {
    gap: 16px;
    padding: 12px;
  }
  
  .complete-stat-value {
    font-size: 22px;
  }
  
  .complete-action-btn {
    padding: 12px;
    gap: 10px;
  }
  
  .complete-action-icon {
    width: 36px;
    height: 36px;
  }
  
  .complete-action-icon svg {
    width: 18px;
    height: 18px;
  }
}

/* Summary Section */
.summary-section {
  margin-top: 24px;
  padding: 20px;
  background: var(--bg-alt);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.summary-section.hidden {
  display: none;
}

.summary-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 12px;
}

.summary-content {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre-wrap;
}

.summary-public {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}

.summary-public input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

#summarize-btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

#summarize-btn.loading #summarize-btn-text::after {
  content: '...';
  animation: dots 1s infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PREMIUM MICRO-INTERACTIONS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Smooth hover lift effect for interactive cards */
.story-card,
.complete-action-btn,
.mode-tab,
.header-btn {
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), 
              box-shadow 0.2s ease,
              background 0.15s ease,
              border-color 0.15s ease;
}

.story-card:hover,
.complete-action-btn:hover {
  transform: translateY(-2px);
}

.story-card:active,
.complete-action-btn:active {
  transform: translateY(0) scale(0.98);
}

/* Button press effect */
.btn-primary,
.btn-outline,
.btn-start {
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.15s ease,
              background 0.15s ease;
}

.btn-primary:active,
.btn-outline:active,
.btn-start:active {
  transform: scale(0.97);
}

/* Glow effect on focus for inputs */
.text-input:focus,
.complete-input:focus,
.complete-textarea:focus {
  box-shadow: 0 0 0 3px rgba(109, 184, 154, 0.2),
              0 0 20px rgba(109, 184, 154, 0.1);
}

/* Smooth modal backdrop */
.modal-backdrop {
  transition: opacity 0.3s ease;
}

.modal.hidden .modal-backdrop {
  opacity: 0;
}

/* Modal content entrance */
.modal-box {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.3s ease;
}

.modal.hidden .modal-box {
  transform: scale(0.95) translateY(10px);
  opacity: 0;
}

/* Pulse animation for active elements */
@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(109, 184, 154, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(109, 184, 154, 0);
  }
}

.complete-action-btn.selected {
  animation: pulse-glow 2s ease-in-out infinite;
}

/* Reading word animation */
.word-container {
  transition: opacity 0.1s ease;
}

/* Progress bar smooth animation */
.progress-fill {
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Stat value counter animation */
@keyframes count-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.complete-stat-value,
.stat-value {
  animation: count-up 0.4s ease-out both;
}

.complete-stats .complete-stat:nth-child(1) .complete-stat-value { animation-delay: 0.1s; }
.complete-stats .complete-stat:nth-child(2) .complete-stat-value { animation-delay: 0.2s; }
.complete-stats .complete-stat:nth-child(3) .complete-stat-value { animation-delay: 0.3s; }
.complete-stats .complete-stat:nth-child(4) .complete-stat-value { animation-delay: 0.4s; }

/* Success checkmark animation */
@keyframes checkmark-draw {
  0% {
    stroke-dashoffset: 50;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

.complete-icon svg {
  stroke-dasharray: 50;
  animation: checkmark-draw 0.5s ease-out 0.2s both;
}

/* Shimmer loading effect */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.loading-shimmer {
  background: linear-gradient(
    90deg,
    var(--bg-alt) 0%,
    var(--bg-elevated) 50%,
    var(--bg-alt) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* Floating label effect for inputs */
.input-wrapper {
  position: relative;
}

.input-wrapper .floating-label {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  transition: all 0.2s ease;
  font-size: 14px;
}

.input-wrapper input:focus + .floating-label,
.input-wrapper input:not(:placeholder-shown) + .floating-label {
  top: 0;
  font-size: 11px;
  background: var(--bg);
  padding: 0 4px;
  color: var(--accent);
}

/* Ripple effect for buttons */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.3s ease, height 0.3s ease, opacity 0.3s ease;
  opacity: 0;
}

.ripple:active::after {
  width: 200%;
  height: 200%;
  opacity: 1;
  transition: 0s;
}

/* Smooth scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Selection highlight */
::selection {
  background: var(--accent);
  color: white;
}

/* Focus visible for accessibility */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

/* Responsive */
@media (max-width: 900px) {
  .view--home {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  
  .panel--input {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 50vh;
  }
  
  .panel--controls {
    padding: 16px;
    max-height: 50vh;
  }
  
  .panel--controls-content {
    overflow-y: auto;
  }
  
  .story-list-inner {
    grid-template-columns: 1fr;
  }
  
  .word-container {
    font-size: 36px;
  }
  
  .extension-banner {
    margin-top: 12px;
  }
}

