/* Equipment surfaces: dark hide, worn metal, quiet ornament and readable rolls. */
#database {
  --sheet-metal: #857557;
  --sheet-title: #e4c28b;
  --sheet-text: #ded9cd;
  --sheet-blue: #a5c8f0;
}
#database #db-item-dialog {
  position: fixed;
  inset: 0;
  width: min(570px, calc(100vw - 28px));
  height: min(800px, calc(100dvh - 40px));
  max-height: none;
  margin: auto;
  padding: 7px;
  overflow: hidden;
  border: 1px solid #a18e68;
  outline: 1px solid #343632;
  outline-offset: 3px;
  border-radius: 2px;
  color: var(--sheet-text);
  background: linear-gradient(135deg, #53544a, #191c1b 12%, #292b27 48%, #666150 76%, #151818);
  box-shadow: inset 0 0 0 2px #0c0e0e, inset 0 0 0 3px #9e92753d, 0 20px 90px #000, 0 0 18px #000;
}
#database #db-item-dialog::backdrop { background: #000b; backdrop-filter: blur(2px); }
#database #db-item-dialog::after {
  content: "";
  position: absolute;
  inset: 3px;
  pointer-events: none;
  z-index: 3;
  background:
    linear-gradient(#c0a675, #c0a675) left top / 19px 2px,
    linear-gradient(#c0a675, #c0a675) left top / 2px 19px,
    linear-gradient(#c0a675, #c0a675) right top / 19px 2px,
    linear-gradient(#c0a675, #c0a675) right top / 2px 19px,
    linear-gradient(#8d7855, #8d7855) left bottom / 19px 2px,
    linear-gradient(#8d7855, #8d7855) left bottom / 2px 19px,
    linear-gradient(#8d7855, #8d7855) right bottom / 19px 2px,
    linear-gradient(#8d7855, #8d7855) right bottom / 2px 19px;
  background-repeat: no-repeat;
}
#database .db-dialog-content { height: 100%; overflow: auto; scrollbar-width: thin; scrollbar-color: #706044 #101110; }
#database #db-item-dialog .db-detail,
#database .db-detail.db-item-sheet {
  min-height: 100%;
  margin: 0;
  padding: 26px 26px 22px;
  border: 1px solid #5b5548;
  border-radius: 0;
  box-shadow: inset 0 0 28px #000b;
  background-color: #101211;
  background-blend-mode: normal, soft-light, normal;
  background-image:
    radial-gradient(ellipse at 20% 0, #6b4a263d, transparent 42%),
    repeating-linear-gradient(112deg, #ffffff02 0 1px, #0000 1px 5px);
}
#database .db-tone-legendary { --sheet-title: #eda765; }
#database .db-tone-unique { --sheet-title: #dfc7a0; }
#database .db-tone-mythic { --sheet-title: #d3b0ef; }
#database #db-item-dialog .db-detail.db-tone-mythic { background-image: radial-gradient(ellipse at 20% 0, #67438050, transparent 65%); }
#database .db-dialog-close {
  position: absolute;
  top: 13px;
  right: 13px;
  float: none;
  margin: 0;
  width: 30px;
  height: 30px;
  z-index: 4;
  border: 1px solid #83745a;
  box-shadow: inset 0 0 0 2px #111412, 0 2px 5px #000;
  background: linear-gradient(#34332b, #141716);
  color: #ddc99f;
  font-size: 23px;
  line-height: 1;
}
#database .db-dialog-close:hover { color: #fff2cf; border-color: #cab081; }
body:has(#db-item-dialog[open]) { overflow: hidden; }
#database .db-sheet-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 118px;
  gap: 18px;
  padding: 0 20px 12px 0;
}
#database .db-sheet-heading > div { min-width: 0; }
#database .db-sheet-quality { color: #b69b6c; font-size: 14px; letter-spacing: .13em; margin-bottom: 6px; }
#database .db-sheet-heading h2 {
  font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
  font-weight: 600;
  font-size: 32px;
  line-height: 1.35;
  color: var(--sheet-title);
  margin: 0 0 6px;
  text-shadow: 0 2px 2px #000, 0 0 16px #c1872520;
}
#database .db-sheet-base { font-size: 16px; color: #cdc0a6; margin: 0; }
#database .db-sheet-art { width: 82px; height: 106px; object-fit: contain; flex-shrink: 0; filter: drop-shadow(0 6px 5px #000); }
#database .db-base-selector { display: flex; flex-wrap: wrap; gap: 4px 13px; margin: 0 0 9px; }
#database .db-base-selector button {
  padding: 5px 2px;
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  color: #aba79b;
  font-size: 14px;
  line-height: 1.6;
  cursor: pointer;
}
#database .db-base-selector button[aria-selected="true"] { border-color: #c4a775; color: #f0d7a4; text-shadow: 0 0 8px #a7804233; }
#database .db-base-selector button:hover { color: #f0d7a4; }
#database .db-sheet-divider { display: flex; align-items: center; gap: 8px; height: 19px; margin: 2px 0 12px; color: #a48f65; }
#database .db-sheet-divider::before, #database .db-sheet-divider::after { content: ""; height: 1px; flex: 1; background: linear-gradient(90deg, #9d8b6555, #b3a17e88); box-shadow: 0 1px #000; }
#database .db-sheet-divider::after { transform: rotate(180deg); }
#database .db-sheet-divider span { font-size: 8px; text-shadow: 0 1px #000; }
#database .db-equipment-line {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 6px 0;
  color: var(--sheet-text);
  font-size: 18px;
  line-height: 1.65;
  white-space: pre-line;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 2px #000;
}
#database .db-stat-marker { display: inline-block; flex: 0 0 5px; width: 5px; height: 5px; background: #a3a398; transform: rotate(45deg); opacity: .85; }
#database .db-stat-value { color: var(--sheet-blue); }
#database .db-equipment-line.is-power { color: #e0b57b; margin-top: 14px; }
#database .is-power .db-stat-marker { background: #ddba77; box-shadow: 0 0 5px #cf9d4733; }
#database .is-power .db-stat-value { color: #f3d493; }
#database .db-sheet-variant[hidden] { display: none; }
#database .db-sheet-requirement { color: #aaa89d; margin: 18px 0 12px; font-size: 13px; line-height: 1.7; text-align: right; }
#database .db-sheet-class-affix { padding-top: 10px; }
#database .db-sheet-class-affix > p:first-child { color: #bdb09a; font-size: 13px; margin: 0; }
#database .db-recipe { border: 0; background: none; padding: 0; margin: 15px 0 0; }
#database .db-recipe h3 { color: #bcb09b; font-size: 14px; font-weight: 400; margin-bottom: 10px; letter-spacing: .06em; }
#database .db-recipe-items li { background: #191c1980; border-color: #645d494f; box-shadow: inset 0 0 9px #0007; }
#database .db-recipe-items a { text-decoration: none; }
#database .db-recipe-items a:hover { color: #ffdfa3; }
#database .db-recipe-items .db-material-icon { display: block; line-height: 0; }
#database .db-runeword-recipe .db-recipe-items { gap: 9px; }
#database .db-runeword-recipe .db-recipe-items li { position: relative; flex-direction: column; gap: 4px; width: 72px; min-width: 0; padding: 8px 4px 6px; border: 0; border-bottom: 1px solid #8e774055; background: radial-gradient(ellipse at 50% 28%, #b29c5930, #12151300 73%); box-shadow: none; }
#database .db-runeword-recipe .db-recipe-items img { width: 41px; height: 48px; filter: drop-shadow(0 3px 3px #000); }
#database .db-runeword-recipe .db-recipe-items li > div { text-align: center; }
#database .db-runeword-recipe .db-recipe-items a { font-size: 16px; color: #d6c69f; white-space: nowrap; }
#database .db-runeword-recipe .db-recipe-items li:not(:last-child)::after { content: "·"; position: absolute; right: -7px; top: 23px; font-size: 15px; color: #7e7761; }
#database .db-recipe-result { color: #d0c8b7; border-color: #62584166; font-size: 16px; }
#database .db-detail-tags { display: none; }
#database #db-item-dialog .db-detail > h2 { color: var(--sheet-title); font-size: 30px; }
#database #db-item-dialog .db-detail-art { border: 0; background: none; box-shadow: none; }
#database #db-item-dialog .db-detail > .d4-section-label { padding-right: 25px; line-height: 1.7; color: #b7a98f; }
#database .db-grid > .d4-database-card {
  border-radius: 0;
  padding: 22px;
  background: radial-gradient(ellipse at 15% 0, #54402830, transparent 60%), #121513;
  border: 1px solid #5c5b4b;
  box-shadow: inset 0 0 0 3px #0d100f, inset 0 0 0 4px #8c81642b, 0 4px 12px #0005;
}
#database .db-grid > .db-tone-runeword { --item-tone: var(--sheet-title); }
#database .db-grid > .db-tone-mythic { --item-tone: #d1a0fa; background: radial-gradient(ellipse at 15% 0, #64417133, transparent 60%), #151119; border-color: #77627e; }
#database .db-grid > .d4-database-card:hover { background-color: #181b17; border-color: #a09272; }
#database .db-item-heading { border-bottom: 1px solid #8d7f5d55; padding-bottom: 15px; }
#database .db-item-heading h2 { font-family: "Noto Serif SC", "Songti SC", "SimSun", serif; font-size: 23px; }
#database .db-item-meta { color: #b4ac98; font-size: 14px; }
#database .db-grid .db-equipment-line { font-size: 16px; line-height: 1.7; }
#database .db-grid .db-recipe { padding-top: 13px; border-top: 1px solid #8d7f5d44; }
#database .db-grid .db-open { font-size: 14px; color: #beac89; text-align: right; padding-top: 16px; }
#database .db-grid .db-open span { padding-left: 7px; font-size: 20px; }
#database .db-grid .db-runeword-recipe .db-recipe-items li { width: 62px; }
@media (max-width:600px) {
  #database #db-item-dialog { width: calc(100vw - 24px); height: calc(100dvh - 30px); padding: 6px; }
  #database #db-item-dialog .db-detail { padding: 22px 17px 20px; }
  #database .db-sheet-heading { min-height: 108px; gap: 10px; padding-right: 13px; }
  #database .db-sheet-heading h2 { font-size: 28px; }
  #database .db-sheet-art { width: 64px; height: 94px; }
  #database .db-equipment-line { font-size: 17px; gap: 10px; }
  #database .db-base-selector { gap: 3px 10px; }
  #database .db-runeword-recipe .db-recipe-items { gap: 5px; }
  #database .db-runeword-recipe .db-recipe-items li { width: 52px; }
  #database .db-runeword-recipe .db-recipe-items a { font-size: 15px; }
  #database .db-runeword-recipe .db-recipe-items li:not(:last-child)::after { right: -4px; }
  #database .db-grid > .d4-database-card { padding: 19px; }
}
