/* ==========================================================================
   CHỦ HỒ CÂU — giao diện "sổ tay hồ câu" (Claude viết lại 30/09)
   Nền giấy kem · viền nâu dày giống nét vẽ nhân vật chibi · mái hiên sọc đỏ trắng
   nút kẹo nổi khối · băng keo giấy · con dấu. Mobile-first, khung tối đa 480px.
   ========================================================================== */

:root {
  --paper: #fff8ea;
  --paper-2: #fdeed3;
  --paper-3: #f6e0bb;
  --desk: #f1dcb6;
  --ink: #4b3527;
  --ink-soft: #8a6a55;
  --line: #e6cfae;
  --red: #e2574c;
  --red-dark: #b53c32;
  --green: #5bb35a;
  --green-dark: #3d8a3c;
  --gold: #f5b83d;
  --gold-dark: #c98c14;
  --blue: #55b3e2;
  --blue-dark: #2c7fae;
  --pink: #ff8fa3;
  --radius: 18px;
  --stroke: 2.5px solid var(--ink);
  --pop: 0 4px 0 var(--ink);
  --font-head: "Baloo 2", "Be Vietnam Pro", system-ui, sans-serif;
  --font-body: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background-color: #e9cfa3;
  background-image: radial-gradient(rgba(75, 53, 39, 0.08) 1.2px, transparent 1.3px);
  background-size: 18px 18px;
}

#app-container {
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  background-color: var(--desk);
  background-image: radial-gradient(rgba(75, 53, 39, 0.06) 1px, transparent 1.2px);
  background-size: 14px 14px;
  position: relative;
  overflow-x: hidden;
  box-shadow: 0 0 0 3px var(--ink), 0 0 40px rgba(0, 0, 0, 0.25);
}

.hidden { display: none !important; }
strong { font-weight: 700; }

/* ------------------------------ Màn hình ------------------------------ */
.screen { display: none; min-height: 100vh; padding-bottom: 28px; }
.screen.active { display: block; animation: screenIn 0.35s ease-out; }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.screen-body { padding: 14px 14px 0; display: flex; flex-direction: column; gap: 16px; }

