/* ==========================================================
   TEAP採点くん — style.css
   dark glass + gradient UI
   ========================================================== */
:root {
  --bg: #070b16;
  --bg-2: #0c1224;
  --card: rgba(255, 255, 255, 0.045);
  --card-border: rgba(255, 255, 255, 0.09);
  --text: #eef2ff;
  --text-dim: #9aa5c4;
  --accent: #38bdf8;
  --accent-2: #818cf8;
  --accent-3: #f472b6;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;
  --grad: linear-gradient(120deg, #38bdf8, #818cf8 55%, #c084fc);
  --radius: 20px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  font-size: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: "Noto Sans JP", "Outfit", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--text-dim); }
.small { font-size: 0.8rem; }
.sp-only { display: none; }
@media (max-width: 560px) { .sp-only { display: block; } }

/* ---------- 背景デコ ---------- */
.bg-deco { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.35; }
.orb-1 { width: 480px; height: 480px; background: #1d4ed8; top: -160px; left: -120px; animation: drift 18s ease-in-out infinite alternate; }
.orb-2 { width: 420px; height: 420px; background: #7c3aed; bottom: -140px; right: -100px; animation: drift 22s ease-in-out infinite alternate-reverse; }
.orb-3 { width: 300px; height: 300px; background: #0891b2; top: 40%; left: 55%; animation: drift 26s ease-in-out infinite alternate; }
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(60px, -40px) scale(1.15); }
}
.grid-overlay {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 30%, transparent 75%);
}

/* ---------- ヘッダー ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(7, 11, 22, 0.65);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.header-inner {
  max-width: 1080px; margin: 0 auto; padding: 0.7rem 1.2rem;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 0.7rem; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--grad);
  display: grid; place-items: center;
  font-family: "Outfit", sans-serif; font-weight: 900; font-size: 1.4rem; color: #fff;
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.5);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 900; font-size: 1.15rem; letter-spacing: 0.02em; }
.brand-name .accent { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.brand-sub { font-size: 0.68rem; color: var(--text-dim); letter-spacing: 0.06em; }
.header-link {
  color: var(--text-dim); text-decoration: none; font-size: 0.85rem;
  padding: 0.4rem 0.9rem; border: 1px solid var(--card-border); border-radius: 999px;
  transition: 0.2s;
}
.header-link:hover { color: var(--text); border-color: var(--accent); }

/* ---------- レイアウト ---------- */
.main { max-width: 880px; margin: 0 auto; padding: 0 1.2rem 4rem; }

/* ---------- HERO ---------- */
.hero { text-align: center; padding: 4.5rem 0 3rem; }
.hero-badge {
  display: inline-block; font-size: 0.8rem; font-weight: 700;
  padding: 0.4rem 1.1rem; border-radius: 999px;
  background: rgba(56, 189, 248, 0.12); color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.35);
  margin-bottom: 1.4rem;
}
.hero-title {
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  font-weight: 900; line-height: 1.2; letter-spacing: 0.01em;
  margin-bottom: 1.1rem;
}
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero-lead { color: var(--text-dim); line-height: 1.9; font-size: 1rem; margin-bottom: 2rem; }
.hero-lead strong { color: var(--text); }
.hero-features {
  display: flex; flex-wrap: wrap; gap: 0.7rem; justify-content: center; margin-top: 2.2rem;
}
.feat {
  display: flex; align-items: center; gap: 0.45rem;
  font-size: 0.85rem; font-weight: 500; color: var(--text-dim);
  background: var(--card); border: 1px solid var(--card-border);
  padding: 0.5rem 1rem; border-radius: 999px;
}

