* { box-sizing: border-box; }
:root {
  color-scheme: light;
  --bg: #fff; --surface: #f8f9fa; --ink: #202124; --muted: #5f6368;
  --border: #dadce0; --border-light: #e8eaed; --accent: #1a73e8;
  --accent-hover: #1557b0; --accent-pale: #e8f0fe; --success: #188038;
  --danger: #b3261e; --shadow: 0 1px 6px rgba(60,64,67,.1);
  --shadow-lg: 0 1px 3px rgba(60,64,67,.15), 0 4px 12px rgba(60,64,67,.1);
}
html { min-width: 320px; background: var(--bg); }
body { min-height: 100vh; margin: 0; color: var(--ink); background: var(--bg); font-family: Roboto, "Noto Sans JP", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif; line-height: 1.6; }
button, select, textarea { font: inherit; } button { color: inherit; }
button:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid rgba(26,115,232,.34); outline-offset: 2px; }
[hidden] { display: none !important; }
img.emoji { width: 1em; height: 1em; margin: 0 .05em 0 .1em; vertical-align: -.1em; }
.header { position: sticky; z-index: 10; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 68px; padding: 12px 24px; border-bottom: 1px solid var(--border-light); background: rgba(255,255,255,.97); backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand-icon { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 50%; color: #fff; background: var(--accent); font-size: 13px; font-weight: 700; letter-spacing: -.7px; }
.brand-copy { display: grid; gap: 0; } .brand-text { font-size: 21px; font-weight: 500; letter-spacing: -.45px; line-height: 1.18; }
.brand-sub { margin-top: 3px; color: var(--muted); font-size: 10px; letter-spacing: .75px; }
.settings-btn, .icon-btn, .modal-close { display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
.settings-btn { width: 40px; height: 40px; border: 1px solid var(--border); font-family: Georgia, serif; font-size: 18px; }
.settings-btn:hover, .icon-btn:hover:not(:disabled), .modal-close:hover { background: var(--surface); color: var(--accent); }
.main { width: min(960px, 100%); margin: 0 auto; padding: 30px 24px 38px; }
.lang-bar { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 0 22px; }
.lang-choice { display: flex; align-items: center; gap: 6px; min-width: 152px; }
.flag-emoji { display: inline-grid; width: 28px; min-width: 28px; place-items: center; font-size: 20px; }
.lang-select { width: 100%; appearance: none; padding: 9px 28px 9px 10px; border: 0; border-radius: 5px; color: var(--accent); background-color: transparent; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%231a73e8' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; font-size: 16px; font-weight: 500; cursor: pointer; }
.lang-select:hover, .lang-select:focus { background-color: var(--accent-pale); }
.swap-btn { display: grid; width: 40px; height: 40px; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 21px; cursor: pointer; transition: background .15s, color .15s, transform .2s; }
.swap-btn:hover:not(:disabled) { background: var(--surface); color: var(--accent); transform: rotate(180deg); }
.translate-card { overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: var(--bg); box-shadow: var(--shadow-lg); }
.panes { display: grid; grid-template-columns: 1fr 1fr; }
.pane { display: flex; min-width: 0; min-height: 280px; flex-direction: column; padding: 20px 24px 14px; }
.pane + .pane { border-left: 1px solid var(--border-light); background: var(--surface); }
.pane-header { display: flex; min-height: 36px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.pane-label { color: var(--muted); font-size: 15px; font-weight: 500; } .pane-actions { display: flex; gap: 4px; }
.icon-btn { width: 36px; height: 36px; font-size: 21px; line-height: 1; } .icon-btn:disabled { cursor: default; opacity: .35; }
.text-input, .text-output { display: block; width: 100%; min-height: 170px; flex: 1; padding: 8px 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-family: inherit; font-size: 22px; line-height: 1.65; overflow-wrap: anywhere; }
.text-input { resize: vertical; } .text-input::placeholder, .text-output:empty::before { color: #bdc1c6; }
.text-output { white-space: pre-wrap; } .text-output:empty::before { content: "翻訳結果がここに表示されます"; }
.pane-footer { display: flex; min-height: 34px; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--border-light); }
.char-count, .pane-hint { color: var(--muted); font-size: 11px; } .pane-hint { text-align: right; }
.translate-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; border-top: 1px solid var(--border-light); background: var(--surface); }
.shortcuts { color: var(--muted); font-size: 11px; }
.translate-btn { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 9px; padding: 11px 30px; border: 0; border-radius: 5px; color: #fff; background: var(--accent); box-shadow: 0 1px 3px rgba(26,115,232,.3); font-size: 14px; font-weight: 500; letter-spacing: .2px; cursor: pointer; transition: background .15s, box-shadow .15s; }
.translate-btn:hover:not(:disabled) { background: var(--accent-hover); box-shadow: 0 2px 6px rgba(26,115,232,.4); } .translate-btn:disabled { opacity: .65; cursor: wait; }
.spinner { width: 17px; height: 17px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.info-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; padding: 10px 4px; }
.model-info { display: flex; min-width: 0; align-items: center; gap: 9px; font-size: 13px; }
.status-dot { width: 8px; min-width: 8px; height: 8px; border-radius: 50%; background: #9aa0a6; }
.status-dot.ready { background: var(--success); } .status-dot.busy { background: #f9ab00; animation: pulse 1.2s ease-in-out infinite; } .status-dot.error { background: var(--danger); }
@keyframes pulse { 50% { opacity: .35; } }
#statusText { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.model-badge { display: inline-flex; flex: 0 0 auto; align-items: center; padding: 3px 9px; border-radius: 100px; color: var(--accent); background: var(--accent-pale); font-size: 11px; font-weight: 500; }
.endpoint-text { color: var(--muted); font-size: 11px; text-align: right; }
.caveat { display: flex; gap: 7px; margin-top: 3px; padding: 11px 14px; border: 1px solid #e8eaed; border-radius: 9px; color: var(--muted); background: #fbfcff; font-size: 12px; }
.caveat strong { flex: 0 0 auto; color: #3c4043; font-weight: 500; }
.history-section { margin-top: 23px; padding-top: 19px; border-top: 1px solid var(--border-light); }
.history-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.history-title { margin: 0; color: var(--muted); font-size: 14px; font-weight: 500; }
.history-clear { padding: 4px 7px; border: 0; border-radius: 4px; color: var(--muted); background: transparent; font-size: 12px; cursor: pointer; }
.history-clear:hover { color: var(--accent); background: var(--surface); }
.history-list { display: flex; flex-direction: column; gap: 7px; }
.history-item { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid var(--border-light); border-radius: 8px; background: var(--surface); text-align: left; cursor: pointer; }
.history-item:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.history-text { overflow: hidden; color: var(--ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.history-meta { flex: 0 0 auto; color: var(--muted); font-size: 11px; }
.history-note { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.site-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; padding: 18px 24px 26px; border-top: 1px solid var(--border-light); color: var(--muted); font-size: 10px; text-align: center; }
.site-footer a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; } .site-footer a:hover { color: var(--accent); }
.modal-overlay { position: fixed; z-index: 30; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(32,33,36,.58); }
.modal { width: min(480px, 100%); overflow: hidden; border-radius: 16px; background: var(--bg); box-shadow: var(--shadow-lg); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 0; }
.modal-title { margin: 0; font-size: 20px; font-weight: 400; } .modal-close { width: 38px; height: 38px; font-size: 25px; }
.modal-body { padding: 18px 22px 22px; } .modal-model { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; color: var(--accent); font-size: 14px; font-weight: 600; }
.modal-model span { padding: 2px 8px; border-radius: 100px; background: var(--accent-pale); font-size: 10px; font-weight: 500; }
.modal-body p { margin: 0 0 13px; color: var(--ink); font-size: 14px; line-height: 1.7; } .modal-body p:last-child { margin-bottom: 0; }
.modal-body .modal-small { padding-top: 12px; border-top: 1px solid var(--border-light); color: var(--muted); font-size: 12px; }
.modal-body code { padding: 1px 4px; border-radius: 3px; background: var(--surface); font-size: 12px; }
.modal-footer { display: flex; justify-content: flex-end; padding: 0 22px 20px; }
.btn { min-width: 86px; padding: 9px 16px; border: 1px solid var(--border); border-radius: 5px; color: var(--accent); background: var(--bg); font-size: 13px; font-weight: 500; cursor: pointer; }
.btn-primary { border-color: var(--accent); color: #fff; background: var(--accent); } .btn-primary:hover { background: var(--accent-hover); }
@media (max-width: 720px) {
  .header { min-height: 62px; padding: 10px 16px; } .brand-icon { width: 37px; height: 37px; } .brand-text { font-size: 19px; } .brand-sub { font-size: 9px; }
  .main { padding: 22px 14px 28px; } .lang-bar { gap: 3px; margin-bottom: 15px; } .lang-choice { min-width: 0; width: min(42vw, 175px); gap: 3px; }
  .lang-select { padding-left: 6px; font-size: 14px; } .flag-emoji { width: 24px; min-width: 24px; font-size: 18px; }
  .panes { grid-template-columns: 1fr; } .pane { min-height: 214px; padding: 15px 17px 12px; } .pane + .pane { border-top: 1px solid var(--border-light); border-left: 0; }
  .text-input, .text-output { min-height: 110px; font-size: 19px; } .translate-row { padding: 11px 14px; } .translate-btn { min-width: 145px; flex: 1; }
  .info-bar { align-items: flex-start; flex-direction: column; gap: 5px; margin-top: 13px; } .endpoint-text { padding-left: 17px; text-align: left; }
  .caveat { flex-direction: column; gap: 2px; } .site-footer { padding: 16px 16px 22px; }
}
@media (max-width: 390px) { .pane-hint { max-width: 55%; } .shortcuts { font-size: 10px; } .translate-row { gap: 8px; } .translate-btn { min-width: 125px; padding-right: 17px; padding-left: 17px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }

/* Landing page */
.landing-main { display: grid; min-height: calc(100vh - 138px); place-items: center; padding: 42px 20px; }
.landing-card { width: min(620px, 100%); padding: 44px 48px 37px; border: 1px solid var(--border); border-radius: 18px; background: var(--bg); box-shadow: var(--shadow-lg); text-align: center; }
.landing-eyebrow { display: flex; align-items: center; justify-content: center; gap: 9px; margin: 0 0 16px; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: 1.05px; }
.landing-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.landing-title { margin: 0; color: var(--ink); font-size: clamp(30px, 6vw, 42px); font-weight: 500; letter-spacing: -1.2px; line-height: 1.25; }
.landing-description { max-width: 430px; margin: 17px auto 26px; color: var(--muted); font-size: 14px; line-height: 1.85; }
.landing-open { display: inline-flex; min-width: 154px; min-height: 48px; align-items: center; justify-content: center; gap: 22px; padding: 0 17px 0 23px; border-radius: 6px; color: #fff; background: var(--accent); box-shadow: 0 1px 3px rgba(26,115,232,.3); font-size: 14px; font-weight: 500; text-decoration: none; transition: background .15s, box-shadow .15s, transform .15s; }
.landing-open:hover { transform: translateY(-1px); background: var(--accent-hover); box-shadow: 0 3px 8px rgba(26,115,232,.25); }
.landing-arrow { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 5px; color: var(--accent); background: #fff; font-size: 17px; line-height: 1; }
.landing-note { margin: 16px 0 0; color: #858b91; font-size: 11px; }
.landing-footer { padding: 14px 18px 20px; color: var(--muted); font-size: 10px; text-align: center; }
@media (max-width: 600px) { .landing-main { min-height: calc(100vh - 125px); padding: 28px 16px; } .landing-card { padding: 35px 20px 29px; border-radius: 15px; } .landing-description { margin: 14px auto 23px; font-size: 13px; } }
