/* Legacy Color Palette */
:root {
  --legacy-bg: #0f172a;
  --legacy-card: #1e293b;
  --legacy-card-hover: #334155;
  --legacy-border: #334155;
  --legacy-text: #f1f5f9;
  --legacy-muted: #94a3b8;
  --legacy-green: #10b981;
  --legacy-green-bg: #065f46;
  --legacy-blue: #3b82f6;
  --legacy-purple: #8b5cf6;
  --legacy-orange: #f59e0b;
  --quiz-locked: #475569;
}

/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--legacy-bg) !important;
  color: var(--legacy-text) !important;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

/* Desktop Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Mobile Container */
@media (max-width: 767px) {
  .container {
    max-width: 428px;
    padding: 0;
  }
}

/* Header with Reading Info and Score */
.header-banner {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  padding: 20px;
  margin-bottom: 24px;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.reading-timer {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.1);
  padding: 12px 20px;
  border-radius: 12px;
  backdrop-filter: blur(10px);
}

.timer-icon {
  width: 24px;
  height: 24px;
}

.timer-display {
  font-size: 24px;
  font-weight: 600;
  color: var(--legacy-text);
  font-variant-numeric: tabular-nums;
}

.reading-info {
  display: flex;
  flex-direction: column;
}

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

.estimated-time {
  font-size: 18px;
  font-weight: 600;
  color: var(--legacy-text);
}

.header-right {
  display: flex;
  gap: 16px;
}

.success-badge,
.score-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
}

.score-badge {
  background: rgba(59, 130, 246, 0.2);
  color: var(--legacy-blue);
}

/* Main Layout Grid */
.main-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 100px 20px;
}

@media (min-width: 1024px) {
  .main-grid {
    grid-template-columns: 2fr 1fr;
  }
}

/* Article Card */
.article-card {
  background: var(--legacy-card);
  border: 1px solid var(--legacy-border);
  border-radius: 16px;
  overflow: hidden;
}

.article-hero {
  width: 100%;
  height: 300px;
  object-fit: cover;
}

.article-content {
  padding: 32px;
}

.article-title {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 16px;
  line-height: 1.2;
}

.article-text {
  font-size: 18px;
  line-height: 1.7;
  color: var(--legacy-muted);
}

/* Quiz Section with Compact Lock */
.quiz-section {
  background: var(--legacy-card);
  border: 1px solid var(--legacy-border);
  border-radius: 16px;
  padding: 24px;
  position: relative;
}

.quiz-locked {
  filter: blur(2px);
  opacity: 0.7;
  pointer-events: none;
}

.quiz-content {
  transition:
    filter 0.3s ease,
    opacity 0.3s ease;
}

/* Compact Lock Overlay */
.quiz-lock-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--legacy-card);
  border: 2px solid var(--legacy-border);
  border-radius: 16px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
  min-width: 300px;
}

.lock-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  color: var(--legacy-muted);
}

.lock-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--legacy-text);
  margin-bottom: 8px;
  text-align: center;
}

.lock-subtitle {
  font-size: 14px;
  color: var(--legacy-muted);
  text-align: center;
}

/* Quiz Content */
.quiz-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.quiz-title {
  font-size: 20px;
  font-weight: 600;
}