/* ---------- ボタン ---------- */
.btn {
  font-family: inherit; font-weight: 700; font-size: 0.95rem;
  border: none; border-radius: 14px; cursor: pointer;
  padding: 0.85rem 1.6rem; transition: 0.22s;
  display: inline-flex; align-items: center; gap: 0.5rem; justify-content: center;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary {
  background: var(--grad); color: #fff;
  box-shadow: 0 8px 28px rgba(99, 102, 241, 0.45);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 12px 34px rgba(99, 102, 241, 0.6); }
.btn-lg { font-size: 1.08rem; padding: 1rem 2.2rem; border-radius: 16px; }
.btn-ghost {
  background: transparent; color: var(--text-dim);
  border: 1px solid var(--card-border);
}
.btn-ghost:hover { color: var(--text); border-color: rgba(255,255,255,0.3); }
.btn-arrow { transition: transform 0.2s; }
.btn-primary:hover .btn-arrow { transform: translateX(4px); }

/* ---------- ステッパー ---------- */
.wizard { padding-top: 2.5rem; }
.stepper {
  list-style: none; display: flex; justify-content: center; gap: 0;
  margin-bottom: 2.2rem; counter-reset: step;
}
.step {
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  position: relative; flex: 1; max-width: 150px;
}
.step:not(:last-child)::after {
  content: ""; position: absolute; top: 17px; left: calc(50% + 24px);
  width: calc(100% - 48px); height: 2px;
  background: rgba(255, 255, 255, 0.1); border-radius: 2px;
}
.step.is-done:not(:last-child)::after { background: var(--accent); }
.step-dot {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800; font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.07); color: var(--text-dim);
  border: 2px solid rgba(255, 255, 255, 0.12);
  transition: 0.3s;
}
.step.is-active .step-dot {
  background: var(--grad); color: #fff; border-color: transparent;
  box-shadow: 0 0 0 5px rgba(99, 102, 241, 0.22);
}
.step.is-done .step-dot { background: rgba(56, 189, 248, 0.18); color: var(--accent); border-color: var(--accent); }
.step-label { font-size: 0.72rem; color: var(--text-dim); font-weight: 500; }
.step.is-active .step-label { color: var(--text); font-weight: 700; }

/* ---------- パネル ---------- */
.panel {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 2rem 1.8rem;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  animation: panelIn 0.4s ease both;
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.panel-title { font-size: 1.3rem; font-weight: 800; margin-bottom: 0.8rem; text-align: center; }
.panel-note { text-align: center; color: var(--text-dim); font-size: 0.9rem; line-height: 1.8; margin-bottom: 1.4rem; }
.panel-actions { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.8rem; }

/* ---------- タスクカード ---------- */
.task-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; margin-top: 1.5rem; }
@media (max-width: 640px) { .task-cards { grid-template-columns: 1fr; } }
.task-card {
  font-family: inherit; text-align: left; cursor: pointer;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid var(--card-border); border-radius: 18px;
  padding: 1.5rem 1.4rem; color: var(--text); transition: 0.22s;
  position: relative; overflow: hidden;
}
.task-card::before {
  content: ""; position: absolute; inset: 0;
  background: var(--grad); opacity: 0; transition: 0.25s;
}
.task-card:hover { transform: translateY(-4px); border-color: var(--accent-2); box-shadow: 0 14px 40px rgba(99, 102, 241, 0.3); }
.task-card:hover::before { opacity: 0.08; }
.task-card h3 { font-size: 1.12rem; font-weight: 800; margin: 0.7rem 0 0.5rem; position: relative; }
.task-card p { font-size: 0.86rem; color: var(--text-dim); line-height: 1.75; position: relative; }
.task-card p strong { color: var(--accent); }
.task-tag {
  display: inline-block; font-family: "Outfit", sans-serif; font-weight: 800; font-size: 0.78rem;
  padding: 0.3rem 0.85rem; border-radius: 999px; letter-spacing: 0.05em; position: relative;
}
.task-tag-a { background: rgba(56, 189, 248, 0.15); color: #7dd3fc; border: 1px solid rgba(56, 189, 248, 0.4); }
.task-tag-b { background: rgba(192, 132, 252, 0.15); color: #d8b4fe; border: 1px solid rgba(192, 132, 252, 0.4); }
.task-meta { margin-top: 0.9rem; font-size: 0.75rem; color: var(--text-dim); position: relative; }

/* ---------- ドロップゾーン ---------- */
.drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.2); border-radius: 18px;
  padding: 2.2rem 1rem; text-align: center; cursor: pointer;
  transition: 0.2s; background: rgba(255, 255, 255, 0.02);
}
.drop-zone:hover, .drop-zone.is-over {
  border-color: var(--accent); background: rgba(56, 189, 248, 0.06);
}
.drop-icon { font-size: 2.4rem; margin-bottom: 0.6rem; }
.drop-inner p { font-size: 0.92rem; line-height: 1.9; }

.thumbs { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.1rem; }
.thumb {
  position: relative; width: 110px; height: 110px; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--card-border);
  animation: panelIn 0.3s ease both;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-del {
  position: absolute; top: 5px; right: 5px;
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.65); color: #fff; border: none;
  font-size: 0.85rem; cursor: pointer; display: grid; place-items: center;
}
.thumb-del:hover { background: var(--bad); }

/* ---------- 確認ボックス ---------- */
.confirm-grid { display: grid; gap: 0.7rem; margin: 1.4rem 0; }
.confirm-item {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--card-border);
  border-radius: 12px; padding: 0.85rem 1.2rem;
}
.confirm-label { color: var(--text-dim); font-size: 0.85rem; }
.confirm-value { font-weight: 700; }

