/* Shared interior controls. Page geometry and the home screen stay independent. */
body.realm-mode {
  --realm-control-ink: #101218;
  --realm-control-metal: #a99d88;
  --realm-control-silver: #e4d9c5;
  --realm-control-ruby: #9d3546;
}
body.realm-mode :is(.filter-tab,.category,.kb-tab,.kb-class-tab,.kb-square-button,.kb-entry,.kb-equipment-choice,.realm-tab,.realm-chip,.chip,[role="tab"]) {
  position: relative;
  isolation: isolate;
  color: #c8beb0;
  border-color: #9e8c6c48;
  background:
    linear-gradient(135deg, #d4c3a00b, transparent 34%),
    linear-gradient(180deg, #27252ad9, #11141be8 40%, #0d1016ed);
  box-shadow: inset 0 1px #e8d6b214, inset 0 -1px #000b, 0 2px 5px #0003;
  text-shadow: 0 1px 2px #000b;
  transition: border-color 180ms ease, color 180ms ease, background-color 180ms ease, box-shadow 200ms ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
body.realm-mode :is(.filter-tab,.kb-class-tab,.realm-tab,.realm-chip,.chip,[role="tab"]) {
  border: 1px solid #9e8c6c48;
  border-radius: 1px;
}
body.realm-mode .kb-tab {
  border-bottom-width: 2px;
  box-shadow: inset 0 1px #e8d6b20b, inset 0 -1px #080910;
}
body.realm-mode :is(.filter-tab,.category,.kb-tab,.kb-class-tab,.kb-square-button,.kb-entry,.kb-equipment-choice,.realm-tab,.realm-chip,.chip,[role="tab"])::after {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: -1;
  pointer-events: none;
  border-top: 1px solid transparent;
  background: linear-gradient(110deg, transparent 43%, #e8d2a309 47%, #fff0cc42 50%, #fff0cc06 54%, transparent 58%) 180% 0 / 270% 100% no-repeat;
  clip-path: polygon(5px 0, calc(100% - 5px) 0, 100% 5px, 100% calc(100% - 5px), calc(100% - 5px) 100%, 5px 100%, 0 calc(100% - 5px), 0 5px);
  opacity: 0;
}
body.realm-mode :is(.filter-tab,.category,.kb-tab,.kb-class-tab,.kb-square-button,.kb-entry,.kb-equipment-choice,.realm-tab,.realm-chip,.chip,[role="tab"]):is(:hover,:focus-visible) {
  color: #f4e8d2;
  border-color: #c9b7989e;
  box-shadow: inset 0 1px #eeddb735, inset 0 0 18px #b9833211, 0 2px 8px #0006;
}
body.realm-mode :is(.filter-tab,.category,.kb-tab,.kb-class-tab,.kb-square-button,.kb-entry,.kb-equipment-choice,.realm-tab,.realm-chip,.chip,[role="tab"]):is(:hover,:focus-visible)::after {
  animation: realm-control-sweep 800ms cubic-bezier(.25,.6,.3,1) both;
}
body.realm-mode :is(.filter-tab,.category,.kb-tab,.kb-class-tab,.kb-entry,.kb-equipment-choice,.realm-tab,.realm-chip,.chip,[role="tab"]):is(.active,.is-active,[aria-selected="true"],[aria-pressed="true"]) {
  color: #f3ddba;
  border-color: #ae79747d;
  background:
    radial-gradient(ellipse at 0 40%, #b3444440, transparent 82%),
    linear-gradient(180deg, #34232aeb, #1a151df2);
  box-shadow: inset 0 1px #e5bd9926, inset 2px 0 #b26660, inset 0 -1px #0009, 0 2px 9px #0005;
}
body.realm-mode .kb-entry.is-active::before {
  background: #d58b77;
  box-shadow: 0 0 9px #dc594260;
}
body.realm-mode :is(.filter-tab,.category,.kb-tab,.kb-class-tab,.kb-square-button,.kb-entry,.kb-equipment-choice,.realm-tab,.realm-chip,.chip,[role="tab"]):active {
  box-shadow: inset 0 3px 12px #000c, inset 0 0 0 1px #d1b38332;
}
body.realm-mode .kb-square-button {
  background: linear-gradient(145deg,#5d5146,#27272a 20%,#14161d 75%,#493d35);
  border-color: #b7a4859e;
  color: #f0dfbc;
  box-shadow: inset 0 0 0 2px #0b0d13, inset 0 0 0 3px #b9a28423, 0 2px 5px #0008;
}
body.realm-mode .kb-square-button:not(:disabled):is(:hover,:focus-visible) {
  background: linear-gradient(145deg,#9b7960,#51313a 24%,#251721 76%,#694436);
  border-color: #e5cda6;
  box-shadow: inset 0 0 0 2px #110b11, inset 0 0 12px #d866434d, 0 0 9px #b1483026;
}
body.realm-mode .kb-equip-slot > .kb-emblem {
  border-color: #ac987164;
  background: linear-gradient(145deg,#39343a,#11151ded 38%,#0a0d13);
  box-shadow: inset 0 0 0 3px #070a10, inset 0 0 0 4px #bdac8223, 0 4px 14px #0007;
  transition: border-color 180ms ease, box-shadow 200ms ease, color 180ms ease;
}
body.realm-mode .kb-equip-slot:is(.is-active,:hover,:focus-visible) > .kb-emblem {
  color: #edcfaa;
  border-color: #d6ad81;
  background: radial-gradient(ellipse at 50% 20%,#79313a77,#15131de8 78%);
  box-shadow: inset 0 0 0 3px #160d16, inset 0 0 19px #c7543f2b, 0 0 16px #b84d3c25;
}
body.realm-mode :is(.realm-nav,.portal-nav,.account-nav,.account-menu,.workshop-nav) a {
  position: relative;
  isolation: isolate;
  text-decoration-color: #b59a6c70;
  transition: color 180ms ease, text-shadow 180ms ease, box-shadow 180ms ease;
}
body.realm-mode :is(.realm-nav,.portal-nav,.account-nav,.account-menu,.workshop-nav) a:is(:hover,:focus-visible) {
  color: #f2ddba;
  text-shadow: 0 0 12px #dfac7250;
  box-shadow: inset 0 -1px #c3a576;
}
body.realm-mode :is(select,input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),textarea) {
  color: #e7dece;
  border-color: #9e8c6c54;
  background-color: #0d1018e6;
  box-shadow: inset 0 2px 8px #0007, inset 0 -1px #d9ba7f10;
  caret-color: #edc488;
  accent-color: #b96060;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
body.realm-mode select { color-scheme: dark; }
body.realm-mode :is(select,input,textarea):focus {
  border-color: #cfb188;
  box-shadow: inset 0 2px 8px #0007, 0 0 0 2px #ba955d1a, 0 0 16px #a2512920;
}
body.realm-mode :is(.filter-tab,.category,.kb-tab,.kb-class-tab,.kb-square-button,.kb-entry,.kb-equipment-choice,.kb-equip-slot,.realm-tab,.realm-chip,.chip,[role="tab"],select):focus-visible {
  outline: 1px solid #ecd3a4;
  outline-offset: 3px;
}
body.realm-mode :is(.realm-nav,.portal-nav,.account-nav,.account-menu,.workshop-nav) a:focus-visible {
  outline: 1px solid #ecd3a4;
  outline-offset: 4px;
}
body.realm-mode :is(.realm-menu-toggle,.realm-motion-toggle) {
  transition: color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
body.realm-mode :is(.realm-menu-toggle,.realm-motion-toggle):is(:hover,:focus-visible) {
  color: #f0d1ae;
  border-color: #cfad83;
  box-shadow: inset 0 0 12px #a2593020;
}
body.realm-mode :is(.realm-menu-toggle,.realm-motion-toggle):focus-visible {
  outline: 1px solid #ecd3a4;
  outline-offset: 3px;
}
body.realm-mode :is(.filter-tab,.category,.kb-tab,.kb-class-tab,.kb-square-button,.kb-entry,.kb-equipment-choice,.kb-equip-slot,.realm-tab,.realm-chip,.chip,[role="tab"]):is(:disabled,[aria-disabled="true"]) {
  opacity: .4;
  cursor: default;
  box-shadow: inset 0 1px #ffffff08;
}
body.realm-mode :is(:disabled,[aria-disabled="true"])::after { animation: none !important; }
body.realm-mode .realm-motion-anchor { position: relative; }
body.realm-mode .realm-pulse-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: block;
  overflow: hidden;
  border-radius: inherit;
  clip-path: inset(1px);
  pointer-events: none;
  contain: strict;
}
body.realm-mode .realm-press-flare {
  position: absolute;
  display: block;
  border: 1px solid #edce966b;
  background:
    linear-gradient(45deg,transparent 48%,#f2d7a41c 49% 51%,transparent 52%),
    linear-gradient(-45deg,transparent 48%,#f2d7a41c 49% 51%,transparent 52%),
    radial-gradient(ellipse,#f1c3882b,transparent 68%);
  box-shadow: inset 0 0 12px #d8ad6c29, 0 0 10px #db815133;
  pointer-events: none;
  will-change: transform,opacity;
}
body.realm-mode .primary .realm-press-flare {
  border-color: #ffd6b884;
  background: radial-gradient(ellipse,#ffb58b4a,#f172421c 40%,transparent 72%);
  box-shadow: inset 0 0 15px #ff935144, 0 0 12px #df5d3a50;
}
body.realm-mode .realm-reveal.realm-reveal-pending { opacity: 0; }
@keyframes realm-control-sweep {
  0% { background-position: 180% 0; opacity: 0; }
  20% { opacity: .8; }
  80% { opacity: .55; }
  100% { background-position: -80% 0; opacity: 0; }
}
@media (hover: none) {
  body.realm-mode :is(.filter-tab,.category,.kb-tab,.kb-class-tab,.kb-square-button,.kb-entry,.kb-equipment-choice,.realm-tab,.realm-chip,.chip,[role="tab"]):hover::after { animation: none; }
}
@media (prefers-reduced-motion: reduce) {
  body.realm-mode :is(.filter-tab,.category,.kb-tab,.kb-class-tab,.kb-square-button,.kb-entry,.kb-equipment-choice,.kb-equip-slot,.realm-tab,.realm-chip,.chip,[role="tab"],input,textarea,select),
  body.realm-mode :is(.filter-tab,.category,.kb-tab,.kb-class-tab,.kb-square-button,.kb-entry,.kb-equipment-choice,.realm-tab,.realm-chip,.chip,[role="tab"])::after {
    animation: none !important;
    transition: none !important;
  }
  body.realm-mode .realm-pulse-layer { display: none; }
  body.realm-mode .realm-reveal.realm-reveal-pending { opacity: 1; }
}
