:root {
  color-scheme: light;
  --cream: #edf5ff;
  --paper: #fbfdff;
  --paper-strong: #ffffff;
  --ink: #1e222a;
  --muted: #52616f;
  --soft: #dce8f5;
  --line: rgb(30 34 42 / 14%);
  --ember: #ff3a00;
  --blue: #1677ff;
  --blue-soft: #e4f0ff;
  --control-hover: #46515e;
  --control-hover-soft: #edf1f5;
  --control-hover-border: rgb(30 34 42 / 24%);
  --radius: 8px;
  --content: 1180px;
  --shadow: 0 22px 62px rgb(30 34 42 / 14%);
  --small-shadow: 0 10px 28px rgb(30 34 42 / 10%);
  --font:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "SF Pro Text",
    "Helvetica Neue",
    Arial,
    sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgb(251 253 255 / 96%) 0%, rgb(237 245 255 / 76%) 44%, rgb(237 245 255 / 25%) 100%),
    linear-gradient(132deg, rgb(247 201 0 / 17%) 0%, rgb(247 201 0 / 0%) 30%),
    linear-gradient(24deg, rgb(255 58 0 / 8%) 0%, rgb(255 58 0 / 0%) 38%),
    var(--cream);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgb(30 34 42 / 3%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(30 34 42 / 3%) 1px, transparent 1px);
  background-size: 56px 56px;
  content: "";
  mask-image: linear-gradient(180deg, rgb(0 0 0 / 42%), transparent 86%);
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

p,
h1,
h2,
h3,
dl,
dd {
  margin: 0;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 30;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-strong);
  box-shadow: var(--small-shadow);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.store-shell {
  width: min(100%, var(--content));
  margin: 0 auto;
  padding: 138px 32px 72px;
}

.app-detail {
  padding: 42px;
  border: 1px solid rgb(30 34 42 / 12%);
  border-radius: 22px;
  background: rgb(255 255 255 / 78%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.app-hero {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  grid-template-areas:
    "icon identity"
    "icon actions";
  column-gap: 28px;
  row-gap: 0;
  align-items: start;
  min-height: 140px;
}

.app-icon {
  width: 120px;
  height: 120px;
  overflow: hidden;
  border: 1px solid rgb(30 34 42 / 10%);
  border-radius: 20px;
  background: var(--soft);
  box-shadow: 0 14px 30px rgb(30 34 42 / 14%);
}

.app-icon img,
.icon-placeholder {
  width: 100%;
  height: 100%;
}

.app-icon img {
  object-fit: cover;
}

.app-icon-column {
  grid-area: icon;
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: start;
}

.icon-placeholder {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #ffcc69, #ff693f);
  color: #fff;
  font-size: 2rem;
  font-weight: 820;
}

.app-identity {
  grid-area: identity;
  min-width: 0;
}

.app-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-title-row h1 {
  min-width: 0;
}

.current-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 780;
}

h1 {
  max-width: 20ch;
  font-size: clamp(2.5rem, 6vw, 4.4rem);
  font-weight: 810;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.app-tagline {
  max-width: 720px;
  margin-top: 12px;
  color: var(--muted);
  font-size: clamp(1.08rem, 2vw, 1.34rem);
  font-weight: 520;
}

.app-actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
}

.like-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-left: 4px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 740;
  white-space: nowrap;
}

.like-count-mobile {
  display: none;
  flex: none;
  padding-left: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.94rem;
  font-weight: 740;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-1px);
}

