/* ===================================================================== */
/* COREPEDIA (#corepedia-window): the CoreCraftia fantasy frame - bright   */
/* blue border, gold title, 3D tabs/filters and leaf corners. Presentation */
/* only: the markup and behaviour live in corepedia.js. The book injects   */
/* its own <style> at runtime (after this file), so every rule here uses   */
/* "body #corepedia-window" to win on specificity.                         */
/* ===================================================================== */

body #corepedia-overlay{
  --cp-frame: #2f93ff;
  --cp-card: linear-gradient(180deg, #0c2144, #081a38);
  --cp-btn: linear-gradient(180deg, #1b5fb8 0%, #123f86 52%, #0c2c62 100%);
  --cp-btn-on: linear-gradient(180deg, #4aa6ff 0%, #2677e6 52%, #1757bd 100%);
  --cp-leaf-tl: url("data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20viewBox=%270%200%2090%2070%27%3E%3Cg%20transform=%27translate%280%200%29%20scale%281%201%29%27%3E%3Cdefs%3E%3ClinearGradient%20id=%27g%27%20x1=%270%27%20y1=%270%27%20x2=%271%27%20y2=%271%27%3E%3Cstop%20offset=%270%27%20stop-color=%27%23a6e864%27/%3E%3Cstop%20offset=%271%27%20stop-color=%27%232f8a3a%27/%3E%3C/linearGradient%3E%3Cg%20id=%27l%27%3E%3Cpath%20d=%27M2%2012C10%200%2028%200%2038%2012%2028%2024%2010%2024%202%2012Z%27%20fill=%27url%28%23g%29%27%20stroke=%27%2316501f%27%20stroke-width=%272%27%20stroke-linejoin=%27round%27/%3E%3Cpath%20d=%27M6%2012H34%27%20stroke=%27%23d8f8ad%27%20stroke-opacity=%27.75%27%20stroke-width=%271.6%27%20stroke-linecap=%27round%27/%3E%3C/g%3E%3C/defs%3E%3Cuse%20href=%27%23l%27%20x=%272%27%20y=%2726%27%20width=%2734%27%20height=%2720%27%20transform=%27rotate%28-38%2019%2036%29%27/%3E%3Cuse%20href=%27%23l%27%20x=%2722%27%20y=%278%27%20width=%2734%27%20height=%2720%27%20transform=%27rotate%28-8%2039%2018%29%27/%3E%3Cuse%20href=%27%23l%27%20x=%2740%27%20y=%2734%27%20width=%2730%27%20height=%2718%27%20transform=%27rotate%2834%2055%2043%29%27/%3E%3C/g%3E%3C/svg%3E");
  --cp-leaf-tr: url("data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20viewBox=%270%200%2090%2070%27%3E%3Cg%20transform=%27translate%2890%200%29%20scale%28-1%201%29%27%3E%3Cdefs%3E%3ClinearGradient%20id=%27g%27%20x1=%270%27%20y1=%270%27%20x2=%271%27%20y2=%271%27%3E%3Cstop%20offset=%270%27%20stop-color=%27%23a6e864%27/%3E%3Cstop%20offset=%271%27%20stop-color=%27%232f8a3a%27/%3E%3C/linearGradient%3E%3Cg%20id=%27l%27%3E%3Cpath%20d=%27M2%2012C10%200%2028%200%2038%2012%2028%2024%2010%2024%202%2012Z%27%20fill=%27url%28%23g%29%27%20stroke=%27%2316501f%27%20stroke-width=%272%27%20stroke-linejoin=%27round%27/%3E%3Cpath%20d=%27M6%2012H34%27%20stroke=%27%23d8f8ad%27%20stroke-opacity=%27.75%27%20stroke-width=%271.6%27%20stroke-linecap=%27round%27/%3E%3C/g%3E%3C/defs%3E%3Cuse%20href=%27%23l%27%20x=%272%27%20y=%2726%27%20width=%2734%27%20height=%2720%27%20transform=%27rotate%28-38%2019%2036%29%27/%3E%3Cuse%20href=%27%23l%27%20x=%2722%27%20y=%278%27%20width=%2734%27%20height=%2720%27%20transform=%27rotate%28-8%2039%2018%29%27/%3E%3Cuse%20href=%27%23l%27%20x=%2740%27%20y=%2734%27%20width=%2730%27%20height=%2718%27%20transform=%27rotate%2834%2055%2043%29%27/%3E%3C/g%3E%3C/svg%3E");
  --cp-leaf-bl: url("data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20viewBox=%270%200%2090%2070%27%3E%3Cg%20transform=%27translate%280%2070%29%20scale%281%20-1%29%27%3E%3Cdefs%3E%3ClinearGradient%20id=%27g%27%20x1=%270%27%20y1=%270%27%20x2=%271%27%20y2=%271%27%3E%3Cstop%20offset=%270%27%20stop-color=%27%23a6e864%27/%3E%3Cstop%20offset=%271%27%20stop-color=%27%232f8a3a%27/%3E%3C/linearGradient%3E%3Cg%20id=%27l%27%3E%3Cpath%20d=%27M2%2012C10%200%2028%200%2038%2012%2028%2024%2010%2024%202%2012Z%27%20fill=%27url%28%23g%29%27%20stroke=%27%2316501f%27%20stroke-width=%272%27%20stroke-linejoin=%27round%27/%3E%3Cpath%20d=%27M6%2012H34%27%20stroke=%27%23d8f8ad%27%20stroke-opacity=%27.75%27%20stroke-width=%271.6%27%20stroke-linecap=%27round%27/%3E%3C/g%3E%3C/defs%3E%3Cuse%20href=%27%23l%27%20x=%272%27%20y=%2726%27%20width=%2734%27%20height=%2720%27%20transform=%27rotate%28-38%2019%2036%29%27/%3E%3Cuse%20href=%27%23l%27%20x=%2722%27%20y=%278%27%20width=%2734%27%20height=%2720%27%20transform=%27rotate%28-8%2039%2018%29%27/%3E%3Cuse%20href=%27%23l%27%20x=%2740%27%20y=%2734%27%20width=%2730%27%20height=%2718%27%20transform=%27rotate%2834%2055%2043%29%27/%3E%3C/g%3E%3C/svg%3E");
  --cp-leaf-br: url("data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20viewBox=%270%200%2090%2070%27%3E%3Cg%20transform=%27translate%2890%2070%29%20scale%28-1%20-1%29%27%3E%3Cdefs%3E%3ClinearGradient%20id=%27g%27%20x1=%270%27%20y1=%270%27%20x2=%271%27%20y2=%271%27%3E%3Cstop%20offset=%270%27%20stop-color=%27%23a6e864%27/%3E%3Cstop%20offset=%271%27%20stop-color=%27%232f8a3a%27/%3E%3C/linearGradient%3E%3Cg%20id=%27l%27%3E%3Cpath%20d=%27M2%2012C10%200%2028%200%2038%2012%2028%2024%2010%2024%202%2012Z%27%20fill=%27url%28%23g%29%27%20stroke=%27%2316501f%27%20stroke-width=%272%27%20stroke-linejoin=%27round%27/%3E%3Cpath%20d=%27M6%2012H34%27%20stroke=%27%23d8f8ad%27%20stroke-opacity=%27.75%27%20stroke-width=%271.6%27%20stroke-linecap=%27round%27/%3E%3C/g%3E%3C/defs%3E%3Cuse%20href=%27%23l%27%20x=%272%27%20y=%2726%27%20width=%2734%27%20height=%2720%27%20transform=%27rotate%28-38%2019%2036%29%27/%3E%3Cuse%20href=%27%23l%27%20x=%2722%27%20y=%278%27%20width=%2734%27%20height=%2720%27%20transform=%27rotate%28-8%2039%2018%29%27/%3E%3Cuse%20href=%27%23l%27%20x=%2740%27%20y=%2734%27%20width=%2730%27%20height=%2718%27%20transform=%27rotate%2834%2055%2043%29%27/%3E%3C/g%3E%3C/svg%3E");
  background:
    radial-gradient(circle at 20% 0%, rgba(73, 168, 255, 0.18), transparent 28%),
    radial-gradient(circle at 80% 0%, rgba(34, 199, 255, 0.12), transparent 24%),
    rgba(2, 10, 18, 0.74) !important;
  font-family: Georgia, "Times New Roman", serif;
}

/* ---- frame ---- */
body #corepedia-window{
  overflow: visible;
  border: 4px solid var(--cp-frame);
  border-radius: 22px;
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(90, 170, 255, 0.22), transparent 60%),
    linear-gradient(180deg, #123c72 0%, #0b2750 52%, #081b38 100%);
  box-shadow:
    0 0 0 2px #082f66,
    0 18px 44px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1px rgba(150, 210, 255, 0.35),
    inset 0 3px 0 rgba(255, 255, 255, 0.08);
}
body #corepedia-window::before{ display: none; }
body #corepedia-window::after{
  content: "";
  position: absolute;
  left: -12px;
  top: -12px;
  right: auto;
  width: calc(100% + 24px);
  height: calc(100% + 24px);
  z-index: 6;
  border: 0;
  pointer-events: none;
  background:
    var(--cp-leaf-tl) left top / 54px 42px no-repeat,
    var(--cp-leaf-tr) right top / 54px 42px no-repeat,
    var(--cp-leaf-bl) left bottom / 54px 42px no-repeat,
    var(--cp-leaf-br) right bottom / 54px 42px no-repeat;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.35));
}

