
    :root {
      --bg: #ffffff;
      --panel: #ffffff;
      --panel-2: #f4f6f9;
      --text: #111111;
      --muted: #6b7280;
      --line: #e5e7eb;
      --accent: #2563eb;
      --accent-2: #93c5fd;
      --danger: #e53e3e;
      --ok: #16a34a;
      --shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
      --grad: linear-gradient(135deg, #2563eb, #93c5fd);
    }

    * { box-sizing: border-box; }

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

    main {
      width: min(1180px, calc(100vw - 32px));
      margin: 0 auto;
      padding: 24px 0 40px;
    }

    header {
      display: flex;
      justify-content: space-between;
      align-items: flex-end;
      gap: 18px;
      margin-bottom: 14px;
    }

    h1 {
      margin: 0;
      font-size: clamp(26px, 3vw, 42px);
      letter-spacing: -0.01em;
      font-family: "Cinzel", "Times New Roman", Georgia, serif;
      font-weight: 700;
      color: var(--text);
      /* 그라데이션 색 분포를 텍스트 너비 대비 비율로 고정 — 폰트가 커지든 작아지든 색 분포는 동일 */
      background-image: linear-gradient(90deg, #111111 0%, #1e3a8a 60%, #2563eb 100%);
      background-size: 100% 100%;
      background-repeat: no-repeat;
      -webkit-background-clip: text;
      background-clip: text;
      -webkit-text-fill-color: transparent;
      display: inline-block;
    }

    /* 영문 타이틀 옆에 붙는 한글 부제 — 작고 얇은 세리프 */
    .title-row {
      display: flex;
      align-items: baseline;
      gap: 10px;
      flex-wrap: wrap;
    }

    .title-ko {
      font-family: "Nanum Myeongjo", "Noto Serif KR", "본명조", "Batang", serif;
      font-weight: 400;
      font-size: clamp(13px, 1.2vw, 16px);
      color: var(--muted);
      letter-spacing: 0.02em;
      white-space: nowrap;
    }

    .subtitle {
      margin: 8px 0 0;
      color: var(--muted);
      font-size: 14px;
    }

    .grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 16px;
    }

    .card {
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: 22px;
      box-shadow: var(--shadow);
      overflow: hidden;
    }

    .card-head {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      padding: 12px 14px;
      border-bottom: 1px solid var(--line);
      background: var(--panel-2);
    }

    .card-title {
      font-weight: 800;
      letter-spacing: -0.02em;
    }

    .hint { color: var(--muted); font-size: 12px; }

    textarea, input, select { font: inherit; }

    /* 큰 원문/결과 영역 — 비어있을 땐 한 줄 크기, 내용 따라 자라되 50vh가 상한.
       textarea는 JS로 auto-resize, #outputText(div)는 자연스러운 height 확장. */
    .card textarea {
      width: 100%;
      resize: none;
      min-height: 72px;
      max-height: 50vh;
      overflow-y: auto;
      background: #fafdff;
      color: var(--text);
      border: 0;
      outline: none;
      padding: 16px;
      line-height: 1.6;
      font-size: 15px;
      display: block;
    }

    #outputText {
      min-height: 72px;
      max-height: 50vh;
      overflow-y: auto;
      white-space: pre-wrap;
      word-break: break-word;
      color: var(--text);
      padding: 16px;
      line-height: 1.6;
      font-size: 15px;
    }

    .controls {
      display: grid;
      grid-template-columns: repeat(12, 1fr);
      gap: 7px;
      margin: 10px 0;
    }

    .field {
      background: var(--panel-2);
      border: 1px solid var(--line);
      border-radius: 16px;
      padding: 7px 10px;
      max-height: 600px;
      transition: max-height 0.35s ease, opacity 0.25s ease, padding 0.3s ease, margin 0.3s ease, border-width 0.3s ease;
    }

    .field.collapsed {
      max-height: 0 !important;
      padding-top: 0 !important;
      padding-bottom: 0 !important;
      border-width: 0 !important;
      opacity: 0;
      pointer-events: none;
      overflow: hidden;
    }

    /* field 내부 텍스트 입력류만 박스 스타일 — 체크박스/라디오는 제외 */
    .field input:not([type="checkbox"]):not([type="radio"]),
    .field select,
    .field textarea {
      width: 100%;
      background: var(--panel);
      border: 1px solid var(--line);
      color: var(--text);
      border-radius: 12px;
      outline: none;
      padding: 5px 11px;
    }

    .field textarea {
      min-height: 60px;
      resize: vertical;
      line-height: 1.35;
      font-size: 14px;
    }

    /* ==================== 합쳐진 박스 내부 섹션 구분 ====================
       박스 하나에 여러 입력을 묶을 때, 각 섹션을 가로/세로 구분선으로 나눠준다. */
    .field-group {
      display: grid;
      gap: 0;
    }

    .field-group.cols-2 {
      grid-template-columns: 1fr 1fr;
    }

    .field-section {
      padding: 0 10px;
    }

    .field-group.cols-2 > .field-section + .field-section {
      border-left: 1px solid var(--line);
    }

    .field-section:first-child { padding-left: 0; }
    .field-section:last-child  { padding-right: 0; }

    /* 한 박스 안에서 위/아래 섹션을 시각적으로 나누는 가로 구분선 */
    .field-divider {
      height: 1px;
      background: var(--line);
      margin: 6px 0;
    }

    .span-12 { grid-column: span 12; }

    .counter {
      font-size: 11px;
      color: var(--muted);
      margin-top: 2px;
      text-align: right;
    }

    .counter.over { color: var(--danger); }

    .actions {
      display: flex;
      gap: 10px;
      justify-content: flex-end;
      margin-top: 14px;
    }

    button {
      border: 0;
      border-radius: 14px;
      padding: 11px 16px;
      font-weight: 800;
      cursor: pointer;
      color: #ffffff;
      background-color: var(--accent);
      background-image: var(--grad);
      background-clip: padding-box;
    }

    button.secondary {
      background-color: var(--panel-2);
      background-image: none;
      color: var(--text);
      border: 1px solid var(--line);
    }

    button:disabled { opacity: 0.55; cursor: not-allowed; }

    .status {
      margin-top: 12px;
      color: var(--muted);
      font-size: 13px;
      min-height: 20px;
    }

    .status.ok { color: var(--ok); }
    .status.err { color: var(--danger); }

    footer {
      margin-top: 40px;
      padding: 20px 0;
      border-top: 1px solid var(--line);
      color: var(--muted);
      font-size: 12px;
      line-height: 1.7;
    }

    .counter-card {
      padding: 0;
      margin: 0;
    }

    /* ==================== 모든 field 헤더 라인 통일 ====================
       좌/우 박스 대칭의 핵심 — 라벨 줄을 단일 컴포넌트로 일원화.
       체크박스가 있든 없든 같은 높이/마진을 가짐. */
    .field-head {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      min-height: 18px;
      margin-bottom: 4px;
    }

    .field-label {
      color: var(--muted);
      font-size: 12px;
      line-height: 1.35;
      margin: 0;
      flex: 1;
      min-width: 0;
    }

    /* ==================== 커스텀 체크박스 (pill) ==================== */
    .check-pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: 12px;
      line-height: 1;
      color: var(--muted);
      cursor: pointer;
      user-select: none;
      white-space: nowrap;
      flex-shrink: 0;
      transition: color 0.2s ease;
    }

    .check-pill:hover { color: var(--accent); }

    .check-pill input[type="checkbox"] {
      appearance: none;
      -webkit-appearance: none;
      -moz-appearance: none;
      width: 16px;
      height: 16px;
      margin: 0;
      padding: 0;
      border: 1.5px solid var(--line);
      border-radius: 4px;
      background-color: var(--panel);
      background-image: none;
      background-clip: padding-box;
      color: transparent;
      outline: none;
      cursor: pointer;
      flex-shrink: 0;
      position: relative;
      overflow: hidden;
      vertical-align: middle;
      transition: border-color 0.2s ease, background-color 0.2s ease, background-image 0.2s ease;
    }

    .check-pill input[type="checkbox"]:hover {
      border-color: var(--accent-2);
    }

    .check-pill input[type="checkbox"]:checked {
      background-color: var(--accent);
      background-image: var(--grad);
      border-color: transparent;
    }

    /* 체크 마크 V — 박스 중앙에 안전하게 배치 */
    .check-pill input[type="checkbox"]:checked::after {
      content: "";
      position: absolute;
      left: 50%;
      top: 45%;
      width: 4px;
      height: 7px;
      border: solid #ffffff;
      border-width: 0 2px 2px 0;
      transform: translate(-50%, -50%) rotate(45deg);
    }

    /* ==================== 엔진 토글 / 형식 유지 래퍼 ==================== */
    #preserveFormatWrap {
      display: inline-flex;
      overflow: hidden;
      max-width: 120px;
      opacity: 1;
      transition: max-width 0.3s ease, opacity 0.25s ease;
    }

    #preserveFormatWrap.hidden {
      max-width: 0;
      opacity: 0;
      pointer-events: none;
    }

    .engine-toggle {
      display: flex;
      gap: 8px;
      margin-top: 0;
    }

    .toggle-btn {
      flex: 1;
      border: 1px solid var(--line);
      border-radius: 12px;
      padding: 5px 12px;
      font-weight: 600;
      font-size: 13px;
      cursor: pointer;
      background-color: var(--panel-2);
      background-image: none;
      background-clip: padding-box;
      color: var(--muted);
      transition: background-color 0.2s ease, background-image 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    }

    .toggle-btn.active {
      background-color: var(--accent);
      background-image: var(--grad);
      color: #ffffff;
      border-color: transparent;
    }

    /* ==================== TTS / 사전 기능 ==================== */
    /* 카드 하단 푸터 — 좌측에 듣기 버튼, 우측에 카운터/정보 */
    .card-footer {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      padding: 6px 14px 10px;
      min-height: 36px;
    }

    .card-footer-left,
    .card-footer-right {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    /* 박스 없는 아이콘 버튼 — 구글 번역기 스타일 */
    .speak-btn {
      background: transparent;
      background-image: none;
      border: 0;
      padding: 6px;
      margin: 0;
      border-radius: 50%;
      color: var(--muted);
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      transition: color 0.15s ease, background-color 0.15s ease;
    }

    .speak-btn:hover {
      color: var(--accent);
      background-color: var(--panel-2);
    }

    .speak-btn:disabled {
      color: var(--line);
      cursor: not-allowed;
      background-color: transparent;
    }

    .speak-btn.active {
      color: var(--accent);
    }

    .speak-btn svg {
      width: 20px;
      height: 20px;
      display: block;
    }

    /* 재생/정지 아이콘 토글 */
    .speak-btn .icon-stop { display: none; }
    .speak-btn.active .icon-play { display: none; }
    .speak-btn.active .icon-stop { display: block; }

    /* 번역 결과 영역의 영어 단어 — 클릭 가능 */
    .word {
      cursor: pointer;
      border-bottom: 1px dotted transparent;
      transition: border-color 0.15s ease, color 0.15s ease;
    }

    .word:hover {
      border-bottom-color: var(--accent);
      color: var(--accent);
    }

    /* 사전 popover */
    .dict-popover {
      position: fixed;
      z-index: 100;
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: 14px;
      box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
      padding: 14px 36px 14px 16px;
      max-width: 340px;
      min-width: 200px;
      font-size: 13px;
      line-height: 1.5;
      animation: popoverFade 0.12s ease-out;
    }

    @keyframes popoverFade {
      from { opacity: 0; transform: translateY(-4px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    .dict-popover .dict-word {
      font-weight: 800;
      font-size: 16px;
      margin-bottom: 2px;
      color: var(--text);
    }

    .dict-popover .dict-phonetic {
      color: var(--muted);
      font-size: 12px;
      margin-bottom: 6px;
    }

    .dict-popover .dict-pos {
      color: var(--accent);
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      margin-top: 8px;
      margin-bottom: 2px;
      letter-spacing: 0.04em;
    }

    .dict-popover .dict-def {
      margin-top: 2px;
      color: var(--text);
    }

    .dict-popover .dict-example {
      color: var(--muted);
      font-style: italic;
      margin-top: 3px;
      font-size: 12px;
    }

    .dict-popover .dict-close {
      position: absolute;
      top: 6px;
      right: 8px;
      background: transparent;
      background-image: none;
      border: 0;
      color: var(--muted);
      cursor: pointer;
      padding: 2px 8px;
      font-size: 18px;
      font-weight: 400;
      line-height: 1;
      border-radius: 6px;
    }

    .dict-popover .dict-close:hover {
      color: var(--text);
      background-color: var(--panel-2);
    }

    .dict-popover .dict-loading {
      color: var(--muted);
      font-size: 12px;
      margin-top: 4px;
    }

    .dict-popover .dict-error {
      color: var(--danger);
      font-size: 12px;
      margin-top: 4px;
    }

    /* 원문 지우기 X 버튼 */
    .clear-source-btn {
      background: transparent;
      background-image: none;
      border: 0;
      padding: 3px;
      margin: 0;
      border-radius: 50%;
      color: var(--muted);
      cursor: pointer;
      display: none;
      align-items: center;
      justify-content: center;
      transition: color 0.15s ease, background-color 0.15s ease;
      flex-shrink: 0;
    }

    .clear-source-btn.visible {
      display: inline-flex;
    }

    .clear-source-btn:hover {
      color: var(--danger);
      background-color: var(--panel-2);
    }

    .clear-source-btn svg {
      width: 14px;
      height: 14px;
      display: block;
    }

    /* ==================== 알아듣기 쉽게 — 프리셋 버튼 ==================== */
    .simplify-presets {
      display: flex;
      flex-wrap: wrap;
      gap: 7px;
      margin-top: 2px;
    }

    .preset-btn {
      flex: none;
      border: 1.5px solid var(--line);
      border-radius: 20px;
      padding: 5px 13px;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      background-color: var(--panel);
      background-image: none;
      background-clip: padding-box;
      color: var(--muted);
      transition: background-color 0.18s ease, background-image 0.18s ease, color 0.18s ease, border-color 0.18s ease;
    }

    .preset-btn:hover {
      border-color: var(--accent-2);
      color: var(--accent);
    }

    .preset-btn.active {
      background-color: var(--accent);
      background-image: var(--grad);
      color: #ffffff;
      border-color: transparent;
    }

    /* ==================== 알아듣기 쉽게 — 난이도 버튼 ==================== */
    .simplify-levels {
      display: flex;
      flex-direction: column;
      gap: 6px;
      margin-top: 2px;
    }

    .level-btn {
      display: flex;
      align-items: center;
      gap: 10px;
      border: 1.5px solid var(--line);
      border-radius: 14px;
      padding: 8px 12px;
      font-size: 13px;
      cursor: pointer;
      background-color: var(--panel);
      background-image: none;
      background-clip: padding-box;
      color: var(--text);
      text-align: left;
      transition: background-color 0.18s ease, background-image 0.18s ease, color 0.18s ease, border-color 0.18s ease;
      width: 100%;
    }

    .level-btn:hover {
      border-color: var(--accent-2);
    }

    .level-btn.active {
      background-color: var(--accent);
      background-image: var(--grad);
      color: #ffffff;
      border-color: transparent;
    }

    .level-icon {
      font-size: 18px;
      flex-shrink: 0;
      line-height: 1;
    }

    .level-text {
      display: flex;
      flex-direction: column;
      gap: 1px;
      min-width: 0;
    }

    .level-text strong {
      font-weight: 700;
      font-size: 13px;
      line-height: 1.2;
    }

    .level-text small {
      font-size: 11px;
      opacity: 0.75;
      line-height: 1.2;
      font-weight: 400;
    }

    .level-btn.active .level-text small {
      opacity: 0.85;
    }

    @media (max-width: 860px) {
      header { align-items: stretch; flex-direction: column; }
      .grid { grid-template-columns: 1fr; }
      .controls { grid-template-columns: 1fr; }
      .span-12 { grid-column: span 1; }
    }
  
/* Portfolio demo refinements */
body { background:#f6f8fc; }
main { max-width:1120px; }
.demo-notice { background:#edf3ff; border:1px solid #cadbff; padding:18px 22px; border-radius:18px; margin:18px 0; }
.demo-notice strong { font-size:11px; letter-spacing:.14em; color:#1e40af; }
.demo-notice p { margin:8px 0 12px; line-height:1.6; }
.demo-notice small { display:block; color:#475569; margin-top:10px; line-height:1.6; }
:focus-visible { outline:3px solid #2563eb; outline-offset:3px; }
.word:focus-visible { background:#dbeafe; }
.dict-popover { max-width:calc(100vw - 16px); }
button { touch-action:manipulation; }
@media (prefers-reduced-motion:reduce) { *, *::before, *::after { animation:none!important; transition:none!important; } }
@media(max-width:480px) { .engine-toggle { flex-wrap:wrap; } .actions { flex-wrap:wrap; } .actions button { flex:1; } }
/* Entry dialog: original translation surface remains visible behind it. */
[hidden] { display:none !important; }
.account-bar { display:flex; align-items:center; gap:10px; font-size:14px; color:var(--muted); }
.sample-bar { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:18px 0; font-size:14px; color:var(--muted); }
#accessDialog { width:min(420px,calc(100vw - 32px)); max-height:calc(100dvh - 32px); overflow:auto; border:1px solid #d9e3f3; border-radius:24px; padding:34px 30px 24px; background:#fff; color:#142033; box-shadow:0 24px 90px #142f5940; }
#accessDialog::backdrop { background:rgb(24 38 59 / 35%); }
#accessDialog .dialog-close { position:absolute; right:14px; top:10px; background:none; color:#60718b; border:0; box-shadow:none; font-size:26px; padding:4px 8px; }
.dialog-eyebrow { font-size:12px; font-weight:700; letter-spacing:.12em; color:#2563eb; }
#accessTitle { margin:12px 0 8px; font-size:28px; letter-spacing:-.04em; }
#accessIntro { font-size:16px; line-height:1.6; color:#56647b; margin:0 0 24px; }
.google-area { min-height:44px; display:flex; justify-content:center; }
.google-placeholder { width:100%; background:#f8fafc; border:1px solid #d8dee9; color:#667085; border-radius:24px; font-size:14px; }
.auth-divider { display:flex; align-items:center; gap:12px; margin:24px 0; color:#7a8495; font-size:12px; }
.auth-divider::before,.auth-divider::after { content:''; height:1px; background:#e4e9f1; flex:1; }
#trialForm label { display:block; font-size:14px; font-weight:600; }
#trialAvailability { font-size:13px; line-height:1.5; color:#667085; margin:7px 0 12px; }
#trialPassword { width:100%; min-height:48px; padding:12px 14px; border:1px solid #cbd5e1; border-radius:12px; background:#fff; font-size:16px; }
#trialSubmit { width:100%; min-height:48px; margin-top:12px; border-radius:12px; font-size:15px; }
#authMessage { min-height:20px; margin:12px 0 0; color:#b42318; font-size:14px; line-height:1.5; }
.auth-footnote { font-size:12px; line-height:1.6; margin:12px 0 0; color:#667085; text-align:center; }
@media(max-width:480px) { #accessDialog { padding:28px 22px 20px; } .sample-bar { align-items:flex-start; flex-direction:column; } .account-bar { justify-content:flex-end; } }
