:root {
    --bg: #f6ead7;
    --paper: #fff7ea;
    --wood: #6b4328;
    --wood-dark: #4e2f1b;
    --accent: #a53b2d;
    --green: #4c7d3b;
    --text: #2f241b;
    --muted: #786455;
    --gold: #cf9b47;
    --shadow: 0 12px 28px rgba(58, 32, 14, 0.14);
    --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body.market-page {
    margin: 0;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(255,255,255,.55), transparent 30%),
        linear-gradient(180deg, #f9efdf 0%, var(--bg) 100%);
    color: var(--text);
    min-height: 100vh;
}

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

.container {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

/* ─── TOPBAR ─── */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
    background: rgba(249, 239, 223, 0.84);
    border-bottom: 1px solid rgba(107, 67, 40, 0.12);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 76px;
}

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

.brand-logo {
    height: 52px;
    width: auto;
    border-radius: 12px;
}

.brand-text {
    font-weight: 900;
    font-size: 20px;
    color: var(--wood-dark);
    line-height: 1.1;
}

.brand-sub {
    font-size: 11px;
    color: var(--muted);
    font-weight: 700;
    letter-spacing: .4px;
}

.nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.nav a {
    padding: 11px 14px;
    border-radius: 999px;
    font-weight: 700;
    color: var(--wood-dark);
    transition: background .2s;
}

.nav a:hover { background: rgba(107, 67, 40, 0.08); }

/* ─── BUTTONS ─── */
.chip,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    font-weight: 800;
    font-family: inherit;
    font-size: 14px;
    transition: transform .15s, box-shadow .15s;
}

.chip {
    background: #fff9f0;
    color: var(--wood-dark);
    padding: 12px 14px;
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px rgba(107, 67, 40, 0.1);
}

.btn {
    padding: 14px 18px;
    border-radius: 14px;
    box-shadow: var(--shadow);
}

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

.btn-primary {
    background: linear-gradient(180deg, var(--green), #3f6b31);
    color: #fff;
}

.btn-secondary {
    background: linear-gradient(180deg, #7e4f31, var(--wood-dark));
    color: #fff6ef;
}

.btn-accent {
    background: linear-gradient(180deg, #c4452e, var(--accent));
    color: #fff;
}

.btn-gold {
    background: linear-gradient(180deg, #d4a24e, #b8862f);
    color: #fff;
}

/* ─── DOWNLOAD BUTTON IMAGE ─── */
.download-img-btn {
    display: inline-block;
    cursor: pointer;
    transition: transform .15s;
}

.download-img-btn:hover { transform: scale(1.03); }

.download-img-btn img {
    height: 52px;
    width: auto;
}

/* ─── HERO ─── */
.hero {
    padding: 54px 0 28px;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    gap: 24px;
    align-items: stretch;
}

.card-bg,
.hero-main,
.hero-side,
.app-card,
.section-box,
.footer-box {
    background: linear-gradient(180deg, rgba(255,249,239,.98), rgba(247,236,217,.97));
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(107, 67, 40, 0.1);
}

.hero-main {
    padding: 34px;
    position: relative;
    overflow: hidden;
}

.hero-main::before {
    content: "";
    position: absolute;
    inset: auto -50px -60px auto;
    width: 240px;
    height: 240px;
    background: radial-gradient(circle, rgba(207,155,71,.22), transparent 70%);
    pointer-events: none;
}

.eyebrow {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(166, 60, 50, 0.12);
    color: var(--accent);
    font-weight: 900;
    letter-spacing: .3px;
    margin-bottom: 14px;
    font-size: 13px;
    text-transform: uppercase;
}

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

h1 {
    font-size: clamp(36px, 5vw, 58px);
    line-height: .98;
    margin-bottom: 16px;
    letter-spacing: -1.5px;
}

.hero-copy {
    max-width: 640px;
    font-size: 18px;
    line-height: 1.58;
    color: var(--muted);
    margin-bottom: 24px;
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

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

.stat {
    background: rgba(255,255,255,.55);
    padding: 16px;
    border-radius: 16px;
    border: 1px solid rgba(107,67,40,.08);
}

.stat strong {
    display: block;
    font-size: 22px;
    margin-bottom: 4px;
}

.stat span {
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

.hero-side {
    padding: 22px;
    display: grid;
    gap: 16px;
}

.character-card {
    background: linear-gradient(180deg, rgba(111, 69, 39, .08), rgba(76,125,59,.08));
    border-radius: 18px;
    padding: 20px;
    display: grid;
    grid-template-columns: 86px 1fr;
    gap: 16px;
    align-items: center;
}

.avatar-img {
    width: 86px;
    height: 86px;
    border-radius: 20px;
    object-fit: cover;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}

.quote {
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    font-weight: 700;
}

.mini-list {
    display: grid;
    gap: 10px;
}

.mini-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255,255,255,.6);
    border: 1px solid rgba(107,67,40,.08);
    transition: background .2s;
}

.mini-item:hover { background: rgba(255,255,255,.85); }

.mini-item span { color: var(--muted); font-size: 14px; font-weight: 700; }
.mini-item strong { font-size: 15px; }

.tag {
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(76,125,59,.12);
    color: var(--green);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .3px;
    white-space: nowrap;
}

.muted { color: var(--muted); }

/* ─── SECTION ─── */
section {
    padding: 18px 0 8px;
}

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

.section-head p {
    color: var(--muted);
    line-height: 1.5;
    max-width: 680px;
}

/* ─── APP GRID ─── */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.app-card {
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: transform .2s, box-shadow .2s;
}

.app-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 36px rgba(58, 32, 14, 0.18);
}

.app-icon-wrap {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(58, 32, 14, 0.15);
    flex-shrink: 0;
}

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

.app-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.pill-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(166,60,50,.1);
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
}

.app-card-actions {
    margin-top: auto;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* ─── PRICE TAGS ─── */
.price-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, #d4a24e, #b8862f);
    color: #fff;
    font-weight: 900;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(180, 130, 40, 0.3);
}

.price-tag-small {
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 10px;
}

.free-tag {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: 12px;
    background: rgba(76,125,59,.15);
    color: var(--green);
    font-weight: 900;
    font-size: 14px;
}

/* ─── APP DETAIL ─── */
.detail-header {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.detail-icon {
    width: 120px;
    height: 120px;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(58, 32, 14, 0.2);
    flex-shrink: 0;
}

.detail-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-info {
    flex: 1;
    min-width: 260px;
}

.detail-info h1 {
    font-size: 36px;
    margin-bottom: 8px;
    letter-spacing: -1px;
}

.detail-version {
    color: var(--muted);
    margin-bottom: 12px;
    font-weight: 600;
}

.detail-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 18px 0;
    align-items: center;
}

.detail-section {
    margin-top: 24px;
}

.detail-section h2 {
    font-size: 22px;
    margin-bottom: 12px;
}

.detail-quote {
    background: linear-gradient(180deg, rgba(111, 69, 39, .06), rgba(76,125,59,.06));
    border-radius: 18px;
    padding: 20px 24px;
    font-size: 17px;
    line-height: 1.55;
    font-weight: 700;
    color: var(--text);
    border-left: 4px solid var(--gold);
}

/* ─── PRICING TABLE ─── */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.pricing-card {
    background: rgba(255,255,255,.7);
    border: 2px solid rgba(107,67,40,.1);
    border-radius: 18px;
    padding: 24px;
    text-align: center;
    transition: border-color .2s, transform .2s;
}

.pricing-card:hover {
    border-color: var(--gold);
    transform: translateY(-2px);
}

.pricing-card .pricing-period {
    font-size: 16px;
    font-weight: 800;
    color: var(--muted);
    margin-bottom: 8px;
}

.pricing-card .pricing-price {
    font-size: 36px;
    font-weight: 900;
    color: var(--text);
    margin-bottom: 4px;
}

.pricing-card .pricing-currency {
    font-size: 18px;
    color: var(--muted);
}

.pricing-card .pricing-per-day {
    font-size: 13px;
    color: var(--muted);
    font-weight: 700;
    margin-bottom: 16px;
}

/* ─── OTHER APPS ─── */
.other-apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}

.other-app-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255,255,255,.6);
    border: 1px solid rgba(107,67,40,.08);
    transition: background .2s, transform .15s;
}