/* ---- header ---- */
body #corepedia-window .cp-head{
  padding: 12px 18px 8px 22px;
  background: none;
  border-bottom: 2px solid rgba(120, 190, 255, 0.3);
  box-shadow: none;
}
body #corepedia-window .cp-title{
  display: flex;
  align-items: center;
  gap: 12px;
  font: 900 clamp(22px, 2.6vw, 34px)/1.05 Georgia, "Times New Roman", serif;
  letter-spacing: 0.04em;
  color: #ffd34a;
  -webkit-text-stroke: 5px #3b1c05;
  paint-order: stroke fill;
  text-shadow: 0 4px 0 rgba(30, 12, 2, 0.85);
}
body #corepedia-window .cp-title::before{
  content: "";
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  background: url("/photos/icons_tilemap.png") no-repeat;
  background-size: 440px 320px;
  background-position: -40px 0;
  -webkit-text-stroke: 0;
  filter: drop-shadow(0 3px 0 rgba(30, 14, 4, 0.55));
}
body #corepedia-window .cp-title small{
  font: 700 clamp(13px, 1.3vw, 17px)/1 Georgia, serif;
  letter-spacing: 0.02em;
  color: #cfe9ff;
  -webkit-text-stroke: 0;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.55);
}
body #corepedia-window .cp-icon-btn{
  width: 38px;
  height: 38px;
  border: 3px solid #0b2c5e;
  border-radius: 11px;
  background: var(--cp-btn);
  box-shadow: 0 3px 0 #061a38, inset 0 2px 0 rgba(255, 255, 255, 0.3);
  color: #fff;
  font: 900 20px/1 Georgia, serif;
  text-shadow: 0 2px 0 rgba(0, 20, 60, 0.85);
  transition: filter 120ms ease, transform 120ms ease;
}
body #corepedia-window .cp-icon-btn:hover{ filter: brightness(1.15); }
body #corepedia-window .cp-icon-btn:active{ transform: translateY(2px); }
body #corepedia-window .cp-close{
  border: 3px solid #fff;
  background: linear-gradient(180deg, #ff6a5c 0%, #d3201a 52%, #a31410 100%);
  box-shadow: 0 0 0 2px #4a1210, 0 4px 8px rgba(0, 0, 0, 0.5), inset 0 3px 0 rgba(255, 255, 255, 0.4);
}

