html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; background: #1d1022; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root { --ink: #5b2747; --plum: #6e2552; --gold: #c8953a; --rose: #ee8fb4; --cream: #fff7ec; --font: system-ui, sans-serif; }

#app { position: absolute; left: 0; top: 0; width: 396px; height: 704px; overflow: hidden; transform-origin: 0 0;
  font-family: var(--font); color: var(--ink); user-select: none; -webkit-user-select: none; }
#cv { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; }

.layer, .overlay { position: absolute; inset: 0; display: none; }
.layer.active, .overlay.active { display: block; }

/* ---------- 9-slice art (fallback until the pictures are cropped) ---------- */
.panel { background: rgba(255, 248, 238, 0.95); border: 3px solid var(--gold); border-radius: 16px;
  box-shadow: 0 6px 16px rgba(60, 20, 50, 0.28); }
.btn { position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 48px; padding: 6px 16px; border: 3px solid var(--gold); border-radius: 999px;
  background: linear-gradient(#ffb3cf, #ea7ea8); color: #fff; font-family: var(--font); font-weight: 900; font-size: 17px;
  cursor: pointer; outline: none; transition: transform 90ms ease-out, filter 120ms ease-out;
  text-shadow: 2px 0 0 var(--plum), -2px 0 0 var(--plum), 0 2px 0 var(--plum), 0 -2px 0 var(--plum),
    1.4px 1.4px 0 var(--plum), -1.4px 1.4px 0 var(--plum), 1.4px -1.4px 0 var(--plum), -1.4px -1.4px 0 var(--plum), 0 3px 0 rgba(60,10,40,.4); }
.btn:active, .btn.press { transform: translateY(2px) scale(0.95); }
.btn.focus { filter: brightness(1.12) drop-shadow(0 0 4px #fff) drop-shadow(0 0 10px #ffd27a); transform: translateY(-2px) scale(1.04); }
.btn[disabled], .btn.off { filter: grayscale(0.85) brightness(0.9); opacity: 0.75; }
.btn.small { min-height: 44px; font-size: 15px; padding: 4px 18px; }

/* ---------- title ---------- */
#logo { position: absolute; left: 50%; top: 7%; width: 84%; max-height: 30%; object-fit: contain; transform: translateX(-50%);
  filter: drop-shadow(0 6px 10px rgba(80, 20, 60, 0.35)); opacity: 0; }
#title.active #logo { animation: logoIn 0.75s cubic-bezier(.34,1.56,.64,1) 0.1s forwards, logoFloat 4s ease-in-out 1s infinite; }
@keyframes logoIn { from { opacity: 0; transform: translateX(-50%) translateY(-50px) scale(0.6); } to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); } }
@keyframes logoFloat { 0%,100% { opacity: 1; transform: translateX(-50%) translateY(0); } 50% { opacity: 1; transform: translateX(-50%) translateY(-6px); } }
#tapStart { position: absolute; left: 0; right: 0; bottom: 15%; text-align: center; font-weight: 900; font-size: 20px; color: #fff;
  text-shadow: 0 0 6px rgba(120, 30, 80, 0.9), 2px 2px 0 var(--plum), -2px 2px 0 var(--plum), 2px -2px 0 var(--plum), -2px -2px 0 var(--plum); }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.55; transform: scale(0.96); } }
