#guidebookDialog.guidebook-dialog {
  position: relative; width: min(1180px, calc(100vw - 28px), calc((100dvh - 28px) * 1.598)); aspect-ratio: 1586 / 992;
  height: auto; max-width: none; max-height: calc(100dvh - 28px); padding: 0; overflow: hidden; color: #3e2918;
  border: 0; border-radius: 10px; background: #a77d4b url('/assets/guidebook/open-book-v2.png') center / 100% 100% no-repeat;
  box-shadow: 0 28px 84px #000d; font-family: Georgia, 'Batang', serif;
}
#guidebookDialog.guidebook-dialog:not([open]) { display: none; }
#guidebookDialog::backdrop { background: radial-gradient(circle at 50% 42%, #3343399c, #020605ec 73%); }
.guidebook-dialog button { min-height: 0; color: #51351e; border: 0; border-radius: 0; background: transparent; box-shadow: none; }.guidebook-dialog button:hover:not(:disabled) { color: #1f1209; background: #ead19744; }.guidebook-dialog button:focus-visible { outline: 3px solid #714e25; outline-offset: 2px; }

.guidebook-header { position: absolute; z-index: 3; top: 9%; left: 23%; right: 10%; display: flex; align-items: center; justify-content: flex-start; min-height: 32px; pointer-events: none; }.guidebook-header > div { text-align: left; text-shadow: 0 1px #f9edce; }.guidebook-header p { display: none; margin: 0 0 1px; color: #896339; font: 700 9px/1.2 system-ui, sans-serif; letter-spacing: .13em; }.guidebook-header h2 { margin: 0; color: #49301a; font-size: clamp(16px, 2vw, 24px); line-height: 1.1; }.guidebook-header .icon-button { position: absolute; right: 0; display: grid; width: 44px; height: 44px; place-items: center; color: #714925; font-size: 23px; pointer-events: auto; }.guidebook-header .icon-button:hover { background: none; color: #241409; }

.guidebook-spread { position: absolute; inset: 0; min-height: 0; }.guidebook-sections { position: absolute; z-index: 2; top: 18%; bottom: 16%; left: 1%; display: flex; width: 9%; flex-direction: column; justify-content: space-around; gap: 4px; padding: 3px 0; }.guidebook-section { position: relative; min-height: 32px; padding: 5px 4px 5px 8px; color: #f9e5bf !important; text-align: left; text-shadow: 0 1px #2b1609; background: linear-gradient(90deg, #5e2b18, #a45a30 65%, #c47e42) !important; box-shadow: inset 0 1px #f2c26d66, 1px 2px 2px #32160977 !important; font: 700 clamp(8px, 1vw, 12px)/1.05 system-ui, sans-serif; }.guidebook-section:nth-child(2n) { transform: translateX(3px); }.guidebook-section:nth-child(3n) { transform: translateX(-2px); }.guidebook-section::after { content: ''; position: absolute; top: 0; right: -8px; border-block: 16px solid transparent; border-left: 8px solid #c47e42; }.guidebook-section small { display: block; margin-top: 2px; color: #f4c873; font-size: 8px; }.guidebook-section[aria-pressed='true'] { color: #fff7da !important; background: linear-gradient(90deg, #3d2918, #775025 65%, #d1a458) !important; box-shadow: inset 0 0 0 1px #ffe0a2aa, 1px 2px 3px #21100588 !important; }

.guidebook-gallery { position: absolute; top: 14%; bottom: 14%; left: 15%; display: grid; width: 32%; grid-template-rows: minmax(0, 1fr) minmax(176px, 36%); min-height: 0; }.guidebook-portrait { display: grid; min-height: 0; place-items: center; overflow: hidden; }.guidebook-hero { position: relative; display: grid; width: 100%; height: 100%; min-height: 0; place-items: center; overflow: hidden; background: none; border: 0; }.guidebook-hero::before, .guidebook-hero::after { content: none; }.guidebook-hero > canvas, .guidebook-hero > img, .guidebook-hero > span:not(:last-child) { width: min(90%, 275px); height: min(90%, 250px); object-fit: contain; image-rendering: pixelated; }.guidebook-hero > span:last-child { position: absolute; bottom: 1px; left: 8%; right: 8%; color: #73542d; text-align: center; font: 700 10px/1.2 system-ui, sans-serif; letter-spacing: .06em; text-shadow: 0 1px #f5e9ca; }.guidebook-hero .skill-art { display: grid; width: min(74%, 210px); height: min(74%, 210px); place-items: center; background: none; border: 0; }.guidebook-hero .skill-art::before, .guidebook-hero .skill-art::after { content: none; }.guidebook-hero .skill-art img { width: 100%; height: 100%; }.guidebook-hero .relic-art { width: min(66%, 180px); aspect-ratio: 1; border: 0; background-color: transparent; }.guidebook-hero .bestiary-illustration { width: min(90%, 260px); height: min(90%, 240px); image-rendering: auto; mix-blend-mode: multiply; }

.guidebook-list { display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; min-height: 0; padding: 2px 0 0; }.guidebook-list > h3 { margin: 0 0 4px 3px; color: #5a3c20; font-size: 15px; line-height: 1.2; text-shadow: 0 1px #f5e9cd; }.guidebook-list > p { margin: 4px; color: #785d3e; font: 12px/1.5 system-ui, sans-serif; }.guidebook-cards { display: grid; grid-auto-columns: 92px; grid-auto-flow: column; grid-template-rows: repeat(2, 72px); gap: 5px; min-height: 0; overflow-x: auto; overflow-y: hidden; scrollbar-color: #967345 transparent; scrollbar-width: thin; }.guidebook-card { position: relative; display: grid; grid-template-rows: 1fr auto; min-width: 0; padding: 2px; overflow: hidden; text-align: center; }.guidebook-card[aria-current='true'] { outline: 2px solid #876136; outline-offset: -1px; background: #c5a46b29; }.guidebook-card > div { min-width: 0; }.guidebook-card b { display: block; padding: 1px 2px; overflow: hidden; color: #4d321d; font-size: 11px; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }.guidebook-card small { display: none; }.guidebook-thumb { display: grid; min-height: 0; place-items: center; overflow: hidden; background: none; border: 0; }.guidebook-thumb > canvas, .guidebook-thumb > img, .guidebook-thumb > span:not(.guidebook-seal) { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }.guidebook-thumb .skill-art { display: grid; width: 88%; height: 88%; place-items: center; background: none; border: 0; }.guidebook-thumb .skill-art::before, .guidebook-thumb .skill-art::after { content: none; }.guidebook-thumb .skill-art img { width: 100%; height: 100%; }.guidebook-seal { display: grid; width: 70%; aspect-ratio: 1; place-items: center; color: #9b7a4c; border: 1px solid #a48454; border-radius: 50%; background: #cdbb8d77; font-size: 24px; }.guidebook-seal--large { width: 128px; margin: 18px auto 8px; font-size: 70px; }.guidebook-card-marks { position: absolute; z-index: 1; right: 1px; top: 1px; display: grid; gap: 2px; }.guidebook-card-marks em { padding: 2px 3px; color: #735022; border: 1px solid #997038; border-radius: 50%; background: #ead49d; font: 700 8px/1.05 system-ui, sans-serif; font-style: normal; transform: rotate(-8deg); }.guidebook-card-marks .is-equipped { color: #36543d; border-color: #63816c; background: #d3d7ad; }

.guidebook-detail { position: absolute; top: 14%; right: 10%; bottom: 14%; width: 33%; min-width: 0; min-height: 0; padding: 3px 8px 8px; overflow: auto; scrollbar-color: #967345 transparent; scrollbar-width: thin; background: none; }.guidebook-detail h3 { margin: 0 0 7px; color: #442917; font-size: clamp(22px, 2.8vw, 33px); line-height: 1.08; text-shadow: 0 1px #f7e9c8; }.guidebook-detail h3:focus { outline: 0; }.guidebook-detail > p { max-width: 42ch; margin: 0; color: #59412a; font-size: 15px; line-height: 1.58; }.guidebook-detail.is-locked { text-align: center; }.guidebook-detail.is-locked > p { margin-inline: auto; }.guidebook-detail > .guidebook-hero { display: none; }.guidebook-facts { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin: 13px 0; padding: 10px 0; border-block: 1px solid #a98a5b88; font-size: 14px; }.guidebook-facts dt { color: #846238; }.guidebook-facts dd { margin: 0; color: #49341f; font-family: system-ui, sans-serif; }.guidebook-relations, .guidebook-notes { margin-top: 14px; }.guidebook-relations h4, .guidebook-notes h4 { margin: 0 0 6px; color: #704c25; font-size: 15px; }.guidebook-relations > div { display: flex; flex-wrap: wrap; gap: 5px; }.guidebook-link { min-height: 28px; padding: 4px 6px; color: #68441f !important; border-bottom: 1px solid #9f7a49 !important; font-size: 12px; }.guidebook-notes p { margin: 6px 0; padding-left: 9px; border-left: 2px solid #b18d58; color: #5d472e; font-size: 14px; line-height: 1.48; }.guidebook-notes small { color: #896c42; }.guidebook-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 15px; padding-top: 10px; border-top: 1px solid #aa895a88; }.guidebook-actions button { min-height: 30px; padding: 5px 8px; color: #59371b; border: 1px solid #9e7848; background: #e7cb91a6; font-size: 12px; }.guidebook-actions .primary { color: #fff0ce; border-color: #563416; background: #775025; }.guidebook-actions .primary:hover { background: #5e3a19; }.guidebook-mobile-portrait, .guidebook-back { display: none; }

.guidebook-cover { position: absolute; z-index: 8; inset: 0; display: none; place-content: center; gap: 10px; padding: 30px; color: #ebd6a1; text-align: center; background: radial-gradient(circle at 50% 40%, #5c4a2c, #171b16 72%); transform-origin: left center; }.guidebook-cover::before { content: ''; position: absolute; inset: 18px; border: 1px solid #d1ad62aa; pointer-events: none; }.guidebook-cover small { color: #d9b56b; font: 700 12px system-ui, sans-serif; letter-spacing: .2em; }.guidebook-cover strong { font-size: clamp(29px, 5vw, 48px); }.guidebook-cover span { color: #c5b692; font: 14px system-ui, sans-serif; }.guidebook-dialog.guidebook-opening .guidebook-cover { display: grid; animation: guidebook-open-cover 650ms cubic-bezier(.2,.72,.15,1) both; }.guidebook-dialog.guidebook-opening .guidebook-spread { animation: guidebook-open-pages 460ms 90ms ease-out both; }@keyframes guidebook-open-cover { from { opacity: 1; transform: perspective(900px) rotateY(0); } to { opacity: 0; transform: perspective(900px) rotateY(-94deg); } }@keyframes guidebook-open-pages { from { opacity: .45; transform: perspective(900px) rotateY(5deg) scaleX(.96); transform-origin: left center; } to { opacity: 1; transform: none; } }@media (prefers-reduced-motion: reduce) { .guidebook-dialog.guidebook-opening .guidebook-cover { display: none; animation: none; }.guidebook-dialog.guidebook-opening .guidebook-spread { animation: none; } }

@media (max-width: 960px) {
  #guidebookDialog.guidebook-dialog {
    display: flex; flex-direction: column; width: calc(100% - 12px);
    height: calc(100dvh - 12px); max-height: calc(100dvh - 12px); aspect-ratio: auto;
    background-position: 83% center; background-size: 360% 160%;
    border: 2px solid #795630; box-shadow: inset 0 0 16px #76502655, 0 20px 60px #000b;
  }
  .guidebook-header {
    position: relative; top: auto; left: auto; right: auto; flex: 0 0 auto;
    min-height: 44px; margin: 8px 16px; gap: 8px; pointer-events: auto;
  }
  .guidebook-header > div { flex: 1; min-width: 0; }
  .guidebook-header h2 { font-size: 19px; line-height: 1.3; overflow-wrap: anywhere; }
  .guidebook-header .icon-button { position: static; flex: 0 0 44px; height: 44px; }
  .guidebook-spread {
    position: relative; inset: auto; display: grid; grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr); flex: 1 1 auto; min-width: 0; min-height: 0;
  }
  .guidebook-sections {
    position: static; grid-row: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(44px, auto)); width: auto; margin: 0 16px 10px;
    padding: 0; gap: 6px; overflow: visible;
  }
  .guidebook-dialog .guidebook-section {
    display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 44px;
    padding: 7px 3px; transform: none; white-space: normal; font-size: 13px; line-height: 1.3;
    border: 1px solid #794c2e; border-bottom: 3px solid #56341d; border-radius: 3px;
    background: linear-gradient(100deg, #76432d, #975d39) !important;
    box-shadow: inset 0 0 0 2px #d6ad7333, 0 1px 2px #39220d55 !important;
  }
  .guidebook-section::after, .guidebook-section small { display: none; }
  .guidebook-dialog .guidebook-section[aria-pressed='true'] {
    color: #38220f !important; text-shadow: 0 1px #fff0c7;
    border-color: #815a2a; border-bottom-color: #6c481d;
    background: linear-gradient(100deg, #f1dcaa, #dec28a) !important;
    box-shadow: inset 0 0 0 2px #fff1cb99, 0 1px 2px #39220d55 !important;
  }
  .guidebook-dialog .guidebook-section:focus-visible { outline-offset: 1px; }
  .guidebook-gallery, .guidebook-detail {
    position: relative; inset: auto; grid-row: 3; grid-column: 1; width: auto; min-width: 0; min-height: 0;
    margin: 0 16px max(16px, env(safe-area-inset-bottom)); padding: 0;
  }
  .guidebook-gallery { display: grid; grid-template-rows: minmax(0, 1fr); }
  .guidebook-portrait { display: none; }
  .guidebook-list { min-height: 0; padding-top: 0; }
  .guidebook-list > h3 { margin: 2px 0 10px; font-size: 17px; }
  .guidebook-cards {
    grid-template-columns: repeat(auto-fill, minmax(min(84px, 100%), 1fr)); grid-auto-columns: auto; grid-auto-flow: row;
    grid-template-rows: none; grid-auto-rows: max-content; align-content: start; gap: 10px 7px;
    overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; padding: 3px;
  }
  .guidebook-card { grid-template-rows: 56px auto; align-content: start; gap: 6px; padding: 6px 3px; }
  .guidebook-card b { padding: 0; overflow: visible; white-space: normal; font-size: 13px; line-height: 1.4; word-break: keep-all; overflow-wrap: anywhere; }
  .guidebook-thumb { height: 56px; width: 100%; }
  .guidebook-thumb > canvas, .guidebook-thumb > img, .guidebook-thumb > span:not(.guidebook-seal) { max-width: 64px; max-height: 56px; }
  .guidebook-card .guidebook-thumb .skill-art { width: 48px; height: 48px; }
  .guidebook-card .guidebook-thumb .relic-art, .guidebook-thumb .guidebook-seal { width: 48px; height: 48px; }
  .guidebook-card-marks { position: static; display: flex; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
  .guidebook-card-marks em { font-size: 9px; transform: none; border-radius: 3px; }
  .guidebook-detail { display: none; overflow: auto; overscroll-behavior: contain; padding: 0 3px 12px; }
  .guidebook-mobile-portrait { display: grid; float: left; width: 80px; height: 88px; margin: 0 12px 8px 0; place-items: center; }
  .guidebook-mobile-portrait .guidebook-hero { height: 88px; }
  .guidebook-mobile-portrait .guidebook-hero > canvas,
  .guidebook-mobile-portrait .guidebook-hero > img,
  .guidebook-mobile-portrait .guidebook-hero > span:not(:last-child) { width: 80px; height: 80px; }
  .guidebook-mobile-portrait .guidebook-hero > span:last-child { display: none; }
  .guidebook-dialog.guidebook--detail .guidebook-gallery { display: none; }
  .guidebook-dialog.guidebook--detail .guidebook-detail { display: block; }
  .guidebook-dialog.guidebook--detail .guidebook-back {
    position: static; grid-row: 2; justify-self: start; display: block; min-height: 44px;
    margin: -5px 16px 8px; padding: 7px 3px; color: #5b391e;
    border-bottom: 1px solid #926b38; font-size: 13px;
  }
  .guidebook-detail h3 { font-size: 23px; line-height: 1.3; }
  .guidebook-detail > p { max-width: none; font-size: 15px; line-height: 1.6; }
  .guidebook-detail :is(h3, h4, p, dt, dd, button) { min-width: 0; max-width: 100%; white-space: normal; word-break: keep-all; overflow-wrap: anywhere; }
  .guidebook-detail > :is(dl, section:not(.guidebook-mobile-portrait), footer) { clear: both; }
  .guidebook-facts { grid-template-columns: minmax(60px, 86px) minmax(0, 1fr); gap: 8px 12px; font-size: 14px; }
  .guidebook-facts dd { overflow-wrap: anywhere; }
  .guidebook-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .guidebook-dialog .guidebook-actions button { min-height: 44px; font-size: 14px; }
  .guidebook-dialog .guidebook-link { min-height: 44px; font-size: 13px; }
}

@media (min-width: 540px) and (max-width: 960px) {
  .guidebook-sections { grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-rows: minmax(44px, auto); }
}

@media (max-width: 960px) and (max-height: 540px) {
  .guidebook-header { margin-block: 2px; }
  .guidebook-sections { margin-bottom: 6px; }
  .guidebook-gallery, .guidebook-detail { margin-bottom: max(8px, env(safe-area-inset-bottom)); }
}
