/* ============================================================
   ベースリセット
   (旧 Tailwind Play CDN の Preflight 相当。挙動維持に必要な範囲のみ)
   ============================================================ */
*, ::before, ::after {
  box-sizing: border-box;
  border-width: 0;
  border-style: solid;
  border-color: #e5e7eb;
}
html {
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  line-height: inherit;
}
h1, h2, h3, p {
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
}
table {
  text-indent: 0;
  border-color: inherit;
  border-collapse: collapse;
}
button, input {
  font-family: inherit;
  font-size: 100%;
  font-weight: inherit;
  line-height: inherit;
  color: inherit;
  margin: 0;
  padding: 0;
}
button {
  background-color: transparent;
  background-image: none;
  text-transform: none;
  -webkit-appearance: button;
  cursor: pointer;
}
input::placeholder {
  color: #9ca3af;
  opacity: 1;
}
img {
  max-width: 100%;
  height: auto;
}

/* ============================================================
   ユーティリティ
   (旧 Tailwind で使っていたクラスの自前定義。値は Tailwind v3 準拠、
    カラー・角丸は旧 tailwind.config のトークン)
   ============================================================ */

/* レイアウト */
.fixed { position: fixed; }
.inset-0 { inset: 0; }
.z-50 { z-index: 50; }
.flex { display: flex; }
.inline-block { display: inline-block; }
.flex-1 { flex: 1 1 0%; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.overflow-hidden { overflow: hidden; }

/* サイズ */
.min-h-screen { min-height: 100vh; }
.h-2 { height: 8px; }
.h-full { height: 100%; }
.w-full { width: 100%; }
.max-w-sm { max-width: 384px; }
.max-w-380 { max-width: 380px; }
.w-col-label { width: 13%; }   /* 時限ラベル列 */
.w-col-day { width: 17.4%; }   /* 曜日列 × 5 */

/* 余白 */
.p-5 { padding: 20px; }
.px-2 { padding-left: 8px; padding-right: 8px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.px-6 { padding-left: 24px; padding-right: 24px; }
.px-2px { padding-left: 2px; padding-right: 2px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }
.py-6 { padding-top: 24px; padding-bottom: 24px; }
.py-10 { padding-top: 40px; padding-bottom: 40px; }
.py-16 { padding-top: 64px; padding-bottom: 64px; }
.pt-3 { padding-top: 12px; }
.pt-5 { padding-top: 20px; }
.pb-1 { padding-bottom: 4px; }
.pb-2 { padding-bottom: 8px; }
.pb-4 { padding-bottom: 16px; }
.mt-2px { margin-top: 2px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

/* 文字 */
.text-10 { font-size: 10px; }
.text-11 { font-size: 11px; }
.text-12 { font-size: 12px; }
.text-13 { font-size: 13px; }
.text-14 { font-size: 14px; }
.text-15 { font-size: 15px; }
.text-20 { font-size: 20px; }
.text-28 { font-size: 28px; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-bold { font-weight: 700; }
.leading-tight { line-height: 1.25; }
.leading-snug { line-height: 1.375; }
.leading-relaxed { line-height: 1.625; }
.text-left { text-align: left; }
.text-center { text-align: center; }
.align-middle { vertical-align: middle; }

/* 色(旧 tailwind.config のカラートークン) */
.text-ink { color: #222222; }
.text-muted { color: #6a6a6a; }
.text-muted-soft { color: #929292; }
.bg-white { background-color: #ffffff; }

/* 枠線・角丸 */
.border-t { border-top-width: 1px; }
.border-collapse { border-collapse: collapse; }
.rounded-sm { border-radius: 8px; }
.rounded-md { border-radius: 14px; }

/* テーブル */
.table-fixed { table-layout: fixed; }

/* 表示切替(.flex より後に定義して、併用時に必ず非表示が勝つようにする) */
.hidden { display: none; }

/* ============================================================
   ベーススタイル
   ============================================================ */
html, body {
  background-color: #ffffff;
  color: #222222;
  font-family: 'Inter', 'Noto Sans JP', -apple-system, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
/* テキスト入力 focus: 2px ink 枠、リング/グロー禁止 */
.app-input {
  height: 56px;
  border-radius: 8px;
  border: 1px solid #dddddd;
  background: #ffffff;
  padding: 0 16px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.1s ease, border-width 0.1s ease;
}
.app-input:focus {
  border: 2px solid #222222;
  padding: 0 15px; /* 枠が太くなる分を相殺してガタつき防止 */
}
.btn-primary {
  height: 48px;
  border-radius: 8px;
  background-color: #ff385c;
  color: #ffffff;
  font-weight: 500;
  font-size: 16px;
  transition: background-color 0.1s ease;
}
.btn-primary:hover {
  background-color: #e00b41;
}
.btn-primary:active {
  background-color: #e00b41;
}
.btn-primary:disabled {
  background-color: #ffd1da;
  cursor: default;
}
.btn-secondary {
  height: 48px;
  border-radius: 8px;
  background-color: #ffffff;
  color: #222222;
  border: 1px solid #222222;
  font-weight: 500;
  font-size: 16px;
}
.btn-tertiary {
  background: transparent;
  color: #222222;
  font-weight: 500;
  font-size: 15px;
}
.btn-tertiary:hover {
  text-decoration: underline;
}
.shadow-card1 {
  box-shadow: rgba(0,0,0,0.02) 0 0 0 1px, rgba(0,0,0,0.04) 0 2px 6px, rgba(0,0,0,0.1) 0 4px 8px;
}
/* 時間割の各マス */
.cell-subject {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}
.cell-teacher {
  font-size: 9.5px;
  color: #6a6a6a;
  line-height: 1.2;
  white-space: nowrap;
  margin-top: 2px;
}
.miracle-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  color: #ff385c;
  background: #fff0f2;
  border-radius: 9999px;
  padding: 1px 5px;
  margin-bottom: 2px;
  white-space: nowrap;
}
#view-result.hidden, #view-top.hidden, #save-modal.hidden {
  display: none;
}
#save-modal {
  background: rgba(0,0,0,0.5);
}
/* スマホでの横スクロール防止 */
html, body {
  overflow-x: hidden;
}

/* ============ トップビュー ============ */
#view-top {
  background-color: #fff0f2;
}
.top-card {
  background-color: #ffffff;
  border-radius: 14px;
  padding: 32px 24px;
}
.top-badge {
  display: inline-block;
  background-color: #ffffff;
  color: #ff385c;
  border: 1px solid #ffd1da;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 12px;
  margin-bottom: 14px;
}
/* サンプル時間割ミニプレビュー(純粋な装飾) */
.mini-preview-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}
.mini-preview {
  width: 220px;
  transform: rotate(-2deg);
  background-color: #ffffff;
  border: 1px solid #ebebeb;
  border-radius: 8px;
  overflow: hidden;
}
.mini-preview table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.mini-preview th {
  background-color: #f7f7f7;
  font-size: 10px;
  font-weight: 500;
  color: #6a6a6a;
  padding: 4px 0;
  border-bottom: 1px solid #ebebeb;
  border-right: 1px solid #ebebeb;
}
.mini-preview td {
  text-align: center;
  vertical-align: middle;
  font-size: 11px;
  font-weight: 600;
  color: #222222;
  padding: 8px 2px;
  border-bottom: 1px solid #ebebeb;
  border-right: 1px solid #ebebeb;
  white-space: nowrap;
}
.mini-preview th:last-child,
.mini-preview td:last-child {
  border-right: none;
}
.mini-preview tr:last-child td {
  border-bottom: none;
}
.mini-preview td.mini-funny {
  background-color: #fff0f2;
  color: #ff385c;
}

/* ============ 診断中オーバーレイ ============ */
#diagnosing-overlay {
  position: fixed;
  inset: 0;
  z-index: 40; /* 保存モーダル(z-50)より下 */
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}
#diagnosing-overlay.hidden {
  display: none;
}
.diagnosing-spinner {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  border: 3px solid #ffd1da;
  border-top-color: #ff385c;
  animation: diagnosing-spin 0.8s linear infinite;
}
@keyframes diagnosing-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
#diagnosing-message {
  font-size: 14px;
  color: #6a6a6a;
}

/* ============ 結果カードの登場アニメーション ============ */
@keyframes card-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes actions-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
#capture-card.anim-card-enter {
  animation: card-enter 0.35s ease-out both;
}
#result-actions.anim-actions-enter {
  animation: actions-enter 0.35s ease-out 0.1s both;
}

@media (prefers-reduced-motion: reduce) {
  .diagnosing-spinner {
    animation: none;
  }
  #capture-card.anim-card-enter,
  #result-actions.anim-actions-enter {
    animation: none !important;
    opacity: 1;
    transform: none;
  }
}