.button-primary {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.button-primary:hover,
.button-primary:focus-visible {
  border-color: var(--control-hover);
  background: var(--control-hover);
}

.button-secondary {
  border-color: rgb(30 34 42 / 14%);
  background: rgb(255 255 255 / 82%);
  color: var(--ink);
}

.button-secondary:hover,
.button-secondary:focus-visible {
  border-color: var(--control-hover-border);
  background: var(--control-hover-soft);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.metadata-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-top: 38px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.metadata-item {
  min-width: 0;
}

.metadata-item dt {
  margin-bottom: 5px;
  color: rgb(82 97 111 / 64%);
  font-size: 0.71rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.metadata-item dd {
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 630;
  overflow-wrap: anywhere;
}

.metadata-item dd strong {
  color: var(--ink);
}

.metadata-item a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.metadata-item a:hover,
.metadata-item a:focus-visible {
  color: var(--ember);
}

.screenshot-section {
  display: grid;
  place-items: center;
  padding-top: 46px;
}

.screenshot-frame {
  width: fit-content;
  max-width: 100%;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgb(255 255 255 / 86%);
  box-shadow: var(--small-shadow);
}

.screenshot-frame img {
  width: auto;
  max-width: 100%;
  max-height: 720px;
  border-radius: 11px;
  object-fit: contain;
}

.about-section,
.detail-section {
  margin-top: 54px;
}

.about-section {
  max-width: 820px;
}

h2 {
  font-size: clamp(1.65rem, 3vw, 2.15rem);
  font-weight: 790;
  letter-spacing: -0.025em;
  line-height: 1.12;
}

.app-description {
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.72;
  white-space: pre-line;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 17px;
}

.permissions-card,
.version-card {
  border: 1px solid rgb(30 34 42 / 8%);
  border-radius: 18px;
  background: rgb(247 249 252 / 86%);
}

.permissions-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 26px 34px;
  padding: 27px;
}

.permission-item,
.no-permissions {
  display: flex;
  gap: 15px;
  align-items: flex-start;
}

.permission-icon,
.no-permissions > svg {
  flex: 0 0 28px;
  width: 28px;
  color: var(--blue);
}

.permission-icon svg,
.no-permissions > svg {
  width: 24px;
  height: 24px;
}

.permission-item h3,
.no-permissions h3 {
  font-size: 1rem;
  font-weight: 760;
}

.permission-item p,
.no-permissions p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.94rem;
}

.no-permissions {
  grid-column: 1 / -1;
  justify-content: center;
}

.versions-list {
  display: grid;
  gap: 12px;
}

.version-card {
  overflow: hidden;
}

.version-card summary {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 78px;
  padding: 16px 22px;
  cursor: pointer;
  list-style: none;
}

.version-card summary::-webkit-details-marker {
  display: none;
}

.version-card summary:hover {
  background: rgb(30 34 42 / 3%);
}

.disclosure-icon {
  width: 9px;
  height: 9px;
  border-right: 2px solid rgb(82 97 111 / 55%);
  border-bottom: 2px solid rgb(82 97 111 / 55%);
  transform: rotate(-45deg);
  transition: transform 140ms ease;
}

.version-card[open] .disclosure-icon {
  transform: rotate(45deg) translateY(-2px);
}

.version-title-group {
  display: grid;
  gap: 1px;
}

.version-title-group strong {
  font-size: 1rem;
}

.version-title-group span {
  color: var(--muted);
  font-size: 0.84rem;
}

.current-badge {
  padding: 3px 8px;
}

.version-details {
  display: grid;
  gap: 9px;
  padding: 2px 22px 24px 43px;
}

.version-details > div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
}

.version-details dt {
  font-size: 0.84rem;
  font-weight: 740;
}

