.applinks-wrap {
  position: relative;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  color: #1e293b;
}

.applinks-wrap.light {
  background: transparent;
}

.applinks-viewer {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.applinks-wrap[data-mode="browser"] .applinks-viewer {
  border-radius: 16px 16px 0 0;
}


.applinks-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(120deg, #f8fafc, #e2e8f0);
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

.applinks-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 auto;
  min-width: 0;
}

.applinks-open {
  border: none;
  background: #ffffff;
  color: #0f172a;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.45);
  transition: background 0.2s ease, color 0.2s ease, transform 0.08s ease;
}

.applinks-open:hover {
  background: #e0f2fe;
  color: #0284c7;
}

.applinks-open:focus {
  outline: 2px solid rgba(14, 165, 233, 0.75);
  outline-offset: 2px;
}

.applinks-open:active {
  transform: translateY(1px);
}

.applinks-title {
  flex: 1 1 auto;
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.applinks-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1rem;
  padding: 1.25rem;
}

.applinks-card {
  position: relative;
  display: block;
  background: #f8fafc;
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  aspect-ratio: 4 / 3;
}

.applinks-card:hover,
.applinks-card:focus {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(14, 165, 233, 0.18);
  outline: none;
}

.applinks-card-text {
  position: absolute;
  top: 0.65rem;
  left: 0.75rem;
  right: 0.75rem;
  padding: 0.4rem 0.5rem;
  background: rgba(255, 255, 255, 0.55);
  color: #111827;
  text-shadow: none;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
  border-radius: 0.65rem;
  backdrop-filter: blur(4px);
  z-index: 2;
}

.applinks-thumb {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 1;
}

.applinks-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
}

.alink-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72%;
  height: 72%;
  background: rgba(226, 232, 240, 0.8);
  border-radius: 50%;
  font-size: 2rem;
  color: #1e3a8a;
}

.applinks-empty {
  padding: 2rem;
  text-align: center;
  color: #475569;
  font-style: italic;
}

.applinks-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 70;
}

.applinks-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.applinks-overlay-card {
  width: min(520px, 92vw);
  max-height: 80vh;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.24);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.applinks-overlay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: #e0f2fe;
}

.applinks-overlay-title {
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
}

.applinks-close {
  border: none;
  background: transparent;
  color: #0f172a;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.applinks-close:hover {
  background: rgba(14, 165, 233, 0.15);
  color: #0284c7;
}

.applinks-close:focus {
  outline: 2px solid rgba(14, 165, 233, 0.7);
  outline-offset: 2px;
}

.applinks-overlay-body {
  padding: 1rem 1.25rem;
  overflow-y: auto;
}

.applinks-tree {
  list-style: none;
  margin: 0;
  padding: 0;
}

.anode {
  margin: 0;
  padding: 0;
}

.anode.folder > .anode-label {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: #0f172a;
  cursor: pointer;
  font-weight: 600;
  text-align: left;
}

.anode.folder > .anode-label:hover,
.anode.folder > .anode-label:focus {
  background: rgba(14, 165, 233, 0.12);
  outline: none;
}

.anode-caret {
  display: inline-block;
  transition: transform 0.2s ease;
}

.anode.folder.open > .anode-label .anode-caret {
  transform: rotate(90deg);
}

.anode-children {
  display: none;
  padding-left: 0.75rem;
}

.anode.folder.open > .anode-children {
  display: block;
}

.anode.file {
  list-style: none;
}

.aitem {
  width: 100%;
  border: none;
  background: transparent;
  padding: 0.4rem 0.85rem;
  border-radius: 10px;
  text-align: left;
  font-size: 0.92rem;
  color: #1f2937;
  cursor: pointer;
}

.aitem:hover,
.aitem:focus {
  background: rgba(14, 165, 233, 0.12);
  outline: none;
}

.aitem.active {
  background: rgba(14, 165, 233, 0.2);
  color: #0f172a;
  font-weight: 600;
}

@media (max-width: 1024px) {
  .applinks-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .applinks-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    padding: 1rem;
  }

  .applinks-card-text {
    font-size: 0.78rem;
    top: 0.5rem;
  }

  .applinks-thumb {
    padding: 2.25rem 0.75rem 0.75rem;
  }

  .applinks-btn {
    padding: 0.35rem 0.65rem;
  }
}
