/* Health RPG skin (Audi 2026-10-18): 16/32-bit MMORPG item art + three Daily Routine concepts.
   Daily Routine uses the inventory look (body[data-rpg="inventory"]). */
:root {
  --rpg-pixel: 'Silkscreen', 'Outfit', system-ui, sans-serif;
  --rpg-ink: #2b1a0e;
  --rpg-ink-soft: #5a4128;
  --rpg-parch: #fbf0d4;
  --rpg-parch-2: #efdcae;
  --rpg-gold: #f3cc76;
  --rpg-gold-deep: #b8781e;
  --rpg-walnut: #3a2414;
  --rpg-walnut-2: #241509;
  --rpg-done: #2f8a55;
}
.rpg-icon { image-rendering: pixelated; image-rendering: crisp-edges; display: block; flex: none; }

/* ---------- shared: tab bar, quick tiles, log type tiles ---------- */
.guild-theme .health-tab .rpg-tab-icon { width: 32px; height: 32px; margin: -4px 0; }
.guild-theme .health-tab.active .rpg-tab-icon { animation: rpg-bob 1.2s steps(2) infinite; }
.guild-theme #today-panel #quick-actions button > .rpg-icon-slot {
  display: grid; place-items: center; width: 56px; height: 56px; font-size: 0;
  background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 0 !important;
}
.guild-theme #today-panel #quick-actions button > .rpg-icon-slot .rpg-icon { width: 64px; height: 64px; }
.guild-theme #today-panel #quick-actions button:hover > .rpg-icon-slot .rpg-icon { animation: rpg-bob .6s steps(2) 2; }
.quick-log-switcher [data-log-kind] { display: inline-flex; align-items: center; gap: .45rem; }
.quick-log-switcher [data-log-kind] .rpg-icon { width: 32px; height: 32px; }

