/* =========================
   Base
========================= */
* {
  box-sizing: border-box;
}

:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-border: #e6eaf2;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary: #eef2ff;
  --success-bg: #ecfdf5;
  --success-text: #047857;
  --error-bg: #fef2f2;
  --error-text: #b91c1c;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 18px;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic",
    "Meiryo", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, #eef4ff 0%, transparent 35%),
    linear-gradient(180deg, #f8fbff 0%, #f3f6fb 100%);
  color: var(--text);
  line-height: 1.6;
}

/* =========================
   Layout
========================= */
.container {
  width: min(100%, 1040px);
  margin: 0 auto;
  padding: 32px 16px 56px;
}

.page-header {
  margin-bottom: 24px;
  padding: 8px 4px;
}

.page-header h1 {
  margin: 0 0 8px;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #111827;
}

.page-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
}

/* =========================
   Panels
========================= */
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 22px;
}

.panel h2 {
  margin: 0 0 16px;
  font-size: 1.15rem;
  font-weight: 700;
  color: #111827;
}

/* =========================
   Form
========================= */
.form-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px 16px;
  align-items: end;
}

.form-item {
  grid-column: span 4;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.secret-item {
  grid-column: span 12;
}

.form-item label {
  font-size: 0.92rem;
  font-weight: 600;
  color: #374151;
}

.form-item input,
.form-item select {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid #d6dbe6;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.form-item input::placeholder {
  color: #9ca3af;
}

.form-item input:focus,
.form-item select:focus {
  border-color: rgba(37, 99, 235, 0.75);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
  background: #fcfdff;
}

/* =========================
   Buttons
========================= */
.button-row {
  grid-column: span 12;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
}

button {
  appearance: none;
  border: none;
  border-radius: 12px;
  height: 46px;
  padding: 0 18px;
  font-size: 0.96rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease,
    opacity 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button[type="submit"] {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.24);
}

button[type="submit"]:hover {
  background: var(--primary-hover);
}

#syncBtn {
  background: var(--secondary);
  color: #3730a3;
  border: 1px solid #c7d2fe;
}

#syncBtn:hover {
  background: #e0e7ff;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* =========================
   Status
========================= */
.status {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  color: #334155;
  font-size: 0.95rem;
  font-weight: 600;
}

.status.error {
  background: var(--error-bg);
  border-color: #fecaca;
  color: var(--error-text);
}

.status.success {
  background: var(--success-bg);
  border-color: #a7f3d0;
  color: var(--success-text);
}

/* =========================
   Summary
========================= */
.summary-section {
  margin-bottom: 22px;
}

.summary-section:empty {
  display: none;
}

.summary-section .summary-card,
.summary-section .summary-box,
.summary-section > div {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
}

.summary-section h2,
.summary-section h3,
.summary-section h4 {
  margin-top: 0;
  color: #111827;
}

.summary-section p {
  margin: 0.4em 0;
  color: #374151;
}

.summary-section strong {
  color: #111827;
}


.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.summary-stat {
  background: #f8fbff;
  border: 1px solid #dbe7ff;
  border-radius: 14px;
  padding: 16px;
}

.summary-stat .label {
  display: block;
  font-size: 0.86rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.summary-stat .value {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
  color: #0f172a;
}
.prediction-card {
  min-height: 80px;
}
/* =========================
   Chart
========================= */
.chart-panel {
  overflow: hidden;
}

.chart-wrap {
  position: relative;
  width: 100%;
  min-height: 360px;
  padding: 8px 4px 4px;
}

.chart-wrap canvas {
  display: block;
  width: 100% !important;
  max-width: 100%;
  height: 380px !important;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border-radius: 14px;
}

/* =========================
   Notes
========================= */
.notes {
  margin: 0;
  padding-left: 1.2rem;
  color: #374151;
}

.notes li {
  margin-bottom: 10px;
}

.notes li:last-child {
  margin-bottom: 0;
}

code {
  display: inline-block;
  padding: 0.15em 0.45em;
  border-radius: 8px;
  background: #f3f4f6;
  color: #b91c1c;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

/* =========================
   Responsive
========================= */
@media (max-width: 860px) {
  .form-item {
    grid-column: span 6;
  }

  .secret-item {
    grid-column: span 12;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .chart-wrap canvas {
    height: 340px !important;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 22px 12px 40px;
  }

  .panel {
    padding: 18px;
    border-radius: 16px;
  }

  .form-grid {
    gap: 14px;
  }

  .form-item,
  .secret-item {
    grid-column: span 12;
  }

  .button-row {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  .chart-wrap {
    min-height: 280px;
  }

  .chart-wrap canvas {
    height: 280px !important;
  }

  .page-header h1 {
    font-size: 1.8rem;
  }

  .page-header p {
    font-size: 0.92rem;
  }
  
}
