:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  color: #111;
  background: #fff;
  font-synthesis: none;
  --border: #dedede;
  --muted: #666;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; line-height: 1.6; }
button, input, textarea, select { font: inherit; }
button, input, textarea, select, summary { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-underline-offset: 3px; }
button {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid #aaa;
  border-radius: 5px;
  background: #fff;
  color: #111;
  font-weight: 600;
  cursor: pointer;
}
button:hover:not(:disabled) { background: #f3f3f3; }
button:disabled { opacity: .42; cursor: not-allowed; }
:focus-visible { outline: 2px solid #111; outline-offset: 3px; }
[hidden] { display: none !important; }
header {
  max-width: 1180px;
  margin: auto;
  padding: 22px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 20px;
  border-bottom: 1px solid var(--border);
}
.brand { font-size: 17px; font-weight: 650; text-decoration: none; }
#connection { color: var(--muted); font-size: 12px; }
main { max-width: 1180px; margin: auto; padding: 32px; }
.intro { margin-bottom: 24px; }
h1 { margin: 0; font-size: 24px; line-height: 1.5; font-weight: 650; }
h2 { margin: 0; font-size: 16px; font-weight: 650; }
h3 { margin: 24px 0 8px; font-size: 13px; font-weight: 600; color: #444; }
p { margin: 0 0 12px; }
.card { border: 1px solid var(--border); border-radius: 6px; padding: 24px; margin-bottom: 20px; }
.connect { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 24px; }
.connect p { font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.connect form { display: flex; gap: 8px; margin-left: auto; min-width: 0; }
.connect input { width: 230px; min-width: 0; padding: 10px 12px; border: 1px solid #888; border-radius: 5px; }
#serverInfo { flex-basis: 100%; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 390px; align-items: start; gap: 24px; }
.content, aside { min-width: 0; }
.section-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.section-top .quiet { margin: -10px 0; }
.modes { display: flex; gap: 0; margin-bottom: 24px; border: 1px solid #888; border-radius: 5px; overflow: hidden; }
.modes button { flex: 1; min-width: 0; border: 0; border-right: 1px solid #888; border-radius: 0; font-weight: 500; }
.modes button:last-child { border-right: 0; }
.modes .active { color: #fff; background: #111; font-weight: 600; }
.modes .active:hover:not(:disabled) { background: #222; }
.modes button:focus-visible { outline-offset: -4px; }
.input-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; font-weight: 500; }
.language-label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #444; }
select { min-height: 40px; border: 1px solid #888; border-radius: 4px; background: #fff; color: #111; padding: 6px 10px; }
textarea { display: block; width: 100%; min-height: 160px; resize: vertical; border: 1px solid #888; border-radius: 5px; padding: 14px; color: #111; background: #fff; line-height: 1.8; }
textarea::placeholder, input::placeholder { color: #707070; opacity: 1; }
.text-bottom { display: flex; justify-content: space-between; gap: 12px; margin: 9px 0 16px; font-size: 12px; color: var(--muted); }
.upload { display: flex; align-items: center; position: relative; padding: 16px; border: 1px dashed #888; border-radius: 5px; cursor: pointer; }
.upload > span { min-width: 0; }
.upload strong { display: block; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.upload small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.upload input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload:focus-within { outline: 2px solid #111; outline-offset: 3px; }
.small { color: var(--muted); font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
#jobForm > .small { margin: 12px 0 0; }
.submit-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 20px; margin-top: 20px; border-top: 1px solid var(--border); }
.submit-row > span { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.primary { background: #111; color: #fff; border-color: #111; white-space: nowrap; }
.primary:hover:not(:disabled) { background: #333; }
.secondary { background: #fff; }
.quiet { border-color: transparent; color: #444; background: transparent; }
.secondary-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.secondary-actions:has(button:not([hidden])) { margin-top: 12px; }
.error { border-left: 3px solid #111; padding: 10px 12px; margin: 16px 0 0; background: #f4f4f4; font-size: 13px; font-weight: 500; }
.empty { color: var(--muted); padding: 8px 0; }
.empty p { margin: 0; }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.9; }
.short-result { padding: 16px; border: 1px solid var(--border); border-radius: 4px; }
.result-meta { font-size: 12px; color: #555; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.citation-list { padding-left: 20px; line-height: 1.9; overflow-wrap: anywhere; }
.citation-list li + li { margin-top: 8px; }
#history { list-style: none; padding: 0; margin: 0; }
#history > .small { padding: 8px 0; }
.history-item { display: flex; align-items: center; gap: 12px; padding: 16px 0; border-top: 1px solid var(--border); }
.history-item:first-child { border-top: 0; }
.history-open { flex: 1; min-width: 0; border: 0; background: transparent; padding: 0; text-align: left; font-size: 13px; font-weight: 500; line-height: 1.8; overflow-wrap: anywhere; }
.history-open:hover:not(:disabled) { background: transparent; text-decoration: underline; }
.history-open small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 4px; }
.history-delete { padding: 8px 12px; font-size: 12px; flex-shrink: 0; }
.preview-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 2px 0 16px; }
.preview-label span { font-size: 12px; color: var(--muted); }
.preview-frame { width: 100%; aspect-ratio: 390 / 450; }
.watch { width: 100%; height: 100%; display: flex; flex-direction: column; gap: 20px; border: 8px solid #111; border-radius: 26px; padding: 24px; background: #111; color: #fff; overflow: hidden; }
.watch-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid #555; font-size: 14px; font-weight: 600; }
.watch-top time { font-size: 13px; color: #ddd; font-weight: 400; }
.watch-mode { font-size: 14px; font-weight: 600; }
.watch p { flex: 1; min-height: 0; overflow-y: auto; overflow-wrap: anywhere; white-space: pre-wrap; font-size: 18px; line-height: 1.8; margin: 0; }
.watch p:focus-visible { outline-color: #fff; }
.watch-footer { color: #ccc; font-size: 12px; border-top: 1px solid #555; padding-top: 12px; }
details { margin-top: 24px; border-top: 1px solid var(--border); padding-top: 16px; font-size: 13px; }
summary { font-weight: 500; cursor: pointer; min-height: 44px; }
details .small { margin-bottom: 12px; }
#diagnosticResult { margin: 12px 0 0; overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 1060px) {
  .workspace { grid-template-columns: minmax(0,1fr) 320px; }
  .connect form { flex: 1; }
  .connect input { flex: 1; width: 180px; }
  .watch { padding: 18px; gap: 14px; }
}
@media (max-width: 780px) {
  header { padding: 18px 20px; }
  main { padding: 24px 20px; }
  h1 { font-size: 22px; }
  .workspace { grid-template-columns: minmax(0,1fr); gap: 8px; }
  .card { padding: 20px; }
  .connect form { margin-left: 0; flex-basis: 100%; }
  .connect input { width: 0; }
  input, textarea, select { font-size: 16px; }
  .workspace aside { width: 100%; max-width: 390px; justify-self: center; }
  .prewrap { font-size: 15px; }
  .watch { padding: 20px; gap: 18px; }
  .history-item { gap: 8px; }
}
