.wallpaper-stage {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.24s ease;
}

.wallpaper-stage img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.wallpaper-stage.is-visible {
  opacity: 1;
}

.top-menu-wrap {
  position: relative;
  display: inline-flex;
  z-index: 121;
}

.top-menu-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 148px;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
  display: grid;
  gap: 6px;
  z-index: 200;
}

.top-menu-panel[hidden] {
  display: none !important;
}

.top-menu-item {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #1d1d1f;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.top-menu-item:hover {
  background: rgba(15, 23, 42, 0.05);
}

.top-menu-item[disabled] {
  opacity: 0.6;
  cursor: default;
}

.wallpaper-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
}

.usage-modal {
  position: fixed;
  inset: 0;
  z-index: 130;
}

.wallpaper-modal[hidden],
.usage-modal[hidden] {
  display: none !important;
}

.wallpaper-modal-backdrop,
.usage-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(6px);
  z-index: 0;
}

.wallpaper-modal-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(720px, calc(100vw - 32px));
  max-height: min(88vh, 900px);
  overflow: hidden;
  border-radius: 30px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 30px 70px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  z-index: 1;
}

.usage-modal-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(760px, calc(100vw - 32px));
  max-height: min(88vh, 920px);
  overflow: hidden;
  border-radius: 30px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 30px 70px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  z-index: 1;
}

.wallpaper-modal-header,
.usage-modal-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 24px 24px 18px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(14px);
}

.wallpaper-modal-header {
  align-items: flex-start;
}

.usage-modal-header {
  align-items: center;
}

.wallpaper-modal-title,
.usage-modal-title {
  font-size: 22px;
  font-weight: 700;
  color: #111827;
}

.wallpaper-modal-subtitle {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.6;
  color: #6b7280;
}

.wallpaper-modal-close,
.usage-modal-close {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  font-size: 24px;
  line-height: 1;
  color: #4b5563;
  cursor: pointer;
}

.wallpaper-modal-body,
.usage-modal-body {
  display: grid;
  overflow: auto;
  min-height: 0;
  padding: 20px 24px 24px;
}

.wallpaper-modal-body {
  gap: 18px;
}

.usage-modal-body {
  gap: 20px;
}

.usage-modal-content {
  font-size: 16px;
  line-height: 1.9;
  color: #374151;
}

.usage-modal-actions {
  display: flex;
  justify-content: flex-end;
}

.usage-modal-confirm {
  min-width: 120px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #1d1d1f;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.usage-modal-confirm:hover {
  border-color: rgba(52, 199, 89, 0.24);
  background: rgba(244, 255, 247, 0.96);
  box-shadow: 0 10px 22px rgba(52, 199, 89, 0.12);
}

.wallpaper-preview-shell {
  border-radius: 24px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  background: rgba(248, 250, 252, 0.86);
  padding: 14px;
}

.wallpaper-preview {
  aspect-ratio: 16 / 9;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.18)),
    radial-gradient(circle at top center, rgba(222, 255, 231, 0.45) 0%, rgba(242, 242, 245, 0.95) 70%);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.wallpaper-preview-empty {
  font-size: 14px;
  color: #6b7280;
}

.wallpaper-note-list {
  display: grid;
  gap: 8px;
}

.wallpaper-note {
  font-size: 13px;
  line-height: 1.6;
  color: #4b5563;
}

.wallpaper-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.wallpaper-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: #1d1d1f;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.wallpaper-btn-primary {
  border: 0;
  background: linear-gradient(180deg, #41d86b, #29b44c);
  color: #ffffff;
}

.wallpaper-btn:hover {
  border-color: rgba(52, 199, 89, 0.28);
  background: rgba(244, 255, 247, 0.96);
  box-shadow: 0 10px 22px rgba(52, 199, 89, 0.12);
  transform: translateY(-1px);
}

.wallpaper-btn[disabled] {
  opacity: 0.6;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.wallpaper-btn[hidden] {
  display: none !important;
}

.wallpaper-status {
  font-size: 13px;
  line-height: 1.6;
  color: #5b5b60;
}

@media (max-width: 640px) {
  .wallpaper-modal-header,
  .usage-modal-header {
    padding: 18px 18px 14px;
  }

  .wallpaper-modal-body,
  .usage-modal-body {
    padding: 16px 18px 18px;
  }
}
