* {
  box-sizing: border-box;
}

* {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--muted) 58%, transparent)
    color-mix(in srgb, var(--panel) 82%, var(--bg) 18%);
}

*::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

*::-webkit-scrollbar-track {
  background: color-mix(in srgb, var(--panel) 82%, var(--bg) 18%);
}

*::-webkit-scrollbar-thumb {
  border: 3px solid color-mix(in srgb, var(--panel) 82%, var(--bg) 18%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 58%, transparent);
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

body.policy-layout,
body:has(.policy-page) {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

.google-translate {
  position: fixed;
  left: -9999px;
  bottom: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.goog-te-banner-frame,
.skiptranslate iframe {
  display: none !important;
}

body {
  top: 0 !important;
}

html,
body {
  margin: 0 !important;
  padding: 0 !important;
}

body {
  top: 0 !important;
  position: static !important;
}

/* Google Translate 상단 배너 방지 */
.goog-te-banner-frame,
.skiptranslate iframe {
  display: none !important;
}

body > .skiptranslate {
  display: none !important;
}

/* 광고/번역이 body 밀어내는 경우 보정 */
body[style] {
  padding-top: 0 !important;
  margin-top: 0 !important;
  top: 0 !important;
}

.app-index-page {
  width: min(1180px, calc(100% - 32px));
  margin: 40px auto 80px;
}

.app-index-header {
  margin-bottom: 28px;
}

.app-index-eyebrow {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted, #777);
}

.app-index-header h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 4vw, 44px);
}

.app-index-header p {
  margin: 0;
  color: var(--muted, #777);
}

.app-index-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: -6px 0 18px;
}

.app-index-tools > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--muted, #777);
  font-size: 13px;
  font-weight: 800;
}

.app-index-tools strong {
  color: var(--ink, #111);
  font-size: 22px;
  line-height: 1;
}

.app-sort-tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  border: 1px solid var(--border, rgba(120, 120, 120, 0.22));
  border-radius: 999px;
  background: var(--card-bg, rgba(255, 255, 255, 0.75));
  padding: 4px;
}

.app-sort-tabs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  min-width: 72px;
  border-radius: 999px;
  color: var(--muted, #777);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.app-sort-tabs a.active {
  background: #111;
  color: #fff;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.app-card {
  padding: 22px;
  border: 1px solid var(--border, rgba(120, 120, 120, 0.22));
  border-radius: 20px;
  background: var(--card-bg, rgba(255, 255, 255, 0.75));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.06);
}

.app-card-badge {
  display: inline-flex;
  margin-bottom: 14px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: rgba(120, 120, 120, 0.12);
}

.app-card h2 {
  margin: 0 0 14px;
  font-size: 20px;
}

.app-card p {
  margin: 0 0 18px;
  color: var(--muted, #777);
}

.app-card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.app-click-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 18px;
}

.app-click-stats.compact {
  max-width: 420px;
  margin-bottom: 4px;
}

.app-click-stats span {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 1px solid var(--border, rgba(120, 120, 120, 0.18));
  border-radius: 12px;
  background: rgba(120, 120, 120, 0.07);
  padding: 9px 8px;
  color: var(--muted, #777);
  font-size: 11px;
  font-weight: 850;
  text-align: center;
}

.app-click-stats b {
  overflow: hidden;
  color: var(--ink, #111);
  font-size: 17px;
  font-weight: 950;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-card-actions a,
.app-open-link,
.app-back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 13px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid var(--border, rgba(120, 120, 120, 0.25));
  color: inherit;
}

.app-card-actions a:first-child {
  background: #111;
  color: #fff;
  border-color: #111;
}

.app-empty {
  padding: 40px;
  border: 1px dashed var(--border, rgba(120, 120, 120, 0.35));
  border-radius: 20px;
  color: var(--muted, #777);
  text-align: center;
}

.app-viewer {
  display: grid;
  gap: 16px;
}

.app-viewer-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.app-viewer h2 {
  margin: 0;
  font-size: 28px;
}

.app-preview-frame {
  width: 100%;
  min-height: 760px;
  border: 1px solid var(--border, rgba(120, 120, 120, 0.22));
  border-radius: 20px;
  background: #fff;
}

@media (max-width: 640px) {
  .app-index-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .app-sort-tabs {
    width: 100%;
  }

  .app-sort-tabs a {
    min-width: 0;
  }
}