/* ------------------------------ Header: mái hiên + bảng gỗ ------------------------------ */
.screen-header {
  position: sticky; top: 0; z-index: 30;
  padding: 26px 12px 10px;
  background: var(--paper);
  border-bottom: var(--stroke);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.screen-header::before {           /* mái hiên sọc đỏ trắng, mép lượn sóng */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 22px;
  background: repeating-linear-gradient(90deg, var(--red) 0 24px, #fff6ec 24px 48px);
  border-bottom: var(--stroke);
  -webkit-mask: radial-gradient(12px 8px at 12px 100%, transparent 98%, #000) 0 0 / 24px 100%;
          mask: radial-gradient(12px 8px at 12px 100%, transparent 98%, #000) 0 0 / 24px 100%;
}
.header-day {
  font-family: var(--font-head); font-weight: 800; font-size: 17px; line-height: 1.1;
  background: #c68b55; color: #fff8ea;
  padding: 6px 12px 4px; border: var(--stroke); border-radius: 12px;
  box-shadow: 0 3px 0 var(--ink); text-shadow: 0 2px 0 rgba(75, 53, 39, 0.5);
  white-space: nowrap;
}
.header-stats { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.stat-badge {
  font-family: var(--font-head); font-weight: 800; font-size: 15px; line-height: 1;
  padding: 7px 10px 5px; border: var(--stroke); border-radius: 999px;
  background: #fff; box-shadow: 0 3px 0 var(--ink); white-space: nowrap;
}
.stat-badge.money { background: #fff3c4; }
.stat-badge.stars { background: #ffe1e6; }
.stat-badge.bump { animation: bump 0.4s ease; }
@keyframes bump { 40% { transform: scale(1.18); } }

/* ------------------------------ Thẻ giấy + băng keo ------------------------------ */
.card {
  position: relative;
  background: var(--paper);
  border: var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--pop);
  padding: 16px 14px 14px;
}
.section-card::before, .log-card::before, .profit-card::before {   /* băng keo giấy */
  content: ""; position: absolute; top: -11px; left: 50%;
  width: 84px; height: 22px; transform: translateX(-50%) rotate(-3deg);
  background: rgba(245, 184, 61, 0.55);
  border-left: 2px dashed rgba(255, 255, 255, 0.6); border-right: 2px dashed rgba(255, 255, 255, 0.6);
}
.screen-body > .section-card:nth-of-type(even)::before { background: rgba(255, 143, 163, 0.5); transform: translateX(-50%) rotate(2deg); }

.section-title {
  font-family: var(--font-head); font-weight: 800; font-size: 19px; line-height: 1.2;
  margin: 4px 0 10px;
}

/* ------------------------------ Nút bấm ------------------------------ */
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
button:disabled { cursor: not-allowed; filter: grayscale(0.7); opacity: 0.6; }

.btn-primary, .btn-secondary, .btn-danger {
  display: block; width: 100%;
  font-family: var(--font-head); font-weight: 800; font-size: 20px; line-height: 1.2;
  padding: 13px 16px 11px; border: var(--stroke); border-radius: 16px;
  color: #fff; background: var(--green);
  box-shadow: 0 5px 0 var(--ink); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn-secondary { background: var(--blue); }
.btn-danger { background: var(--red); }
.btn-primary:active:not(:disabled), .btn-secondary:active, .btn-danger:active {
  transform: translateY(4px); box-shadow: 0 1px 0 var(--ink);
}
.btn-open-pond { margin-top: 12px; font-size: 22px; animation: wiggle 2.4s ease-in-out infinite; }
.btn-open-pond:disabled { animation: none; }
@keyframes wiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-2deg); } 90% { transform: rotate(2deg); } 95% { transform: rotate(-1deg); } }

.btn-step, .btn-sm {
  min-width: 46px; height: 40px; padding: 0 8px;
  font-family: var(--font-head); font-weight: 800; font-size: 16px;
  background: #fff; border: var(--stroke); border-radius: 12px; box-shadow: 0 3px 0 var(--ink);
}
.btn-step:active, .btn-sm:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn-step[data-action^="add"] { background: #e3f5d8; }
.btn-step[data-action^="sub"] { background: #ffe3de; }

/* ------------------------------ Màn mở đầu ------------------------------ */
#screen-start { padding: 0; }
.start-hero {
  position: relative; height: 330px; overflow: hidden;
  background: #bfe6f5 center / cover no-repeat;
  border-bottom: var(--stroke);
}
.start-hero::after { content: ""; position: absolute; inset: auto 0 0 0; height: 80px; background: linear-gradient(transparent, rgba(255, 248, 234, 0.55)); }
.start-hero .hero-char { position: absolute; bottom: -6px; width: 210px; z-index: 2; animation: breathe 2.6s ease-in-out infinite; transform-origin: bottom center; }
.start-hero .hero-char.left { left: -6px; }
.start-hero .hero-char.right { right: -14px; width: 170px; animation-delay: 0.8s; }
.logo-wrap { position: absolute; top: 22px; left: 0; right: 0; text-align: center; z-index: 3; }
.game-title {
  font-family: var(--font-head); font-weight: 800; font-size: 46px; line-height: 1;
  color: #fff; letter-spacing: 0.5px;
  -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill;
  text-shadow: 0 5px 0 var(--ink);
  transform: rotate(-3deg);
}
.game-subtitle {
  display: inline-block; margin-top: 10px;
  font-family: var(--font-head); font-weight: 700; font-size: 15px;
  background: var(--red); color: #fff; padding: 3px 14px 1px;
  border: var(--stroke); border-radius: 999px; box-shadow: 0 3px 0 var(--ink);
  transform: rotate(2deg);
}
.start-card { margin: -26px 14px 0; position: relative; z-index: 4; display: flex; flex-direction: column; gap: 14px; }
.slides-container { text-align: center; }
.slide-card h3 { font-family: var(--font-head); font-weight: 800; font-size: 19px; margin-bottom: 4px; }
.slide-card p { color: var(--ink-soft); min-height: 68px; }
.slide-dots { display: flex; gap: 6px; justify-content: center; margin: 8px 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--ink); background: #fff; }
.dot.active { background: var(--red); width: 24px; border-radius: 6px; }
.slide-nav { display: flex; justify-content: space-between; }
.start-form label { display: block; font-family: var(--font-head); font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.start-form input, .chat-input {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  padding: 12px 14px; background: #fff; border: var(--stroke); border-radius: 14px; outline: none;
}
.start-form input:focus, .chat-input:focus { box-shadow: 0 0 0 4px rgba(245, 184, 61, 0.45); }
.start-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.brand-foot { text-align: center; font-size: 13px; color: var(--ink-soft); padding: 4px 0 8px; }
.brand-foot b { color: var(--red-dark); }

/* ------------------------------ Buổi sáng ------------------------------ */
.weather-card { background: #eaf6fd; padding: 12px; }
.weather-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.weather-col { background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 8px 10px; }
.weather-col.border-left { background: #fdf6e8; }
.badge-tag {
  display: inline-block; font-family: var(--font-head); font-weight: 800; font-size: 12px;
  background: var(--ink); color: #fff; padding: 1px 8px 0; border-radius: 999px; margin-bottom: 4px;
}
.weather-main { font-family: var(--font-head); font-size: 18px; font-weight: 700; line-height: 1.2; }
.weather-desc { font-size: 12.5px; color: var(--ink-soft); line-height: 1.35; margin-top: 2px; }

.status-card { padding: 12px 14px; }
.status-row { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.status-row > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.status-badge {
  font-family: var(--font-head); font-weight: 800; font-size: 13px;
  padding: 1px 10px 0; border: 2px solid var(--ink); border-radius: 999px;
}
.status-badge.success { background: #d9f2cf; }
.status-badge.warning { background: #fff0b8; }
.status-badge.danger { background: #ffd4cf; }
.progress-bar {
  height: 18px; margin-top: 10px; overflow: hidden;
  background: #fff; border: var(--stroke); border-radius: 999px;
}
.progress-fill {
  height: 100%; border-right: 2px solid var(--ink);
  background: repeating-linear-gradient(-45deg, var(--blue) 0 10px, #7ccaf0 10px 20px);
  transition: width 0.3s;
}
.progress-fill.over { background: repeating-linear-gradient(-45deg, var(--red) 0 10px, #f07e74 10px 20px); }

.item-list { display: flex; flex-direction: column; gap: 10px; }
.item-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 8px 8px 6px; background: #fff; border: 2px solid var(--ink); border-radius: 14px;
}
.item-info { display: flex; align-items: center; gap: 8px; min-width: 0; }
.item-thumb { width: 50px; height: 50px; flex: none; object-fit: contain; }
.item-emoji { width: 50px; height: 50px; flex: none; display: grid; place-items: center; font-size: 30px; }
.item-text { display: flex; flex-direction: column; min-width: 0; }
.item-name { font-family: var(--font-head); font-weight: 800; font-size: 17px; line-height: 1.15; }
.item-sub { font-size: 12px; color: var(--ink-soft); line-height: 1.35; }
.item-controls { display: flex; align-items: center; gap: 4px; flex: none; }
.item-qty { min-width: 58px; text-align: center; font-family: var(--font-head); font-weight: 800; font-size: 16px; }
.cost-summary { margin-top: 10px; text-align: right; font-size: 14px; }

.mode-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-mode {
  font-family: var(--font-head); font-weight: 800; font-size: 17px; line-height: 1.2;
  padding: 10px 6px 8px; background: #fff; border: var(--stroke); border-radius: 14px; box-shadow: 0 3px 0 var(--ink);
}
.btn-mode small { display: block; font-family: var(--font-body); font-weight: 500; font-size: 11.5px; color: var(--ink-soft); }
.btn-mode.active { background: var(--gold); transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.price-controls { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.price-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; background: #fff; border: 2px dashed var(--ink-soft); border-radius: 12px; font-size: 14px;
}
.btn-group-sm { display: flex; gap: 6px; }

.summary-box { background: #fff3c4; }
.summary-line { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; padding: 3px 0; }
.summary-line.total { border-top: 2px dashed var(--ink-soft); margin-top: 6px; padding-top: 8px; font-size: 15px; }
.positive { color: var(--green-dark); }
.negative { color: var(--red-dark); }
.error-text { margin-top: 8px; color: var(--red-dark); font-weight: 600; font-size: 13.5px; }

/* ------------------------------ Ở hồ (cảnh vẽ) ------------------------------ */
.day-body { padding-top: 12px; }
/* Giữ đúng tỉ lệ ảnh cảnh hồ (1080×1350 = 4:5) để toạ độ % của ghế, nước, công trình khớp tranh trên mọi máy */
.pond-stage {
  position: relative; aspect-ratio: 4 / 5; overflow: hidden;
  border: var(--stroke); border-radius: 22px; box-shadow: var(--pop);
  background: #bfe6f5 center / 100% 100% no-repeat;
  transition: background-image 1s;
}
.stage-top { position: absolute; top: 10px; left: 10px; right: 10px; z-index: 6; display: flex; justify-content: space-between; align-items: flex-start; }
.clock-sign {
  background: #c68b55; color: #fff8ea; text-align: center;
  padding: 4px 12px 2px; border: var(--stroke); border-radius: 14px; box-shadow: 0 3px 0 var(--ink);
}
.clock-display { font-family: var(--font-head); font-weight: 800; font-size: 28px; line-height: 1; text-shadow: 0 2px 0 rgba(75, 53, 39, 0.5); }
.weather-mini { font-size: 12px; font-weight: 600; }
.speed-controls { display: flex; gap: 6px; }
.btn-speed {
  font-family: var(--font-head); font-weight: 800; font-size: 15px;
  width: 44px; height: 38px; background: #fff; border: var(--stroke); border-radius: 12px; box-shadow: 0 3px 0 var(--ink);
}
.btn-speed.active { background: var(--gold); transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }

/* Chip số liệu nằm trên nền trời (không che ghế câu ở bờ trước) */
.stage-chips { position: absolute; left: 10px; right: 10px; top: 76px; z-index: 6; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.pond-info-chip {
  font-size: 13px; font-weight: 600; background: rgba(255, 248, 234, 0.95);
  padding: 4px 10px; border: 2px solid var(--ink); border-radius: 999px; box-shadow: 0 2px 0 var(--ink);
}

/* Cá chỉ bơi trong vùng nước của tranh (x 0–79%, y 52–76%), mờ như dưới nước */
.fish-zone { position: absolute; left: 0; top: 52%; width: 79%; height: 23%; overflow: hidden; z-index: 2; pointer-events: none; border-radius: 0 40% 40% 0 / 0 50% 50% 0; }
.fish-sprite { position: absolute; width: 17%; opacity: 0.8; filter: saturate(0.85); }
.fish-sprite.s1 { top: 8%; animation: swimR 14s linear infinite; }
.fish-sprite.s2 { top: 48%; animation: swimL 17s linear infinite 2s; width: 14%; }
.fish-sprite.s3 { top: 28%; animation: swimR 21s linear infinite 6s; width: 19%; }
@keyframes swimR { from { left: -25%; } to { left: 105%; } }
@keyframes swimL { from { left: 105%; transform: scaleX(-1); } to { left: -25%; transform: scaleX(-1); } }

.rain-layer {
  position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: 0.55;
  background-image:
    linear-gradient(105deg, transparent 48%, rgba(255, 255, 255, 0.9) 49%, transparent 51%),
    linear-gradient(105deg, transparent 48%, rgba(255, 255, 255, 0.7) 49%, transparent 51%);
  background-size: 22px 46px, 31px 63px;
  animation: rain 0.6s linear infinite;
}
@keyframes rain { to { background-position: -10px 46px, -14px 63px; } }

.catch-pop { position: absolute; z-index: 7; width: 96px; text-align: center; pointer-events: none; animation: catchPop 1.8s ease-out forwards; }
.catch-pop img { width: 96px; }
.catch-pop span {
  display: inline-block; font-family: var(--font-head); font-weight: 800; font-size: 16px;
  background: #fff; padding: 1px 8px 0; border: 2px solid var(--ink); border-radius: 999px;
}
@keyframes catchPop { 0% { transform: translateY(40px) scale(0.4); opacity: 0; } 25% { transform: translateY(-10px) scale(1.1); opacity: 1; } 70% { opacity: 1; } 100% { transform: translateY(-40px) scale(0.9); opacity: 0; } }

.money-float {
  position: absolute; z-index: 8; pointer-events: none;
  font-family: var(--font-head); font-weight: 800; font-size: 20px; color: #fff;
  -webkit-text-stroke: 2px var(--green-dark); paint-order: stroke fill;
  animation: floatUp 1.6s ease-out forwards;
}
.money-float.neg { -webkit-text-stroke-color: var(--red-dark); }
@keyframes floatUp { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-60px); opacity: 0; } }

.visitor { position: absolute; bottom: 4%; z-index: 120; width: 38%; left: -45%; transition: left 1s cubic-bezier(.3,1.3,.5,1); }
.visitor.in { left: 31%; }
.visitor img { width: 100%; display: block; animation: breathe 1.6s ease-in-out infinite; transform-origin: bottom center; }
.visitor .bang {
  position: absolute; top: -8px; right: 6px; width: 38px; height: 38px; display: grid; place-items: center;
  font-family: var(--font-head); font-weight: 800; font-size: 24px; color: #fff;
  background: var(--red); border: var(--stroke); border-radius: 50%; animation: bump 0.6s ease infinite;
}
@keyframes breathe { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.03) translateY(-1px); } }

/* Công trình nâng cấp trên cảnh hồ + ca đêm + bảng hết chỗ */
.scene-obj { position: absolute; z-index: 3; transform: translate(-50%, -100%); pointer-events: none; filter: drop-shadow(0 2px 0 rgba(75, 53, 39, 0.25)); }
.night-layer { position: absolute; inset: 0; z-index: 5; pointer-events: none; opacity: 0; background: #1d2350; mix-blend-mode: multiply; transition: opacity 1.2s; }
.full-sign {
  position: absolute; z-index: 7; right: 12px; top: 64px; transform: rotate(6deg);
  font-family: var(--font-head); font-weight: 800; font-size: 16px; color: #fff;
  background: var(--red); padding: 3px 10px 1px; border: var(--stroke); border-radius: 10px; box-shadow: 0 3px 0 var(--ink);
  animation: bump 1s ease infinite;
}
.angler.vip svg { filter: drop-shadow(0 0 4px gold); }

/* Bảng sự cố giữa ngày (trên cảnh hồ) */
.incident-banner {
  position: absolute; z-index: 130; left: 6%; right: 6%; top: 30%;
  display: flex; gap: 10px; align-items: center;
  background: #fff6ec; border: var(--stroke); border-radius: 16px; box-shadow: var(--pop);
  padding: 10px 12px; font-size: 13.5px; line-height: 1.35;
  animation: bannerIn 0.4s cubic-bezier(.3,1.5,.5,1);
}
.incident-banner.bad { background: #ffe7e3; }
.incident-banner.good { background: #e6f6dd; }
.incident-banner b { display: block; font-family: var(--font-head); font-weight: 800; font-size: 17px; }
.incident-banner .incident-icon { font-size: 34px; flex: none; }
.incident-banner.out { opacity: 0; transform: translateY(-10px); transition: 0.4s; }
@keyframes bannerIn { from { transform: scale(0.6); opacity: 0; } }

.forecast { margin-top: 10px; font-size: 14px; background: #eef7ff; border: 2px dashed var(--blue-dark); border-radius: 12px; padding: 7px 10px; }
.forecast.warn { background: #fff3c4; border-color: var(--gold-dark); }
.forecast small { display: block; color: var(--ink-soft); font-size: 12.5px; margin-top: 2px; }

/* Thẻ sự kiện buổi sáng */
.event-card { background: #fff6dc; padding-right: 14px; overflow: hidden; }
.event-card.pending { background: #ffe8c2; animation: bump 0.6s ease 1; }
.event-tag { display: inline-block; font-family: var(--font-head); font-weight: 800; font-size: 12px; background: var(--red); color: #fff; padding: 1px 9px 0; border-radius: 999px; }
.event-title { font-family: var(--font-head); font-weight: 800; font-size: 19px; line-height: 1.2; margin: 6px 0 2px; }
.event-text { font-size: 14px; color: var(--ink-soft); margin-bottom: 8px; }
.event-art { float: right; width: 84px; margin: -4px -6px 0 6px; }
.event-choices { display: flex; flex-direction: column; gap: 7px; clear: both; }
.event-result { clear: both; font-weight: 600; font-size: 14px; padding: 8px 10px; background: #fff; border: 2px dashed var(--ink-soft); border-radius: 12px; }

/* Cần thủ (mặt ghép ngẫu nhiên — js/faces.js) ngồi quanh bờ */
/* Người ngồi ghế: điểm neo = mặt ghế (xem ANGLER_SEAT_Y trong js/faces.js = 70.2%) */
.anglers { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.angler { position: absolute; transform: translate(-50%, -70.2%); }
.angler.fresh { animation: anglerIn 0.45s cubic-bezier(.3,1.5,.5,1); }
.angler svg { display: block; width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 2px 0 rgba(75, 53, 39, 0.25)); }
@keyframes anglerIn { from { transform: translate(-50%, -55%) scale(0.4); opacity: 0; } }
.log-face { display: inline-block; width: 22px; height: 22px; vertical-align: -6px; margin-right: 5px; }
.log-face svg { width: 100%; height: 100%; }
.review-avatar.face { background: #eaf6fd; overflow: hidden; }
.review-avatar.face svg { width: 100%; height: 100%; transform: translateY(3px) scale(1.12); }

.log-card { padding: 16px 12px 10px; }
.log-header { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--font-head); font-weight: 800; font-size: 17px; margin-bottom: 6px; }
.log-header small { font-family: var(--font-body); font-weight: 500; font-size: 12px; color: var(--ink-soft); }
.log-list { max-height: 190px; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; padding-right: 2px; }
.log-item {
  font-size: 13.5px; line-height: 1.4; padding: 5px 9px;
  background: #fff; border-left: 5px solid var(--line); border-radius: 8px;
  animation: logIn 0.3s ease-out;
}
.log-item.customer { border-left-color: var(--blue); }
.log-item.catch { border-left-color: var(--gold); background: #fff9e3; }
.log-item.special { border-left-color: var(--red); background: #fff0ee; font-weight: 600; }
.log-item.system { border-left-color: var(--ink-soft); color: var(--ink-soft); }
@keyframes logIn { from { opacity: 0; transform: translateX(-8px); } }

/* ------------------------------ Chat khách (kiểu truyện tranh) ------------------------------ */
.chat-sheet { position: fixed; inset: 0; z-index: 100; display: none; }
.chat-sheet.active { display: block; }
.chat-backdrop { position: absolute; inset: 0; background: rgba(40, 25, 15, 0.55); animation: fadeIn 0.25s; }
@keyframes fadeIn { from { opacity: 0; } }
.chat-panel {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: 480px; height: 94vh; height: 94dvh;
  display: flex; flex-direction: column;
  background: var(--paper); border: var(--stroke); border-bottom: none; border-radius: 26px 26px 0 0;
  animation: sheetUp 0.35s cubic-bezier(.2,1.2,.4,1);
}
@keyframes sheetUp { from { transform: translate(-50%, 100%); } }

.chat-stage {
  position: relative; flex: none; height: 30vh; min-height: 190px; max-height: 260px;
  border-bottom: var(--stroke); border-radius: 24px 24px 0 0; overflow: hidden;
  background: #cdeefa center 70% / cover no-repeat;
}
.chat-portrait {
  position: absolute; left: 50%; bottom: -4%; height: 104%; transform: translateX(-50%);
  transform-origin: bottom center; filter: drop-shadow(0 3px 0 rgba(75, 53, 39, 0.35));
}
.chat-portrait.pop { animation: portraitPop 0.45s ease; }
.chat-portrait.shake { animation: shake 0.5s ease; }
@keyframes portraitPop { 0% { transform: translateX(-50%) scale(0.92); } 50% { transform: translateX(-50%) scale(1.06); } 100% { transform: translateX(-50%) scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(-50%); } 20%, 60% { transform: translateX(calc(-50% - 7px)); } 40%, 80% { transform: translateX(calc(-50% + 7px)); } }
.chat-nametag {
  position: absolute; left: 10px; bottom: 10px; z-index: 2;
  background: #fff; border: var(--stroke); border-radius: 14px; box-shadow: 0 3px 0 var(--ink);
  padding: 4px 12px 3px; transform: rotate(-2deg);
}
.chat-name { font-family: var(--font-head); font-weight: 800; font-size: 19px; line-height: 1.1; color: var(--red-dark); }
.chat-tagline { font-size: 12px; color: var(--ink-soft); }

.chat-messages { flex: 1; overflow-y: auto; padding: 14px 12px 6px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg {
  position: relative; max-width: 84%; padding: 9px 13px; font-size: 15px; line-height: 1.45;
  border: var(--stroke); border-radius: 18px; animation: msgIn 0.25s ease-out;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(8px) scale(0.97); } }
.chat-msg.customer { align-self: flex-start; background: #fff; border-bottom-left-radius: 4px; box-shadow: 0 2px 0 var(--ink); }
.chat-msg.owner { align-self: flex-end; background: #d9f2cf; border-bottom-right-radius: 4px; box-shadow: 0 2px 0 var(--ink); }
.chat-msg.system { align-self: center; max-width: 92%; font-size: 13px; background: #fff3c4; border-style: dashed; border-width: 2px; text-align: center; }

.chat-typing { display: flex; align-items: center; gap: 4px; padding: 0 16px 6px; color: var(--ink-soft); font-size: 13px; }
.typing-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-soft); animation: typing 1s infinite; }
.typing-dot:nth-child(2) { animation-delay: 0.15s; } .typing-dot:nth-child(3) { animation-delay: 0.3s; }
.typing-text { margin-left: 4px; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-5px); opacity: 1; } }

.chat-result-box {
  margin: 4px 12px 8px; padding: 12px 14px; position: relative;
  background: #fff; border: var(--stroke); border-radius: 16px; box-shadow: var(--pop);
  animation: msgIn 0.3s ease-out;
}
.result-title { font-family: var(--font-head); font-weight: 800; font-size: 17px; margin-bottom: 4px; }
.result-details { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.result-review { margin-top: 8px; padding-top: 8px; border-top: 2px dashed var(--line); font-size: 14px; color: var(--ink-soft); }
.result-stamp {
  position: absolute; right: 10px; top: 8px; transform: rotate(12deg);
  font-family: var(--font-head); font-weight: 800; font-size: 15px; letter-spacing: 1px;
  padding: 2px 10px 0; border: 3px solid currentColor; border-radius: 10px; opacity: 0.85;
  animation: stamp 0.35s cubic-bezier(.3,1.6,.5,1);
}
.result-stamp.good { color: var(--green-dark); }
.result-stamp.bad { color: var(--red); }
@keyframes stamp { from { transform: rotate(12deg) scale(2.2); opacity: 0; } }

.chat-actions { padding: 0 12px; }
.chat-button-group { display: flex; flex-direction: column; gap: 7px; padding-bottom: 8px; }
.btn-chat-choice {
  text-align: left; font-size: 14px; line-height: 1.35; font-weight: 600;
  padding: 9px 12px; background: #fff; border: 2px solid var(--ink); border-radius: 14px; box-shadow: 0 3px 0 var(--ink);
}
.btn-chat-choice:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn-chat-choice.btn-soft { background: #e3f5d8; }
.btn-chat-choice.btn-hard { background: #fff6dc; }
.btn-chat-choice.btn-rude { background: #ffe3de; }
.chat-continue-btn { margin-bottom: 12px; }
.chat-input-row { display: flex; gap: 8px; padding: 8px 12px calc(12px + env(safe-area-inset-bottom)); border-top: 2px dashed var(--line); }
.chat-input { flex: 1; padding: 11px 14px; }
.btn-send-chat {
  flex: none; width: 50px; font-size: 20px; color: #fff;
  background: var(--blue); border: var(--stroke); border-radius: 14px; box-shadow: 0 3px 0 var(--ink);
}
.btn-send-chat:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }

/* ------------------------------ Buổi tối ------------------------------ */
.profit-card { text-align: center; padding: 26px 14px 16px; }
.profit-label { font-family: var(--font-head); font-weight: 800; font-size: 16px; color: var(--ink-soft); }
.profit-amount { font-family: var(--font-head); font-weight: 800; font-size: 42px; line-height: 1.1; margin: 4px 0; }
.profit-pos .profit-amount { color: var(--green-dark); }
.profit-neg .profit-amount { color: var(--red-dark); }
.profit-sub { font-size: 14px; }
.day-stamp {
  position: absolute; right: 10px; top: 8px; transform: rotate(14deg);
  font-family: var(--font-head); font-weight: 800; font-size: 17px; letter-spacing: 2px;
  padding: 2px 9px 0; border: 4px double currentColor; border-radius: 10px;
  animation: stamp 0.45s 0.3s cubic-bezier(.3,1.6,.5,1) both;
}
.profit-pos .day-stamp { color: var(--green); }
.profit-neg .day-stamp { color: var(--red); }

.finance-table { display: flex; flex-direction: column; gap: 12px; }
.finance-group { background: #fff; border: 2px solid var(--ink); border-radius: 14px; overflow: hidden; }
.finance-header { font-family: var(--font-head); font-weight: 800; font-size: 15px; padding: 5px 12px 3px; border-bottom: 2px solid var(--ink); }
.finance-header.green { background: #d9f2cf; }
.finance-header.red { background: #ffd9d4; }
.finance-row { display: flex; justify-content: space-between; gap: 8px; padding: 5px 12px; font-size: 14px; border-bottom: 1.5px dashed var(--line); }
.finance-row:last-child { border-bottom: none; }

.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.metric-item { background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 8px 10px; display: flex; flex-direction: column; }
.metric-label { font-size: 12px; color: var(--ink-soft); }
.metric-value { font-size: 15px; }

.reviews-list { display: flex; flex-direction: column; gap: 10px; }
.review-item { display: flex; gap: 10px; align-items: flex-start; background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 8px 10px; }
.review-avatar { width: 48px; height: 48px; flex: none; border-radius: 50%; border: 2px solid var(--ink); background: #eaf6fd center 12% / 160% no-repeat; display: grid; place-items: center; font-size: 24px; }
.review-body { flex: 1; min-width: 0; }
.review-head { display: flex; justify-content: space-between; gap: 6px; font-size: 14px; }
.review-stars { font-size: 12px; white-space: nowrap; }
.review-text { font-size: 13.5px; color: var(--ink-soft); line-height: 1.4; margin-top: 2px; }
.empty-text { text-align: center; color: var(--ink-soft); font-size: 14px; padding: 8px; }

.hint-text { margin-top: 10px; font-size: 13.5px; background: #fff3c4; border: 2px dashed var(--gold-dark); border-radius: 12px; padding: 6px 10px; }

/* Cửa hàng nâng cấp */
.shop-card { scroll-margin-top: 90px; }
.shop-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin: 0 -4px 6px; padding-left: 4px; scrollbar-width: none; }
.shop-tab {
  flex: none; font-family: var(--font-head); font-weight: 800; font-size: 14px;
  padding: 6px 11px 4px; background: #fff; border: 2px solid var(--ink); border-radius: 999px; box-shadow: 0 2px 0 var(--ink);
}
.shop-tab.active { background: var(--gold); transform: translateY(1px); box-shadow: 0 1px 0 var(--ink); }
.shop-list { display: flex; flex-direction: column; gap: 9px; }
.shop-item { display: flex; align-items: center; gap: 10px; background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 8px 10px 8px 8px; }
.shop-item.owned { background: #eef8e8; }
.shop-icon { flex: none; width: 54px; height: 54px; display: grid; place-items: center; font-size: 30px; background: #eaf6fd; border-radius: 12px; overflow: hidden; }
.shop-icon img { width: 100%; height: 100%; object-fit: contain; }
.shop-info { flex: 1; min-width: 0; }
.shop-name { font-family: var(--font-head); font-weight: 800; font-size: 16px; line-height: 1.2; }
.shop-lv { font-family: var(--font-body); font-size: 11px; font-weight: 700; background: var(--ink); color: #fff; padding: 1px 7px; border-radius: 999px; vertical-align: 2px; }
.shop-desc { font-size: 12.5px; color: var(--ink-soft); line-height: 1.35; margin: 2px 0; }
.shop-price { font-family: var(--font-head); font-weight: 800; font-size: 15px; color: var(--green-dark); }
.shop-buy {
  flex: none; min-width: 64px; font-family: var(--font-head); font-weight: 800; font-size: 15px; color: #fff;
  padding: 8px 10px 6px; background: var(--green); border: var(--stroke); border-radius: 12px; box-shadow: 0 3px 0 var(--ink);
}
.shop-buy.fire { background: var(--red); }
.shop-buy:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.shop-done { flex: none; font-size: 22px; color: var(--green-dark); padding: 0 10px; }

/* Phiếu giảm giá thật + màn kết thúc */
.coupon-card { background: #fff0f3; text-align: center; border-style: dashed; }
.coupon-title { font-family: var(--font-head); font-weight: 800; font-size: 19px; color: var(--red-dark); }
.coupon-code { display: inline-block; margin-top: 8px; font-family: var(--font-head); font-weight: 800; font-size: 26px; letter-spacing: 3px; padding: 4px 16px 2px; background: #fff; border: var(--stroke); border-radius: 12px; }
.btn-gold { background: var(--gold); color: var(--ink); text-shadow: none; }
.ending-card { text-align: center; background: #fff6dc; padding: 22px 14px 18px; }
.ending-trophy { width: 120px; display: block; margin: -6px auto 0; }
.ending-icon { font-size: 54px; line-height: 1; }
.ending-label { font-size: 14px; color: var(--ink-soft); margin-top: 6px; }
.ending-title {
  font-family: var(--font-head); font-weight: 800; font-size: 32px; line-height: 1.15; color: #fff; margin: 4px 0;
  -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--ink);
}
.ending-desc { font-size: 15px; }

.bankrupt-card { text-align: center; background: #ffe3de; }
.bankrupt-icon { font-size: 54px; line-height: 1; }
.bankrupt-title { font-family: var(--font-head); font-weight: 800; font-size: 26px; color: var(--red-dark); margin: 6px 0; }
.bankrupt-card p { margin-bottom: 12px; }
.evening-actions { padding-bottom: 8px; }
