/* =====================
   CSS Custom Properties — Baby mode (default)
   ===================== */
:root {
  --primary:       #7A9E6E;
  --primary-fg:    #ffffff;
  --primary-light: #EBF3E6;
  --bg:            #FAF9F6;
  --fg:            #3D3830;
  --card:          #ffffff;
  --muted:         #F3EFE8;
  --muted-fg:      #9B8F83;
  --border:        #E6E0D6;
  --type-active-bg: #FCF0F2;
  --type-active-fg: #D9909A;
  --type-active-border: rgba(217,144,154,.35);
  --sage:          #A8BF9C;
  --amber:         #C9975A;
  --amber-light:   #FBF3E8;
  --radius:        1.1rem;
  --radius-lg:     1.5rem;
  /* smooth theme transitions */
  transition: background .3s ease, color .3s ease;
}

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

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN',
               'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--fg);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 80px;
}

/* =====================
   Header
   ===================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  width: 100%;
  background: var(--primary);
  color: var(--primary-fg);
  padding: 14px 16px 14px;
  text-align: center;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
}
.app-header h1 { font-size: 1.35rem; font-weight: 800; letter-spacing: .02em; }
.app-header > p { font-size: .78rem; opacity: .82; margin-top: 2px; }

/* =====================
   Mode segment control
   ===================== */
.mode-seg {
  display: inline-flex;
  background: rgba(0,0,0,.15);
  border-radius: 999px;
  padding: 3px;
  margin-top: 10px;
  gap: 2px;
}
.mode-btn {
  border: none;
  background: transparent;
  color: rgba(255,255,255,.72);
  font-family: inherit;
  font-size: .82rem;
  font-weight: 700;
  padding: 6px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .22s ease;
  white-space: nowrap;
  min-height: 34px;
}
.mode-btn.active {
  background: rgba(255,255,255,.94);
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}

/* =====================
   Main layout
   ===================== */
.app-main {
  width: 100%;
  max-width: 440px;
  padding: 18px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

/* =====================
   Button groups
   ===================== */
.btn-group { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-grid  { grid-template-columns: 1fr 1fr; }

.btn-base, .btn-type {
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: var(--card);
  color: var(--fg);
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  transition: all .18s ease;
  box-shadow: 0 1px 5px rgba(0,0,0,.05);
}

.btn-base {
  padding: 15px 8px;
  font-size: 1.05rem;
  min-height: 52px;
}
.btn-base.active {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
  box-shadow: 0 3px 12px rgba(0,0,0,.15);
  transform: scale(1.02);
}
.btn-base:not(.active):hover {
  border-color: var(--sage);
  background: var(--primary-light);
}

.btn-type {
  padding: 12px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: 62px;
}
.btn-type.active {
  background: var(--type-active-bg);
  color: var(--type-active-fg);
  border-color: var(--type-active-border);
}
.btn-type:not(.active):hover {
  background: var(--primary-light);
  border-color: var(--sage);
}
.type-label { font-size: .95rem; font-weight: 700; line-height: 1.2; text-align: center; }
.type-age   { font-size: .7rem; font-weight: 400; color: var(--muted-fg); }
.btn-type.active .type-age { color: var(--type-active-fg); opacity: .75; }

/* =====================
   Custom N input
   ===================== */
.custom-n-card {
  background: var(--primary-light);
  border: 1.5px solid var(--sage);
  border-radius: var(--radius-lg);
  padding: 13px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.custom-n-label {
  font-size: .8rem;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
}
.custom-n-control {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
}
.n-input {
  width: 72px;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 800;
  font-family: inherit;
  color: var(--primary);
  background: var(--card);
  border: 2px solid var(--sage);
  border-radius: var(--radius);
  padding: 6px 6px;
  outline: none;
  transition: border-color .15s;
}
.n-input:focus { border-color: var(--primary); }
.n-unit {
  font-size: .95rem;
  font-weight: 700;
  color: var(--primary);
}
.n-hint {
  font-size: .73rem;
  color: var(--muted-fg);
  flex-shrink: 0;
  max-width: 80px;
  text-align: right;
  line-height: 1.3;
}

/* =====================
   Tab bar
   ===================== */
.tab-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 4px;
  box-shadow: 0 1px 5px rgba(0,0,0,.05);
}
.tab-btn {
  border: none;
  background: transparent;
  color: var(--muted-fg);
  cursor: pointer;
  font-family: inherit;
  font-size: .88rem;
  font-weight: 700;
  padding: 10px 6px;
  border-radius: calc(var(--radius-lg) - 3px);
  line-height: 1.35;
  transition: all .18s ease;
  min-height: 52px;
}
.tab-btn small { font-size: .72rem; font-weight: 400; opacity: .85; }
.tab-btn.active {
  background: var(--primary);
  color: var(--primary-fg);
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}

/* =====================
   Tab content
   ===================== */
.tab-content { display: none; flex-direction: column; gap: 13px; }
.tab-content.active { display: flex; }

/* =====================
   Card
   ===================== */
.card {
  background: var(--card);
  border: 1.5px solid rgba(0,0,0,.07);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.result-card {
  background: var(--primary-light);
  border-color: rgba(0,0,0,.06);
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}

/* =====================
   Inputs
   ===================== */
.input-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.input-label { font-size: 1.05rem; font-weight: 700; }
.input-with-unit { display: flex; align-items: center; gap: 6px; }

.num-input {
  width: 88px;
  text-align: right;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: inherit;
  color: var(--fg);
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  outline: none;
  transition: border-color .15s;
}
.num-input:focus { border-color: var(--primary); }

.unit    { font-size: .95rem; color: var(--muted-fg); font-weight: 500; }
.unit-sm { font-size: .9rem;  color: var(--muted-fg); font-weight: 500; margin-left: 3px; }

/* =====================
   Slider
   ===================== */
.slider {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--primary) 0%, var(--sage) 100%);
  outline: none;
  cursor: pointer;
  margin-top: 4px;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid white;
  box-shadow: 0 1px 6px rgba(0,0,0,.2);
  cursor: pointer;
}
.slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid white;
  box-shadow: 0 1px 6px rgba(0,0,0,.2);
  cursor: pointer;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
}

