:root {
  --bg: #f5f0eb;
  --card-bg: #ffffff;
  --text: #2d2825;
  --text-muted: #7a6f68;
  --border: #ddd5cc;
  --accent: #7B6B5A;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

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

body {
  font-family: 'Helvetica Neue', 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.app {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

/* ヘッダー */
header {
  text-align: center;
  padding: 24px 0 20px;
}

header h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent);
}

header p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* 入力セクション */
.input-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.input-section label {
  font-size: 14px;
  color: var(--text-muted);
  align-self: flex-start;
}

.input-row {
  display: flex;
  gap: 10px;
  width: 100%;
  align-items: center;
}

input[type="date"] {
  flex: 1;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
  outline: none;
}

input[type="date"]:focus {
  border-color: var(--accent);
}

.calc-btn {
  padding: 12px 24px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.calc-btn:hover { opacity: 0.85; }
.calc-btn:active { opacity: 0.7; }

/* 結果セクション */
.result-section {
  margin-top: 20px;
}

.hidden { display: none !important; }

/* タブ */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--card-bg);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 8px 8px 0;
  box-shadow: var(--shadow);
}

.tab-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  border-radius: 8px 8px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.tab-btn.active {
  background: var(--bg);
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
}

.tab-panel {
  display: none;
  background: var(--card-bg);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.tab-panel.active { display: block; }

/* 星カード */
.star-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: 10px;
  border: 1.5px solid;
  margin-bottom: 20px;
}

.star-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
}

.star-name {
  font-size: 20px;
  font-weight: 700;
}

.meisu-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

.reigo-badge {
  margin-top: 6px;
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  background: #fff3e0;
  color: #b06820;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #f0c070;
}

/* 今日の運気カード */
.today-cycles {
  margin-bottom: 20px;
}

.today-cycles h3,
.fortune-section h3,
.meters-section h3,
.lucky-section h3,
.cycle-diagram-section h3,
.calendar-section h3 {
  font-size: 14px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.cycle-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.cycle-mini {
  padding: 10px 8px;
  border-radius: 8px;
  text-align: center;
  border: 1.5px solid;
}

.cycle-mini-title { font-size: 11px; opacity: 0.75; margin-bottom: 3px; }
.cycle-mini-name { font-size: 16px; font-weight: 700; margin-bottom: 3px; }
.cycle-mini-desc { font-size: 11px; opacity: 0.8; }
.cycle-mini-advice { font-size: 10px; opacity: 0.8; line-height: 1.4; }

.cycle-good  { background: #eef4fb; border-color: #8ab0d8; color: #2d5080; }
.cycle-great { background: #eef7ee; border-color: #72b072; color: #2d6030; }
.cycle-caution { background: #fef9e7; border-color: #d4a017; color: #7a5c00; }
.cycle-dsk   { background: #fdf0f0; border-color: #e07070; color: #8b2020; }

/* 運勢テキスト */
.fortune-section {
  margin-bottom: 20px;
}

.fortune-text {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
}

/* 運勢メーター */
.meters-section {
  margin-bottom: 20px;
}

.meter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.meter-label {
  width: 60px;
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.meter-bar {
  flex: 1;
  height: 10px;
  background: var(--border);
  border-radius: 5px;
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.6s ease;
}

.meter-value {
  width: 28px;
  font-size: 12px;
  text-align: right;
  color: var(--text-muted);
}

/* ラッキーチップ */
.lucky-section {
  margin-bottom: 8px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1.5px solid;
  font-size: 12px;
  font-weight: 500;
}

/* 大殺界タブ */
.dsk-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-weight: 600;
}

.banner-icon { font-size: 22px; flex-shrink: 0; }
.banner-text { font-size: 15px; }

.banner-safe    { background: #eef7ee; color: #2d6030; }
.banner-caution { background: #fef9e7; color: #7a5c00; }
.banner-dsk     { background: #fdf0f0; color: #8b2020; }

/* SVGサイクル図 */
.cycle-diagram-section {
  margin-bottom: 20px;
  text-align: center;
}

.cycle-svg {
  display: block;
  margin: 0 auto;
}

/* 運気カレンダー */
.calendar-section {
  margin-bottom: 8px;
}

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

.cal-cell {
  padding: 8px 6px;
  border-radius: 8px;
  border: 1.5px solid;
  text-align: center;
}

.cal-cell.current-year {
  box-shadow: 0 0 0 2px currentColor;
  font-weight: 700;
}

.cal-year  { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.cal-cycle { font-size: 14px; font-weight: 700; }
.cal-desc  { font-size: 10px; opacity: 0.8; margin-top: 1px; }

/* カレンダーセルの色はサイクルクラスと共通 */
.cal-cell.cycle-good    { background: #eef4fb; border-color: #8ab0d8; color: #2d5080; }
.cal-cell.cycle-great   { background: #eef7ee; border-color: #72b072; color: #2d6030; }
.cal-cell.cycle-caution { background: #fef9e7; border-color: #d4a017; color: #7a5c00; }
.cal-cell.cycle-dsk     { background: #fdf0f0; border-color: #e07070; color: #8b2020; }

@media (max-width: 400px) {
  .calendar-grid { grid-template-columns: repeat(2, 1fr); }
  .cycle-cards { grid-template-columns: 1fr; }
}
