:root {
  --c-bg:          #FDF6F0;
  --c-bg2:         #FFF8F2;
  --c-bg3:         #FCE4EC;
  --c-bg4:         #FFF3EA;
  --c-bg5:         #F5E6D8;
  --c-her:         #D4688A;
  --c-her-light:   #FCE4EC;
  --c-her-mid:     #E8A0B4;
  --c-his:         #6B4226;
  --c-his-light:   #F5E6D8;
  --c-his-mid:     #9C6644;
  --c-accent:      #C8922A;
  --c-border:      #EDD9C8;
  --c-border2:     #C8956C;
  --c-text:        #3E2010;
  --c-text2:       #7A4F35;
  --c-text3:       #B08060;
  --c-text4:       #9C6644;
  --c-scroll:      #F5E6D8;
  --c-splash1:     #FDF6F0;
  --c-splash2:     #FCE4EC;
  --c-splash3:     #FFF3EA;
  --c-tab-bg:      #FFF8F2;
  --c-ring:        #F5C6C6;
  --c-input-focus: #FCE4EC;

  --bg: #FDF6F0;
  --surface: #FFF8F2;
  --surface2: #F5E6D8;
  --border: #EDD9C8;
  --text: #3E2010;
  --text2: #7A4F35;
  --accent: #c8956a;
  --accent2: #8b5a3c;
  --shadow: 0 2px 16px rgba(107,66,38,0.08);
  --radius: 14px;
  --nav-h: 60px;
}

[data-theme="blue"] {
  --c-bg: #F0F7FF; --c-bg2: #F7FBFF; --c-bg3: #E0F0FF; --c-bg4: #EBF5FF; --c-bg5: #D5E8FA;
  --c-her: #6AAEE8; --c-her-light: #E0F0FF; --c-her-mid: #9CCAF0;
  --c-his: #0A2D5E; --c-his-light: #D5E8FA; --c-his-mid: #1A4A8A;
  --c-accent: #7AB8E8; --c-border: #C8DFF5; --c-border2: #A8C8EA;
  --c-text: #061828; --c-text2: #0A2848; --c-text3: #4A6E98; --c-text4: #2A5080;
  --c-scroll: #D5E8FA; --c-splash1: #F0F7FF; --c-splash2: #E0F0FF; --c-splash3: #EBF5FF;
  --c-tab-bg: #F7FBFF; --c-ring: #B8D8F5; --c-input-focus: #E0F0FF;
  --bg: #F0F7FF; --surface: #F7FBFF; --surface2: #D5E8FA;
  --border: #C8DFF5; --text: #061828; --text2: #0A2848;
  --accent: #7AB8E8; --accent2: #0A2D5E;
}

[data-theme="brown"] {
  --c-bg: #FAF6F2; --c-bg2: #FFF8F0; --c-bg3: #EEE0D0; --c-bg4: #F5EDE0; --c-bg5: #E8D5BE;
  --c-her: #8B5E3C; --c-her-light: #EEE0D0; --c-her-mid: #C4956A;
  --c-his: #4A2E1A; --c-his-light: #E8D5BE; --c-his-mid: #7A4F2E;
  --c-accent: #A07050; --c-border: #D9C4A8; --c-border2: #B8926A;
  --c-text: #2E1A0A; --c-text2: #5A3820; --c-text3: #9A7050; --c-text4: #7A5030;
  --c-scroll: #E8D5BE; --c-splash1: #FAF6F2; --c-splash2: #EEE0D0; --c-splash3: #F5EDE0;
  --c-tab-bg: #FFF8F0; --c-ring: #D9C4A8; --c-input-focus: #EEE0D0;
  --bg: #FAF6F2; --surface: #FFF8F0; --surface2: #E8D5BE;
  --border: #D9C4A8; --text: #2E1A0A; --text2: #5A3820;
  --accent: #A07050; --accent2: #4A2E1A;
}

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

body {
  background: var(--c-bg);
  font-family: 'DM Sans', sans-serif;
  color: var(--c-text);
  font-size: 16px;
  line-height: 1.5;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--c-scroll); }
::-webkit-scrollbar-thumb { background: var(--c-border2); border-radius: 3px; }

input:focus { outline: none; border-color: var(--c-her) !important; box-shadow: 0 0 0 3px var(--c-input-focus) !important; }
button { font-family: 'Lato', 'Helvetica Neue', Arial, sans-serif; cursor: pointer; }

.fade { animation: fadeUp .4s ease; }
.hov { transition: all .18s ease; cursor: pointer; }
.hov:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,.13) !important; }

.confetti-piece { position: fixed; top: -10px; border-radius: 2px; animation: fall linear forwards; pointer-events: none; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--c-his); color: #fff; padding: 10px 24px; border-radius: 24px; font-size: 12px; font-weight: 700; box-shadow: 0 4px 20px rgba(0,0,0,.2); z-index: 9999; opacity: 0; transition: opacity .3s; pointer-events: none; white-space: nowrap; }
.toast.show { opacity: 1; }