/* =====================
   Results
   ===================== */
.result-header {
  font-size: .78rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding-bottom: 14px;
  margin-bottom: 14px;
}
.result-row:last-child { padding-bottom: 0; margin-bottom: 0; }
.border-bottom { border-bottom: 1px solid var(--border); }
.result-label { font-size: 1.05rem; font-weight: 700; }
.result-label.muted { font-size: .9rem; color: var(--muted-fg); font-weight: 600; }
.result-value-group { display: flex; align-items: flex-end; }
.result-big  { font-size: 2.5rem; font-weight: 800; line-height: 1; }
.result-mid  { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.primary { color: var(--primary); }

/* =====================
   Cooking guide
   ===================== */
.guide-section { display: flex; flex-direction: column; gap: 12px; }
.section-title { font-size: 1rem; font-weight: 700; padding: 0 2px; }

.guide-card { padding: 18px; }
.guide-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.guide-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pot-icon       { background: var(--primary-light); color: var(--primary); }
.microwave-icon { background: var(--amber-light); color: var(--amber); }
.guide-title { font-size: 1rem; font-weight: 700; }

.guide-steps { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.guide-steps li {
  display: flex;
  gap: 8px;
  font-size: .88rem;
  color: rgba(61,56,48,.8);
  line-height: 1.5;
}
.step-num { font-weight: 700; flex-shrink: 0; }
.step-num.pot   { color: var(--primary); }
.step-num.micro { color: var(--amber); }

.guide-tip {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--amber-light);
  border-radius: var(--radius);
  font-size: .78rem;
  color: var(--amber);
  line-height: 1.55;
}
.guide-note {
  font-size: .75rem;
  color: var(--muted-fg);
  line-height: 1.6;
  padding: 0 2px;
}

/* =====================
   Column section (article links)
   ===================== */
.column-section {
  width: 100%;
  max-width: 440px;
  padding: 0 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Fade transition wrapper */
#column-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: opacity .22s ease;
}
#column-list.fading { opacity: 0; pointer-events: none; }

/* Shared card styles — both <a> and <button> */
.column-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
  transition: box-shadow .18s ease, border-color .18s ease;
}
.column-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.09);
  border-color: var(--primary);
}

/* Button variant (baby mode — opens About modal) */
.column-card-btn {
  width: 100%;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
}

.column-card-tag {
  font-size: .7rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  align-self: flex-start;
  letter-spacing: .04em;
}

.column-card-title {
  font-size: .98rem;
  font-weight: 800;
  color: var(--fg);
  line-height: 1.4;
}

.column-card-desc {
  font-size: .8rem;
  color: var(--muted-fg);
  line-height: 1.55;
}

.column-card-arrow {
  font-size: .78rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 2px;
}

/* =====================
   Column card accordion expand
   ===================== */
.col-card-wrap {
  display: flex;
  flex-direction: column;
}

.col-card-btn.expanded {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-bottom-color: var(--primary);
}

.col-expand {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.45s ease, opacity 0.28s ease;
}

.col-expand.open {
  max-height: 5200px;
  opacity: 1;
}

