:root {
  /* 세련된 그레이 팔레트 */
  --bg-color: #f5f5f7;        /* 밝은 실버 그레이 */
  --card-bg: #ffffff;         /* 순백색 카드 */
  --border-color: #e2e2e7;    /* 아주 연한 구분선 */
  --text-main: #1d1d1f;       /* 깊은 차콜 (거의 검정) */
  --text-sub: #86868b;        /* 중간 그레이 */
  --accent-color: #515154;    /* 강조용 다크 그레이 */
  --accent-light: #ebebeb;    /* 호버용 라이트 그레이 */
  --timer-color: #333333;     /* 타이머 바 색상 */

  /* 부드러운 효과 */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.08);
  --radius-lg: 18px;
  --radius-md: 12px;
}

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

body {
  min-height: 100vh;
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Pretendard", sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: 40px 20px;
  line-height: 1.6;
}

.cycle-flash {
  position: fixed;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 50ms ease;
  z-index: 9999;
}

.cycle-flash.is-visible {
  opacity: 0.5;
}

.app-shell {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Header & Nav */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-sub);
  text-transform: uppercase;
}

.site-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.site-nav {
  display: flex;
  background: rgba(0,0,0,0.05);
  padding: 4px;
  border-radius: 100px;
}

.nav-link {
  padding: 8px 20px;
  border: none;
  background: transparent;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link.is-active {
  background: var(--card-bg);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

/* 메인 카드 스타일 */
.typing-screen, .editor-screen {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 48px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

/* 타이핑 화면 */
.typing-meta {
  margin-bottom: 50px;
  text-align: center;
}

.typing-hint {
  font-size: 14px;
  color: var(--text-sub);
  font-weight: 400;
}

.typing-source-hint {
  margin-top: 14px;
  color: rgba(29, 29, 31, 0.42);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.6;
}

.typing-display {
  font-size: 32px;
  font-weight: 500;
  color: var(--text-main);
  text-align: center;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.01em;
}

.timer-bar-wrap {
  height: 2px;
  background: var(--accent-light);
  margin-top: 40px;
  border-radius: 2px;
}

.timer-bar {
  height: 100%;
  background: var(--timer-color);
  transition: transform 0.1s linear;
}

/* 입력 폼 스타일 */
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
  display: block;
}

.field-input {
  width: 100%;
  padding: 14px 18px;
  background: #fafafa;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 15px;
  color: var(--text-main);
  transition: all 0.2s;
}

.field-input:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--text-sub);
  box-shadow: 0 0 0 4px rgba(0,0,0,0.03);
}

.field-textarea {
  min-height: 240px;
  line-height: 1.7;
  resize: vertical;
}

.paired-entry-panel {
  margin-top: 8px;
}

.paired-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* 상태 표시 */
.status-note {
  font-size: 13px;
  color: var(--text-sub);
  background: var(--bg-color);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 30px;
  display: inline-block;
}

/* 버튼 스타일 */
.primary-button, .secondary-button {
  padding: 12px 28px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.primary-button {
  background: var(--text-main);
  color: #fff;
  border: none;
}

.primary-button:hover {
  background: #444;
  transform: translateY(-1px);
}

.secondary-button {
  background: #fff;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.secondary-button:hover {
  background: var(--bg-color);
}

/* 복습 리스트 */
.saved-list {
  margin-top: 24px;
  border-top: 1px solid var(--border-color);
}

.saved-list li {
  padding: 16px 0;
  border-bottom: 1px solid #f0f0f0;
  list-style: none;
  color: var(--text-main);
  font-size: 15px;
}

/* Screen Visibility */
.screen[hidden] {
  display: none;
}

.sr-only-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 640px) {
  .app-shell { gap: 20px; }
  .site-header { flex-direction: column; align-items: flex-start; gap: 16px; }
  .typing-screen, .editor-screen { padding: 24px; }
  .field-grid { grid-template-columns: 1fr; }
  .paired-field-grid { grid-template-columns: 1fr; }
}

/* --- 복습 화면 전용 추가 스타일 --- */

/* 필터 상태 메시지 (순차 시작/셔플 시작 버튼 옆) */
#review-filter-status {
  font-size: 13px;
  color: var(--text-sub);
  font-weight: 500;
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
}

/* 복습 결과 섹션 컨테이너 */
.review-results {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* 복습 결과 헤더 (Selected Sentences) */
.review-results .panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.subsection-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 4px;
}

.status-subnote {
  font-size: 13px;
  color: var(--text-sub);
  font-weight: 500;
}

/* 문장이 없을 때의 상태 */
.empty-state {
  padding: 40px;
  text-align: center;
  background: #fafafa;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-sub);
  font-size: 14px;
}

/* 복습 문장 리스트 (ol) */
.saved-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-left: 0; /* 기본 리스트 여백 제거 */
}

.saved-list li {
  list-style: none;
  padding: 18px 24px;
  background: #fafafa;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 16px;
  font-weight: 400;
  transition: transform 0.2s ease, background 0.2s ease;
  display: flex;
  align-items: flex-start;
}

/* 리스트 아이템 숫자 표시 (커스텀) */
.saved-list li::before {
  content: counter(item) ".";
  counter-increment: item;
  margin-right: 12px;
  color: var(--text-sub);
  font-weight: 600;
  font-size: 14px;
}

/* 호버 시 살짝 강조 */
.saved-list li:hover {
  background: #ffffff;
  transform: translateX(4px);
  border-color: var(--text-sub);
}

/* 버튼 행 레이아웃 보조 */
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* 리스트 카운터 초기화 */
#review-results-list {
  counter-reset: item;
}