/* ---------- ローディング ---------- */
.loading { text-align: center; padding: 2.5rem 0 1.5rem; }
.scanner { display: flex; justify-content: center; margin-bottom: 1.6rem; }
.scanner-paper {
  width: 130px; height: 165px; border-radius: 10px; position: relative; overflow: hidden;
  background: linear-gradient(160deg, #f8fafc, #e2e8f0);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.scan-text-lines { position: absolute; inset: 18px 16px; display: flex; flex-direction: column; gap: 11px; }
.scan-text-lines i {
  display: block; height: 7px; border-radius: 4px;
  background: #cbd5e1;
}
.scan-text-lines i:nth-child(2) { width: 85%; }
.scan-text-lines i:nth-child(3) { width: 70%; }
.scan-text-lines i:nth-child(4) { width: 90%; }
.scan-text-lines i:nth-child(5) { width: 55%; }
.scan-line {
  position: absolute; left: 0; right: 0; height: 42px; z-index: 2;
  background: linear-gradient(to bottom, transparent, rgba(56, 189, 248, 0.45), transparent);
  animation: scan 1.8s ease-in-out infinite;
}
@keyframes scan {
  0%, 100% { top: -42px; }
  50% { top: 165px; }
}
.loading-msg { font-weight: 700; font-size: 1rem; margin-bottom: 1.2rem; min-height: 1.6em; }
.loading-bar {
  width: min(320px, 80%); height: 8px; margin: 0 auto;
  background: rgba(255, 255, 255, 0.08); border-radius: 999px; overflow: hidden;
}
.loading-bar-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: var(--grad); transition: width 0.6s ease;
}

/* ---------- エラー ---------- */
.error-box { text-align: center; padding: 2rem 0 1rem; }
.error-box p {
  color: var(--bad); font-weight: 600; line-height: 1.8; margin-bottom: 1.4rem;
  background: rgba(251, 113, 133, 0.08); border: 1px solid rgba(251, 113, 133, 0.3);
  border-radius: 12px; padding: 1rem 1.2rem;
}

/* ---------- 結果 ---------- */
.result { padding-top: 2.5rem; animation: panelIn 0.5s ease both; }
.result-header { text-align: center; margin-bottom: 2rem; }
.result-task-chip {
  display: inline-block; font-family: "Outfit", sans-serif; font-weight: 800; font-size: 0.85rem;
  background: rgba(56, 189, 248, 0.14); color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.4);
  padding: 0.35rem 1.1rem; border-radius: 999px; margin-bottom: 0.8rem;
}
.result-title { font-size: 2rem; font-weight: 900; }
.result-date { color: var(--text-dim); font-size: 0.8rem; margin-top: 0.4rem; }

.score-hero {
  display: grid; grid-template-columns: auto 1fr; gap: 2rem; align-items: center;
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 2rem;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow); margin-bottom: 1.4rem;
}
@media (max-width: 640px) { .score-hero { grid-template-columns: 1fr; text-align: center; } }

.gauge-wrap { position: relative; width: 190px; height: 190px; margin: 0 auto; }
.gauge { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge-track { fill: none; stroke: rgba(255, 255, 255, 0.08); stroke-width: 13; }
.gauge-fill {
  fill: none; stroke: url(#gaugeGrad); stroke-width: 13; stroke-linecap: round;
  stroke-dasharray: 527.8; stroke-dashoffset: 527.8;
  transition: stroke-dashoffset 1.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.gauge-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 0.4rem;
}
.gauge-score { font-family: "Outfit", sans-serif; font-weight: 900; font-size: 2.9rem; line-height: 1; }
.gauge-max { font-size: 1rem; color: var(--text-dim); font-weight: 600; }
.cefr-chip {
  font-family: "Outfit", sans-serif; font-weight: 800; font-size: 0.95rem;
  background: var(--grad); color: #fff;
  padding: 0.25rem 1rem; border-radius: 999px;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.45);
}
.examiner-comment { line-height: 2; font-size: 0.95rem; }
.word-count { margin-top: 1rem; font-size: 0.85rem; color: var(--text-dim); }
.word-count strong { color: var(--accent); font-size: 1.05rem; }

/* ---------- 基準カード ---------- */
.criteria-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-bottom: 1.8rem;
}
@media (max-width: 640px) { .criteria-grid { grid-template-columns: 1fr; } }
.crit-card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: 16px; padding: 1.2rem 1.3rem;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.crit-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.6rem; }
.crit-name { font-weight: 700; font-size: 0.92rem; }
.crit-band { font-family: "Outfit", sans-serif; font-weight: 900; font-size: 1.3rem; }
.crit-band small { font-size: 0.75rem; color: var(--text-dim); font-weight: 600; }
.crit-bar { height: 7px; background: rgba(255, 255, 255, 0.08); border-radius: 999px; overflow: hidden; margin-bottom: 0.7rem; }
.crit-bar-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: var(--grad);
  transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.crit-comment { font-size: 0.83rem; color: var(--text-dim); line-height: 1.75; }