.progress-bar-inner { transition: width 1.2s ease; }
.shimmer-bar { background: linear-gradient(90deg, var(--c-border2) 0%, var(--c-her) 40%, var(--c-accent) 60%, var(--c-border2) 100%); background-size: 200% 100%; animation: barShimmer 2.5s linear infinite; }
.animate-heartbeat { animation: heartbeat 1.4s ease-in-out infinite; }
.animate-ring-glow { animation: ringGlow 2s ease-in-out infinite; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 10px; }

.json-bar { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 16px; flex-wrap: wrap; background: var(--c-bg2); border-bottom: 1px solid var(--c-border); }
.btn-export { padding: 9px 20px; font-size: 11px; font-weight: 700; letter-spacing: .5px; border-radius: 24px; border: none; background: linear-gradient(135deg, var(--c-his), var(--c-his-mid)); color: #fff; box-shadow: 0 3px 12px rgba(0,0,0,.2); cursor: pointer; transition: all .18s; }
.btn-export:hover { transform: translateY(-1px); box-shadow: 0 5px 18px rgba(0,0,0,.3); }
.btn-import { padding: 9px 20px; font-size: 11px; font-weight: 700; letter-spacing: .5px; border-radius: 24px; border: none; background: linear-gradient(135deg, var(--c-her), var(--c-her-mid)); color: #fff; cursor: pointer; transition: all .18s; }
.btn-import:hover { transform: translateY(-1px); }

@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); opacity: 0; } }
@keyframes heartbeat { 0%, 100% { transform: scale(1); } 14% { transform: scale(1.15); } 28% { transform: scale(1); } 42% { transform: scale(1.08); } 70% { transform: scale(1); } }
@keyframes floatHeart { 0% { transform: translateY(0) rotate(-10deg); opacity: .8; } 100% { transform: translateY(-90px) rotate(20deg); opacity: 0; } }
@keyframes barShimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes ringGlow { 0%, 100% { filter: drop-shadow(0 0 0px var(--c-her)); } 50% { filter: drop-shadow(0 0 10px var(--c-her)); } }
@keyframes bounceIn { 0% { transform: scale(.5); opacity: 0; } 60% { transform: scale(1.1); } 80% { transform: scale(.95); } 100% { transform: scale(1); opacity: 1; } }
@keyframes floatUpDown { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes fadeSlideIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }

.hidden { display: none !important; }
.tab-section { display: none; }
.tab-section.active { display: block; }
.animate-bounce-in { animation: bounceIn .6s cubic-bezier(.36,.07,.19,.97) both; }

/* Layout elements */
.s-top-bar { height: 6px; background: linear-gradient(90deg, var(--c-border2), var(--c-her-mid), var(--c-her), var(--c-accent), var(--c-her), var(--c-her-mid), var(--c-border2)); background-size: 200% 100%; animation: gradientShift 4s ease infinite; }
.s-bottom-bar { height: 5px; background: linear-gradient(90deg, var(--c-border2), var(--c-her-mid), var(--c-her), var(--c-accent), var(--c-her), var(--c-her-mid), var(--c-border2)); background-size: 200% 100%; animation: gradientShift 4s ease infinite; }
.s-sync-bar { background: var(--c-bg5); border-bottom: 1px solid var(--c-border); padding: 6px 16px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.s-sync-status { font-size: 11px; font-weight: 700; color: var(--c-his-mid); }
.s-header-stats { display: grid; grid-template-columns: repeat(4, 1fr); background: #fff; border-bottom: 1px solid var(--c-border); box-shadow: 0 2px 18px rgba(107,66,38,.09); max-width: 440px; margin: 16px auto 0; border-radius: 14px; overflow: hidden; }
.s-stat-item { padding: 10px; text-align: center; border-right: 1px solid var(--c-border); }
.s-stat-item:last-child { border-right: none; }
.s-stat-label { font-size: 7px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--c-text3); margin-bottom: 2px; white-space: nowrap; }
.s-stat-value { font-size: 14px; font-weight: 700; color: var(--c-his); white-space: nowrap; }
.s-stat-muted { color: var(--c-text2); }
.s-stat-her { color: var(--c-her); }
.s-stat-muted2 { color: var(--c-his-mid); }
.s-page-content { max-width: 880px; margin: 0 auto; padding: 16px 16px 60px; }
.s-hearts { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.s-confetti { position: fixed; inset: 0; pointer-events: none; z-index: 998; }

#page-loader {
  position: fixed; inset: 0; z-index: 99998;
  display: flex; align-items: center; justify-content: center;
  background: var(--c-bg, #FDF6F0);
}
#page-loader .spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid var(--c-border, #EDD9C8);
  border-top-color: var(--c-her, #D4688A);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes gradientShift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
@keyframes numberPop { 0% { transform: scale(1); } 50% { transform: scale(1.18); } 100% { transform: scale(1); } }
