@font-face {
  font-family: "Inter";
  src: url("/fonts/Inter-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("/fonts/Inter-Medium.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("/fonts/Inter-Bold.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Source Code Pro";
  src: url("/fonts/SourceCodePro-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Source Code Pro";
  src: url("/fonts/SourceCodePro-Semibold.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

:root {
  --ral-5010: #0e294b;
  --ral-5012: #46a5cb;
  --ral-6018: #57a639;
  --ral-1003: #f9a800;

  --text-main: #102237;
  --text-dim: rgba(11, 30, 49, 0.72);
  --focus-ring: #0f6ec8;
  --shadow-card: 0 10px 32px rgba(10, 39, 77, 0.2);

  --surface-glass: rgba(255, 255, 255, 0.26);
  --surface-glass-border: rgba(255, 255, 255, 0.52);
  --surface-strong: rgba(255, 255, 255, 0.78);
  --border-soft: rgba(255, 255, 255, 0.26);
  --border-soft-strong: rgba(255, 255, 255, 0.31);

  --layout-normal: 1260px;
  --layout-wide: 1720px;
  --tile-gap: 18px;
  --grid-gap: var(--tile-gap);
}

:root[data-theme="dark"] {
  --text-main: #e7eef9;
  --text-dim: rgba(231, 238, 249, 0.75);
  --focus-ring: #84bcff;
  --shadow-card: 0 14px 36px rgba(0, 0, 0, 0.34);
  --surface-glass: rgba(10, 15, 25, 0.4);
  --surface-glass-border: rgba(255, 255, 255, 0.2);
  --surface-strong: rgba(0, 0, 0, 0.48);
  --border-soft: rgba(255, 255, 255, 0.1);
  --border-soft-strong: rgba(255, 255, 255, 0.14);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --text-main: #e7eef9;
    --text-dim: rgba(231, 238, 249, 0.75);
    --focus-ring: #84bcff;
    --shadow-card: 0 14px 36px rgba(0, 0, 0, 0.34);
    --surface-glass: rgba(10, 15, 25, 0.4);
    --surface-glass-border: rgba(255, 255, 255, 0.2);
    --surface-strong: rgba(0, 0, 0, 0.48);
    --border-soft: rgba(255, 255, 255, 0.1);
    --border-soft-strong: rgba(255, 255, 255, 0.14);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--text-main);
  font-family: "Inter", "Segoe UI", sans-serif;
}

code,
pre {
  font-family: "Source Code Pro", monospace;
}

#bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(62vmax 62vmax at 10% 16%, var(--ral-5012), transparent 62%),
    radial-gradient(55vmax 55vmax at 84% 18%, var(--ral-5010), transparent 62%),
    radial-gradient(56vmax 56vmax at 18% 80%, var(--ral-6018), transparent 62%),
    radial-gradient(56vmax 56vmax at 88% 78%, var(--ral-1003), transparent 62%),
    linear-gradient(120deg, #eaf5ff 0%, #f9fbff 100%);
  filter: saturate(1.05);
}

:root[data-theme="dark"] #bg {
  background:
    radial-gradient(62vmax 62vmax at 10% 16%, color-mix(in oklab, var(--ral-5012), white 8%), transparent 62%),
    radial-gradient(55vmax 55vmax at 84% 18%, color-mix(in oklab, var(--ral-5010), white 6%), transparent 62%),
    radial-gradient(56vmax 56vmax at 18% 80%, color-mix(in oklab, var(--ral-6018), white 6%), transparent 62%),
    radial-gradient(56vmax 56vmax at 88% 78%, color-mix(in oklab, var(--ral-1003), white 5%), transparent 62%),
    linear-gradient(120deg, #091224 0%, #111a2e 100%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #bg {
    background:
      radial-gradient(62vmax 62vmax at 10% 16%, color-mix(in oklab, var(--ral-5012), white 8%), transparent 62%),
      radial-gradient(55vmax 55vmax at 84% 18%, color-mix(in oklab, var(--ral-5010), white 6%), transparent 62%),
      radial-gradient(56vmax 56vmax at 18% 80%, color-mix(in oklab, var(--ral-6018), white 6%), transparent 62%),
      radial-gradient(56vmax 56vmax at 88% 78%, color-mix(in oklab, var(--ral-1003), white 5%), transparent 62%),
      linear-gradient(120deg, #091224 0%, #111a2e 100%);
  }
}

#bg.use-custom,
:root[data-theme="dark"] #bg.use-custom {
  background: var(--bg-img) center / cover no-repeat fixed;
  filter: none;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-icon {
  width: 30px;
  height: 30px;
  display: block;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.05));
}

.app-title {
  margin: 0;
  font-size: clamp(1.35rem, 1.6vw, 1.8rem);
  font-weight: 500;
  letter-spacing: 0.15px;
}

.status {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.app {
  height: calc(100vh - 64px);
  overflow: auto;
  margin: 0 auto;
  max-width: var(--layout-normal);
  padding: 8px 24px 96px;
}

:root[data-layout="wide"] .app {
  max-width: var(--layout-wide);
}

:root[data-layout="full"] .app {
  max-width: none;
  width: 100%;
  margin: 0;
  padding-left: var(--grid-gap);
  padding-right: var(--grid-gap);
}

.section {
  margin-top: 8px;
}

.section-title {
  margin: 12px 8px 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(233px, 1fr));
  gap: var(--grid-gap);
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 226px;
  padding: 20px 18px 16px;
  border-radius: 18px;
  border: 1px solid var(--border-soft);
  background: var(--surface-glass);
  box-shadow: var(--shadow-card), inset 0 0 12px rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

@supports ((backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px))) {
  .tile {
    backdrop-filter: blur(10px) saturate(1.1);
    -webkit-backdrop-filter: blur(10px) saturate(1.1);
  }
}

.tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(10, 39, 77, 0.24), inset 0 0 12px rgba(255, 255, 255, 0.16);
}

.tile:active {
  transform: translateY(0);
}

.icon-wrap {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.55);
  display: grid;
  place-items: center;
  margin-inline: auto;
}