/* ---- tier tabs ---- */
body #corepedia-window .cp-tab,
body #corepedia-window .cp-filter{
  border: 3px solid #0b2c5e;
  background: var(--cp-btn);
  box-shadow: 0 3px 0 #061a38, inset 0 2px 0 rgba(255, 255, 255, 0.25);
  color: #fff;
  font-family: Georgia, serif;
  text-shadow: 0 2px 0 rgba(0, 20, 60, 0.85);
  transition: filter 120ms ease, transform 120ms ease;
}
body #corepedia-window .cp-tab{ min-height: 38px; border-radius: 14px; font-size: 13px; letter-spacing: 0.04em; }
body #corepedia-window .cp-tab:hover,
body #corepedia-window .cp-filter:hover{ filter: brightness(1.15); transform: translateY(-1px); }
body #corepedia-window .cp-tab.is-active,
body #corepedia-window .cp-filter[aria-pressed="true"]{
  border-color: #0b2c5e;
  background: var(--cp-btn-on);
  box-shadow: 0 3px 0 #061a38, 0 0 0 2px #8fd2ff, inset 0 3px 0 rgba(255, 255, 255, 0.45);
}
body #corepedia-window .cp-tab.is-empty:not(.is-active){ opacity: 0.6; }

/* ---- panels ---- */
body #corepedia-window .cp-grid-wrap,
body #corepedia-window .cp-details{
  border: 3px solid rgba(120, 190, 255, 0.45);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(4, 14, 32, 0.78), rgba(6, 20, 42, 0.62));
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.4);
  scrollbar-color: #2f93ff rgba(0, 0, 0, 0.25);
  scrollbar-width: thin;
}
body #corepedia-window .cp-empty{ color: #cfe6ff; font-weight: 800; }