.quiz-question {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.question-text {
  font-size: 16px;
  margin-bottom: 16px;
  color: var(--legacy-text);
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quiz-option {
  background: var(--legacy-bg);
  border: 2px solid var(--legacy-border);
  border-radius: 8px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
}

.quiz-option:hover {
  border-color: var(--legacy-blue);
  background: rgba(59, 130, 246, 0.05);
}

.quiz-option.selected {
  border-color: var(--legacy-green);
  background: rgba(16, 185, 129, 0.1);
}

.option-radio {
  width: 20px;
  height: 20px;
  border: 2px solid var(--legacy-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.option-radio.selected {
  border-color: var(--legacy-green);
  background: var(--legacy-green);
}

.option-radio.selected::after {
  content: "";
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
}

.quiz-submit {
  background: var(--legacy-blue);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 16px 32px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  margin-top: 20px;
  transition: all 0.2s;
}

.quiz-submit:hover {
  background: #2563eb;
  transform: translateY(-2px);
}

.quiz-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Quiz Result Display */
.quiz-result {
  background: var(--legacy-card);
  border: 1px solid var(--legacy-border);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
}

.result-score {
  font-size: 48px;
  font-weight: 700;
  color: var(--legacy-green);
  margin-bottom: 8px;
}

.result-text {
  font-size: 18px;
  color: var(--legacy-text);
  margin-bottom: 20px;
}

/* ===================================== */
/* Aurora Night Quiz Styles (FT-103)    */
/* ===================================== */

.an-quiz-options {
  display: flex;
  flex-direction: column;
  gap: var(--an-space-3);
}

.an-quiz-option {
  background: var(--an-surface-elevated);
  border: 2px solid var(--an-border-subtle);
  border-radius: var(--an-radius-md);
  padding: var(--an-space-4);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: var(--an-space-3);
  min-height: var(--an-touch-target);
}

.an-quiz-option:hover {
  border-color: var(--an-plasma-purple);
  background: rgba(122, 95, 255, 0.05);
}

.an-quiz-option.selected {
  border-color: var(--an-aurora-green);
  background: rgba(61, 240, 192, 0.1);
}

.an-option-radio {
  width: 20px;
  height: 20px;
  border: 2px solid var(--an-border-subtle);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.an-option-radio.selected {
  border-color: var(--an-aurora-green);
  background: var(--an-aurora-green);
}

.an-option-radio.selected::after {
  content: '';
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
}

/* ===================================== */
/* Aurora Night Rating Styles (FT-103)  */
/* ===================================== */

.an-rating-section {
  background: var(--an-surface-elevated);
  border: 1px solid var(--an-border-subtle);
  border-radius: var(--an-radius-lg);
  padding: var(--an-space-6);
  margin-top: var(--an-space-6);
  display: none;
}

.an-rating-section.show {
  display: block;
}

.an-rating-title {
  font-size: 20px;
  font-weight: 600;
  text-align: center;
  color: var(--an-text-primary);
  margin-bottom: var(--an-space-2);
}

.an-rating-subtitle {
  font-size: 14px;
  color: var(--an-text-secondary);
  text-align: center;
  margin-bottom: var(--an-space-6);
}

/* Horizontal Dice Container */
.an-dice-container {
  display: flex;
  justify-content: center;
  gap: var(--an-space-3);
  margin-bottom: var(--an-space-6);
  flex-wrap: wrap;
}

.an-dice {
  width: 48px;
  height: 48px;
  background: var(--an-surface-base);
  border: 2px solid var(--an-border-subtle);
  border-radius: var(--an-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.an-dice:hover {
  transform: scale(1.1);
  border-color: var(--an-plasma-purple);
  background: rgba(122, 95, 255, 0.1);
}

.an-dice.selected {
  background: var(--an-aurora-green);
  border-color: var(--an-aurora-green);
  box-shadow: 0 0 0 3px rgba(61, 240, 192, 0.2);
}

.an-dice-dots {
  position: absolute;
  width: 100%;
  height: 100%;
  padding: 8px;
}

.an-dice .dot {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--an-text-primary);
  border-radius: 50%;
}

.an-dice.selected .dot {
  background: var(--an-surface-base);
}

/* Dice dot patterns for 1-6 */
.an-dice-1 .dot:nth-child(1) {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
}

.an-dice-2 .dot:nth-child(1) {
  top: 25%;
  left: 25%;
}
.an-dice-2 .dot:nth-child(2) {
  bottom: 25%;
  right: 25%;
}

.an-dice-3 .dot:nth-child(1) {
  top: 20%;
  left: 20%;
}
.an-dice-3 .dot:nth-child(2) {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.an-dice-3 .dot:nth-child(3) {
  bottom: 20%;
  right: 20%;
}

.an-dice-4 .dot:nth-child(1) {
  top: 25%;
  left: 25%;
}
.an-dice-4 .dot:nth-child(2) {
  top: 25%;
  right: 25%;
}
.an-dice-4 .dot:nth-child(3) {
  bottom: 25%;
  left: 25%;
}
.an-dice-4 .dot:nth-child(4) {
  bottom: 25%;
  right: 25%;
}

.an-dice-5 .dot:nth-child(1) {
  top: 20%;
  left: 20%;
}
.an-dice-5 .dot:nth-child(2) {
  top: 20%;
  right: 20%;
}
.an-dice-5 .dot:nth-child(3) {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.an-dice-5 .dot:nth-child(4) {
  bottom: 20%;
  left: 20%;
}
.an-dice-5 .dot:nth-child(5) {
  bottom: 20%;
  right: 20%;
}

.an-dice-6 .dot:nth-child(1) {
  top: 20%;
  left: 25%;
}
.an-dice-6 .dot:nth-child(2) {
  top: 20%;
  right: 25%;
}
.an-dice-6 .dot:nth-child(3) {
  top: 50%;
  left: 25%;
  transform: translateY(-50%);
}
.an-dice-6 .dot:nth-child(4) {
  top: 50%;
  right: 25%;
  transform: translateY(-50%);
}
.an-dice-6 .dot:nth-child(5) {
  bottom: 20%;
  left: 25%;
}
.an-dice-6 .dot:nth-child(6) {
  bottom: 20%;
  right: 25%;
}

/* Rating Section with Proper Dice Layout */
.rating-section {
  background: var(--legacy-card);
  border: 1px solid var(--legacy-border);
  border-radius: 16px;
  padding: 24px;
  display: none;
}

.rating-section.show {
  display: block;
}

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

.rating-subtitle {
  font-size: 14px;
  color: var(--legacy-muted);
  text-align: center;
  margin-bottom: 24px;
}

/* Horizontal Dice Container */
.dice-container {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
}

.dice {
  width: 44px;
  height: 44px;
  background: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.dice:hover {
  transform: scale(1.1);
}

.dice.selected {
  background: var(--legacy-green);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.dice-dots {
  position: absolute;
  width: 100%;
  height: 100%;
  padding: 8px;
}

/* Dice dot patterns */
.dice-1 .dot {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #333;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.dice-2 .dot:nth-child(1) {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #333;
  border-radius: 50%;
  top: 25%;
  left: 25%;
}
.dice-2 .dot:nth-child(2) {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #333;
  border-radius: 50%;
  bottom: 25%;
  right: 25%;
}
.dice-3 .dot:nth-child(1) {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #333;
  border-radius: 50%;
  top: 20%;
  left: 20%;
}
.dice-3 .dot:nth-child(2) {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #333;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.dice-3 .dot:nth-child(3) {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #333;
  border-radius: 50%;
  bottom: 20%;
  right: 20%;
}
.dice-4 .dot {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #333;
  border-radius: 50%;
}
.dice-4 .dot:nth-child(1) {
  top: 25%;
  left: 25%;
}
.dice-4 .dot:nth-child(2) {
  top: 25%;
  right: 25%;
}
.dice-4 .dot:nth-child(3) {
  bottom: 25%;
  left: 25%;
}
.dice-4 .dot:nth-child(4) {
  bottom: 25%;
  right: 25%;
}
.dice-5 .dot {
  position: absolute;
  width: 5px;
  height: 5px;
  background: #333;
  border-radius: 50%;
}
.dice-5 .dot:nth-child(1) {
  top: 20%;
  left: 20%;
}
.dice-5 .dot:nth-child(2) {
  top: 20%;
  right: 20%;
}
.dice-5 .dot:nth-child(3) {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.dice-5 .dot:nth-child(4) {
  bottom: 20%;
  left: 20%;
}
.dice-5 .dot:nth-child(5) {
  bottom: 20%;
  right: 20%;
}
.dice-6 .dot {
  position: absolute;
  width: 5px;
  height: 5px;
  background: #333;
  border-radius: 50%;
}
.dice-6 .dot:nth-child(1) {
  top: 20%;
  left: 25%;
}
.dice-6 .dot:nth-child(2) {
  top: 20%;
  right: 25%;
}
.dice-6 .dot:nth-child(3) {
  top: 50%;
  left: 25%;
  transform: translateY(-50%);
}
.dice-6 .dot:nth-child(4) {
  top: 50%;
  right: 25%;
  transform: translateY(-50%);
}
.dice-6 .dot:nth-child(5) {
  bottom: 20%;
  left: 25%;
}
.dice-6 .dot:nth-child(6) {
  bottom: 20%;
  right: 25%;
}

.dice.selected .dot {
  background: white;
}

/* Styled Submit Button for Rating */
.rating-submit {
  background: var(--legacy-blue);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 16px 32px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: block;
  margin: 0 auto;
  transition: all 0.2s;
}

.rating-submit:hover {
  background: #2563eb;
  transform: translateY(-2px);
}

/* Dictionary Section */
.dictionary-section {
  background: var(--legacy-card);
  border: 1px solid var(--legacy-border);
  border-radius: 16px;
  padding: 24px;
}

.dictionary-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.dictionary-icon {
  width: 24px;
  height: 24px;
}

.dictionary-title {
  font-size: 20px;
  font-weight: 600;
}

.term-card {
  background: var(--legacy-bg);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.term-title {
  color: var(--legacy-blue);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.term-description {
  color: var(--legacy-text);
  font-size: 15px;
  margin-bottom: 12px;
  line-height: 1.5;
}

.translations {
  display: flex;
  gap: 20px;
  color: var(--legacy-muted);
  font-size: 14px;
}

/* References Section */
.references-section {
  background: var(--legacy-card);
  border: 1px solid var(--legacy-border);
  border-radius: 16px;
  padding: 24px;
}

.references-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
}

.reference-card {
  background: var(--legacy-bg);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 12px;
  position: relative;
  padding-left: 24px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: block;
  color: inherit;
}

.reference-card:hover {
  background: var(--legacy-card-hover);
}

.reference-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 12px 0 0 12px;
}

.reference-card.blue::before {
  background: var(--legacy-blue);
}
.reference-card.green::before {
  background: var(--legacy-green);
}
.reference-card.purple::before {
  background: var(--legacy-purple);
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--legacy-card);
  border-top: 1px solid var(--legacy-border);
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  z-index: 1000;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 20px;
  color: var(--legacy-muted);
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border-radius: 8px;
  min-width: 80px;
}

.nav-item:hover {
  color: var(--legacy-text);
  background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  color: var(--legacy-blue);
}

.nav-icon {
  width: 24px;
  height: 24px;
  margin-bottom: 4px;
}

.nav-label {
  font-size: 12px;
  font-weight: 500;
}

/* Icons */
.icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  vertical-align: middle;
}
