:root {
    --bg: #f4f6f8;
    --bg-accent: #e8eef2;
    --card-bg: #ffffff;
    --text: #1f2933;
    --text-muted: #64748b;
    --accent: #0f766e;
    --accent-soft: #ccfbf1;
    --border: #e2e8f0;
    --radius: 12px;
    --max-width: 800px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.08);
    --shadow-hover: 0 6px 18px rgba(15, 23, 42, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

code {
    background: var(--bg-accent);
    border-radius: 4px;
    padding: 0.1em 0.35em;
    font-size: 0.88em;
    word-break: break-all;
}

pre {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: var(--radius);
    padding: 1rem;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* Header */

.site-header {
    background: linear-gradient(135deg, #0f766e, #115e59);
    color: #f0fdfa;
    padding: 1.75rem 1.25rem;
}

.site-header a {
    color: #f0fdfa;
}

.brand {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-logo {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    padding: 4px;
    flex-shrink: 0;
}

.site-header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.site-header p {
    margin: 0.15rem 0 0;
    color: #99f6e4;
    font-size: 0.95rem;
}

.back-link {
    font-size: 0.9rem;
    color: #99f6e4;
}

/* Layout */

main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
}

/* Controls */

.controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.controls input[type="text"] {
    flex: 1;
    padding: 0.7rem 0.9rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text);
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.controls input[type="text"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.count {
    color: var(--text-muted);
    font-size: 0.9rem;
    white-space: nowrap;
}

/* App cards */

.app-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.app-card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow);
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.app-card:hover {
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: #cbd5e1;
}

.app-card-error {
    border-left: 4px solid #dc2626;
    background: #fef2f2;
    cursor: default;
}

.app-icon {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--bg-accent);
    flex-shrink: 0;
}

.app-info {
    min-width: 0;
    flex: 1;
}

.app-info h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.packager {
    margin: 0.15rem 0 0;
    font-size: 0.85rem;
    color: var(--accent);
}

.tagline {
    margin: 0.35rem 0 0;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.meta {
    margin: 0.55rem 0 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.badge {
    background: var(--accent-soft);
    color: #115e59;
    border-radius: 999px;
    padding: 0.15rem 0.6rem;
    font-weight: 600;
}

.badge-muted {
    background: var(--bg-accent);
    color: var(--text-muted);
    font-weight: 500;
}

.error-text {
    color: #b91c1c;
}

.empty {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 1rem;
    background: var(--card-bg);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.notice {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    font-size: 0.9rem;
}

/* Detail page */

.app-detail {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.app-header {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}

.app-header h1 {
    margin: 0;
    font-size: 1.6rem;
    letter-spacing: -0.02em;
}

.app-icon-large {
    width: 88px;
    height: 88px;
    border-radius: 16px;
    object-fit: cover;
    background: var(--bg-accent);
    flex-shrink: 0;
}

.links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1.25rem 0;
}

.link-btn {
    display: inline-block;
    padding: 0.45rem 0.9rem;
    border: 1px solid var(--accent);
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--accent);
    transition: background 0.15s ease, color 0.15s ease;
}

.link-btn:hover {
    background: var(--accent);
    color: #ffffff;
    text-decoration: none;
}

.versions-url {
    margin: 1rem 0;
    padding: 0.85rem 1rem;
    background: var(--bg-accent);
    border-radius: var(--radius);
    font-size: 0.88rem;
}

.versions-url p {
    margin: 0 0 0.35rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.versions-url code {
    background: none;
    padding: 0;
    color: var(--text);
}

.app-detail section {
    margin-top: 2rem;
    border-top: 1px solid var(--border);
    padding-top: 1.25rem;
}

.app-detail section h2 {
    margin: 0 0 0.85rem;
    font-size: 1.15rem;
}

.markdown p {
    margin: 0 0 0.9rem;
}

.markdown h1,
.markdown h2,
.markdown h3 {
    margin: 1.25rem 0 0.6rem;
}

.markdown img {
    max-width: 100%;
    border-radius: var(--radius);
}

.markdown ul,
.markdown ol {
    margin: 0 0 0.9rem;
    padding-left: 1.5rem;
}

.screenshots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.screenshots-grid img {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-accent);
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    background: var(--bg-accent);
    color: var(--text-muted);
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
}

/* Footer */

footer {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1.5rem 1.25rem 2.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}

footer p {
    margin: 0;
}

footer .version {
    margin-top: 0.35rem;
    font-size: 0.78rem;
    opacity: 0.75;
}

/* Responsive */

@media (max-width: 540px) {
    .site-header {
        padding: 1.25rem 1rem;
    }

    .app-icon {
        width: 46px;
        height: 46px;
    }

    .app-icon-large {
        width: 64px;
        height: 64px;
    }

    .app-detail {
        padding: 1.1rem;
    }

    .app-header {
        gap: 0.9rem;
    }
}
