:root {
  color-scheme: light;
  font-family: Pretendard, "Noto Sans KR", system-ui, sans-serif;
  color: #202124;
  background: #eceff3;
}

* { box-sizing: border-box; }
body { height: 100vh; margin: 0; min-width: 760px; overflow: hidden; display: flex; flex-direction: column; }
button, input { font: inherit; }
button { cursor: pointer; }

.toolbar {
  min-height: 58px;
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #fff;
  border-bottom: 1px solid #d9dde3;
}
.toolbar [data-tooltip] { position: relative; }
.toolbar [data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  top: calc(100% + 10px);
  transform: translateX(-50%) translateY(-3px);
  width: max-content;
  max-width: 280px;
  padding: 8px 10px;
  border-radius: 7px;
  background: #111827;
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  white-space: normal;
  box-shadow: 0 7px 22px rgba(15,23,42,.25);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 120;
  transition: opacity .12s ease, transform .12s ease;
}
.toolbar [data-tooltip]:hover::after,
.toolbar [data-tooltip]:focus-visible::after,
.toolbar [data-tooltip]:focus-within::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.toolbar .file-button[data-tooltip]::after { left: 0; transform: translateY(-3px); }
.toolbar .file-button[data-tooltip]:hover::after,
.toolbar .file-button[data-tooltip]:focus-within::after { transform: translateY(0); }
.toolbar .status[data-tooltip]::after { left: auto; right: 0; transform: translateY(-3px); }
.toolbar .status[data-tooltip]:hover::after,
.toolbar .status[data-tooltip]:focus-visible::after { transform: translateY(0); }
.brand { font-weight: 800; margin-right: 4px; }
.brand { color: inherit; text-decoration: none; white-space: nowrap; }
.file-button, .primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.file-button input, .primary-button input { display: none; }
.page-controls, .zoom-controls { display: flex; align-items: center; gap: 6px; }
.page-controls button, .zoom-controls button {
  width: 34px; height: 34px; border: 1px solid #d3d8df; border-radius: 7px; background: #fff;
}
#pageNumber { width: 48px; text-align: center; border: 1px solid #d3d8df; border-radius: 6px; padding: 5px; }
.status { margin-left: auto; font-size: 13px; color: #6b7280; }
.status.ok { color: #15803d; }
.status.bad { color: #b91c1c; }
.ocr-button, .page-action { border: 1px solid #93a3b8; border-radius: 7px; background: #f8fafc; padding: 7px 11px; color: #334155; white-space: nowrap; }
.ocr-button:disabled, .page-action:disabled { cursor: default; opacity: .5; }
.ocr-button.working { color: #1d4ed8; border-color: #60a5fa; }
.view-controls { display: flex; align-items: center; padding: 2px; border: 1px solid #c3d2c9; border-radius: 8px; background: #fffdf7; }
.view-controls button { border: 0; border-radius: 6px; padding: 6px 9px; background: transparent; color: #496158; white-space: nowrap; }
.view-controls button.active { background: #146c4b; color: #fff; font-weight: 700; }
.ocr-progress { display: flex; align-items: center; gap: 7px; min-width: 135px; color: #24513f; font-size: 12px; white-space: nowrap; }
.ocr-progress button { border: 1px solid #d2a6a6; border-radius: 6px; background: #fff5f5; color: #9b3030; padding: 5px 7px; }

.layout { min-height: 0; flex: 1 1 auto; display: grid; grid-template-columns: minmax(500px, 1fr) 360px; }
.viewer { position: relative; overflow: auto; padding: 32px; }
.empty-state { margin: clamp(70px,18vh,180px) auto 0; text-align: center; max-width: 460px; color: #4b5563; }
.empty-state h1 { margin: 16px 0 8px; color: #1f2937; }
.empty-state p { line-height: 1.7; }
.empty-state small { display: block; margin-top: 16px; }
.empty-icon { width: 72px; height: 88px; display: grid; place-items: center; margin: auto; background: #fff; border: 2px solid #9ca3af; border-radius: 8px; font-weight: 800; color: #6b7280; }
.pages-container { width: max-content; min-width: 100%; min-height: 100%; }
.pages-container.single-view { display: grid; place-items: start center; }
.pages-container.continuous-view { display: flex; flex-direction: column; align-items: center; gap: 26px; padding-bottom: 40vh; }
.page-slot { position: relative; flex: 0 0 auto; background: #fff; box-shadow: 0 8px 28px rgba(15, 23, 42, .18); }
.page-slot.current-page { outline: 3px solid rgba(20,108,75,.34); outline-offset: 4px; }
.page-number-badge { position: absolute; z-index: 7; left: 8px; top: 8px; padding: 3px 7px; border-radius: 999px; background: rgba(16,35,28,.78); color: #fff; font-size: 11px; pointer-events: none; }
.page-loading { position: absolute; inset: 0; display: grid; place-items: center; color: #6d7c74; font-size: 13px; }
.page-wrap { position: absolute; inset: 0; background: #fff; }
.pdf-canvas { display: block; }
.text-layer { position: absolute; inset: 0; overflow: hidden; line-height: 1; opacity: 1; }
.text-layer span { position: absolute; color: transparent; white-space: pre; transform-origin: 0 0; cursor: text; }
.text-layer ::selection, .text-layer span::selection { background: rgba(37, 99, 235, .35); color: transparent; }
.page-translation-layer { position: absolute; inset: 0; overflow: hidden; z-index: 4; pointer-events: none; }
.translated-region { position: absolute; background: rgba(255,255,255,.97); color: #111827; padding: 2px 3px; line-height: 1.35; overflow: auto; pointer-events: auto; user-select: text; border: 1px solid rgba(226,232,240,.7); }
.translated-region.failed { background: rgba(254,242,242,.94); color: #991b1b; font-size: 11px; }
.page-wrap.showing-korean .text-layer { pointer-events: none; user-select: none; }
.hidden { display: none !important; }

.sidebar { background: #fff; border-left: 1px solid #d9dde3; overflow: hidden; display: flex; flex-direction: column; }
.ocr-text-panel { flex: 0 0 auto; max-height: 34%; padding: 15px 16px; overflow: hidden; border-bottom: 1px solid #d9e1dc; background: #eef7f1; }
.ocr-text-heading h2 { font-size: 16px; margin: 0 0 5px; }
.ocr-text-heading p { margin: 0 0 10px; font-size: 12px; line-height: 1.45; }
.ocr-text-content { max-height: 180px; padding: 10px; overflow: auto; border: 1px solid #b9cfc2; border-radius: 8px; background: #fffef9; color: #233d33; font-size: 13px; line-height: 1.65; white-space: pre-wrap; user-select: text; cursor: text; }
.ocr-text-content::selection { background: rgba(20,108,75,.28); }
.quiz-panel { flex: 0 0 auto; height: 45%; min-height: 150px; padding: 16px; overflow-y: auto; }
.sidebar-resizer { flex: 0 0 9px; position: relative; cursor: row-resize; background: #eef2f7; border-top: 1px solid #d9dde3; border-bottom: 1px solid #d9dde3; touch-action: none; }
.sidebar-resizer::after { content: ""; position: absolute; left: 50%; top: 3px; width: 42px; height: 3px; transform: translateX(-50%); border-radius: 3px; background: #94a3b8; }
.sidebar-resizer:hover, .sidebar-resizer:focus-visible { background: #dbeafe; outline: none; }
.quiz-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.quiz-heading h2 { font-size: 17px; margin: 0 0 4px; }
.quiz-heading p { margin: 0; color: #6b7280; font-size: 12px; }
.quiz-item { padding: 12px 0 16px; border-bottom: 1px solid #e2e8f0; }
.quiz-item:first-child { padding-top: 0; }
.quiz-item:last-child { border-bottom: 0; padding-bottom: 0; }
.quiz-question { font-weight: 700; line-height: 1.55; margin-bottom: 10px; }
.quiz-option { display: flex; align-items: flex-start; gap: 8px; padding: 8px; margin: 5px 0; border: 1px solid #e2e8f0; border-radius: 8px; line-height: 1.45; cursor: pointer; }
.quiz-option.correct { border-color: #22c55e; background: #f0fdf4; }
.quiz-option.wrong { border-color: #ef4444; background: #fef2f2; }
.quiz-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.quiz-actions button { border: 0; border-radius: 7px; padding: 8px 11px; background: #2563eb; color: white; }
.quiz-actions button.secondary { background: #475569; }
.quiz-result { margin-top: 10px; font-weight: 700; }
.quiz-explanation { margin-top: 10px; padding: 10px; background: #f8fafc; border-radius: 8px; font-size: 13px; line-height: 1.6; white-space: pre-wrap; }
.quiz-evidence { margin-bottom: 6px; color: #1d4ed8; font-weight: 700; }
.quiz-evidence-quote { margin-bottom: 8px; padding: 8px; border-left: 3px solid #93c5fd; background: #eff6ff; color: #334155; font-size: 12px; line-height: 1.5; }
.sidebar-header { padding: 18px; display: flex; align-items: flex-start; justify-content: space-between; border-bottom: 1px solid #e5e7eb; }
.sidebar h2 { font-size: 17px; margin: 0 0 4px; }
.sidebar p { margin: 0; color: #6b7280; font-size: 12px; }
.text-button { border: 0; background: transparent; color: #6b7280; font-size: 12px; }
.history { flex: 1 1 auto; min-height: 100px; padding: 14px; overflow-y: auto; }
.history-empty { color: #9ca3af; text-align: center; padding: 42px 20px; line-height: 1.6; }
.history-card { border: 1px solid #e3e7ed; border-radius: 10px; padding: 14px; margin-bottom: 12px; }
.history-original { font-size: 13px; color: #6b7280; line-height: 1.45; margin-bottom: 9px; }
.history-translation { line-height: 1.6; white-space: pre-wrap; }
.card-actions { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.card-actions button { border: 1px solid #d7dce3; background: #fff; border-radius: 6px; padding: 5px 8px; font-size: 12px; }
.explanation { margin-top: 10px; padding-top: 10px; border-top: 1px dashed #d7dce3; font-size: 13px; line-height: 1.55; white-space: pre-wrap; }

.selection-menu, .translation-popup { position: fixed; z-index: 50; }
.selection-menu button { border: 0; border-radius: 7px; padding: 8px 13px; background: #111827; color: #fff; font-weight: 700; box-shadow: 0 5px 18px rgba(0,0,0,.25); }
.translation-popup { width: min(380px, calc(100vw - 30px)); padding: 16px 38px 16px 16px; background: #fff; border: 1px solid #d7dce3; border-radius: 11px; box-shadow: 0 10px 35px rgba(15,23,42,.25); line-height: 1.6; }
.close-button { position: absolute; right: 8px; top: 7px; border: 0; background: transparent; font-size: 21px; color: #6b7280; }
.loading { color: #6b7280; }
.error { color: #b91c1c; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 80; background: #111827; color: #fff; padding: 10px 14px; border-radius: 8px; font-size: 13px; }

.login-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(15, 23, 42, .72); backdrop-filter: blur(5px); }
.login-card { width: min(360px, calc(100vw - 32px)); padding: 28px; background: #fff; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-card h1 { margin: 0 0 8px; font-size: 22px; }
.login-card p { margin: 0 0 18px; color: #6b7280; }
.login-card input { width: 100%; padding: 11px 12px; border: 1px solid #cbd5e1; border-radius: 8px; }
.login-card button { width: 100%; margin-top: 10px; padding: 11px; border: 0; border-radius: 8px; background: #2563eb; color: #fff; font-weight: 700; }
.login-card label { display: block; margin: 0 0 6px; color: #374151; font-size: 13px; font-weight: 700; }
.login-card .google-login { border: 1px solid #cbd5e1; background: #fff; color: #111827; }
.login-divider { display: flex; align-items: center; gap: 10px; margin: 16px 0 6px; color: #94a3b8; font-size: 12px; }
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: #e2e8f0; }
.login-card .login-help { margin: 14px 0 0; font-size: 12px; }
.login-error { min-height: 20px; margin-top: 10px; color: #b91c1c; font-size: 13px; }
.reward-modal { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 20px; background: rgba(15, 23, 42, .72); }
.reward-card { position: relative; width: min(430px, 100%); padding: 28px; border-radius: 16px; background: #fff; box-shadow: 0 20px 60px rgba(0,0,0,.32); text-align: center; }
.reward-card h2 { margin: 10px 0 8px; }
.reward-card p { color: #64748b; line-height: 1.5; }
.test-ad-badge { display: inline-block; padding: 4px 9px; border-radius: 999px; background: #fef3c7; color: #92400e; font-size: 12px; font-weight: 800; }
.test-ad-area { display: grid; place-items: center; min-height: 145px; margin: 18px 0; border: 2px dashed #cbd5e1; border-radius: 12px; background: #f8fafc; color: #64748b; font-size: 20px; font-weight: 800; }
.reward-card > button:not(.close-button) { width: 100%; padding: 12px; border: 0; border-radius: 9px; background: #2563eb; color: #fff; font-weight: 800; }
.reward-card > button:disabled { opacity: .6; }
.reward-status { min-height: 22px; margin: 12px 0 0 !important; }

/* PDF Study commercial green theme */
:root { color: #173329; background: #e7eee9; }
body { background: #e7eee9; }
.toolbar { background: #f8f6ef; border-bottom-color: #cbd8d0; }
.brand { color: #10231c; }
.file-button, .primary-button { background: #146c4b; }
.page-controls button, .zoom-controls button { border-color: #c3d2c9; background: #fffdf7; color: #173329; }
#pageNumber { border-color: #c3d2c9; background: #fffdf7; color: #173329; }
.status { color: #64746c; }
.status.ok { color: #0f7650; }
.ocr-button, .page-action { border-color: #9cb5a7; background: #eef7f1; color: #24513f; }
.ocr-button:hover:not(:disabled), .page-action:hover:not(:disabled) { background: #dff2e7; border-color: #5d9679; }
.layout { background: #dfe8e2; }
.viewer { background: #dfe8e2; }
.sidebar { background: #f8f6ef; border-left-color: #cbd8d0; }
.sidebar-header { border-bottom-color: #d9e1dc; }
.history-card, .quiz-item { border-color: #d1ddd6; background: #fffef9; }
.history-original, .quiz-question { color: #173329; }
.history-translation { color: #146c4b; }
.card-actions button, .quiz-actions button.secondary, .text-button { color: #146c4b; }
.selection-menu button, .quiz-actions button { background: #146c4b; }
.translation-popup { border-color: #87af9a; background: #fffef9; }
.empty-icon { background: #dff5e9; color: #146c4b; }
.login-overlay, .reward-modal { background: rgba(16,35,28,.76); }
.login-card, .reward-card { background: #fffef9; }
.login-card button, .reward-card > button:not(.close-button) { background: #146c4b; }
.login-card .google-login { border-color: #c5d4cb; background: #fffef9; color: #173329; }
.test-ad-area { border-color: #a9c0b2; background: #eef7f1; color: #3b6654; }
.test-ad-badge { background: #dff5e9; color: #146c4b; }
.translated-region { border-color: #75a98e; background: rgba(248,246,239,.97); color: #173329; }
.toast { background: #10231c; }