/* ---------- タブ ---------- */
.tabs {
  display: flex; gap: 0.4rem; overflow-x: auto; padding-bottom: 0.3rem;
  margin-bottom: 1rem; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  font-family: inherit; font-weight: 700; font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.05); color: var(--text-dim);
  border: 1px solid var(--card-border); border-radius: 999px;
  padding: 0.55rem 1.15rem; cursor: pointer; white-space: nowrap; transition: 0.2s;
}
.tab:hover { color: var(--text); }
.tab.is-active {
  background: var(--grad); color: #fff; border-color: transparent;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}
.tab-panel {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 1.6rem;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: panelIn 0.3s ease both;
}

/* 講評 */
.sw-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
@media (max-width: 640px) { .sw-cols { grid-template-columns: 1fr; } }
.sw-col h4 { font-size: 0.95rem; margin-bottom: 0.8rem; }
.sw-col ul { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; }
.sw-col li {
  font-size: 0.87rem; line-height: 1.75; padding: 0.7rem 0.9rem; border-radius: 10px;
}
.sw-good li { background: rgba(52, 211, 153, 0.08); border-left: 3px solid var(--good); }
.sw-bad li { background: rgba(251, 191, 36, 0.08); border-left: 3px solid var(--warn); }

/* 添削 */
.corr-item {
  border: 1px solid var(--card-border); border-radius: 14px;
  padding: 1rem 1.2rem; margin-bottom: 0.9rem;
  background: rgba(255, 255, 255, 0.03);
}
.corr-type {
  display: inline-block; font-size: 0.7rem; font-weight: 700;
  padding: 0.2rem 0.7rem; border-radius: 999px; margin-bottom: 0.6rem;
  background: rgba(129, 140, 248, 0.15); color: var(--accent-2);
  border: 1px solid rgba(129, 140, 248, 0.35);
}
.corr-original {
  font-family: "Outfit", "Noto Sans JP", sans-serif;
  color: var(--bad); text-decoration: line-through;
  font-size: 0.92rem; line-height: 1.7; margin-bottom: 0.35rem;
  text-decoration-thickness: 1.5px;
}
.corr-fixed {
  font-family: "Outfit", "Noto Sans JP", sans-serif;
  color: var(--good); font-weight: 600; font-size: 0.95rem; line-height: 1.7; margin-bottom: 0.5rem;
}
.corr-explain { font-size: 0.83rem; color: var(--text-dim); line-height: 1.75; }
.corr-empty { text-align: center; color: var(--text-dim); padding: 1.5rem 0; }

/* 書き起こし */
.transcript {
  font-family: "Outfit", "Noto Sans JP", monospace;
  white-space: pre-wrap; word-break: break-word;
  background: rgba(0, 0, 0, 0.3); border: 1px solid var(--card-border);
  border-radius: 12px; padding: 1.2rem; line-height: 1.9; font-size: 0.92rem;
  margin-bottom: 0.8rem;
}
.illegible-mark { background: rgba(251, 191, 36, 0.25); color: var(--warn); border-radius: 4px; padding: 0 4px; }

/* モデルアンサー */
.model-answer {
  font-family: "Outfit", "Noto Sans JP", sans-serif;
  line-height: 2; font-size: 0.97rem;
  background: rgba(52, 211, 153, 0.05); border: 1px solid rgba(52, 211, 153, 0.2);
  border-radius: 12px; padding: 1.3rem;
}

/* アドバイス */
.advice-box { line-height: 2; font-size: 0.93rem; white-space: pre-wrap; }

.result-actions { text-align: center; margin: 2.2rem 0 1rem; }
.disclaimer { text-align: center; font-size: 0.72rem; color: var(--text-dim); line-height: 1.8; }

/* ---------- フッター ---------- */
.site-footer {
  text-align: center; padding: 2rem 1rem 3rem; color: var(--text-dim); font-size: 0.8rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.site-footer a { color: var(--accent); text-decoration: none; }
