/* ============================================================
   style.css — MNIST 手書き数字認識デモ
   ============================================================ */

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

body {
  background: #0f1520;
  color: #c8d8f0;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 28px 16px 40px;
}

.container {
  width: 100%;
  max-width: 800px;
}

h1 {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: #8ec4f8;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.subtitle {
  text-align: center;
  color: #4a6480;
  font-size: 0.84rem;
  margin-bottom: 24px;
}

/* ── キャンバス ─────────────────────────────────────────── */
.canvas-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.canvas-wrapper {
  position: relative;
}

#drawCanvas {
  display: block;
  background: #ffffff;
  border: 2px solid #2a3a5a;
  border-radius: 10px;
  cursor: crosshair;
  touch-action: none;
  box-shadow: 0 0 0 4px #0f1520, 0 0 0 5px #2a3a5a;
}

.canvas-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b0b8c4;
  font-size: 0.9rem;
  pointer-events: none;
  transition: opacity 0.2s;
  border-radius: 10px;
}
.canvas-hint.hidden { opacity: 0; }

/* ── 消去ボタン ─────────────────────────────────────────── */
.btn-clear {
  padding: 9px 36px;
  border-radius: 7px;
  border: 1px solid #2a3a5a;
  background: #1a2436;
  color: #8aabcc;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  letter-spacing: 0.02em;
}
.btn-clear:hover  { background: #1e2c44; color: #c8d8f0; }
.btn-clear:active { background: #161e30; }

/* ── ステータス ─────────────────────────────────────────── */
.status {
  text-align: center;
  font-size: 0.80rem;
  color: #5a7090;
  margin-bottom: 20px;
  min-height: 16px;
  transition: color 0.2s;
}
.status.ok    { color: #4ecca3; }
.status.warn  { color: #e0a040; }
.status.error { color: #e06050; }

/* ── 結果エリア ─────────────────────────────────────────── */
.results {
  display: none;
  gap: 14px;
}

.result-card {
  flex: 1;
  background: #161e30;
  border: 1px solid #2a3a5a;
  border-radius: 10px;
  padding: 18px;
  min-width: 0;
}

.card-header {
  font-size: 0.86rem;
  font-weight: 600;
  color: #8ec4f8;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid #1e2c44;
}

.pred-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 18px;
}
.pred-label {
  font-size: 0.84rem;
  color: #6080a0;
}
.pred-val {
  font-size: 2.4rem;
  font-weight: 800;
  color: #4ecca3;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* ── 確率バー ───────────────────────────────────────────── */
.prob-section-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #3a5070;
  margin-bottom: 8px;
}

.prob-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.prob-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.prob-digit {
  width: 12px;
  font-size: 0.76rem;
  color: #506080;
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.prob-bar-bg {
  flex: 1;
  height: 9px;
  background: #1a2436;
  border-radius: 5px;
  overflow: hidden;
}

.prob-bar-fill {
  height: 100%;
  border-radius: 5px;
  background: #2e4878;
  transition: width 0.12s ease-out;
}
.prob-bar-fill.top {
  background: linear-gradient(90deg, #3aaa88, #4ecca3);
}

.prob-pct {
  width: 40px;
  font-size: 0.70rem;
  color: #4a6080;
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.prob-pct.top {
  color: #4ecca3;
  font-weight: 600;
}

/* ── レスポンシブ ───────────────────────────────────────── */
@media (max-width: 560px) {
  .results    { flex-direction: column; }
  #drawCanvas { width: 260px !important; height: 260px !important; }
  .pred-val   { font-size: 2rem; }
}