.col-body {
  background: var(--card);
  border: 1.5px solid var(--primary);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.col-body h2 {
  font-size: .96rem;
  font-weight: 800;
  color: var(--primary);
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: 6px;
  line-height: 1.45;
  margin-top: 4px;
}

.col-body h3 {
  font-size: .88rem;
  font-weight: 700;
  color: var(--fg);
  padding-left: 9px;
  border-left: 3px solid var(--primary);
  line-height: 1.45;
}

.col-body p {
  font-size: .84rem;
  line-height: 1.8;
  color: rgba(61,56,48,.85);
}

.col-body ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.col-body li {
  font-size: .84rem;
  line-height: 1.65;
  padding-left: 14px;
  position: relative;
  color: rgba(61,56,48,.82);
}

.col-body li::before {
  content: '・';
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: 700;
}

.col-tip {
  background: var(--primary-light);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 10px 12px;
  font-size: .81rem;
  color: var(--fg);
  line-height: 1.7;
}

.col-tip strong { color: var(--primary); }

.col-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: .79rem;
  border-radius: var(--radius);
  overflow: hidden;
}

.col-body th {
  background: var(--primary);
  color: white;
  padding: 8px 5px;
  font-size: .75rem;
  text-align: center;
  font-weight: 700;
}

.col-body td {
  padding: 7px 5px;
  border-bottom: 1px solid var(--border);
  line-height: 1.4;
  vertical-align: top;
}

.col-body tr:last-child td { border-bottom: none; }
.col-body td:first-child { font-weight: 700; color: var(--primary); }

.col-read-more {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--primary);
  color: var(--primary-fg);
  text-decoration: none;
  font-size: .82rem;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: 999px;
  align-self: flex-start;
  transition: opacity .15s;
}
.col-read-more:hover { opacity: .85; }

/* =====================
   Ad banner
   ===================== */
.ad-banner {
  width: 100%;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--muted);
  border-top: 1px solid var(--border);
  color: var(--muted-fg);
  font-size: .75rem;
  margin-top: auto;
}

/* =====================
   About button
   ===================== */
.about-btn {
  position: fixed;
  bottom: 72px;
  right: 14px;
  z-index: 40;
  background: var(--card);
  border: 1.5px solid var(--border);
  color: var(--muted-fg);
  font-family: inherit;
  font-size: .75rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  box-shadow: 0 2px 12px rgba(0,0,0,.1);
  cursor: pointer;
  transition: background .15s;
}
.about-btn:hover { background: var(--muted); }

/* =====================
   Modal
   ===================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.modal-inner { display: flex; flex-direction: column; height: 100%; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px;
  background: var(--primary);
  color: var(--primary-fg);
  flex-shrink: 0;
}
.modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  background: transparent;
  border: none;
  color: var(--primary-fg);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  transition: background .15s;
}
.modal-close:hover { background: rgba(255,255,255,.2); }

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

.about-section { display: flex; flex-direction: column; gap: 10px; }
.about-section h3 { font-size: 1rem; font-weight: 700; }
.about-section p  { font-size: .88rem; color: rgba(61,56,48,.8); line-height: 1.65; }

/* Accordion */
.accordion { border: 1.5px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.accordion-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--primary-light);
  border: none;
  font-family: inherit;
  font-size: .88rem;
  font-weight: 700;
  color: var(--fg);
  cursor: pointer;
  text-align: left;
  transition: background .15s;
}
.accordion-btn:hover { background: var(--muted); }
.chevron { font-size: .7rem; color: var(--primary); margin-left: 8px; flex-shrink: 0; }
.accordion-body {
  display: none;
  padding: 14px;
  background: var(--card);
  flex-direction: column;
  gap: 8px;
}
.accordion-body.open { display: flex; }
.accordion-body p  { font-size: .85rem; color: rgba(61,56,48,.8); line-height: 1.65; }
.accordion-body ul, .accordion-body .step-list { padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.accordion-body li { font-size: .85rem; color: rgba(61,56,48,.8); line-height: 1.6; }
.accordion-body strong { color: var(--primary); }

/* Policy box */
.policy-box {
  background: var(--muted);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.policy-box p  { font-size: .82rem; color: rgba(61,56,48,.8); line-height: 1.6; }
.policy-box strong { color: var(--fg); display: block; margin-bottom: 2px; }

/* Contact */
.contact-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: var(--primary-fg);
  text-decoration: none;
  font-size: .88rem;
  font-weight: 700;
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  transition: opacity .15s;
}
.contact-btn:hover { opacity: .85; }

.about-footer { font-size: .75rem; color: var(--muted-fg); text-align: center; padding-bottom: 8px; }