.icon-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.name {
  margin-top: 10px;
  text-align: center;
  font-weight: 700;
}

.status-img {
  display: block;
  margin-top: 6px;
  margin-inline: auto;
  width: auto;
  height: 20px;
  max-width: 100%;
  border-radius: 8px;
}

.desc {
  margin-top: 6px;
  margin-bottom: 10px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.links {
  margin: auto;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  align-content: center;
}

.links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid var(--border-soft-strong);
  background: var(--surface-strong);
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.73rem;
  font-weight: 600;
  line-height: 1;
  padding: 6px 10px;
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.1);
  transition: transform 120ms ease, background-color 120ms ease;
}

.links a:hover {
  transform: translateY(-1px);
}

.footer {
  position: fixed;
  right: 12px;
  bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.build-meta {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  background: var(--surface-strong);
  color: var(--text-main);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0 10px;
  white-space: nowrap;
}

.footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action {
  position: relative;
}

.theme-toggle,
.bg-image-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--border-soft-strong);
  background: var(--surface-strong);
  color: var(--text-main);
  cursor: pointer;
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.1);
}

.theme-toggle {
  font-size: 0.96rem;
}

.btn-icon {
  width: 16px;
  height: 16px;
  display: block;
}

.menu {
  position: absolute;
  bottom: 36px;
  right: 0;
  display: grid;
  gap: 6px;
  padding: 4px 0;
  opacity: 0;
  pointer-events: none;
}

.menu.is-open,
.menu.is-hover {
  opacity: 1;
  pointer-events: auto;
}

.menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--border-soft-strong);
  background: var(--surface-strong);
  color: var(--text-main);
  cursor: pointer;
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.1);
  transform: translateY(14px) scale(0.96);
  opacity: 0;
  transition: transform 160ms ease, opacity 160ms ease;
}

.menu.is-open .menu-btn,
.menu.is-hover .menu-btn {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.menu.is-open .menu-btn:nth-child(2),
.menu.is-hover .menu-btn:nth-child(2) {
  transition-delay: 40ms;
}

.menu.is-open .menu-btn:nth-child(3),
.menu.is-hover .menu-btn:nth-child(3) {
  transition-delay: 80ms;
}

.tile:focus-visible,
.theme-toggle:focus-visible,
.bg-image-btn:focus-visible,
.menu-btn:focus-visible,
.links a:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.theme-toggle:hover,
.bg-image-btn:hover,
.menu-btn:hover {
  transform: translateY(-1px);
}

@media (max-width: 960px) {
  .header {
    padding: 14px 16px 10px;
  }

  .app {
    padding: 8px 14px 116px;
  }

  :root[data-layout="full"] .app {
    padding-left: var(--grid-gap);
    padding-right: var(--grid-gap);
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  }

  .footer {
    left: 10px;
    right: 10px;
    justify-content: space-between;
  }
}

@media (max-width: 640px) {
  :root {
    --grid-gap: 12px;
  }

  .app-title {
    font-size: 1.12rem;
  }

  .status {
    font-size: 0.7rem;
  }

  .build-meta {
    max-width: 48vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }

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