/* K window on desktop; Unity's violet check-in card on touch layouts.
   The journal's page is .checkin-page (js/online/checkin.js), the popup .ck-popup-body: the cookbook (css/cooking.css) and
   the crafting window's cook page (css/craftgo.css) have their own .ck-page and .ck-grid, so the check-in's rules for those
   two names start from .checkin-page (unscoped, they made the cookbook's pages violet on a phone and its recipes 4-6
   columns, 28 Oct). */
.checkin-page, .ck-popup-body {
  --ck-bg: #10283b; --ck-card: #17364b; --ck-line: #23516b; --ck-ink: #081b2b;
  --ck-dim: #16445c; --ck-active: #10283b; --ck-blue: #185776; --ck-gold: #e8b443;
  color: var(--ck-ink); font-family: 'Mitr', sans-serif; font-size: max(13px, calc(16 * var(--u)));
}
.checkin-page { padding: calc(14 * var(--u)); }
.ck-tabs { display: flex; gap: 8px; padding-bottom: 12px; border-bottom: 2px solid var(--ck-line); }
.ck-tabs button, .ck-popup-links button, .ck-makeup {
  cursor: pointer; border: 1px solid var(--ck-line); border-radius: 12px; background: var(--ck-card);
  color: var(--ck-ink); font: inherit; padding: 8px 16px; min-height: 40px;
}
.ck-tabs button.on { background: var(--ck-active); border-color: var(--ck-blue); color: var(--ck-blue); font-weight: 600; }
.ck-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0; }
.ck-heading h3 { margin: 0; font-size: max(18px, calc(24 * var(--u))); }
.ck-heading p, .ck-popup-month { color: var(--ck-dim); margin: 4px 0 0; }
.ck-progress { color: var(--ck-blue); white-space: nowrap; font-size: 20px; }
.checkin-page .ck-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.checkin-page .ck-grid.first7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.checkin-page .ck-grid.month.n28 { grid-template-columns: repeat(7, minmax(0, 1fr)); } /* (season 2: the camp calendar's four weeks) */
.ck-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-width: 0; min-height: 100px; padding: 8px 4px; border: 2px solid var(--ck-line); border-radius: 12px;
  background: var(--ck-bg); color: var(--ck-ink); font: inherit; cursor: pointer;
}
.ck-day { font-size: 12px; white-space: nowrap; }
.ck-tile img { width: 38px; height: 38px; object-fit: contain; }
.ck-amount { font-size: 13px; font-weight: 600; }
.ck-tile.milestone { background: #10283b; border-color: #d2aa55; }
.ck-tile.final { background: #17364b; }
.ck-tile.got { opacity: .65; }
.ck-tile.today { border-color: var(--ck-gold); box-shadow: inset 0 0 0 2px var(--ck-gold); opacity: 1; }
.ck-tile.selected { outline: 2px solid var(--ck-blue); outline-offset: 2px; }
.ck-stamp { position: absolute; top: 35%; right: 6px; color: #a7c5d9; font-size: 17px; font-weight: 700; }
.ck-tile.today .ck-stamp { top: -8px; bottom: auto; right: 4px; padding: 1px 6px; border-radius: 6px; color: #e8f7ff; background: #17364b; font-size: 11px; }
.ck-detail { display: grid; gap: 10px; margin-top: 14px; border: 1px solid var(--ck-line); border-radius: 12px; background: var(--ck-card); padding: 12px; }
.ck-detail > div, .ck-comeback > div { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.ck-reward { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.ck-reward img { width: 30px; height: 30px; object-fit: contain; flex: none; }
.ck-goal { padding: 10px 0; margin: 0; color: #d7c7ab; }
.ck-goal small { color: var(--ck-dim); margin-left: 8px; }
.ck-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--ck-line); padding-top: 14px; margin-top: 14px; }
.checkin-page .ck-footer { position: sticky; bottom: -1px; z-index: 1; background: var(--ck-bg); padding-bottom: 10px; }
.ck-footer > span { font-size: 13px; color: var(--ck-dim); }
.ck-footer small { display: block; margin-top: 3px; font-size: 11px; }
.ck-claim { min-width: 170px; min-height: 44px; font-size: 16px; }
.ck-comeback { display: grid; gap: 8px; padding: 14px; margin: 12px 0; border: 1px solid var(--ck-gold); border-radius: 12px; background: var(--ck-card); }
.ck-comeback small { color: var(--ck-dim); }
.ck-makeup { margin-top: 12px; }
.ck-makeup:disabled { opacity: .55; cursor: default; }
.ck-message { padding: 10px 12px; border-radius: 10px; background: var(--ck-active); overflow-wrap: anywhere; }
.ck-message.error { color: #c87a85; background: #10283b; }
.ck-empty { display: grid; justify-items: center; gap: 16px; padding: 40px 16px; font-size: 16px; }
.ck-rules { padding-left: 24px; line-height: 1.9; }
.ck-rules li { margin-bottom: 14px; }
.ck-overlay { z-index: 41; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 16px; box-sizing: border-box; background: rgba(9, 10, 26, .7); } /* (a definite track: the window's 100% is the screen, never its content's width) */
/* ---------- the daily popup, layout B "วันนี้ใหญ่" (the owner's pick of three mockups, 2026-10-27) ----------
   today's card is the big one on the left of the week (icon 68, its amount in large type), the other six days in two
   rows beside it; the two milestones stand as a side column, each with a progress bar (--ck-p from checkin.js);
   days taken get a green stamp; the button spans the foot. Phones (≤ 600px) keep the stacked flow below. */
.ck-popup { width: min(720px, 100%); min-width: 0; max-height: calc(100dvh - 32px); overflow: auto; } /* (min-width 0: the phone's 7-day strip scrolls instead of widening the window past the screen) */
.ck-popup > .kw-title { min-height: 48px; font-size: 25px; position: sticky; top: 0; z-index: 1; }
.ck-popup > .kw-title .kw-x { width: 34px; height: 34px; font-size: 16px; }
.ck-popup-body { display: grid; grid-template-columns: minmax(0, 1fr) 236px; column-gap: 16px; padding: 18px 22px 14px; }
.ck-popup-month { grid-row: 1; grid-column: 1 / -1; font-size: 15px; margin: 0 0 14px; text-align: center; }
.ck-popup-month span { white-space: nowrap; } /* (two phrases: a small phone breaks the line only at the dot) */
.ck-previews { grid-row: 2; grid-column: 2; display: grid; grid-template-columns: 1fr; gap: 10px; align-content: start; }
.ck-preview { position: relative; padding: 10px 12px 18px; background: var(--ck-card); border: 2px solid var(--ck-line); border-radius: 14px; }
.ck-preview header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; font-size: 13.5px; color: var(--ck-dim); white-space: nowrap; }
.ck-preview header b { color: #d7c7ab; background: var(--ck-bg); border: 1.5px solid var(--ck-line); border-radius: 999px; padding: 0 8px; font-size: 12.5px; }
.ck-preview > div { display: flex; flex-direction: column; gap: 8px; }
.ck-preview .ck-reward { min-width: 0; }
.ck-preview .ck-reward img { width: 32px; height: 32px; }
.ck-preview .ck-reward span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ck-preview::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 8px; height: 6px; border-radius: 99px; background: var(--ck-line); opacity: .45; }
.ck-preview::before { content: ''; position: absolute; left: 12px; bottom: 8px; z-index: 1; height: 6px; width: calc((100% - 24px) * var(--ck-p, 0)); border-radius: 99px; background: linear-gradient(90deg, #23516b, #e8b443); }
.ck-comeback, .ck-popup-body > .ck-message, .ck-footer, .ck-popup-links { grid-column: 1 / -1; }
.ck-week { grid-row: 2; grid-column: 1; display: grid; grid-template-columns: 1.35fr repeat(3, minmax(0, 1fr)); grid-auto-rows: minmax(92px, 1fr); gap: 8px; }
.ck-week .ck-tile { min-height: 0; border-width: 2.5px; border-radius: 14px; gap: 4px; }
.ck-week .ck-tile img { width: 30px; height: 30px; }
.ck-week .ck-day { font-size: 12px; color: var(--ck-dim); }
.ck-week .ck-amount { font-size: 13.5px; }
.ck-week .ck-tile:not(.got):not(.today) { opacity: .8; }
.ck-week .ck-tile.got { opacity: 1; background: color-mix(in srgb, #23516b 16%, var(--ck-bg)); border-color: #416e87; }
.ck-week .ck-tile.got img { opacity: .45; }
.ck-week .ck-tile.got .ck-stamp { top: 50%; left: 50%; right: auto; transform: translate(-50%, -58%) rotate(-12deg); width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: #23516b; color: #e8f7ff; border: 2.5px solid #416e87; box-shadow: 0 2px 0 rgba(0, 0, 0, .22); font-size: 17px; }
.ck-week .ck-tile.today { order: -1; grid-column: 1; grid-row: 1 / span 2; padding-top: 18px; gap: 8px; opacity: 1; background: color-mix(in srgb, var(--ck-gold) 14%, var(--ck-bg)); border-color: var(--ck-gold); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ck-gold) 45%, #416e87), 0 6px 16px rgba(232, 180, 67, .35); }
.ck-week .ck-tile.today img { width: 68px; height: 68px; }
.ck-week .ck-tile.today .ck-day { font-size: 15px; color: var(--ck-ink); font-weight: 600; }
.ck-week .ck-tile.today .ck-amount { font-size: 22px; }
.ck-week .ck-tile.today .ck-stamp { top: -13px; bottom: auto; left: 50%; right: auto; transform: translateX(-50%); padding: 2px 10px; border-radius: 99px; color: #e8f7ff; background: linear-gradient(#17364b, #ffd04a); border: 2px solid var(--ck-ink); box-shadow: 0 2px 0 var(--ck-ink); font-size: 12px; white-space: nowrap; }
.ck-week .ck-tile.final { background: linear-gradient(#10283b, #17364b); border-color: #d2aa55; }
.ck-popup-body > .ck-footer { margin-top: 16px; }
.ck-popup-body .ck-claim { min-width: 260px; min-height: 52px; font-size: 20px; }
.ck-popup-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; }
.ck-popup-links button { border: 0; color: var(--ck-blue); padding: 8px 0; background: transparent; }
.checkin-page button:focus-visible, .ck-overlay button:focus-visible { outline: 3px solid var(--ck-blue); outline-offset: 3px; }
html.mob .checkin-page, html.mob .ck-popup-body {
  --ck-bg: #081b2b; --ck-card: #081b2b; --ck-line: #16445c; --ck-ink: #10283b;
  --ck-dim: #17364b; --ck-active: #16445c; --ck-blue: #17364b; --ck-gold: #ebc171;
}
html.mob .checkin-page { background: var(--ck-bg); border-radius: 12px; }
html.mob .ck-overlay .ck-popup { background: #081b2b; border-color: #183c54; box-shadow: inset 0 0 0 2px #3c7d98; }
html.mob .ck-overlay .kw-title { background: #185776; border-color: #183c54; }
html.mob .ck-tile.milestone, html.mob .ck-tile.final { background: #16445c; border-color: #c19f65; }
html.mob .ck-goal { color: #c8e1ee; }
html.mob .ck-claim { background: #185776; color: white; -webkit-text-stroke: 0; border-color: #183c54; }
@media (max-width: 600px) {
  .checkin-page, .ck-popup-body { font-size: 14px; }
  .checkin-page { padding: 8px; }
  .ck-tabs button { min-height: 44px; flex: 1; padding: 8px; }
  .checkin-page .ck-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .checkin-page .ck-grid.first7 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .checkin-page .ck-grid.first7 .final { grid-column: span 2; }
  .ck-tile { min-height: 84px; }
  .ck-tile img { width: 30px; height: 30px; }
  .ck-day { font-size: 11px; }
  .ck-footer { flex-direction: column-reverse; align-items: stretch; text-align: center; }
  .ck-claim { width: 100%; }
  .ck-previews { grid-template-columns: 1fr; }
  .ck-preview { padding: 10px; }
  .ck-preview > div { flex-direction: row; flex-wrap: wrap; }
  .ck-preview .ck-reward img { width: 30px; height: 30px; }
  .ck-preview header { margin-bottom: 8px; }
  .ck-popup-month { font-size: 14px; }
  .ck-overlay { justify-items: stretch; } /* (portrait.css gives K windows width:auto there: stretch to the screen, the 7-day strip scrolls) */
  .ck-popup-body { display: block; padding: 14px; }
  .ck-previews { grid-template-columns: 1fr; margin-bottom: 4px; }
  .ck-week .ck-tile.today { order: 0; grid-column: auto; grid-row: auto; padding-top: 10px; gap: 4px; }
  .ck-week .ck-tile.today img { width: 23px; height: 23px; }
  .ck-week .ck-tile.today .ck-day, .ck-week .ck-tile.today .ck-amount { font-size: 11px; }
  .ck-week .ck-tile.got .ck-stamp { width: 24px; height: 24px; font-size: 13px; }
  .ck-week { gap: 3px; }
  .ck-week { grid-template-columns: repeat(7, minmax(46px, 1fr)); overflow-x: auto; padding: 8px 0; }
  .ck-week .ck-tile { min-height: 72px; padding: 6px 2px; }
  .ck-week .ck-tile img { width: 23px; height: 23px; }
  .ck-week .ck-day, .ck-week .ck-amount { font-size: 11px; } /* (Thai ≥ 11px: the owner's rule, 2026-10-27) */
  .ck-popup-links button { min-height: 44px; font-size: 14px; }
}
@media (max-width: 360px) { .checkin-page .ck-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (prefers-reduced-motion: reduce) { .ck-overlay *, .checkin-page * { scroll-behavior: auto; } }