.other-app-link:hover {
    background: rgba(255,255,255,.9);
    transform: translateY(-2px);
}

.other-app-link img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
}

.other-app-link strong {
    font-size: 15px;
}

.other-app-link span {
    font-size: 12px;
    color: var(--muted);
    font-weight: 700;
}

/* ─── DOWNLOAD BANNER ─── */
.download-banner {
    margin-top: 22px;
    background: linear-gradient(135deg, #5f3a22, #3f2718);
    color: #fff4e7;
    border-radius: 28px;
    padding: 28px;
    box-shadow: var(--shadow);
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 16px;
    align-items: center;
}

.download-banner p {
    color: rgba(255,244,231,.82);
    margin-top: 12px;
    line-height: 1.6;
}

.download-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
}

.download-actions .chip {
    background: rgba(255,255,255,.12);
    color: #fff8ee;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.1);
}

/* ─── FOOTER ─── */
footer {
    padding: 26px 0 40px;
}

.footer-box {
    padding: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.footer-logo {
    height: 48px;
    width: auto;
    border-radius: 12px;
}

.footer-links {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    color: var(--muted);
    font-weight: 700;
}

.footer-links a:hover { color: var(--wood-dark); }

/* ─── BACK LINK ─── */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    font-weight: 800;
    color: var(--wood);
    margin-bottom: 12px;
}

.back-link:hover { color: var(--wood-dark); }

/* ─── RESPONSIVE ─── */
@media (max-width: 1080px) {
    .hero-grid,
    .download-banner { grid-template-columns: 1fr 1fr; }
    .download-actions { justify-content: flex-start; }
}

@media (max-width: 760px) {
    .topbar-inner,
    .section-head,
    .footer-box { align-items: flex-start; }
    .topbar-inner { flex-direction: column; padding: 14px 0 22px; }
    .hero-grid,
    .download-banner,
    .hero-stats { grid-template-columns: 1fr; }
    .hero-main,
    .hero-side,
    .section-box { padding: 18px; }
    .character-card { grid-template-columns: 64px 1fr; }
    .avatar-img { width: 64px; height: 64px; }
    h1 { font-size: 34px; }
    .detail-header { flex-direction: column; }
    .detail-icon { width: 96px; height: 96px; }
    .pricing-grid { grid-template-columns: 1fr; }
}
