.gift-gallery-nearby {
  position: absolute;
  right: 24px;
  bottom: 200px;
  z-index: 7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid rgba(190, 164, 119, 0.34);
  border-radius: 12px;
  background: rgba(34, 39, 33, 0.94);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  color: var(--ink);
  pointer-events: auto;
  white-space: nowrap;
}

.gift-gallery-key {
  flex: 0 0 auto;
  border-color: rgba(200, 170, 119, 0.36);
  color: #d2b987;
}

.gift-gallery-trigger-copy {
  color: var(--ink);
  font-size: 12px;
  font-weight: 550;
}

.gift-gallery-scrim {
  position: absolute;
  inset: 0;
  z-index: 19;
  background: rgba(8, 10, 9, 0.15);
  backdrop-filter: none;
  pointer-events: auto;
}

.gift-gallery-dialog {
  position: absolute;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(340px, calc(100vw - 24px));
  max-width: 340px;
  max-height: calc(100dvh - 48px);
  padding: 14px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid rgba(190, 164, 119, 0.34);
  border-radius: 16px;
  background: linear-gradient(155deg, rgba(39, 39, 33, 0.98), rgba(24, 31, 27, 0.98));
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.48), inset 0 1px rgba(244, 241, 234, 0.035);
  color: var(--ink);
  pointer-events: auto;
}

.gift-gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  min-width: 0;
}

.gift-gallery-heading-group {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.gift-gallery-eyebrow {
  color: #c8aa77;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.gift-gallery-heading {
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gift-gallery-header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}

.gift-gallery-count {
  color: #d2c4a9;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.gift-gallery-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-color: rgba(244, 241, 234, 0.14);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}

.gift-gallery-item {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 12px 0 4px;
  border-top: 1px solid rgba(190, 164, 119, 0.2);
}

.gift-gallery-owner {
  color: #c8aa77;
  font-size: 11px;
  line-height: 1.4;
}

.gift-gallery-title {
  color: var(--ink);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.gift-gallery-earned {
  width: fit-content;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid rgba(200, 170, 119, 0.22);
  border-radius: 999px;
  color: #d2c4a9;
  font-size: 10px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.gift-gallery-earned[data-earned="true"] {
  border-color: rgba(143, 191, 154, 0.28);
  color: var(--green);
}

.gift-gallery-description {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.gift-gallery-aside {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border-left: 2px solid rgba(200, 170, 119, 0.62);
  border-radius: 0 9px 9px 0;
  background: rgba(190, 164, 119, 0.055);
}

.gift-gallery-aside-label {
  color: #c8aa77;
  font-size: 10px;
  font-weight: 600;
}

.gift-gallery-aside-copy {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.gift-gallery-day {
  color: var(--green);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.gift-gallery-collection {
  min-width: 0;
  border-top: 1px solid rgba(244, 241, 234, 0.1);
}

.gift-gallery-collection-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  list-style: none;
}

.gift-gallery-collection-summary::-webkit-details-marker {
  display: none;
}

.gift-gallery-collection-summary::after {
  flex: 0 0 auto;
  color: #c8aa77;
  content: '展開';
  font-size: 10px;
}

.gift-gallery-collection[open] > .gift-gallery-collection-summary::after {
  content: '收合';
}

.gift-gallery-list {
  display: grid;
  gap: 4px;
  max-height: 180px;
  margin: 0;
  padding: 0 2px 3px 0;
  overflow-x: hidden;
  overflow-y: auto;
  list-style: none;
}

.gift-gallery-row {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid rgba(244, 241, 234, 0.08);
  border-radius: 9px;
  background: rgba(244, 241, 234, 0.025);
}

.gift-gallery-row[data-current="true"] {
  border-color: rgba(200, 170, 119, 0.28);
  background: rgba(190, 164, 119, 0.07);
}

.gift-gallery-row-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.gift-gallery-row-title,
.gift-gallery-row-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gift-gallery-row-title {
  color: var(--ink);
  font-size: 11px;
  font-weight: 550;
}

.gift-gallery-row-meta {
  color: var(--muted);
  font-size: 10px;
}

.gift-gallery-navigation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 7px;
}

.gift-gallery-step {
  min-width: 44px;
  min-height: 44px;
  padding: 5px 8px;
  border-color: rgba(190, 164, 119, 0.24);
  color: var(--ink);
  font-size: 12px;
}

.gift-gallery-step-next {
  border-color: rgba(143, 191, 154, 0.3);
  color: var(--green);
}

.gift-gallery-step:disabled {
  cursor: default;
  opacity: 0.42;
}

.gift-gallery-touch {
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  border-color: rgba(143, 191, 154, .35);
  color: var(--green);
  font-size: 12px;
}
.gift-gallery-touch:disabled { opacity: .55; }
.gift-gallery-response {
  margin: 8px 0 0;
  padding-left: 10px;
  border-left: 1px solid rgba(190, 164, 119, .4);
  color: #d8cfb7;
  font-size: 12px;
  line-height: 1.65;
}

.gift-gallery-live {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

body.gallery-open #unity-canvas {
  pointer-events: none;
}

body.gallery-open .hud > :not(.gift-gallery-scrim):not(.gift-gallery-dialog) {
  visibility: hidden !important;
}

body.gallery-open .gift-gallery-scrim,
body.gallery-open .gift-gallery-dialog {
  visibility: visible !important;
}

body.gallery-open .care-dock,
body.gallery-open #incident-nearby,
body.gallery-open .wish-nearby,
body.gallery-open #resident-wishes,
body.gallery-open .voice-bubble,
body.gallery-open .cycle-card,
body.gallery-open .top-actions,
body.gallery-open .guide-chip,
body.gallery-open .camera-toggle,
body.gallery-open .movement-hint {
  visibility: hidden !important;
}

.hud:has(#gift-gallery-nearby:not([hidden])) .voice-bubble {
  bottom: 252px;
}

.gift-gallery-nearby:focus-visible,
.gift-gallery-dialog button:focus-visible,
.gift-gallery-collection-summary:focus-visible {
  outline: 2px solid #e2c994;
  outline-offset: 2px;
}

@media (max-width: 600px) {
  .gift-gallery-nearby {
    right: 12px;
    bottom: calc(176px + env(safe-area-inset-bottom));
    max-width: calc(100vw - 24px);
  }

  .gift-gallery-dialog {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    left: 12px;
    width: auto;
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 13px;
  }

  .gift-gallery-header {
    gap: 6px;
  }

  .gift-gallery-count {
    font-size: 10px;
  }
}

@media (max-height: 520px) {
  .gift-gallery-dialog {
    top: max(8px, env(safe-area-inset-top));
    bottom: max(8px, env(safe-area-inset-bottom));
    max-height: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gift-gallery-nearby,
  .gift-gallery-dialog button {
    transition: none;
  }
}
