*{box-sizing:border-box}

body{
  margin:0;
  background:#111016;
  color:#f5f2f7;
  font-family:system-ui,-apple-system,sans-serif
}

#app{
  max-width:620px;
  margin:auto;
  min-height:100vh;
  padding-bottom:80px
}

header{
  position:sticky;
  top:0;
  padding:16px 18px;
  background:#111016ee;
  backdrop-filter:blur(12px);
  display:flex;
  justify-content:space-between;
  align-items:center;
  z-index:2;
  border-bottom:1px solid #302c39
}

header small{
  color:#d8ff62;
  font-weight:800;
  letter-spacing:.15em
}

h1{
  font-size:24px;
  margin:3px 0
}

h2{
  margin:18px 0 5px
}

p{
  color:#aaa5b2;
  font-size:13px;
  line-height:1.5;
  margin-top:5px
}

.page{
  display:none;
  padding:18px
}

.page.active{
  display:block
}

.balance{
  display:flex;
  justify-content:space-between;
  background:#1d1b24;
  border:1px solid #302c39;
  border-radius:18px;
  padding:16px;
  margin-bottom:18px
}

.balance small{
  display:block;
  color:#aaa5b2
}

.balance b{
  display:block;
  font-size:23px;
  margin-top:3px
}

.balance b small{
  display:inline;
  font-size:12px;
  font-weight:700;
  color:#aaa5b2;
  margin-left:4px
}

.balance div:last-child{
  text-align:right
}

input,
select{
  width:100%;
  padding:13px;
  border:1px solid #302c39;
  border-radius:12px;
  background:#1b1922;
  color:white;
  outline:0;
  margin:10px 0
}

.card{
  display:flex;
  align-items:center;
  gap:10px;
  background:#1b1922;
  border:1px solid #302c39;
  border-radius:15px;
  padding:12px;
  margin:8px 0
}

.main{
  flex:1
}

.meta{
  font-size:11px;
  color:#aaa5b2;
  margin-top:3px
}

.pill{
  color:#d8ff62;
  font-size:11px;
  font-weight:800
}

.add,
.redeem,
#buy,
#save{
  border:0;
  border-radius:10px;
  padding:9px 11px;
  background:#d8ff62;
  color:#15150f;
  font-weight:800
}

.check{
  width:26px;
  height:26px;
  border-radius:8px;
  border:2px solid #5a5564;
  background:transparent;
  color:#111
}

.check.done{
  background:#d8ff62
}

.donecard{
  opacity:.5;
  text-decoration:line-through
}

.stats{
  display:flex;
  gap:8px
}

.stats span{
  background:#1b1922;
  border:1px solid #302c39;
  padding:12px;
  border-radius:13px;
  font-size:12px
}

.tabs{
  display:grid;
  grid-template-columns:1fr 1fr;
  background:#1b1922;
  padding:4px;
  border-radius:13px
}

.tabs button,
nav button,
#settings,
#addReward,
#reset{
  border:0;
  background:transparent;
  color:#aaa5b2;
  padding:10px;
  border-radius:10px
}

.tabs button.active{
  background:#292632;
  color:#fff
}

.row{
  display:flex;
  justify-content:space-between;
  align-items:center
}

.custom{
  border:1px dashed #4b4654;
  border-radius:16px;
  padding:15px;
  margin-top:15px
}

.custom button{
  width:100%
}

.modal{
  display:none;
  position:fixed;
  inset:0;
  background:#0009;
  align-items:end;
  z-index:10
}

.modal.show{
  display:flex
}

.sheet{
  background:#18171e;
  border-radius:24px 24px 0 0;
  padding:20px;
  width:100%;
  max-width:620px;
  margin:auto;
  border:1px solid #302c39;
  max-height:88vh;
  overflow:auto
}

.sheet label{
  display:block;
  font-size:12px;
  color:#aaa5b2
}

.sheet button{
  margin-top:7px
}

.sheet #save{
  width:100%
}

.sheet #reset{
  width:100%;
  color:#ff8f9c
}

.x{
  float:right;
  border:0;
  background:transparent;
  color:#fff;
  font-size:25px
}

nav{
  position:fixed;
  bottom:0;
  left:50%;
  transform:translateX(-50%);
  width:100%;
  max-width:620px;
  background:#18171ef5;
  border-top:1px solid #302c39;
  display:grid;
  grid-template-columns:repeat(3,1fr);
  padding:7px
}

nav button{
  font-size:21px
}

nav small{
  display:block;
  font-size:10px
}

button{
  cursor:pointer
}

button:disabled{
  opacity:.35
}

/* Header */

.header-actions{
  display:flex;
  align-items:center;
  gap:6px
}

.header-actions button{
  border:1px solid #302c39;
  background:#1b1922;
  color:#fff;
  border-radius:10px;
  padding:8px 10px;
  font-weight:800
}

.header-actions #settings{
  font-size:20px;
  padding:7px 9px
}

/* General */

.full{
  width:100%
}

.primary,
.secondary,
.danger{
  border:0;
  border-radius:10px;
  padding:10px 12px;
  font-weight:800
}

.primary{
  background:#d8ff62;
  color:#15150f
}

.secondary{
  background:#292632;
  color:#fff
}

.danger{
  background:#4a2228;
  color:#ffb3bd
}

.add,
.redeem,
#buy{
  transition:transform .12s ease,filter .12s ease
}

button:active{
  transform:scale(.97)
}