#btnBoard { position: absolute; left: 50%; bottom: 6%; transform: translateX(-50%); flex-direction: row; gap: 6px; }
#btnBoard.focus { transform: translateX(-50%) scale(1.05); }
.trophy { width: 18px; height: 16px; background: #ffe7a3; border-radius: 0 0 9px 9px; box-shadow: 0 0 0 2px var(--plum); display: inline-block; }

/* ---------- hub ---------- */
.hud { position: absolute; left: 10px; right: 10px; top: 10px; }
.dayBadge { display: inline-block; padding: 6px 16px 6px; margin-right: 60px; min-width: 170px; max-width: calc(100% - 64px); }
.dayRow { display: flex; align-items: baseline; gap: 6px; }
.dayNum { font-size: 24px; font-weight: 900; color: var(--plum); }
.dayOf { font-size: 15px; font-weight: 800; color: #a4708e; }
.countdown { font-size: 14px; font-weight: 800; color: #b23a6d; }
.countdown.danger { color: #d1264f; animation: pulse 1s ease-in-out infinite; }
.statPanel { margin-top: 8px; padding: 8px 12px 10px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.stat { display: flex; align-items: center; gap: 4px; min-width: 0; }
.stat img { width: 30px; height: 30px; object-fit: contain; flex: 0 0 auto; }
.stat .sl { font-size: 12px; font-weight: 800; color: #9a5d80; line-height: 1.1; white-space: nowrap; }
.stat .sv { font-size: 20px; font-weight: 900; color: var(--plum); line-height: 1.05; }
.stat.bump .sv { animation: bump 0.5s ease-out; }
@keyframes bump { 0% { transform: scale(1); } 30% { transform: scale(1.5); color: #e0457f; } 100% { transform: scale(1); } }
.fat { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.fl { font-size: 13px; font-weight: 800; color: #9a5d80; white-space: nowrap; }
.fv { font-size: 16px; font-weight: 900; color: var(--plum); min-width: 30px; text-align: right; }
/* the track past the penalty threshold (--tired, set from the editor value) is tinted red */
.bar { position: relative; flex: 1; height: 12px; border-radius: 8px; box-shadow: inset 0 1px 2px rgba(0,0,0,.2);
  background: linear-gradient(90deg, rgba(110, 37, 82, 0.15) var(--tired, 70%), rgba(209, 38, 79, 0.3) var(--tired, 70%)); }
.bar i { display: block; height: 100%; width: 0; border-radius: 8px; background: linear-gradient(90deg, #8fd6a4, #f2d16b, #ee6b6b); background-size: 300px 100%; transition: width 0.5s ease-out; }
/* the fatigue penalty threshold: a red mark across the bar with its number above it */
.fmark { position: absolute; top: -4px; bottom: -4px; left: 70%; width: 3px; margin-left: -1.5px; border-radius: 2px; background: #d1264f;
  box-shadow: 0 0 0 1.5px #fff; pointer-events: none; }
.fmark::after { content: attr(data-n); position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); margin-bottom: 1px;
  font-size: 12px; font-weight: 900; line-height: 1; color: #d1264f; white-space: nowrap;
  text-shadow: 1px 0 0 #fff, -1px 0 0 #fff, 0 1px 0 #fff, 0 -1px 0 #fff, 1px 1px 0 #fff, -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff; }
.warn { margin-top: 8px; padding: 6px 12px; border-radius: 12px; background: rgba(200, 30, 70, 0.88); color: #fff; font-weight: 800; font-size: 14px; line-height: 1.35;
  display: none; text-align: center; box-shadow: 0 3px 8px rgba(60, 10, 30, 0.3); }
.warn.show { display: block; animation: popIn 0.3s cubic-bezier(.34,1.56,.64,1); }
.warn.soon { background: rgba(214, 118, 28, 0.92); }
.warn .wc { margin-top: 2px; font-size: 13px; color: #fff3b0; }
/* an open sheet tells the same thing itself: the pill would only peek out from under it */
#hub:has(.sheet.open) .warn { visibility: hidden; }
.hubActions { position: absolute; left: 10px; right: 10px; bottom: 18px; display: flex; gap: 8px; }
.btn.big { flex: 1; min-height: 96px; border-radius: 24px; padding: 6px 4px; gap: 1px; }
.btn.big img { width: 34px; height: 34px; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(80,10,50,.4)); }
.btn.big .bl { font-size: 20px; line-height: 1.15; }
.btn.big .bs { font-size: 12px; font-weight: 800; line-height: 1.1; }
.moon { width: 30px; height: 30px; border-radius: 50%; box-shadow: inset -9px -3px 0 0 #fff3b5; margin: 2px 0; filter: drop-shadow(0 2px 2px rgba(80,10,50,.4)); transform: rotate(-20deg); }

.sheet { position: absolute; left: 10px; right: 10px; bottom: 14px; padding: 14px 14px 12px; display: none; }
.sheet.open { display: block; animation: slideUp 0.28s cubic-bezier(.34,1.4,.64,1); }
@keyframes slideUp { from { transform: translateY(60px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes popIn { from { transform: scale(0.7); opacity: 0; } to { transform: none; opacity: 1; } }
.sheetTitle { text-align: center; font-weight: 900; font-size: 19px; color: var(--plum); margin-bottom: 10px; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { flex-direction: row; justify-content: flex-start; gap: 10px; border-radius: 18px; min-height: 58px; padding: 6px 14px; text-align: left; }
.opt img { width: 40px; height: 40px; object-fit: contain; flex: 0 0 auto; }
.opt .ot { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.opt .on { font-size: 18px; line-height: 1.15; }
.opt .od { font-size: 13px; font-weight: 800; line-height: 1.2; }
.opt .ou { font-size: 12px; font-weight: 800; line-height: 1.25; color: #fff3b0; margin-top: 1px; }
/* training sheet: what the stat does and the battle numbers it gives right now */
.opt.train { padding-top: 5px; padding-bottom: 5px; }
.opt.train .on { font-size: 17px; line-height: 1.1; }
.opt.train .od { line-height: 1.15; }
.opt.train .ou { font-size: 13px; line-height: 1.2; margin-top: 0; }
.opt .ow { font-size: 12px; font-weight: 800; line-height: 1.2; color: #ffe6f1; }
/* the training sheet is the tallest sheet: kept compact so the stat row above it stays in view */
#sheetTrain { padding: 12px 12px 10px; }
#sheetTrain .sheetTitle { margin-bottom: 8px; }
#sheetTrain .opts { gap: 6px; }
#sheetTrain .back { margin-top: 8px; }
/* a gain lowered by fatigue */
.opt .od b.dn { display: inline-block; padding: 0 5px; border-radius: 6px; background: #d1264f; color: #fff; text-shadow: none; font-weight: 900; }
.back { display: flex; margin: 10px auto 0; min-width: 140px; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.card { flex-direction: row; gap: 8px; border-radius: 18px; min-height: 76px; padding: 6px 10px 6px 6px; justify-content: flex-start; text-align: left; }
.card .face { width: 54px; height: 54px; border-radius: 50%; flex: 0 0 auto; background: #fff center/cover no-repeat; box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--gold); }
.card .ct { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.card .cn { font-size: 16px; line-height: 1.15; }
.card .ch { font-size: 13px; font-weight: 800; line-height: 1.2; display: flex; align-items: center; gap: 3px; }
.card .ch img { width: 16px; height: 16px; }
.card .ch small { font-size: 11px; font-weight: 800; opacity: 0.9; }
.card .cev { font-size: 11px; font-weight: 900; color: #fff6b0; line-height: 1.2; }
.card .cend { font-size: 12px; font-weight: 900; line-height: 1.2; color: #ffe0ea; margin-top: 2px; }
.card .cend.ok { color: #c9ffd6; }
.card.used, .card.locked { filter: grayscale(0.9) brightness(0.92); }
.endReq { text-align: center; font-size: 13px; font-weight: 800; color: #9a3d6c; margin: -4px 0 10px; line-height: 1.35; }
.endReq:empty { display: none; }
.endReq .rq1 { color: var(--plum); font-weight: 900; }
.endReq b { color: #d1264f; font-size: 15px; }
.endReq b.ok { color: #2f8a4c; }
/* training sheet: the fatigue threshold and where this training leaves her */
.tiredReq { margin: -4px 0 8px; line-height: 1.3; }
.tiredReq .rq1 { color: #b8325f; }
.tiredReq.bad { padding: 3px 6px; border-radius: 10px; background: rgba(209, 38, 79, 0.1); }
.tiredReq.bad .rq1 { color: #d1264f; }
.tiredReq .rq3 { margin-top: 4px; padding: 3px 8px; border-radius: 10px; background: rgba(122, 63, 160, 0.1); color: #7a3fa0; font-size: 12.5px; font-weight: 900; }
.tiredReq .rq3.ok { color: #2f8a4c; background: rgba(47, 138, 76, 0.1); }

/* ---------- battle ---------- */
.enemyPlate { position: absolute; left: 10px; top: 10px; width: calc(100% - 84px); padding: 6px 14px 8px; }
.ename { font-weight: 900; font-size: 17px; color: var(--plum); margin-bottom: 4px; }
.hpbar { position: relative; height: 16px; border-radius: 10px; background: rgba(60, 20, 50, 0.25); overflow: hidden; box-shadow: inset 0 1px 3px rgba(0,0,0,.3); }
.hpbar i { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; border-radius: 10px; transition: width 0.45s ease-out; }
.hpbar.enemy i { background: linear-gradient(#c56cf0, #7b2fb3); }
.hpbar.hero i { background: linear-gradient(#9de38f, #3fae5a); }
.hpbar.mp i { background: linear-gradient(#8fd2ff, #3a7fd8); }
.hpbar b { position: absolute; right: 8px; top: 0; font-size: 12px; line-height: 16px; color: #fff; font-weight: 900; text-shadow: 0 1px 2px #000, 0 0 3px #000; }
.hpbar.mp { height: 12px; margin-top: 4px; }
.hpbar.mp b { line-height: 12px; font-size: 11px; }
.heroPlate { position: absolute; right: 10px; width: 200px; padding: 6px 12px 8px; }
.hname { font-weight: 900; font-size: 15px; color: var(--plum); margin-bottom: 3px; white-space: nowrap; }
/* her battle damage is lowered by fatigue */
.tiredTag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 12px; font-weight: 900; line-height: 1.3;
  color: #fff; background: #d1264f; vertical-align: 1px; animation: pulse 1.6s ease-in-out infinite; }
.tiredTag:empty { display: none; }
.bLog { position: absolute; left: 10px; right: 10px; text-align: center; font-weight: 900; font-size: 16px; color: #fff; min-height: 22px;
  text-shadow: 2px 0 0 var(--plum), -2px 0 0 var(--plum), 0 2px 0 var(--plum), 0 -2px 0 var(--plum), 0 0 8px rgba(80,10,50,.8); }
.cmds { position: absolute; left: 10px; right: 10px; bottom: 14px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; transition: opacity 0.2s; }
.cmds.wait { opacity: 0.45; pointer-events: none; }
.btn.cmd { min-height: 60px; border-radius: 20px; gap: 0; padding-left: 6px; padding-right: 6px; }
.btn.cmd .bl { font-size: 18px; line-height: 1.15; white-space: nowrap; }
.btn.cmd .bs { font-size: 12px; font-weight: 800; line-height: 1.15; white-space: nowrap; }
.btn.cmd.skill { grid-column: span 2; }
.btn.cmd.skill .bl { color: #fff3b0; }
.btn.cmd.skill:not(.off) { animation: skillGlow 1.8s ease-in-out infinite; }
@keyframes skillGlow { 0%,100% { filter: drop-shadow(0 0 0 rgba(255,230,140,0)); } 50% { filter: drop-shadow(0 0 8px rgba(255,230,140,.9)); } }
.btn.cmd.skill.focus { animation: none; }
#sheetBond, #sheetSkill { bottom: 14px; }
.opt.skill .skIcon { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff3b0; background: radial-gradient(circle at 40% 35%, #fff6d0, #e7a94a 55%, #9b4a2a); box-shadow: 0 0 0 2px #fff, 0 0 10px rgba(255, 220, 120, .8); }
.opt.skill.locked, .opt.skill.used { filter: grayscale(0.85) brightness(0.92); }

/* ---------- combo attacks (his affection at the combo value) ---------- */
/* the Bond command glows pink and gold while a combo is ready */
.btn.cmd.combo:not(.off) { animation: comboGlow 1.4s ease-in-out infinite; }
.btn.cmd.combo .bs { color: #fff3b0; }
.btn.cmd.combo.focus { animation: none; }
@keyframes comboGlow {
  0%,100% { filter: drop-shadow(0 0 2px rgba(255,140,190,.7)); }
  50% { filter: brightness(1.08) drop-shadow(0 0 6px rgba(255,120,185,1)) drop-shadow(0 0 12px rgba(255,220,130,.95)); }
}
/* his card on the Bond sheet: a gold glow, a COMBO badge on the corner and the combo's name */
.card.combo { animation: comboGlow 1.6s ease-in-out infinite; padding-top: 10px; }
.card.combo.focus, .card.combo.used { animation: none; }
.card.combo .face { box-shadow: 0 0 0 3px #fff3b0, 0 0 0 5px #ff7fb4, 0 0 12px 3px rgba(255, 210, 120, .85); }
.card .ctag { position: absolute; top: -9px; right: 8px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 900; line-height: 1.3;
  letter-spacing: 0.04em; white-space: nowrap; color: #7a2d12; text-shadow: none;
  background: linear-gradient(#fff6c8, #f4c45a 60%, #e39a35); box-shadow: 0 0 0 2px #fff, 0 2px 4px rgba(90, 20, 50, .35); }
.card .cbn { font-size: 13px; font-weight: 900; line-height: 1.15; color: #fff3b0; margin: 1px 0 2px; overflow-wrap: anywhere; }
.card.combo .cd { color: #ffe6f1; }

/* ---------- dialogue ---------- */
#dlg { z-index: 20; }
.dbox { position: absolute; left: 10px; right: 10px; bottom: 14px; min-height: 150px; padding: 26px 18px 18px; cursor: pointer; }
.dname { position: absolute; left: 14px; top: -18px; padding: 4px 16px; border-radius: 999px; background: linear-gradient(#f7a8c8, #e0699a);
  color: #fff; font-weight: 900; font-size: 16px; border: 2px solid #fff; box-shadow: 0 0 0 2px var(--gold), 0 3px 6px rgba(0,0,0,.25);
  text-shadow: 0 1px 0 var(--plum), 1px 0 0 var(--plum), -1px 0 0 var(--plum), 0 -1px 0 var(--plum); }
.dname:empty { display: none; }
.dname .epi { font-size: 11px; font-weight: 800; margin-left: 6px; opacity: 0.95; }
.dtext { font-size: 17px; font-weight: 700; line-height: 1.6; color: var(--ink); white-space: pre-wrap; min-height: 82px; }
.dtext.nar { font-style: italic; color: #6b4a63; text-align: center; }
.dnext { position: absolute; right: 18px; bottom: 8px; color: #d0679a; font-size: 14px; animation: bob 0.9s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(4px); } }
.choices { position: absolute; left: 22px; right: 22px; bottom: 182px; display: flex; flex-direction: column; gap: 10px; }
.choices .btn { width: 100%; min-height: 54px; font-size: 16px; line-height: 1.3; animation: popIn 0.25s cubic-bezier(.34,1.56,.64,1) both; }
.choices .btn:nth-child(2) { animation-delay: 0.06s; }
#dlg.dim::before { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 55%, rgba(40, 10, 30, 0.35)); pointer-events: none; }

/* ---------- help ---------- */
.modal { z-index: 40; background: rgba(30, 10, 25, 0.55); }
.helpBox { position: absolute; left: 16px; right: 16px; top: 50%; transform: translateY(-50%); padding: 18px; animation: popIn 0.26s cubic-bezier(.34,1.56,.64,1); max-height: calc(100% - 40px); overflow: auto; }
.helpBody { font-size: 14px; font-weight: 700; line-height: 1.55; white-space: pre-wrap; margin-bottom: 14px; }
#helpOk { display: flex; margin: 0 auto; min-width: 160px; }

/* ---------- banner ---------- */
.banner { position: absolute; left: 0; right: 0; top: 36%; text-align: center; z-index: 30; pointer-events: none; display: none; }
.banner.show { display: block; }
.banner .bMain { font-size: 46px; font-weight: 900; letter-spacing: 0.04em; color: #fff3c4; line-height: 1.15; padding: 0 10px;
  text-shadow: 0 0 0 transparent, 3px 3px 0 var(--plum), -3px 3px 0 var(--plum), 3px -3px 0 var(--plum), -3px -3px 0 var(--plum),
    0 4px 0 var(--plum), 0 -4px 0 var(--plum), 4px 0 0 var(--plum), -4px 0 0 var(--plum), 0 8px 12px rgba(0,0,0,.45); }
.banner .bSub { margin-top: 6px; font-size: 18px; font-weight: 900; color: #fff; padding: 0 14px;
  text-shadow: 2px 2px 0 var(--plum), -2px 2px 0 var(--plum), 2px -2px 0 var(--plum), -2px -2px 0 var(--plum); }
.banner.show .bMain { animation: slam 0.45s cubic-bezier(.2,1.6,.4,1) both; }
.banner.show .bSub { animation: popIn 0.35s ease-out 0.2s both; }
.banner.dark .bMain { color: #ffd0e6; }
.banner.skill .bMain { font-size: 38px; color: #fff3b0; }
.banner.skill .bSub { font-size: 26px; color: #fff7d6; }
@keyframes slam { from { transform: scale(2.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- intro ---------- */
#intro { z-index: 50; background: #000 url(assets/intro-start.webp) center/cover no-repeat; }
#introVideo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: transparent; }
.subtitle { position: absolute; left: 16px; right: 16px; bottom: 9%; text-align: center; color: #fff; font-weight: 800; font-size: 17px; line-height: 1.55;
  padding: 10px 14px; border-radius: 14px; background: rgba(20, 8, 20, 0.55); }
.subtitle:empty { display: none; }
#skipBtn { position: absolute; right: 12px; top: 12px; min-width: 90px; z-index: 2; }

#fade { position: absolute; inset: 0; background: #1d1022; opacity: 0; pointer-events: none; z-index: 60; transition: opacity 0.28s ease; }
#fade.on { opacity: 1; pointer-events: auto; }
