:root {
  --bg-color: #EFE4DB;
  --card-bg: #FFFDFB;
  --text-main: #4A403A;
  --text-muted: #8C7D73;
  --primary: #FF8A65;
  --primary-hover: #FF7043;
  --secondary: #FFE0D2;
  --danger: #E57373;
  --success: #81C784;
  --border: #F3E5DF;
  --radius: 12px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

/* さがみはらキャンペーン（温かみのあるグリーン・ティール系） */
:root[data-campaign="sagamihara"] {
  --bg-color: #E6EEEC;
  --primary: #3EA69B;
  --primary-hover: #2E8B81;
  --secondary: #E0F2F1;
  --border: #D5E5E2;
}

/* かながわトクトクキャンペーン（知的なブルー・サファイア系） */
:root[data-campaign="kanagawa"] {
  --bg-color: #E5ECF4;
  --primary: #4A89DC;
  --primary-hover: #3572C6;
  --secondary: #E6F0FA;
  --border: #D6E4F2;
}

:root[data-campaign="sagamihara"] h1 {
  background: linear-gradient(135deg, #3EA69B 0%, #00796B 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

:root[data-campaign="kanagawa"] h1 {
  background: linear-gradient(135deg, #4A89DC 0%, #1A237E 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

html {
  background-color: var(--bg-color);
  transition: background-color 0.3s;
}

body {
  font-family: 'Outfit', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
  padding-bottom: 40px;
  transition: background-color 0.3s, color 0.3s;
}

header {
  background: var(--card-bg);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-top {
  padding: 16px 20px 8px;
  text-align: center;
}

h1 {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #FF7043 0%, #FF4081 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  text-shadow: 0 2px 10px rgba(255, 112, 67, 0.1);
}
h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 12px; }

/* Tabs */
.tabs {
  display: flex;
  background-color: var(--card-bg);
  border-bottom: 1px solid var(--border);
}
.tab-btn {
  flex: 1;
  padding: 12px 8px;
  border: none;
  background: none;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  line-height: 1.2;
}
.tab-btn small {
  font-size: 0.75rem;
  font-weight: normal;
}
.tab-btn.active {
  color: var(--primary);
  border-bottom: 3px solid var(--primary);
  background-color: var(--secondary);
}

main { padding: 16px; max-width: 600px; margin: 0 auto; }

.simulator-card {
  background: var(--card-bg);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.input-group label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 0.95rem; }
.input-wrapper { position: relative; display: flex; align-items: center; }
.input-wrapper input {
  width: 100%; padding: 16px 40px 16px 16px;
  font-size: 1.5rem; font-weight: 700;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-color); color: var(--text-main);
  outline: none; transition: border-color 0.2s;
}
.input-wrapper input:focus { border-color: var(--primary); }
.input-wrapper .unit { position: absolute; right: 16px; font-size: 1.2rem; font-weight: 600; color: var(--text-muted); }

.hint { font-size: 0.85rem; color: var(--text-muted); margin-top: 12px; }

.section-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 16px; }
.total-status { font-size: 0.9rem; font-weight: 600; color: var(--text-muted); }
.total-status .highlight { color: var(--primary); font-size: 1.1rem; }

.pay-cards { display: flex; flex-direction: column; gap: 16px; }

.pay-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--border);
}

.pay-card-header {
  padding: 12px 16px;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border);
  color: white; font-weight: 700;
}

.pay-card-body { padding: 16px; }
.progress-container { margin-bottom: 12px; }
.progress-text { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 4px; font-weight: 600;}
.progress-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); transition: width 0.3s; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.stat-box { background: var(--bg-color); padding: 10px; border-radius: 8px; text-align: center; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; }
.stat-value { font-size: 1rem; font-weight: 700; }

.simulation-results {
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
  border-radius: 8px; padding: 12px; margin-bottom: 16px;
  transition: all 0.3s;
}
.sim-row { display: flex; justify-content: space-between; margin-bottom: 8px; align-items: center;}
.sim-row:last-child { margin-bottom: 0; }
.sim-badge { font-size: 0.75rem; background: var(--primary); color: white; padding: 2px 6px; border-radius: 4px; font-weight: bold;}
.sim-points { font-size: 1.1rem; font-weight: 700; color: var(--primary); }
.sim-points.limit { color: var(--danger); }

.record-actions { display: flex; gap: 8px; }
.record-actions button {
  flex: 1; padding: 10px; border: none; border-radius: 8px;
  font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: opacity 0.2s;
}
.btn-10 { background: var(--secondary); color: var(--text-main); }
.btn-20 { background: var(--primary); color: white; }
.btn-10:active, .btn-20:active { opacity: 0.8; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.modal {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal:not(.hidden) { opacity: 1; pointer-events: auto; }
.modal-content {
  background: var(--card-bg); width: 90%; max-width: 400px;
  padding: 24px; border-radius: var(--radius); box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}
.modal-content h3 { margin-bottom: 12px; }
.modal-content p { margin-bottom: 24px; color: var(--text-muted); }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; }
.btn { padding: 10px 16px; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; }
.btn.secondary { background: var(--secondary); color: var(--text-main); }
.btn.primary { background: var(--primary); color: white; }

/* History Section */
.history-section {
  margin-top: 24px;
  background: var(--card-bg);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.history-list { display: flex; flex-direction: column; gap: 12px; }
.history-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-color);
}
.history-info { display: flex; flex-direction: column; gap: 4px; }
.history-date { font-size: 0.75rem; color: var(--text-muted); }
.history-detail { font-size: 0.9rem; font-weight: 600; }
.history-points { color: var(--primary); font-weight: bold; }
.delete-btn {
  background: none; border: none; color: var(--danger);
  font-size: 1.2rem; cursor: pointer; padding: 4px 8px;
}
.delete-btn:hover { background: rgba(229, 62, 62, 0.1); border-radius: 4px; }
.empty-history { font-size: 0.9rem; color: var(--text-muted); text-align: center; padding: 12px 0; }

/* Pay Logo */
.pay-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
  margin-right: 8px;
  flex-shrink: 0;
  border-radius: 4px;
  background: white;
  padding: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.history-logo {
  width: 18px;
  height: 18px;
  object-fit: contain;
  margin-right: 6px;
  flex-shrink: 0;
  border-radius: 3px;
  background: white;
  padding: 1px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Data Management Section */
.data-management-section {
  margin-top: 24px;
  background: var(--card-bg);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}
.data-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.data-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn-data-export, .btn-data-import {
  flex: 1;
  min-width: 160px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-color);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-data-export:hover, .btn-data-import:hover {
  background: var(--secondary);
  border-color: var(--primary);
  transform: translateY(-1px);
}
.btn-data-export:active, .btn-data-import:active {
  transform: translateY(0);
}