.card{
  transition:
    transform .18s ease,
    opacity .18s ease,
    border-color .18s ease
}

.card:hover{
  transform:translateY(-1px)
}

.actions{
  display:flex;
  gap:6px;
  align-items:center;
  flex-wrap:wrap
}

.edit-btn,
.remove-btn{
  border:0;
  border-radius:9px;
  padding:7px 9px;
  font-size:11px;
  font-weight:800
}

.edit-btn{
  background:#292632;
  color:#fff
}

.remove-btn{
  background:#3a2025;
  color:#ffb3bd
}

/* Toast */

.toast{
  position:fixed;
  top:14px;
  left:50%;
  transform:translate(-50%,-20px);
  width:min(calc(100% - 28px),560px);
  padding:12px 15px;
  border-radius:13px;
  background:#292632;
  color:#fff;
  text-align:center;
  font-weight:800;
  box-shadow:0 12px 30px #0008;
  z-index:1000;
  opacity:0;
  pointer-events:none;
  transition:
    opacity .2s ease,
    transform .2s ease
}

.toast.show{
  opacity:1;
  transform:translate(-50%,0)
}

.toast.success{
  background:#2f4c28
}

.toast.warn{
  background:#5a441b
}

.toast.error{
  background:#5a252c
}

/* Confirmation / editing dialogs */

.overlay{
  position:fixed;
  inset:0;
  background:#000a;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
  z-index:50
}

.overlay[hidden]{
  display:none!important
}

.dialog{
  width:min(100%,440px);
  background:#18171e;
  border:1px solid #302c39;
  border-radius:20px;
  padding:20px;
  box-shadow:0 20px 70px #000b;
  animation:dialogIn .18s ease both
}

.dialog h3{
  margin:0 0 8px
}

.dialog p{
  margin:0 0 16px
}

.dialog label{
  display:block;
  font-size:12px;
  color:#aaa5b2;
  margin:10px 0
}

.dialog input,
.dialog select{
  margin:6px 0 0
}

.dialog-actions{
  display:flex;
  gap:8px;
  justify-content:flex-end;
  margin-top:16px
}

.dialog-actions button{
  min-width:100px
}

.value-preview{
  color:#d8ff62!important;
  font-weight:800;
  font-size:12px!important;
  margin:2px 0 12px!important
}

@keyframes dialogIn{
  from{
    opacity:0;
    transform:translateY(8px) scale(.98)
  }
  to{
    opacity:1;
    transform:none
  }
}

/* Animations */

.pop{
  animation:popIn .25s ease both
}

.donecard{
  animation:donePulse .3s ease both
}

@keyframes popIn{
  from{
    opacity:0;
    transform:translateY(7px)
  }
  to{
    opacity:1;
    transform:none
  }
}

@keyframes donePulse{
  0%{transform:scale(1)}
  35%{transform:scale(1.025)}
  100%{transform:scale(1)}
}

/* History */

.history-tabs{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:5px;
  background:#1b1922;
  padding:4px;
  border-radius:12px;
  margin:10px 0
}

.history-tab{
  border:0;
  background:transparent;
  color:#aaa5b2;
  padding:9px;
  border-radius:9px;
  font-weight:800
}

.history-tab.active{
  background:#292632;
  color:#fff
}

.history-item{
  background:#1b1922;
  border:1px solid #302c39;
  border-radius:13px;
  padding:11px;
  margin:7px 0
}

.history-item strong{
  display:block
}

.history-meta{
  font-size:11px;
  color:#aaa5b2;
  margin-top:3px
}

.empty{
  padding:18px 8px;
  color:#aaa5b2;
  text-align:center;
  border:1px dashed #3b3744;
  border-radius:13px
}

.sheet hr{
  border:0;
  border-top:1px solid #302c39;
  margin:20px 0
}

.sheet .primary{
  margin-top:6px
}

.custom button{
  margin-top:5px
}

.locked-note{
  color:#ffcf75
}

/* Manage shop */

.manage-item{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  background:#1b1922;
  border:1px solid #302c39;
  border-radius:14px;
  padding:12px;
  margin:8px 0
}
.stats-tabs{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:6px;
  margin:14px 0 18px;
}

.stats-tab{
  padding:10px 6px;
  font-size:12px;
}

.stats-tab.active{
  background:#d8ff62;
  color:#111;
}

.stat-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}

.stat-card{
  background:#19171d;
  border:1px solid #302d35;
  border-radius:14px;
  padding:15px;
}

.stat-card small{
  display:block;
  color:#aaa5b2;
  margin-bottom:6px;
}

.stat-card b{
  display:block;
  font-size:20px;
}

.stat-card span{
  display:block;
  color:#d8ff62;
  font-size:12px;
  margin-top:4px;
}

.streak-box{
  background:#19171d;
  border:1px solid #302d35;
  border-radius:14px;
  padding:15px;
  margin-top:8px;
}

.streak-box b{
  display:block;
  font-size:24px;
  color:#d8ff62;
}

.streak-box span{
  color:#aaa5b2;
  font-size:12px;
}
.manage-options{
  display:flex;
  gap:7px;
  flex-direction:column;
  min-width:92px
}

.manage-options label{
  display:flex!important;
  align-items:center;
  gap:6px;
  color:#fff!important;
  font-size:11px!important;
  margin:0!important;
  white-space:nowrap
}

.manage-options input{
  width:auto;
  margin:0;
  padding:0;
  accent-color:#d8ff62
}

#editShopLabel select,
#editPaidLabel select{
  margin-top:6px
}