:root {
  --ink: #16243a;
  --muted: #67758a;
  --line: #dfe5ec;
  --surface: #ffffff;
  --canvas: #f4f7f9;
  --primary: #087e8b;
  --primary-dark: #05636d;
  --accent: #ffb000;
  font-family: "Segoe UI", "Yu Gothic UI", Meiryo, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 80% 0, #e5f7f5 0, transparent 32rem), var(--canvas); }
button, select, input { font: inherit; }
.hidden { display: none !important; }

.site-header { height: 76px; padding: 0 clamp(20px, 5vw, 72px); display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,.9); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); }
.brand { display: flex; gap: 12px; align-items: center; color: var(--ink); text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: #fff; font-weight: 800; background: linear-gradient(135deg, var(--primary), #16a5a4); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; letter-spacing: .02em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 10px; letter-spacing: .12em; }
.session-actions { display: flex; align-items: center; gap: 14px; }
.user-label { color: var(--muted); font-size: 13px; }

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 58px 0 72px; }
.hero-copy { max-width: 720px; margin-bottom: 32px; }
.eyebrow { color: var(--primary); font-size: 12px; font-weight: 800; letter-spacing: .16em; }
h1 { margin: 8px 0 12px; font-size: clamp(32px, 5vw, 52px); line-height: 1.15; letter-spacing: -.04em; }
.hero-copy > p:last-child, .login-panel > p { color: var(--muted); line-height: 1.8; }
.grid { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); gap: 24px; align-items: stretch; }
.card { padding: clamp(22px, 3vw, 34px); background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 18px 50px rgba(31, 54, 75, .07); }
.card-heading { display: flex; gap: 14px; align-items: center; margin-bottom: 24px; }
.step { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: var(--primary); background: #e5f5f4; font-size: 12px; font-weight: 800; }
.card h2 { margin: 0 0 3px; font-size: 20px; }
.card-heading p { margin: 0; color: var(--muted); font-size: 13px; }

.drop-zone { min-height: 210px; padding: 24px; display: flex; flex-direction: column; gap: 8px; justify-content: center; align-items: center; border: 1.5px dashed #9db1be; border-radius: 16px; background: #f9fbfc; cursor: pointer; text-align: center; transition: .2s ease; }
.drop-zone:hover, .drop-zone.drag { border-color: var(--primary); background: #eef9f8; transform: translateY(-1px); }
.drop-zone input { position: absolute; opacity: 0; pointer-events: none; }
.drop-zone span:last-child { color: var(--muted); font-size: 13px; }
.upload-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 5px; border-radius: 50%; color: #fff; background: var(--primary); font-size: 25px; font-weight: 300; }
.preview-panel { display: flex; gap: 13px; align-items: center; margin-top: 14px; padding: 10px; background: #f7f9fa; border-radius: 13px; }
.preview-panel img { width: 58px; height: 58px; object-fit: cover; border-radius: 9px; }
.preview-panel strong, .preview-panel span { display: block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-panel span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.field { margin: 22px 0; }
.field label { display: block; margin-bottom: 8px; font-weight: 700; font-size: 13px; }
select { width: 100%; padding: 12px 42px 12px 13px; color: var(--ink); background: #fff; border: 1px solid #bdc8d2; border-radius: 10px; }
.field-help { min-height: 32px; margin: 8px 2px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

.button { padding: 10px 18px; border: 0; border-radius: 10px; cursor: pointer; font-weight: 700; transition: .18s ease; }
.button.primary { color: #fff; background: var(--primary); box-shadow: 0 8px 20px rgba(8,126,139,.18); }
.button.primary:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-1px); }
.button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.button.ghost { color: var(--ink); background: transparent; border: 1px solid var(--line); }
.button.full { width: 100%; min-height: 48px; }
.error-message { padding: 11px 13px; color: #9f2336; background: #fff0f2; border-radius: 9px; font-size: 13px; }

.result-card { min-height: 650px; }
.empty-result { min-height: 470px; display: grid; place-content: center; color: #91a0ae; text-align: center; }
.empty-result > span { width: 72px; height: 72px; margin: 0 auto 13px; display: grid; place-items: center; color: #83a0a3; background: #edf3f3; border-radius: 22px; font-family: serif; font-size: 31px; }
.empty-result p { line-height: 1.7; }
.progress-panel { min-height: 470px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); text-align: center; }
.progress-panel strong { color: var(--ink); }
.spinner { width: 42px; height: 42px; margin-bottom: 8px; border: 3px solid #d8e8e9; border-top-color: var(--primary); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.result-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 13px; }
.badge { padding: 5px 9px; color: #00606c; background: #def4f2; border-radius: 999px; font-size: 11px; font-weight: 800; }
.badge.muted { color: #646f7e; background: #eef1f4; }
.copy-button { margin-left: auto; padding: 6px 10px; color: var(--primary); background: transparent; border: 0; cursor: pointer; font-weight: 700; }
pre { min-height: 330px; max-height: 420px; margin: 0; padding: 20px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: #202d3f; background: #f7f9fb; border: 1px solid #e5e9ee; border-radius: 13px; font-family: Consolas, "Yu Gothic UI", monospace; font-size: 14px; line-height: 1.7; }
.details { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 18px 0 0; }
.details div { padding: 10px 12px; background: #f8fafb; border-radius: 9px; }
.details dt { color: var(--muted); font-size: 10px; }
.details dd { margin: 4px 0 0; font-size: 12px; font-weight: 700; overflow-wrap: anywhere; }
.login-panel { max-width: 700px; margin: 9vh auto; padding: clamp(34px, 7vw, 70px); background: #fff; border: 1px solid var(--line); border-radius: 28px; box-shadow: 0 24px 70px rgba(31,54,75,.09); text-align: center; }
.login-panel .button { margin-top: 20px; padding: 13px 24px; }
footer { padding: 26px; color: #84909d; border-top: 1px solid var(--line); text-align: center; font-size: 11px; letter-spacing: .08em; }

@media (max-width: 820px) {
  .grid { grid-template-columns: 1fr; }
  .site-header { height: 68px; }
  .user-label { display: none; }
  main { padding-top: 36px; }
  .result-card { min-height: 520px; }
}

@media (max-width: 520px) {
  main { width: min(100% - 24px, 1180px); }
  .brand small { display: none; }
  .card { border-radius: 17px; }
  .details { grid-template-columns: 1fr; }
}