/* ---- recipe grid ---- */
body #corepedia-window .cp-slot{
  border-radius: 13px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.12); /* no 3px drop 'lip' under the slot: it read as a stray stripe */
  transition: transform 120ms ease, filter 120ms ease;
}
body #corepedia-window .cp-slot:hover{ transform: translateY(-2px); filter: brightness(1.12); }
body #corepedia-window .cp-slot.is-locked,
body #corepedia-window .cp-slot.is-available{
  border-color: rgba(120, 190, 255, 0.35);
  background: var(--cp-card);
}
body #corepedia-window .cp-slot.is-locked::after,
body #corepedia-window .cp-slot.is-available::after{ color: rgba(190, 220, 250, 0.55); font-family: Georgia, serif; }
body #corepedia-window .cp-slot .cp-tier{ color: #fff; font-family: Georgia, serif; }
body #corepedia-window .cp-slot.is-selected{
  border-color: #ffd34a;
  box-shadow: 0 0 0 2px rgba(255, 211, 74, 0.55), 0 0 14px rgba(255, 211, 74, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.15);
}

/* ---- details ---- */
body #corepedia-window .cp-details h3{ font: 900 clamp(20px, 2vw, 26px)/1.1 Georgia, serif; color: #fff; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.55); }
body #corepedia-window .cp-details .cp-sub{ color: #8fd2ff; font-weight: 800; }
body #corepedia-window .cp-details p{ color: #e3f1ff; font-weight: 700; }
body #corepedia-window .cp-state{ border-width: 2px; border-radius: 10px; padding: 2px 10px 3px; background: rgba(0, 0, 0, 0.3); }
body #corepedia-window .cp-section{ color: #8fd2ff; font-size: 12px; font-weight: 900; letter-spacing: 0.08em; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5); }
body #corepedia-window .cp-formula .cp-op{ color: #ffd34a; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.55); }
body #corepedia-window .cp-item{ color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.55); }
body #corepedia-window .cp-item .cp-box{
  border: 3px solid #4aa8ff;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 40%, rgba(58, 160, 255, 0.28), transparent 72%), linear-gradient(180deg, #15264e, #0a1431);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.45);
}
body #corepedia-window .cp-link{
  border: 3px solid #0b2c5e;
  border-radius: 12px;
  background: var(--cp-btn);
  box-shadow: 0 3px 0 #061a38, inset 0 2px 0 rgba(255, 255, 255, 0.25);
  color: #fff;
  font-family: Georgia, serif;
  text-shadow: 0 2px 0 rgba(0, 20, 60, 0.85);
}
body #corepedia-window .cp-link{ display: inline-flex; align-items: center; gap: 6px; padding-block: 3px; }
body #corepedia-window .cp-link .cp-icon{ display: inline-flex; width: 28px; height: 28px; flex: 0 0 auto; align-items: center; justify-content: center; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.5)); }
body #corepedia-window .cp-link .cp-icon > *{ max-width: 100%; max-height: 100%; }
body #corepedia-window .cp-link.is-unknown{ justify-content: center; min-width: 96px; min-height: 38px; font-size: 16px; }
body #corepedia-window .cp-link:hover{ filter: brightness(1.15); }
body #corepedia-window .cp-link.is-unknown{ border-style: dashed; background: var(--cp-card); }

/* ---- footer ---- */
body #corepedia-window .cp-foot{ border-top: 2px solid rgba(120, 190, 255, 0.3); padding: 10px 14px 12px; }
body #corepedia-window .cp-filter{ border-radius: 14px; padding: 8px 14px; font-size: 13px; }
body #corepedia-window .cp-meta{ color: #e3f1ff; font-weight: 800; font-size: 13px; }
body #corepedia-window .cp-meta b{ color: #ffe9a0; }

/* ---- scrollbars + focus ---- */
body #corepedia-window ::-webkit-scrollbar-thumb{ border-color: rgba(4, 16, 31, 0.94); }
body #corepedia-window button:focus-visible{ outline: 3px solid #ffe27a; outline-offset: 2px; }