.version-details dd {
  min-width: 0;
  color: var(--muted);
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.monospaced {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

.store-home-shell {
  width: min(100%, var(--content));
  margin: 0 auto;
  padding: 138px 32px 84px;
}

.store-home-intro {
  padding-bottom: 34px;
  border-bottom: 1px solid var(--line);
}

.store-home-intro h1 {
  max-width: none;
}

.store-home-intro p {
  max-width: 680px;
  margin-top: 15px;
  color: var(--muted);
  font-size: 1.13rem;
}

.store-home-sections {
  display: grid;
  gap: 58px;
  margin-top: 48px;
}

.store-section-heading {
  display: flex;
  gap: 16px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
}

.store-app-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 18px;
}

.store-app-card {
  min-width: 0;
  border-bottom: 1px solid var(--line);
}

.store-app-card a {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 104px;
  padding: 14px 10px;
  border-radius: 14px;
  transition: background 150ms ease, transform 150ms ease;
}

.store-app-card a:hover,
.store-app-card a:focus-visible {
  background: rgb(255 255 255 / 72%);
  transform: translateY(-1px);
}

.store-card-icon,
.store-card-icon img,
.store-card-icon-placeholder {
  width: 64px;
  height: 64px;
}

.store-card-icon {
  display: block;
  overflow: hidden;
  border: 1px solid rgb(30 34 42 / 10%);
  border-radius: 12px;
  background: var(--soft);
  box-shadow: 0 8px 20px rgb(30 34 42 / 10%);
}

.store-card-icon img {
  object-fit: cover;
}

.store-card-icon-placeholder {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #ffcc69, #ff693f);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 820;
}

.store-card-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.store-card-copy > strong,
.store-card-copy > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.store-card-copy > strong {
  font-size: 1rem;
}

.store-card-description {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 540;
}

.store-card-creator {
  color: rgb(82 97 111 / 72%);
  font-size: 0.76rem;
}

.store-card-creator strong {
  font-weight: 760;
}

.store-empty-state {
  margin-top: 48px;
  padding: 64px 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgb(255 255 255 / 70%);
  text-align: center;
}

.store-empty-state p {
  margin-top: 8px;
  color: var(--muted);
}

.source-dialog {
  width: min(1000px, calc(100% - 36px));
  height: min(760px, calc(100% - 36px));
  padding: 0;
  overflow: hidden;
  border: 1px solid rgb(30 34 42 / 16%);
  border-radius: 18px;
  background: var(--paper-strong);
  color: var(--ink);
  box-shadow: 0 36px 110px rgb(12 18 28 / 34%);
}

.source-dialog[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.source-dialog::backdrop {
  background: rgb(13 20 30 / 48%);
  backdrop-filter: blur(5px);
}

.source-dialog-header,
.source-dialog-actions {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
  background: var(--paper);
}

.source-dialog-header {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.source-dialog-header h2 {
  font-size: 1.45rem;
}

.source-dialog-header p:last-child {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.86rem;
}

.icon-button {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  padding: 9px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-width: 2;
}

.source-state {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 0;
  padding: 40px;
  text-align: center;
}

.source-state p {
  max-width: 520px;
  margin-top: 10px;
  color: var(--muted);
}

.source-error .button {
  margin-top: 18px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--soft);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.source-code {
  min-height: 0;
  margin: 0;
  padding: 20px;
  overflow: auto;
  background: #151a22;
  color: #e7edf7;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.84rem;
  line-height: 1.58;
  tab-size: 4;
}

.source-dialog-actions {
  justify-content: end;
  border-top: 1px solid var(--line);
}

.copy-status {
  margin-right: auto;
  color: var(--muted);
  font-size: 0.84rem;
}

.error-shell {
  width: min(680px, calc(100% - 40px));
  margin: 0 auto;
  padding: 180px 0 120px;
  text-align: center;
}

.error-shell h1 {
  max-width: none;
}

.error-shell > p:not(.eyebrow) {
  margin: 22px auto 30px;
  color: var(--muted);
  font-size: 1.1rem;
}

@media (max-width: 1040px) {
  .store-app-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .store-shell {
    padding: 104px 12px 46px;
  }

  .app-detail {
    padding: 25px 20px;
    border-radius: 17px;
  }

  .app-hero {
    grid-template-columns: 86px minmax(0, 1fr);
    grid-template-areas:
      "icon identity"
      "actions actions";
    column-gap: 18px;
    row-gap: 0;
    align-items: start;
  }

  .app-icon {
    width: 86px;
    height: 86px;
    border-radius: 15px;
  }

  h1 {
    font-size: clamp(2.1rem, 10vw, 3.1rem);
  }

  .app-title-row {
    gap: 10px;
    align-items: flex-start;
  }

  .app-actions {
    width: 100%;
  }

  .app-actions .button {
    flex: 1 1 100%;
  }

  .like-count-desktop {
    display: none;
  }

  .like-count-mobile {
    display: inline-flex;
    margin-left: auto;
    margin-top: 10px;
  }

  .metadata-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .permissions-card {
    grid-template-columns: 1fr;
  }

  .no-permissions {
    justify-content: start;
  }

  .version-details {
    padding-left: 22px;
  }

  .version-details > div {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .store-home-shell {
    padding: 104px 16px 54px;
  }

  .store-home-sections {
    gap: 44px;
  }

  .store-section-heading {
    align-items: flex-start;
  }

  .store-app-grid {
    grid-template-columns: 1fr;
  }

  .source-dialog {
    width: calc(100% - 16px);
    height: calc(100% - 16px);
    border-radius: 14px;
  }

  .source-dialog-actions {
    flex-wrap: wrap;
  }

  .source-dialog-actions .button {
    width: auto;
  }

  .copy-status {
    width: 100%;
    margin: 0;
    text-align: right;
  }
}

@media (max-width: 720px) {
  .store-shell,
  .store-home-shell {
    padding-top: 34px;
  }

  .error-shell {
    padding-top: 70px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
