/* Shared A-style page chrome. Illustrated edges use nine-slicing, never a
   stretched page-height bitmap. Content owns its spacing inside the frame. */
dialog#modal[data-view], #tackle-panel {
  --page-ink: #093c50;
  --page-muted: #52717e;
  --page-blue: #07506d;
  --page-paper: #fff9e9;
  --page-line: #b6d6dc;
  --page-card-art: url('./assets/ui/item-frame-v18.webp');
  --page-blue-art: url('./assets/ui/blue-button-v18.webp');
  --page-coral-art: url('./assets/ui/coral-button-v18.webp');
  --ink: var(--page-ink);
  --muted: var(--page-muted);
  --page-inset: 24px;
  color: var(--page-ink);
  font-family: var(--font);
  width: min(940px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 12px solid transparent;
  border-image: url('./assets/ui/page-frame-v18.webp') 54 / 12px / 0 stretch;
  border-radius: 26px;
  background: var(--page-paper);
  background-clip: padding-box;
  box-shadow: 0 16px 50px #032d4b65;
  overflow: hidden;
  scrollbar-width: thin;
  scrollbar-color: #31829a #e8f0e9;
}
dialog#modal[data-view][open] { display: flex; flex-direction: column; }
dialog#modal[data-view]::backdrop { background: #082f486e; backdrop-filter: blur(5px); }
dialog#modal[data-view]:is([data-view=settings],[data-view=fish],[data-view=help],[data-view=knowledge],[data-view=catch]) { width: min(650px, calc(100vw - 24px)); }
dialog#modal[data-view] #modal-body { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 22px var(--page-inset) 26px; scrollbar-gutter: stable; }
dialog#modal[data-view] .modal-head, #tackle-panel .panel-heading {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  margin: 0;
  padding: 18px 20px;
  min-height: 100px;
  height: auto;
  aspect-ratio: auto;
  border: 0;
  border-image: none;
  border-bottom: 3px solid #55bed0;
  border-radius: 12px 12px 0 0;
  background: #07506d;
  box-shadow: inset 0 1px 0 #9de8f466;
  color: #fff9e9;
}
dialog#modal[data-view] .modal-head > div, #tackle-panel .panel-heading > div {
  position: static;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}
