/* Quán Phở Hối Hả — hoạt hình ấm áp: vàng nghệ, đỏ gạch, gỗ */
:root {
  --ink: #3d2614;
  --muted: #8a6a4a;
  --panel: #fffaf0;
  --panel2: #f5e6c8;
  --line: rgba(110, 70, 30, 0.16);
  --accent: #e8543a;
  --accent2: #b83a24;
  --green: #2e9d5a;
  --gold: #f0a81c;
  --shadow: 0 5px 0 rgba(110, 70, 30, 0.15), 0 12px 28px rgba(110, 70, 30, 0.15);
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
[hidden] {
  display: none !important;
}
html,
body {
  height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: "Be Vietnam Pro", system-ui, sans-serif;
  background: radial-gradient(ellipse at 50% 0%, #fff4d6, #f6d9a4 70%);
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
h1,
h2,
h3 {
  font-family: "Baloo 2", "Be Vietnam Pro", sans-serif;
}
.app {
  position: fixed;
  inset: 0;
  overflow: hidden;
}
.grow {
  flex: 1;
}
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ---------- nút ---------- */
.btn {
  border: 0;
  background: var(--panel2);
  border-radius: 14px;
  padding: 11px 18px;
  font-weight: 800;
  font-size: 15px;
  box-shadow: 0 4px 0 rgba(110, 70, 30, 0.2);
  transition: transform 0.08s;
}
.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(110, 70, 30, 0.2);
}
.btn.primary {
  background: linear-gradient(180deg, #ff7a52, var(--accent));
  color: #fff;
  box-shadow: 0 4px 0 var(--accent2);
}
.btn.big {
  font-size: 18px;
  padding: 13px 26px;
}
.btn.small {
  padding: 8px 12px;
  font-size: 13.5px;
}
.btn small {
  font-size: 13px;
  opacity: 0.9;
  margin-left: 4px;
}
.btn.ghost {
  background: transparent;
  box-shadow: none;
  color: var(--muted);
}
.btn.danger {
  background: transparent;
  color: var(--accent2);
  box-shadow: none;
  border: 2px solid rgba(184, 58, 36, 0.3);
  font-size: 13px;
}
.btn:disabled {
  opacity: 0.45;
}
.icon-btn {
  width: 42px;
  height: 42px;
  flex: none;
  border: 0;
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 3px 0 rgba(110, 70, 30, 0.18);
  font-size: 17px;
  font-weight: 800;
}
.back {
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  font-size: 14px;
  padding: 9px 13px;
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 3px 0 rgba(110, 70, 30, 0.18);
}
.bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
}
.bar h2 {
  margin: 0;
  font-size: 23px;
}
.pill {
  background: var(--panel);
  border-radius: 14px;
  padding: 7px 13px;
  font-weight: 800;
  box-shadow: 0 3px 0 rgba(110, 70, 30, 0.15);
  white-space: nowrap;
}
.tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0 14px 10px;
}
.tabs button {
  border: 0;
  border-radius: 14px;
  padding: 9px 14px;
  background: var(--panel);
  font-weight: 800;
  box-shadow: 0 3px 0 rgba(110, 70, 30, 0.15);
  display: flex;
  align-items: center;
  gap: 6px;
}
.tabs button small {
  font-size: 11px;
  color: var(--muted);
}
.tabs button.on {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 3px 0 var(--accent2);
}
.tabs button.on small {
  color: rgba(255, 255, 255, 0.85);
}
.tabs button.locked {
  opacity: 0.55;
}

/* ---------- sảnh ---------- */
.home-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 16px 28px;
  text-align: center;
}
.logo {
  margin: 0;
  font-size: clamp(42px, 9vw, 70px);
  line-height: 0.92;
  color: #8a3a1a;
  text-shadow: 0 4px 0 rgba(255, 255, 255, 0.75);
}
.logo span {
  display: block;
  color: var(--accent);
}
.hero {
  width: min(560px, 100%);
  height: auto;
  border-radius: 24px;
  border: 4px solid #fff;
  box-shadow: var(--shadow);
  background: #f3d9a4;
}
.tag {
  margin: 0;
  max-width: 540px;
  color: var(--muted);
  font-weight: 600;
}
.home-btns {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.bank {
  font-weight: 800;
  color: var(--muted);
}

/* ---------- bản đồ ngày ---------- */
.shop-head {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 0 16px 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.shop-head .si {
  font-size: 40px;
}
.shop-head b {
  font-family: "Baloo 2", sans-serif;
  font-size: 22px;
  display: block;
}
.shop-head small {
  color: var(--muted);
  font-weight: 600;
}
.days {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 0 16px 24px;
}
.day {
  position: relative;
  border: 0;
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 12px 10px 10px;
  display: grid;
  gap: 4px;
  justify-items: center;
  transition: transform 0.12s;
}
.day:hover:not(.locked) {
  transform: translateY(-3px);
}
.day .dn {
  font-family: "Baloo 2", sans-serif;
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  color: #8a3a1a;
}
.day .dl {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.day .ds i {
  font-style: normal;
  font-size: 19px;
  color: rgba(110, 70, 30, 0.18);
}
.day .ds i.on {
  color: var(--gold);
}
.day .dt {
  font-size: 12px;
  font-weight: 700;
  min-height: 16px;
  color: var(--accent2);
}
.day.locked {
  opacity: 0.5;
}
.day.next {
  box-shadow: 0 0 0 3px var(--accent), var(--shadow);
}
.day .lock {
  position: absolute;
  top: 8px;
  right: 10px;
}

/* ---------- nâng cấp ---------- */
.upg-note {
  text-align: center;
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 600;
  padding: 0 16px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 0 16px 24px;
}
.card {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 4px 12px;
  align-items: center;
  background: var(--panel);
  border-radius: 18px;
  padding: 12px;
  box-shadow: var(--shadow);
}
.card .ci {
  grid-row: span 3;
  font-size: 38px;
  text-align: center;
}
.card b {
  font-size: 16px;
}
.card small {
  color: var(--muted);
  font-weight: 600;
  font-size: 12.5px;
}
.card .lv {
  display: flex;
  gap: 4px;
}
.card .lv i {
  width: 22px;
  height: 7px;
  border-radius: 4px;
  background: var(--panel2);
}
.card .lv i.on {
  background: var(--green);
}
.card .btn {
  grid-column: 1 / -1;
  margin-top: 6px;
}
.card.owned .btn {
  background: #d9f0df;
  color: var(--green);
  box-shadow: none;
}

/* ---------- bán hàng ---------- */
.play {
  overflow: hidden;
  padding: 0;
  background: repeating-linear-gradient(90deg, #8a5428 0 46px, #7d4b22 46px 92px);
}
.hud .icon-btn {
  color: var(--ink);
}
#cv {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.hud {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: max(6px, env(safe-area-inset-top)) 10px 6px;
  background: linear-gradient(180deg, rgba(61, 38, 20, 0.85), rgba(61, 38, 20, 0.6));
  color: #fff;
}
.hday {
  display: grid;
  min-width: 0;
}
.hday b {
  font-size: 14px;
  white-space: nowrap;
}
.hday small {
  font-size: 11.5px;
  opacity: 0.85;
  white-space: nowrap;
}
.htime {
  position: relative;
  flex: 1;
  height: 20px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
  min-width: 80px;
}
.htime i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, #ffd23f, #ff8a2a);
}
.htime span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.hmoney {
  display: grid;
  justify-items: end;
  min-width: 128px;
}
.hmoney b {
  font-family: "Baloo 2", sans-serif;
  font-size: 22px;
  line-height: 1;
  color: #ffd23f;
}
.hstars {
  position: relative;
  width: 128px;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.22);
  margin-top: 13px;
}
.hstars i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 4px;
  background: #ffd23f;
  width: 0;
}
.hstars .m {
  position: absolute;
  top: -3px;
  width: 3px;
  height: 14px;
  translate: -50% 0;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.55);
}
.hstars .m.on {
  background: #ffd23f;
}
.hmoney b small {
  font-family: "Be Vietnam Pro", sans-serif;
  font-size: 13px;
  letter-spacing: -1px;
}
.hstars {
  margin-top: 6px;
}