/* ---------- meal form: one-tap slot chips + "eat it again" ---------- */
.meal-slot-chips { display: flex; flex-wrap: wrap; gap: .45rem; margin: 0 0 .8rem; }
.meal-slot-chips button {
  min-height: 40px; padding: .35rem .8rem; border-radius: 999px; font: 600 .92rem/1.2 var(--font-body, 'AK Thai','Google Sans','Outfit', sans-serif);
  color: var(--rpg-ink); background: #fffaf0; border: 1.5px solid #c9a46a; cursor: pointer;
}
.meal-slot-chips button:hover { background: #fbe9bf; }
.meal-slot-chips button[aria-checked="true"] { background: linear-gradient(180deg,#ffe08a,#e6ad3a); border-color: #8a5a14; box-shadow: inset 0 -2px 0 rgba(122,74,18,.35); }
.meal-slot-chips button:focus-visible, .meal-recent-chip:focus-visible { outline: 3px solid #754017; outline-offset: 2px; }
.meal-recent { margin: 0 0 .9rem; }
.meal-recent-label { display: block; margin-bottom: .35rem; font: 700 .85rem/1.3 var(--font-body, 'AK Thai','Google Sans','Outfit', sans-serif); color: var(--rpg-ink-soft); }
.meal-recent-list { display: flex; flex-wrap: wrap; gap: .45rem; }
.meal-recent-chip {
  display: grid; gap: .1rem; text-align: left; min-height: 44px; padding: .4rem .7rem; border-radius: 10px; cursor: pointer;
  color: var(--rpg-ink); background: #fffdf6; border: 1.5px dashed #b08a52;
}
.meal-recent-chip strong { font-size: .9rem; line-height: 1.3; }
.meal-recent-chip small { font-size: .78rem; color: var(--rpg-ink-soft); }
.meal-recent-chip:hover { border-style: solid; background: #fbefd2; }
.meal-when summary { font-weight: 600; }
.meal-when .meal-when-text { flex: 1 1 auto; min-width: 0; } /* one text run, so the fold row never splits into narrow flex columns on phones */

/* ---------- quick-log window: an RPG game window over the current tab ---------- */
.ro-window {
  width: min(640px, calc(100vw - 24px)); max-height: min(86vh, 900px); padding: 0; overflow: hidden;
  color: #fff3d6;
}
.ro-window[open] { display: flex; flex-direction: column; animation: rpg-window-in .22s steps(4) both; }
.ro-window::backdrop { background: rgba(14,8,4,.62); backdrop-filter: blur(2px); }
.ro-window-bar {
  display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem .5rem .8rem;
  background: linear-gradient(180deg, #6e4220 0%, #4a2a14 55%, #3a2010 100%); border-bottom: 3px solid #c48a24;
}
.ro-window-bar strong { flex: 1; color: #ffe9b3; font: 700 1.1rem/1.2 var(--rpg-pixel); letter-spacing: .02em; text-shadow: 0 2px 0 #1a0e06; }
.ro-window-icon .rpg-icon { width: 32px; height: 32px; }
.ro-window-x {
  width: 40px; height: 40px; border-radius: 8px; cursor: pointer; font: 700 1rem/1 sans-serif;
  color: #ffe9b3; background: #2b1a0e; border: 2px solid #c48a24;
}
.ro-window-x:hover { background: #8a1f2b; }
.ro-window-x:focus-visible { outline: 3px solid #ffe08a; outline-offset: 2px; }
.ro-window-body { padding: 1rem 1.1rem 1.2rem; overflow: auto; background: transparent; }
#quick-log-window .ro-window-body :is(.log-form-surface, .capture-form) { margin: 0 !important; padding: 0 !important; border: 0 !important; box-shadow: none !important; background: transparent !important; }
#quick-log-window .ro-window-body .form-actions, #quick-log-window .ro-window-body .capture-form-actions {
  position: sticky; bottom: -1.2rem; z-index: 1; margin: .6rem -1.1rem -1.2rem; padding: .7rem 1.1rem .9rem;
  background: linear-gradient(180deg, rgba(251,240,212,.85), var(--rpg-parch) 40%); border-top: 2px solid #e2c48a;
}
#quick-log-window .ro-window-body :is(.device-intake, .starter-program:empty) { display: none; }
.ro-window-body .panel-heading { display: none; }
.ro-window-body :is(label, small, p, summary) { color: var(--rpg-ink); }
.ro-window-body :is(input, select, textarea) { color: var(--rpg-ink); background: #fffdf7; border: 1.5px solid #b08a52; }

/* ---------- opened item (detail) = the same game window ---------- */
.guild-theme #card-detail-modal {
  color: #fff3d6;
}
.guild-theme #card-detail-modal[open] { animation: rpg-window-in .22s steps(4) both; }
.guild-theme #card-detail-modal::backdrop { background: rgba(14,8,4,.62); }
.guild-theme #card-detail-modal .modal-dialog-header {
  background: linear-gradient(180deg, #6e4220 0%, #4a2a14 55%, #3a2010 100%); border-bottom: 3px solid #c48a24;
}
.guild-theme #card-detail-modal .modal-dialog-header :is(h2, small) { color: #ffe9b3; }
.guild-theme #card-detail-modal .modal-dialog-header h2 { font-family: var(--rpg-pixel); }
.guild-theme #card-detail-modal .modal-detail-icon {
  display: grid; place-items: center; width: 64px; height: 64px; flex: none;
  background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 0 !important;
}
.guild-theme #card-detail-modal .detail-rpg-icon { width: 56px; height: 56px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.45)); }
.guild-theme #card-detail-modal .modal-close-btn { color: #ffe9b3; background: #1a2344; border: 1px solid rgba(148,163,248,.35); border-radius: 8px; }

/* ---------- shared routine pieces ---------- */
body[data-rpg] #today-panel .daily-adventure .routine-marker.has-rpg-icon { position: relative; display: grid; place-items: center; font-size: 0; flex-shrink: 0; background: transparent !important; border: 0 !important; box-shadow: none !important; }
body[data-rpg] #today-panel .routine-done-check,
body[data-rpg] #today-panel .routine-check-badge {
  position: absolute; right: -2px; bottom: -2px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  font: 800 .74rem/1 'AK Thai','Google Sans','Outfit', sans-serif; color: #dce2ff; background: #161b3d; border: 1.5px solid rgba(148,163,248,.45);
  box-shadow: 0 2px 5px rgba(0,0,0,.45);
}
body[data-rpg] #today-panel .routine-step.done .routine-check-badge,
body[data-rpg] #today-panel .routine-done-check {
  color: #06281e; background: #34d399; border-color: #ecfdf5;
}
body[data-rpg] #today-panel .quest-stat-badge { display: inline-flex; align-items: center; gap: .25rem; font-weight: 800; }
body[data-rpg] #today-panel .quest-stat-badge .rpg-stat-icon { width: 18px; height: 18px; image-rendering: auto; }
body[data-rpg] #today-panel .daily-adventure-heading h2 { font-family: var(--rpg-pixel); letter-spacing: .01em; }

/* ======================= A · INVENTORY & QUEST BOARD ======================= */
body[data-rpg="inventory"] #today-panel .daily-adventure {
  background-color: #111833; border: 1.5px solid rgba(244, 197, 106, .42); border-radius: 20px;
  box-shadow: 0 18px 38px rgba(4, 5, 18, .62), inset 0 1px 0 rgba(255,240,194,.18);
}
body[data-rpg="inventory"] #today-panel .daily-adventure-heading p { color: #f4c56a; }
body[data-rpg="inventory"] #today-panel .daily-adventure-heading p::before { content: '🎒 '; }
body[data-rpg="inventory"] #today-panel .routine-lane.routine-lane-open {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)) !important;
  gap: .85rem !important;
  padding: .25rem 0 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
body[data-rpg="inventory"] #today-panel .routine-step {
  position: relative;
  display: grid !important;
  grid-template-columns: 52px minmax(0, 1fr) auto !important;
  grid-template-areas: "marker copy reward" !important;
  align-items: center !important;
  justify-items: stretch !important;
  text-align: left !important;
  column-gap: .85rem !important;
  row-gap: .35rem !important;
  min-height: 92px;
  height: 100%;
  padding: .9rem 2.9rem .9rem .95rem !important;
  background-color: #182042 !important;
  background-image: linear-gradient(145deg, rgba(148, 163, 248, .10) 0%, rgba(17, 24, 51, .16) 100%) !important;
  border: 1px solid rgba(148, 163, 248, .28) !important;
  border-radius: 14px !important;
  box-shadow: 0 6px 16px rgba(4, 6, 20, .34), inset 0 1px 0 rgba(255, 255, 255, .08) !important;
  transition: transform .15s ease, box-shadow .15s, border-color .15s;
}
body[data-rpg="inventory"] #today-panel .routine-step:hover {
  transform: translateY(-2px);
  background-color: #1f2a54 !important;
  border-color: rgba(244, 197, 106, .65) !important;
  box-shadow: 0 10px 22px rgba(4, 6, 20, .48) !important;
}
body[data-rpg="inventory"] #today-panel .routine-step .routine-marker.has-rpg-icon {
  grid-area: marker;
  width: 52px; height: 52px; border-radius: 0 !important;
  background: transparent !important;
  background-image: none !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}
body[data-rpg="inventory"] #today-panel .routine-marker .routine-rpg-icon { width: 44px; height: 44px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.45)); }
body[data-rpg="inventory"] #today-panel .routine-step:hover .routine-rpg-icon { animation: rpg-bob .6s steps(2) 2; }
body[data-rpg="inventory"] #today-panel .routine-copy {
  grid-area: copy;
  text-align: left !important;
  display: grid;
  gap: .25rem;
  min-width: 0;
}
body[data-rpg="inventory"] #today-panel .routine-copy strong {
  display: block !important;
  font-size: 1rem;
  line-height: 1.3;
  color: #fff9eb !important;
}
body[data-rpg="inventory"] #today-panel .routine-badge-row {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem;
}
body[data-rpg="inventory"] #today-panel .routine-copy small {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: .86rem; line-height: 1.45; color: #cbd5e1 !important;
}
body[data-rpg="inventory"] #today-panel .routine-step > em {
  grid-area: reward;
  align-self: center;
  font: 800 .86rem/1 'JetBrains Mono', 'Outfit', monospace;
  color: #f4c56a !important;
  padding: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  background-image: none !important;
  border: 0 !important;
  box-shadow: none !important;
  white-space: nowrap;
}
body[data-rpg="inventory"] #today-panel .routine-step .routine-edit {
  position: absolute; top: 10px; right: 10px; width: 32px; min-width: 32px; min-height: 32px; height: 32px; padding: 0;
  font-size: 0; border-radius: 8px !important;
  background: rgba(255, 255, 255, .04) !important;
  border: 1px solid rgba(148, 163, 248, .24) !important;
  color: #cbd5e1 !important;
  box-shadow: none !important;
}
body[data-rpg="inventory"] #today-panel .routine-step .routine-edit::before { content: '✏️'; font-size: .85rem; margin: 0 !important; }
body[data-rpg="inventory"] #today-panel .routine-step.done {
  background-color: #132e29 !important;
  background-image: linear-gradient(145deg, rgba(52, 211, 153, .18), rgba(16, 48, 40, .16)) !important;
  border-color: rgba(52, 211, 153, .55) !important;
}
body[data-rpg="inventory"] #today-panel .routine-step.done .routine-marker.has-rpg-icon {
  border: 0 !important;
  box-shadow: none !important;
  animation: none;
}
body[data-rpg="inventory"] #today-panel .routine-step.done > em {
  background: transparent !important;
  background-image: none !important;
  border: 0 !important;
  color: #34d399 !important;
  box-shadow: none !important;
}
body[data-rpg="inventory"] #today-panel .routine-phase-pill { border-radius: 14px; }

