/* Pigs Out!: the page around the canvas (menus, the bar across the top). The game itself is drawn in js/render.js. */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #2b1d14; color: #3a2416; font-family: Fredoka, "Segoe UI", system-ui, sans-serif; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
#app { position: fixed; inset: 0; }
#cv { position: absolute; inset: 0; display: block; touch-action: none; cursor: grab; }
body.playing #cv:active { cursor: grabbing; }
[hidden] { display: none !important; }

/* the bar across the top while you play */
.hud { position: absolute; top: max(8px, env(safe-area-inset-top)); left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right)); display: flex; align-items: center; gap: 10px; pointer-events: none; z-index: 5; }
.hud .pill { background: rgba(43, 29, 20, .82); color: #fff6e6; border: 2px solid rgba(255, 233, 190, .5); border-radius: 999px; height: 44px; padding: 0 16px; display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 20px; white-space: nowrap; box-shadow: 0 3px 10px rgba(0, 0, 0, .3); }
.hud .score b { min-width: 2.2ch; text-align: right; font-variant-numeric: tabular-nums; }
.hud .score span { color: #ffe14d; font-size: 17px; }
.hud .bar { flex: 1; min-width: 60px; max-width: 420px; height: 20px; position: relative; margin-right: 12px; background: rgba(43, 29, 20, .82); border: 2px solid rgba(255, 233, 190, .5); border-radius: 999px; box-shadow: 0 3px 10px rgba(0, 0, 0, .3); }
.hud .bar > i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 999px; background: linear-gradient(#ffd54a, #f39a1e); transition: width .25s; }
.hud .bar > s { position: absolute; top: 50%; transform: translate(-50%, -54%); font-size: 22px; text-decoration: none; color: rgba(255, 255, 255, .55); text-shadow: 0 1px 0 #2b1d14, 0 -1px 0 #2b1d14, 1px 0 0 #2b1d14, -1px 0 0 #2b1d14; transition: color .2s, transform .2s; }
.hud .bar > s.on { color: #ffe14d; transform: translate(-50%, -54%) scale(1.25); }
.hud .bar > s#hS3 { left: 100%; }
.hud .spacer { flex: 1; }
.hud .time.low { color: #ff8a7a; animation: pulse .5s infinite alternate; }
.hud button.pill { pointer-events: auto; cursor: pointer; font: inherit; font-weight: 700; width: 44px; padding: 0; justify-content: center; }
.hud .power { background: rgba(31, 107, 42, .9); }
@keyframes pulse { to { transform: scale(1.12); } }
.toast { position: absolute; left: 50%; top: 68px; transform: translateX(-50%); background: rgba(43, 29, 20, .88); color: #fff6e6; border: 2px solid rgba(255, 233, 190, .5); border-radius: 999px; padding: 8px 20px; font-weight: 700; font-size: 19px; z-index: 6; pointer-events: none; white-space: nowrap; max-width: 94vw; overflow: hidden; text-overflow: ellipsis; }
.toast.in { animation: drop .3s; }
@keyframes drop { from { transform: translate(-50%, -24px); opacity: 0; } }

/* menus */
.ui { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 14px; overflow-y: auto; z-index: 10; background: rgba(30, 18, 10, .34); }
.panel { background: #fff6e2; border: 4px solid #6b4423; border-radius: 26px; box-shadow: 0 10px 0 #4a2e17, 0 18px 40px rgba(0, 0, 0, .45); padding: 22px 24px 24px; width: min(440px, 100%); max-height: 100%; overflow-y: auto; text-align: center; margin: auto; }
.panel.wide { width: min(720px, 100%); }
.panel h2 { margin: 0 0 10px; font-size: 30px; color: #6b2f1a; line-height: 1.1; }
.panel h3 { margin: 14px 0 6px; font-size: 17px; color: #8a5a2a; text-align: left; }
.panel p { margin: 8px 0; font-size: 18px; line-height: 1.4; font-weight: 500; }
.panel .note { font-size: 16px; color: #7a5a3c; }
.panel .eyebrow { margin: 0 0 4px; font-size: 15px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #b0763c; }
.logo { margin: 0; font-size: clamp(54px, 15vw, 84px); line-height: .92; font-weight: 700; letter-spacing: -.01em; }
.logo span { display: inline-block; color: #f58aa1; -webkit-text-stroke: 3px #6b2f1a; paint-order: stroke fill; text-shadow: 0 5px 0 #6b2f1a; transform: rotate(-4deg); }
.logo span + span { color: #ffd23e; transform: rotate(3deg); }
.tag { font-size: 19px !important; color: #6b4423; margin: 12px 0 16px !important; }
button, .btn { font: inherit; font-weight: 700; font-size: 18px; color: #3a2416; background: #ffe2a8; border: 3px solid #6b4423; border-radius: 16px; padding: 10px 16px; min-height: 48px; cursor: pointer; box-shadow: 0 4px 0 #6b4423; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
button:active, .btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #6b4423; }
button:focus-visible, .btn:focus-visible, input:focus-visible { outline: 4px solid #5ac8ff; outline-offset: 2px; }
button.primary { background: #f58aa1; color: #4a1626; }
button.big { font-size: 24px; padding: 12px 26px; min-height: 60px; width: 100%; margin: 6px 0 4px; }
button[disabled] { opacity: .5; cursor: default; box-shadow: 0 4px 0 #6b4423; }
.row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 12px; }
.row > button, .row > .btn { flex: 1 1 auto; }
.row.small button { font-size: 16px; min-height: 42px; padding: 6px 12px; background: #f3e3c2; }
body:not(.ca-home-on) .homelink { display: none; }
.stars i { font-style: normal; color: #d8c8a4; font-size: 1em; }
.stars i.on { color: #ffb400; text-shadow: 0 1px 0 #a86a00; }
.bigstars { font-size: 58px; line-height: 1; margin: 2px 0; }
.bigstars .on { display: inline-block; animation: popin .45s backwards; }
.bigstars .on:nth-child(2) { animation-delay: .26s; } .bigstars .on:nth-child(3) { animation-delay: .52s; }
@keyframes popin { from { transform: scale(0) rotate(-40deg); } 70% { transform: scale(1.3); } }
.result .score { font-size: 54px; font-weight: 700; color: #6b2f1a; margin: 0; line-height: 1.05; }
.stats { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; font-size: 16px !important; color: #7a5a3c; }
.stats b { color: #3a2416; }
.intro canvas { width: min(300px, 80%); height: auto; background: linear-gradient(#bfe6ff, #dff3c8 78%, #a9d77c 78%); border: 3px solid #6b4423; border-radius: 18px; margin: 4px auto; display: block; }
.days { text-align: left; }
.grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.lv { flex-direction: column; padding: 6px 2px 5px; min-height: 76px; gap: 0; border-radius: 14px; }
.lv b { font-size: 24px; line-height: 1; }
.lv small { font-size: 11px; font-weight: 600; line-height: 1.1; color: #7a5a3c; height: 2.2em; overflow: hidden; display: flex; align-items: center; text-align: center; }
.lv .stars { font-size: 15px; }
.lv.bonus { background: #ffd98a; }
.lv.locked { background: #e9dcc0; }
.howgrid { display: grid; grid-template-columns: 170px 1fr; gap: 6px 16px; align-items: center; text-align: left; }
.howgrid svg { width: 100%; background: linear-gradient(#8fd0ff, #bfe6a0 60%, #8fcc66 60%); border: 3px solid #6b4423; border-radius: 18px; }
.howgrid ul { margin: 0; padding-left: 20px; font-size: 17px; line-height: 1.35; font-weight: 500; }
.howgrid li { margin: 4px 0; }
.howtext h3 { margin: 10px 0 2px; font-size: 17px; color: #b0763c; text-transform: uppercase; letter-spacing: .04em; }
.howtext h3:first-child { margin-top: 0; }
.howtext .note { margin: 8px 0 0; }
.howtext a { color: #a8431f; font-weight: 700; }
.howgrid { align-items: start; }
.tick { display: inline-flex; gap: 8px; align-items: center; margin-top: 10px; font-size: 16px; color: #7a5a3c; cursor: pointer; }
.tick input { width: 22px; height: 22px; }
.tabs { display: flex; gap: 8px; justify-content: center; margin-bottom: 8px; }
.tabs button { min-height: 40px; padding: 4px 16px; font-size: 16px; background: #f3e3c2; }
.tabs button.on { background: #ffd23e; }
.board { width: 100%; border-collapse: collapse; font-size: 16px; text-align: left; }
.board th, .board td { padding: 5px 8px; border-bottom: 1px solid #e3d2ad; }
.board th { color: #8a5a2a; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.board td:first-child, .board td:nth-child(3), .board td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.board tr.me td { background: #ffe9a8; font-weight: 700; }
.namebox { margin-top: 12px; padding-top: 6px; border-top: 2px dashed #d8c8a4; }
.namebox input { font: inherit; font-size: 17px; font-weight: 600; padding: 8px 12px; min-height: 48px; border: 3px solid #6b4423; border-radius: 14px; background: #fff; color: #3a2416; flex: 2 1 160px; min-width: 0; -webkit-user-select: text; user-select: text; }
.namebox details { margin-top: 8px; font-size: 15px; color: #7a5a3c; }
.namebox summary { cursor: pointer; }
.code { letter-spacing: .12em; -webkit-user-select: all; user-select: all; }
@media (max-width: 560px) {
  .panel { padding: 16px 14px 18px; border-radius: 22px; }
  .panel h2 { font-size: 25px; }
  .panel p { font-size: 16px; }
  .grid { grid-template-columns: repeat(3, 1fr); }
  .howgrid { grid-template-columns: 1fr; }
  .howgrid svg { width: 120px; margin: 0 auto; }
  .howgrid ul { font-size: 15.5px; }
  .hud { gap: 6px; flex-wrap: wrap; }
  .hud .bar { order: 9; flex: 1 0 100%; max-width: none; margin: 2px 16px 0 6px; width: auto; }
  .hud .pill { height: 40px; padding: 0 11px; font-size: 17px; }
  .hud button.pill { width: 40px; }
  .bigstars { font-size: 48px; } .result .score { font-size: 44px; }
}
@media (max-height: 520px) {
  .panel { padding: 12px 16px 14px; }
  .logo { font-size: 46px; } .tag { margin: 6px 0 8px !important; }
  button.big { min-height: 48px; font-size: 20px; padding: 6px 20px; }
  .row { margin-top: 8px; }
  .bigstars { font-size: 40px; } .result .score { font-size: 38px; }
  .howgrid { grid-template-columns: 110px 1fr; } .howgrid ul { font-size: 14.5px; } .howgrid li { margin: 1px 0; } .howtext h3 { font-size: 14px; margin-top: 6px; }
  .intro canvas { width: 170px; }
}