/* ---------- lớp phủ ---------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(61, 38, 20, 0.45);
  backdrop-filter: blur(3px);
}
.sheet {
  position: relative;
  width: min(440px, 100%);
  max-height: 100%;
  overflow: auto;
  background: var(--panel);
  border-radius: 26px;
  padding: 22px 20px;
  box-shadow: var(--shadow);
  border: 4px solid #fff;
  display: grid;
  gap: 10px;
  text-align: center;
  animation: pop 0.22s ease-out;
}
.sheet.wide {
  width: min(600px, 100%);
  text-align: left;
}
@keyframes pop {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
}
.sheet h2 {
  margin: 0;
  font-size: 27px;
  text-align: center;
  line-height: 1.1;
}
.sheet ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 7px;
  font-size: 14px;
  line-height: 1.5;
}
.sub {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}
.big-ico {
  font-size: 54px;
  line-height: 1;
}
.ev {
  background: #fff1d6;
  border: 2px dashed #f0a81c;
  border-radius: 14px;
  padding: 8px 12px;
  font-weight: 700;
}
.news {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.news span {
  background: #e3f4e7;
  color: var(--green);
  border-radius: 10px;
  padding: 4px 9px;
  font-size: 13px;
  font-weight: 800;
}
.targets {
  display: flex;
  justify-content: center;
  gap: 10px;
  font-weight: 800;
  font-size: 14px;
}
.targets span b {
  color: var(--gold);
}
.btns {
  display: grid;
  gap: 8px;
}
.close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: var(--panel2);
  font-size: 22px;
  line-height: 1;
}
.res-stars span {
  display: inline-block;
  font-size: 50px;
  color: rgba(110, 70, 30, 0.15);
}
.res-stars span.on {
  color: var(--gold);
  animation: starIn 0.4s backwards;
}
@keyframes starIn {
  from {
    transform: scale(2.2) rotate(-30deg);
    opacity: 0;
  }
}
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}
.tbl td {
  padding: 5px 6px;
  border-top: 1px dashed var(--line);
  text-align: left;
}
.tbl td:last-child {
  text-align: right;
  font-weight: 800;
}
.tbl tr.sum td {
  font-size: 17px;
  color: var(--accent2);
}
.toast {
  position: absolute;
  left: 50%;
  bottom: 28px;
  translate: -50% 0;
  z-index: 40;
  max-width: calc(100% - 32px);
  background: #3d2614;
  color: #fff;
  padding: 10px 16px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  pointer-events: none;
}

@media (max-width: 720px) {
  .hday b {
    max-width: 92px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
  }
  .days {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hday small {
    display: none;
  }
  .hmoney {
    min-width: 96px;
  }
  .hstars {
    width: 96px;
  }
  .bar h2 {
    font-size: 19px;
  }
}
@media (max-height: 520px) {
  .hero,
  .tag {
    display: none;
  }
  .sheet {
    gap: 6px;
    padding: 14px 16px;
  }
  .big-ico,
  .res-stars span {
    font-size: 34px;
  }
  .btns {
    grid-template-columns: 1fr 1fr;
  }
}