dialog#modal[data-view] .modal-head h2, #tackle-panel .panel-heading h2 {
  display: block;
  margin: 0;
  padding: 0;
  font-size: clamp(23px, 3vw, 28px);
  line-height: 1.25;
  letter-spacing: .02em;
  color: #fff9e9;
  font-weight: 800;
  text-shadow: 0 2px 0 #043249;
}
dialog#modal[data-view] .modal-head h2::before { display: none; }
dialog#modal[data-view] .modal-head .eyebrow, #tackle-panel .panel-heading .eyebrow {
  display: block;
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: .02em;
  color: #b4e2ec;
}
dialog#modal[data-view] .modal-emblem {
  display: grid;
  place-items: center;
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 50%;
  box-shadow: none;
  background: #116481;
}
dialog#modal[data-view] .modal-emblem > span { width: 46px; height: 46px; }
dialog#modal[data-view=story], dialog#modal[data-view=journal], dialog#modal[data-view=fish] { --page-emblem: url('./assets/ui/nav-journal-v17.webp'); }
dialog#modal[data-view=shop], dialog#modal[data-view=supplies] { --page-emblem: url('./assets/ui/nav-shop-v17.webp'); }
dialog#modal[data-view=creel], dialog#modal[data-view=catch] { --page-emblem: url('./assets/ui/nav-creel-v17.webp'); }
dialog#modal[data-view=travel] { --page-emblem: url('./assets/ui/nav-travel-v17.webp'); }
dialog#modal[data-view=aquarium] { --page-emblem: url('./assets/ui/nav-aquarium-v17.webp'); }
dialog#modal:is([data-view=story],[data-view=journal],[data-view=fish],[data-view=shop],[data-view=supplies],[data-view=creel],[data-view=catch],[data-view=travel],[data-view=aquarium]) .modal-emblem { background: var(--page-emblem) center / contain no-repeat; }
dialog#modal:is([data-view=story],[data-view=journal],[data-view=fish],[data-view=shop],[data-view=supplies],[data-view=creel],[data-view=catch],[data-view=travel],[data-view=aquarium]) .modal-emblem > span { visibility: hidden; }
dialog#modal[data-view] .close-button, #tackle-panel .close-button {
  position: static;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0 0 3px;
  border: 1.5px solid #a4dfe9;
  border-image: none;
  border-radius: 50%;
  background: #06435e;
  color: #fff9e9;
  box-shadow: inset 0 2px 0 #8cd8e738, 0 3px 0 #023149;
  font-size: 31px;
  line-height: 1;
  text-shadow: none;
}
dialog#modal[data-view=save-conflict] #modal-close { display: none; }
dialog#modal[data-view] :is(.primary-button,.secondary-button), #tackle-panel :is(.primary-button,.secondary-button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 46px;
  min-width: 0;
  padding: 3px 12px 5px;
  border: 12px solid transparent;
  border-image: var(--page-blue-art) 64 fill / 12px / 0 stretch;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: #fff9e9;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: .01em;
  text-shadow: 0 1px 1px #063a55;
  white-space: normal;
  text-align: center;
  transition: transform .14s ease, filter .14s ease;
}
dialog#modal[data-view] .primary-button, #tackle-panel .primary-button { border-image-source: var(--page-coral-art); text-shadow: 0 1px 1px #9b3f29; }
dialog#modal[data-view] :is(.primary-button,.secondary-button):disabled, #tackle-panel :is(.primary-button,.secondary-button):disabled { opacity: .56; filter: saturate(.35); transform: none; cursor: default; }
dialog#modal[data-view] :is(.primary-button,.secondary-button):active:not(:disabled), #tackle-panel :is(.primary-button,.secondary-button):active:not(:disabled) { transform: translateY(2px) scale(.99); }
dialog#modal[data-view] :is(.detail-copy,.escape-copy,.knowledge-list,.help-step p) { font-size: 14px; line-height: 1.8; color: var(--page-ink); }
dialog#modal[data-view] :is(.detail-copy,.escape-copy) { margin: 0 0 18px; }
dialog#modal[data-view] .settings-small { display: block; color: var(--page-muted); font-size: 11px; line-height: 1.8; margin: 18px 0 0; padding: 0 2px; }
dialog#modal[data-view] .source-link { color: #087493; }
dialog#modal[data-view] :is(.release-controls>div,.retry-tip,.release-settings,.knowledge-list li) { padding: 18px 20px; background: #eef5f1; border: 1px solid var(--page-line); border-radius: 16px; color: var(--page-ink); }
dialog#modal[data-view] :is(.release-controls b,.retry-tip b,.pause-lead h3,.help-step h3) { color: var(--page-ink); }
dialog#modal[data-view] .help-step > span, dialog#modal[data-view] .pause-lead > span { background: #dceef0; color: #08718b; }
dialog#modal[data-view] .help-bottom { gap: 16px; line-height: 1.7; }
dialog#modal[data-view] :is(.capture-footer,.release-actions) { gap: 12px; }
dialog#modal[data-view] :is(p,li) { overflow-wrap: break-word; }
#tackle-panel { width: min(490px,calc(100vw - 24px)); max-width: 490px; right: 12px; padding: 0 var(--page-inset) 22px; overflow-y: auto; }
#tackle-panel .panel-heading { margin: 0 calc(-1 * var(--page-inset)) 20px; }
#tackle-panel .panel-heading::before { content: ''; width: 58px; height: 58px; flex: 0 0 58px; background: url('./assets/ui/nav-shop-v17.webp') center / contain no-repeat; }
@media(max-width:600px) {
  dialog#modal[data-view], #tackle-panel { --page-inset: 18px; border-width: 9px; border-image-width: 9px; max-height: calc(100dvh - 24px); border-radius: 22px; }
  dialog#modal[data-view] #modal-body { padding-top: 18px; padding-bottom: 22px; }
  dialog#modal[data-view] .modal-head, #tackle-panel .panel-heading { padding: 15px 14px; min-height: 90px; gap: 11px; }
  dialog#modal[data-view] .modal-emblem { flex-basis: 52px; width: 52px; height: 52px; }
  dialog#modal[data-view] .modal-emblem > span { width: 40px; height: 40px; }
  dialog#modal[data-view] .modal-head .eyebrow, #tackle-panel .panel-heading .eyebrow { font-size: 10px; }
  dialog#modal[data-view] :is(.primary-button,.secondary-button), #tackle-panel :is(.primary-button,.secondary-button) { font-size: 13px; padding-left: 8px; padding-right: 8px; }
  #tackle-panel .panel-heading::before { width: 50px; height: 50px; flex-basis: 50px; }
}
@media(max-width:370px) {
  dialog#modal[data-view], #tackle-panel { --page-inset: 14px; }
  dialog#modal[data-view] .modal-head, #tackle-panel .panel-heading { gap: 9px; padding: 14px 12px; }
  dialog#modal[data-view] .modal-head h2, #tackle-panel .panel-heading h2 { font-size: 21px; }
  dialog#modal[data-view] .modal-head .eyebrow, #tackle-panel .panel-heading .eyebrow { font-size: 9px; }
  dialog#modal[data-view] .modal-emblem { flex-basis: 42px; width: 42px; height: 42px; }
  dialog#modal[data-view] :is(.primary-button,.secondary-button), #tackle-panel :is(.primary-button,.secondary-button) { font-size: 12px; }
  #tackle-panel .panel-heading::before { display: none; }
}
@media(max-height:480px) and (orientation:landscape) {
  dialog#modal[data-view] .modal-head, #tackle-panel .panel-heading { min-height: 72px; padding-top: 10px; padding-bottom: 10px; }
  dialog#modal[data-view] .modal-emblem { width: 46px; height: 46px; flex-basis: 46px; }
}
@media(prefers-reduced-motion:reduce) { dialog#modal[data-view] button, #tackle-panel button { transition: none; } }
