/* 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: 72px; height: 72px; font-size: 0;
  background: radial-gradient(circle at 35% 30%, #fff8e0 0, #f1dca8 55%, #d9b874 100%);
  border: 2px solid #84613d; border-radius: 12px; box-shadow: inset 0 -3px 0 rgba(90,60,30,.25);
}
.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, '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, '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: 76px; height: 76px; flex: none; border-radius: 10px;
  background: radial-gradient(circle at 40% 35%, #5a3a20, #2b1a0e); border: 2px solid #c48a24; box-shadow: inset 0 0 0 2px #1a0e06;
}
.guild-theme #card-detail-modal .detail-rpg-icon { width: 64px; height: 64px; }
.guild-theme #card-detail-modal .modal-close-btn { color: #ffe9b3; background: #2b1a0e; border: 2px solid #c48a24; 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; }
body[data-rpg] #today-panel .routine-done-check {
  position: absolute; right: -6px; bottom: -6px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  font: 800 .85rem/1 sans-serif; color: #fff; background: var(--rpg-done); border: 2px solid #fff6e4;
}
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 ======================= */
body[data-rpg="inventory"] #today-panel .daily-adventure {
  background: linear-gradient(180deg, #4a2c16 0%, #2e1b0d 100%); border: 3px solid #1a0e06; border-radius: 12px;
  box-shadow: 0 0 0 3px #b8781e, 0 0 0 5px #1a0e06, inset 0 2px 0 rgba(255,220,150,.15);
}
body[data-rpg="inventory"] #today-panel .daily-adventure-heading p { color: var(--rpg-gold); }
body[data-rpg="inventory"] #today-panel .daily-adventure-heading p::before { content: '🎒 '; }
body[data-rpg="inventory"] #today-panel .routine-lane.routine-lane-open {
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: .7rem; padding: .8rem; border-radius: 10px;
  background: #1f1209; box-shadow: inset 0 3px 10px rgba(0,0,0,.6);
}
body[data-rpg="inventory"] #today-panel .routine-step {
  position: relative; grid-template-columns: 1fr; grid-template-areas: "marker" "copy" "reward";
  justify-items: center; text-align: center; row-gap: .45rem; min-height: 0; height: 100%; padding: .9rem .6rem .7rem;
  background: linear-gradient(180deg, #fff8e6, #f1dfb4); border: 2px solid #8a6438; border-radius: 10px;
  transition: transform .15s steps(3), box-shadow .15s;
}
body[data-rpg="inventory"] #today-panel .routine-step:hover { transform: translateY(-3px); box-shadow: 0 6px 0 #6e4a24; }
body[data-rpg="inventory"] #today-panel .routine-step .routine-marker.has-rpg-icon {
  width: 84px; height: 84px; border-radius: 10px; background: radial-gradient(circle at 40% 35%, #5a3a20, #2b1a0e);
  border: 2px solid #c48a24; box-shadow: inset 0 0 0 2px #1a0e06, inset 0 -6px 12px rgba(0,0,0,.5);
}
body[data-rpg="inventory"] #today-panel .routine-marker .routine-rpg-icon { width: 64px; height: 64px; }
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 { text-align: center !important; }
body[data-rpg="inventory"] #today-panel .routine-copy strong { justify-content: center; font-size: 1rem; }
body[data-rpg="inventory"] #today-panel .routine-copy small {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
body[data-rpg="inventory"] #today-panel .routine-step > em {
  font: 800 .82rem/1 'Outfit', sans-serif; color: #7a4a12; padding: .25rem .55rem; border-radius: 999px; background: #ffe9a8; border: 1px solid #c48a24;
}
body[data-rpg="inventory"] #today-panel .routine-step .routine-edit {
  position: absolute; top: 6px; right: 6px; width: 36px; min-width: 36px; min-height: 36px; height: 36px; padding: 0;
  font-size: 0; border-radius: 8px; background: #fffaf0;
}
body[data-rpg="inventory"] #today-panel .routine-step .routine-edit::before { content: '✏️'; font-size: .95rem; }
body[data-rpg="inventory"] #today-panel .routine-step.done {
  background: linear-gradient(180deg, #f2fbe8, #d6eccb); border-color: var(--rpg-done);
}
body[data-rpg="inventory"] #today-panel .routine-step.done .routine-marker.has-rpg-icon {
  border-color: #ffe08a; box-shadow: inset 0 0 0 2px #1a0e06, 0 0 0 3px rgba(255,224,138,.55), 0 0 18px rgba(255,214,90,.75);
  animation: rpg-glow 2.4s ease-in-out infinite;
}
body[data-rpg="inventory"] #today-panel .routine-phase-pill { border-radius: 10px 10px 4px 4px; }

@media (max-width: 560px) {
  body[data-rpg="inventory"] #today-panel .routine-lane.routine-lane-open { grid-template-columns: repeat(2, minmax(0,1fr)); padding: .5rem; gap: .5rem; }
  .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; }