@media (max-width: 640px) {
  body[data-rpg="inventory"] #today-panel .routine-lane.routine-lane-open { grid-template-columns: 1fr !important; padding: .75rem !important; gap: .75rem !important; }
  body[data-rpg="inventory"] #today-panel .routine-step {
    grid-template-columns: 60px minmax(0, 1fr) !important;
    grid-template-areas: "marker copy" "marker reward" !important;
    padding: .85rem 2.8rem .85rem .85rem !important;
    min-height: 0;
  }
  body[data-rpg="inventory"] #today-panel .routine-step .routine-marker.has-rpg-icon { width: 60px; height: 60px; }
  body[data-rpg="inventory"] #today-panel .routine-marker .routine-rpg-icon { width: 40px; height: 40px; }
  body[data-rpg="inventory"] #today-panel .routine-step > em { justify-self: start; }
  .guild-theme #today-panel #quick-actions button > .rpg-icon-slot { width: 56px; height: 56px; }
  .guild-theme #today-panel #quick-actions button > .rpg-icon-slot .rpg-icon { width: 32px; height: 32px; }
}

@keyframes rpg-bob { 50% { transform: translateY(-3px); } }
@keyframes rpg-glow { 50% { box-shadow: inset 0 0 0 2px #1a0e06, 0 0 0 3px rgba(255,224,138,.3), 0 0 8px rgba(255,214,90,.4); } }
@keyframes rpg-stamp { from { transform: translateY(-50%) rotate(-12deg) scale(1.8); opacity: 0; } }
@keyframes rpg-window-in { from { transform: scale(.94); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .rpg-icon, .routine-marker, .ro-window[open], .routine-step::after { animation: none !important; }
  body[data-rpg] #today-panel .routine-step { transition: none !important; }
}
html[data-motion="paused"] :is(.rpg-icon, .routine-marker, .routine-step::after, .ro-window) { animation: none !important; }

/* emoji badges swapped for item art inside tiles */
.rpg-icon-slot > .rpg-slot-icon { width: 32px; height: 32px; margin: 0 auto; }
