:root {
  --primary: #14b8b8;
  --secondary: #a78bfa;
  --accent: #ff3b30;
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(255, 255, 255, 0.2);
}

* {
  -webkit-font-smoothing: antialiased;
}
body {
  background: #f0f4f8;
  min-height: 100vh;
}
.glass {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.04),
    0 8px 24px rgba(0, 0, 0, 0.08);
  border-radius: 14px;
}
.glass:hover {
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.06),
    0 12px 32px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.3s ease;
}
.glass-header {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.pillar-box {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 16px;
  transition: all 0.2s ease;
}
.pillar-box:hover {
  background: rgba(0, 0, 0, 0.05);
}
.pillar-active {
  background: linear-gradient(
    135deg,
    rgba(20, 184, 184, 0.08),
    rgba(167, 139, 250, 0.06)
  );
  border-color: rgba(20, 184, 184, 0.2);
}
.grade-badge {
  font-size: 3.5rem;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.meiban-cell {
  background: rgba(0, 0, 0, 0.025);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 14px;
}
.meiban-center {
  background: linear-gradient(
    135deg,
    rgba(20, 184, 184, 0.1),
    rgba(167, 139, 250, 0.08)
  );
  border: 2px solid rgba(20, 184, 184, 0.25);
  border-radius: 16px;
}
.houiban-cell {
  min-width: 70px;
  min-height: 70px;
  border-radius: 14px;
}
.houiban-normal {
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.05);
}
.houiban-center-cell {
  background: linear-gradient(
    135deg,
    rgba(20, 184, 184, 0.08),
    rgba(167, 139, 250, 0.06)
  );
  border: 1.5px solid rgba(20, 184, 184, 0.2);
}
.kyou-goou {
  background: rgba(255, 59, 48, 0.06);
  border: 1.5px solid rgba(255, 59, 48, 0.2);
}
.kyou-anken {
  background: rgba(255, 149, 0, 0.06);
  border: 1.5px solid rgba(255, 149, 0, 0.2);
}
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 400;
}
.tag-blue {
  background: rgba(20, 184, 184, 0.1);
  color: #1c1c1e;
}
.tag-purple {
  background: rgba(167, 139, 250, 0.1);
  color: #1c1c1e;
}
.tag-green {
  background: rgba(52, 199, 89, 0.1);
  color: #1c1c1e;
}
.tag-gold {
  background: #fff9c4;
  color: #1c1c1e;
}
.tag-earth {
  background: #fff3e0;
  color: #1c1c1e;
}
.tag-red {
  background: rgba(255, 59, 48, 0.1);
  color: #1c1c1e;
}
.tag-gray {
  background: rgba(142, 142, 147, 0.1);
  color: #1c1c1e;
}
.info-chip {
  background: rgba(0, 0, 0, 0.03);
  border-radius: 12px;
  padding: 10px 14px;
}
@keyframes pulse-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(20, 184, 184, 0.4);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(20, 184, 184, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(20, 184, 184, 0);
  }
}
.pulse-ring {
  animation: pulse-ring 2.5s ease-out infinite;
}
.data-table th {
  font-size: 12px;
  font-weight: 600;
  color: #8e8e93;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.data-table td {
  font-size: 12px;
}
.data-table tr {
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}
.data-table tr:last-child {
  border-bottom: none;
}
.data-table tr:hover {
  background: rgba(0, 0, 0, 0.015);
}

/* Input form */
.input-field {
  background: rgba(255, 255, 255, 0.8);
  border: 1.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 500;
  color: #1c1c1e;
  outline: none;
  transition: all 0.2s ease;
  appearance: none;
}
.input-field:focus {
  border-color: rgba(20, 184, 184, 0.5);
  box-shadow: 0 0 0 3px rgba(20, 184, 184, 0.1);
}
.btn-primary {
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(20, 184, 184, 0.2);
  transition: all 0.2s;
}
.btn-primary:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 16px rgba(20, 184, 184, 0.4);
}
.btn-primary:active {
  transform: translateY(0);
}

#dashboard {
  display: none;
}
#dashboard.active {
  display: block;
  /* --- Data Tables --- */
  .data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
  }
  .data-table th {
    background: rgba(248, 250, 252, 0.8);
    color: #64748b;
    font-weight: 600;
    padding: 10px;
    border-bottom: 1px solid #edf2f7;
    text-align: left;
  }
  .data-table td {
    padding: 10px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
  }
  .data-table tr:last-child td {
    border-bottom: none;
  }

  /* --- Section Variations --- */
  .section-kotodama {
    background: rgba(167, 139, 250, 0.04);
    border: 1px solid rgba(167, 139, 250, 0.1);
  }
  .section-fortune-score {
    background: white;
    border: 1px solid #f1f5f9;
  }
  .section-reading-box {
    background: rgba(20, 184, 184, 0.03);
    border: 1px solid rgba(20, 184, 184, 0.1);
  }
  .section-lifestyle {
    background: rgba(245, 158, 11, 0.03);
    border: 1px solid rgba(245, 158, 11, 0.1);
  }

  /* --- Reading Buttons --- */

  /* --- Tags & Badges --- */
  .tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 400;
    margin-right: 4px;
  }
  .tag-nikkan {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
  }

  /* --- Scan Area Resize --- */
  .scan-container {
    max-width: 240px;
    margin: 0 auto;
  }
  .scan-preview-box {
    width: 220px;
    height: 220px;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    background: #f8fafc;
    border: 1px solid #edf2f7;
  }

  /* --- Fortune Score Detail --- */
  .fortune-score-large {
    font-size: 84px;
    font-weight: 800;
    line-height: 1;
    /* 色はJSのrisk.colorで制御（グレードに応じて変化） */
  }

  /* --- Monthly Table Colors --- */
  .text-optimal {
    color: #059669;
    font-weight: 600;
  }
  .text-good {
    color: #0284c7;
  }
  .text-stable {
    color: #64748b;
  }
}

.fade-in {
  animation: fadeIn 0.5s ease-out;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scan toolbar */
.scan-tool-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(0, 0, 0, 0.02);
  color: #8e8e93;
  cursor: pointer;
  transition: all 0.15s ease;
}
.scan-tool-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #3c3c43;
}
.scan-tool-btn.active {
  background: rgba(255, 59, 48, 0.1);
  border-color: rgba(255, 59, 48, 0.3);
  color: #ff3b30;
}
.scan-note-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(255, 59, 48, 0.05);
  border: 1px solid rgba(255, 59, 48, 0.12);
  border-radius: 10px;
  font-size: 12px;
  color: #ff3b30;
}
.scan-note-item .note-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff3b30;
  flex-shrink: 0;
}
@keyframes popupIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* --- Kotodama Redesign --- */
.kotodama-card {
  position: relative;
  background: linear-gradient(135deg, rgba(20, 184, 184, 0.05) 0%, rgba(167, 139, 250, 0.05) 100%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  padding: 10px;
  padding-left: 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
  overflow: hidden;
  transition: all 0.2s ease;
}
.kotodama-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06);
}
.kotodama-accent {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(to bottom, #14b8b8, #a78bfa);
}
.kotodama-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.kotodama-title {
  font-size: 20px;
  font-weight: 800;
  color: #14b8b8;
  line-height: 1.2;
}
.kotodama-badge {
  background: #14b8b8;
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}
.kotodama-desc {
  font-size: 12px;
  color: #4b5563;
  line-height: 1.6;
}
