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

:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #16a34a;
  --red: #dc2626;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-400: #9ca3af;
  --gray-700: #374151;
  --gray-900: #111827;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-height: 52px;
  --footer-height: 72px;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
  background: #fff;
  color: var(--gray-900);
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

#app {
  max-width: 430px;
  margin: 0 auto;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.screen {
  display: none;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  padding-bottom: calc(var(--footer-height) + var(--safe-bottom));
}

.screen.active {
  display: flex;
}

.screen-top {
  position: sticky;
  top: 0;
  z-index: 20;
  flex-shrink: 0;
  background: #fff;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  min-height: var(--header-height);
  padding: 0 16px;
  border-bottom: 1px solid var(--gray-200);
  background: #fff;
}

.header-center {
  justify-content: center;
}

.header-center h1 {
  text-align: center;
}

.header-with-meta {
  height: auto;
  min-height: var(--header-height);
  padding: 8px 16px;
}

.header-titles {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
}

.header-meta {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.3;
  color: var(--gray-700);
  letter-spacing: 0.02em;
}

.header h1 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.2;
}

.header:not(.header-center) h1 {
  flex: 1;
  text-align: center;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  font-size: 1.25rem;
  color: var(--gray-700);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

.progress-label {
  font-size: 0.875rem;
  color: var(--gray-700);
  min-width: 48px;
  text-align: right;
  flex-shrink: 0;
}

.progress-bar-wrap {
  height: 4px;
  background: var(--gray-200);
  flex-shrink: 0;
}

.progress-bar {
  height: 100%;
  background: var(--blue);
  width: 0%;
  transition: width 0.2s ease;
}

.screen-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.word-list {
  list-style: none;
  margin: 0;
  padding: 8px 16px;
}

.word-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.word-list li:last-child {
  border-bottom: none;
}

.word-list .num {
  color: var(--gray-400);
  font-size: 0.875rem;
  min-width: 1.5rem;
}

.word-list .en {
  font-weight: 700;
  font-size: 1rem;
}

.word-list .ko {
  display: block;
  font-size: 0.875rem;
  color: var(--gray-700);
  margin-top: 2px;
}

.results-list li {
  align-items: center;
}

.results-list .word-body {
  flex: 1;
}

.result-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  flex-shrink: 0;
}

.result-icon.correct {
  background: #dcfce7;
  color: var(--green);
}

.result-icon.wrong {
  background: #fee2e2;
  color: var(--red);
}

.footer {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  background: #fff;
  border-top: 1px solid var(--gray-200);
  z-index: 20;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:active {
  background: var(--blue-dark);
}

.test-main {
  display: flex;
  flex-direction: column;
  padding: 8px 16px;
}

.test-word {
  text-align: center;
  font-size: 1.75rem;
  font-weight: 700;
  margin: 32px 0 40px;
  flex-shrink: 0;
}

.options-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.options-list li {
  margin: 0;
  padding: 0;
  border: none;
}

.option-btn {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 16px;
  border: none;
  border-bottom: 1px solid var(--gray-100);
  border-radius: 0;
  background: #fff;
  text-align: left;
  font-size: 16px;
  line-height: 1.4;
  color: var(--gray-900);
  cursor: pointer;
  touch-action: manipulation;
}

.options-list li:last-child .option-btn {
  border-bottom: none;
}

.option-btn:active {
  background: var(--gray-100);
}

.option-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.option-text {
  flex: 1;
  line-height: 1.4;
}

#screen-test.active {
  padding-bottom: 0;
}

#screen-test .footer {
  display: none;
}

html {
  touch-action: manipulation;
}

button {
  touch-action: manipulation;
}