@media (max-width: 720px){
  body #corepedia-window::after{ left: -8px; top: -8px; width: calc(100% + 16px); height: calc(100% + 16px); background-size: 38px 30px; }
  body #corepedia-window .cp-title::before{ width: 30px; height: 30px; background-size: 330px 240px; background-position: -30px 0; }
  body #corepedia-window .cp-tab{ min-height: 36px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce){
  body #corepedia-window .cp-slot, body #corepedia-window .cp-tab, body #corepedia-window .cp-filter, body #corepedia-window .cp-icon-btn{ transition: none; }
}

/* formula parts that open their own entry */
body #corepedia-window .cp-item.is-link{ cursor: pointer; transition: transform 120ms ease, filter 120ms ease; }
body #corepedia-window .cp-item.is-link:hover{ filter: brightness(1.2); transform: translateY(-2px); }
body #corepedia-window .cp-item.is-link:hover .cp-box{ border-color: #ffd34a; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.45), 0 0 12px rgba(255, 211, 74, 0.55), 0 3px 0 #061a38; }
body #corepedia-window .cp-item.is-link:focus-visible{ outline: 3px solid #ffe27a; outline-offset: 3px; border-radius: 14px; }

/* ---- slots exactly like the inventory slots (see corecraftia-ui.css, .pi-inventory-chip) ---- */
body #corepedia-window{
  --cp-slot-radius: 8px;
  --cp-slot-bg: linear-gradient(180deg, #1b1f25 0%, #14171c 100%);
  --cp-slot-bg-hover: linear-gradient(180deg, #252a32 0%, #1a1e25 100%);
  --cp-slot-border: rgba(255, 255, 255, 0.10);
  --cp-slot-border-hover: rgba(255, 255, 255, 0.46);
  --cp-slot-select: #f4f1e8;
}
body #corepedia-window .cp-slot,
body #corepedia-window .cp-item .cp-box,
body #corepedia-window .cp-link{
  border: 1px solid var(--cp-slot-border) !important;
  border-radius: var(--cp-slot-radius) !important;
  background: var(--cp-slot-bg) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04) !important; /* no grey 3px bar along the bottom of the slot */
  filter: none;
  transform: none;
  transition: background 120ms ease, border-color 120ms ease;
}
body #corepedia-window .cp-slot.is-locked,
body #corepedia-window .cp-slot.is-available,
body #corepedia-window .cp-item.is-unknown .cp-box,
body #corepedia-window .cp-link.is-unknown{
  border-style: solid !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
}
body #corepedia-window .cp-slot:hover,
body #corepedia-window .cp-link:hover,
body #corepedia-window .cp-item.is-link:hover .cp-box{
  background: var(--cp-slot-bg-hover) !important;
  border-color: var(--cp-slot-border-hover) !important;
  filter: none;
  transform: none;
}
body #corepedia-window .cp-slot.is-selected{
  border-color: var(--cp-slot-select) !important;
  background: var(--cp-slot-bg-hover) !important;
  box-shadow: 0 0 0 2px var(--cp-slot-select) inset !important;
}
/* recipe link slots: icon only, same size as the formula boxes */
body #corepedia-window .cp-links{ gap: 8px; }
body #corepedia-window .cp-link{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  padding: 0 !important;
  color: rgba(214, 235, 250, 0.7);
  font: 900 20px/1 Georgia, serif;
  text-shadow: none;
}
body #corepedia-window .cp-link .cp-icon{ width: 44px; height: 44px; filter: none; }
body #corepedia-window .cp-link.is-unknown{ min-width: 56px; min-height: 56px; width: 56px; height: 56px; font-size: 20px; }

/* icons fill the slot like the inventory does (no empty ring around them) */
body #corepedia-window .cp-item{ width: 84px; }
body #corepedia-window .cp-item .cp-box{ width: 64px; height: 64px; padding: 0; }
body #corepedia-window .cp-item .cp-box .cp-icon,
body #corepedia-window .cp-link .cp-icon{ width: 100%; height: 100%; } /* the icon fills the whole box, no empty ring */
body #corepedia-window .cp-item .cp-box .cp-icon > *,
body #corepedia-window .cp-link .cp-icon > *{ width: 100% !important; height: 100% !important; object-fit: contain; }
body #corepedia-window .cp-link,
body #corepedia-window .cp-link.is-unknown{ width: 64px; height: 64px; min-width: 64px; min-height: 64px; }


body #corepedia-window .cp-none{ color: #8fb0d6; font-weight: 700; font-style: italic; }

/* the icon fills the whole slot: no empty ring between it and the slot border */
body #corepedia-window .cp-slot .cp-icon{ inset: 0; }
