/* =============================================
   電気代・家電消費電力計算ツール
   Design: Yellow/Amber系
   ============================================= */

:root {
  --primary: #ca8a04;
  --primary-hover: #a16207;
  --primary-light: #fefce8;
  --accent: #eab308;
  --bg: #fafaf5;
  --surface: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.08);
  --transition: 0.15s ease;
}

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

body {
  font-family: 'BIZ UDPGothic', 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 1rem;
}

/* Header */
header {
  background: linear-gradient(135deg, #92400e 0%, #ca8a04 100%);
  color: #fff;
  padding: 2.5rem 1rem 2rem;
  text-align: center;
}
.header-inner { max-width: 760px; margin: 0 auto; }
.header-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
h1 { font-family: 'Outfit', sans-serif; font-size: clamp(1.4rem, 4vw, 2rem); font-weight: 800; line-height: 1.2; }
.header-sub { margin-top: 0.5rem; font-size: 0.9rem; opacity: 0.9; }

/* Main */
main { max-width: 760px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

/* Ad unit */
.ad-unit { min-height: 0; margin: 1rem 0; }

/* Privacy notice */
.privacy-notice {
  background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: var(--radius-sm);
  padding: 0.6rem 1rem; font-size: 0.85rem; color: #166534;
  display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1.25rem;
}

/* Card */
.card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.5rem; margin-bottom: 1.25rem;
}
.section-title {
  font-family: 'Outfit', sans-serif; font-size: 1.05rem; font-weight: 700;
  color: var(--primary); margin-bottom: 1rem; display: flex; align-items: center; gap: 0.4rem;
}
.section-desc { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 1rem; }

/* Rate row */
.rate-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 480px) { .rate-row { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field-label { font-size: 0.85rem; font-weight: 700; color: var(--text); }
.field-hint { font-size: 0.78rem; color: var(--text-muted); }
.input-wrap { display: flex; align-items: center; gap: 0.5rem; }
.form-input {
  flex: 1; border: 2px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem; font-size: 1rem; color: var(--text); background: #fff;
  transition: border-color var(--transition);
}
.form-input:focus { outline: none; border-color: var(--accent); }
.input-suffix { font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; }

/* Preset buttons */
.preset-group { margin-bottom: 1rem; }
.preset-label { font-size: 0.85rem; font-weight: 700; color: var(--text-muted); display: flex; align-items: center; gap: 0.3rem; margin-bottom: 0.5rem; }
.preset-btns { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.preset-btn {
  background: var(--primary-light); border: 1px solid #fde68a;
  color: var(--primary); font-size: 0.8rem; font-weight: 600;
  padding: 0.35rem 0.7rem; border-radius: 20px; cursor: pointer;
  transition: all var(--transition);
}
.preset-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Table */
.appliance-table-wrap { overflow-x: auto; margin-bottom: 1rem; }
.appliance-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.appliance-table th {
  text-align: left; padding: 0.5rem 0.4rem; font-size: 0.78rem;
  color: var(--text-muted); border-bottom: 2px solid var(--border); white-space: nowrap;
}
.th-unit { font-weight: 400; font-size: 0.72rem; }
.appliance-table td { padding: 0.4rem 0.3rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl-input {
  width: 100%; border: 1px solid var(--border); border-radius: 6px;
  padding: 0.3rem 0.4rem; font-size: 0.875rem; color: var(--text);
}
.tbl-input:focus { outline: none; border-color: var(--accent); }
.tbl-name { min-width: 100px; }
.tbl-num { width: 70px; text-align: right; }
.col-cost-val { font-weight: 700; color: var(--primary); white-space: nowrap; }
.btn-del {
  background: none; border: none; color: #ef4444; cursor: pointer;
  font-size: 1rem; padding: 0.2rem; border-radius: 4px; transition: background var(--transition);
}
.btn-del:hover { background: #fee2e2; }
.col-name { min-width: 120px; }
.col-watt, .col-hours, .col-days { width: 80px; }
.col-cost { width: 90px; }
.col-del { width: 36px; }

/* Empty state */
.empty-state { text-align: center; padding: 2rem 1rem; color: var(--text-muted); }
.empty-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.empty-title { font-weight: 700; margin-bottom: 0.25rem; }
.empty-desc { font-size: 0.85rem; }

/* Custom add */
.custom-add-row { border-top: 1px dashed var(--border); padding-top: 1rem; }
.custom-title { font-size: 0.9rem; font-weight: 700; margin-bottom: 0.75rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.3rem; }
.custom-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: flex-end; }
.custom-name-input { min-width: 120px; }
.btn-add {
  background: var(--primary); color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 0.55rem 1rem; font-size: 0.875rem; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; gap: 0.3rem; white-space: nowrap;
  transition: background var(--transition);
}
.btn-add:hover { background: var(--primary-hover); }
.error-msg { color: #ef4444; font-size: 0.8rem; margin-top: 0.3rem; }

/* Calc button */
.btn-calc {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  width: 100%; background: linear-gradient(135deg, #ca8a04, #d97706);
  color: #fff; border: none; border-radius: var(--radius);
  padding: 1rem; font-size: 1.1rem; font-weight: 800;
  cursor: pointer; margin-bottom: 1.5rem;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 14px rgba(202,138,4,0.35);
}
.btn-calc:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(202,138,4,0.4); }
.btn-calc:active { transform: translateY(0); }

/* KPI grid */
.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; margin-bottom: 1.25rem; }
@media (max-width: 480px) { .kpi-grid { grid-template-columns: 1fr; } }
.kpi-card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.25rem 1rem; text-align: center;
}
.kpi-icon { font-size: 1.5rem; margin-bottom: 0.3rem; }
.kpi-label { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.kpi-value { font-family: 'Outfit', sans-serif; font-size: 1.75rem; font-weight: 800; color: var(--primary); }
.kpi-unit { font-size: 0.72rem; color: var(--text-muted); }
.kpi-monthly { border-top: 3px solid var(--accent); }
.kpi-yearly  { border-top: 3px solid #92400e; }
.kpi-co2     { border-top: 3px solid #22c55e; }

/* Chart */
.chart-card { margin-bottom: 1.25rem; }
.chart-title { font-family: 'Outfit', sans-serif; font-size: 1rem; font-weight: 700; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.4rem; }
.chart-wrap { position: relative; height: 300px; }

/* Sim card */
.sim-card { margin-bottom: 1.25rem; }
.sim-title { font-family: 'Outfit', sans-serif; font-size: 1rem; font-weight: 700; color: var(--primary); margin-bottom: 0.25rem; display: flex; align-items: center; gap: 0.4rem; }
.sim-desc { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem; }
.sim-options { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.sim-option { display: flex; align-items: flex-start; gap: 0.5rem; }
.sim-check { width: 18px; height: 18px; margin-top: 0.1rem; accent-color: var(--primary); flex-shrink: 0; }
.sim-label { font-size: 0.875rem; cursor: pointer; display: flex; align-items: center; gap: 0.3rem; }
.sim-result { background: var(--primary-light); border-radius: var(--radius-sm); padding: 1rem; }
.sim-row { display: flex; justify-content: space-between; align-items: center; padding: 0.35rem 0; font-size: 0.875rem; }
.sim-row + .sim-row { border-top: 1px solid #fde68a; }
.sim-row-label { color: var(--text-muted); }
.sim-row-value { font-weight: 700; }
.sim-saving { color: #16a34a; font-size: 1rem; }

/* Advice */
.advice-card { margin-bottom: 1.25rem; }
.advice-title { font-family: 'Outfit', sans-serif; font-size: 1rem; font-weight: 700; color: var(--primary); margin-bottom: 1rem; display: flex; align-items: center; gap: 0.4rem; }
.advice-list { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; }
.advice-list li {
  padding: 0.75rem 1rem; background: var(--primary-light);
  border-left: 4px solid var(--accent); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.875rem; line-height: 1.5;
}

/* Howto section */
.howto-section { margin-top: 2rem; }
.howto-section h2 { font-family: 'Outfit', sans-serif; font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }
.howto-section p { font-size: 0.875rem; line-height: 1.7; margin-bottom: 1rem; }
.howto-details { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1rem; overflow: hidden; }
.howto-summary { padding: 1rem 1.25rem; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 0.5rem; }
.howto-steps { padding: 0 1.25rem 1rem; }
.howto-steps li { margin-bottom: 0.5rem; font-size: 0.875rem; line-height: 1.6; }
.accordion-group { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1.5rem; }
.accordion-item { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.accordion-summary {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.25rem; font-weight: 700; font-size: 0.9rem;
  cursor: pointer; list-style: none;
}
.accordion-summary::-webkit-details-marker { display: none; }
.accordion-icon::after { content: '▼'; font-size: 0.7rem; color: var(--text-muted); transition: transform 0.2s; }
details[open] .accordion-icon::after { transform: rotate(180deg); }
.accordion-body { padding: 0 1.25rem 1rem; font-size: 0.875rem; line-height: 1.7; }
.accordion-body table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.accordion-body th, .accordion-body td { border: 1px solid var(--border); padding: 0.4rem 0.6rem; text-align: left; }
.accordion-body th { background: var(--primary-light); font-weight: 700; }
.accordion-body dl dt { font-weight: 700; margin-top: 0.75rem; }
.accordion-body dl dd { color: var(--text-muted); margin-left: 0; }

/* Footer */
footer { background: #1e1e2e; color: #aaa; text-align: center; padding: 2rem 1rem; font-size: 0.8rem; }
footer a { color: #eab308; text-decoration: none; }
footer nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 0.75rem; }

@media (max-width: 600px) {
  .appliance-table { font-size: 0.8rem; }
  .tbl-num { width: 55px; }
  .col-cost-val { font-size: 0.85rem; }
}
