/* =========================================================
   Star Trek Games — Theme Stylesheet
   ========================================================= */

:root {
	--stg-bg: #f3f8f4;
	--stg-surface: #ffffff;
	--stg-text: #1c2b22;
	--stg-text-muted: #6b7b72;
	--stg-primary: #16a34a;
	--stg-primary-dark: #0f7a37;
	--stg-accent: #2563eb;
	--stg-orange: #f97316;
	--stg-purple: #9333ea;
	--stg-red: #ef4444;
	--stg-border: #e3ece5;
	--stg-radius: 16px;
	--stg-shadow: 0 4px 14px rgba(20, 40, 25, 0.06);
	--stg-max: 1280px;
}

[data-theme="dark"] {
	--stg-bg: #101712;
	--stg-surface: #182019;
	--stg-text: #eef4ef;
	--stg-text-muted: #a1b0a7;
	--stg-border: #253028;
	--stg-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

/* Must come before any other rule: guarantees elements with the native
   `hidden` attribute (Download button vs Timer vs Get Download button,
   etc.) never show at the same time, even though they share classes
   like .stg-btn that also set `display`. Without this, a same-specificity
   class rule can defeat the browser's built-in [hidden] behavior and you
   end up seeing two buttons stacked at once. */
[hidden] { display: none !important; }

/* Fix: elements with the native [hidden] attribute must always stay
   hidden even if a class on the same element sets its own `display`
   value (e.g. .stg-btn sets display:inline-flex, which would otherwise
   defeat [hidden] and show two buttons at once). */
[hidden] { display: none !important; }

body {
	margin: 0;
	font-family: 'Poppins', system-ui, -apple-system, sans-serif;
	background: var(--stg-bg);
	color: var(--stg-text);
	line-height: 1.6;
	transition: background .2s ease, color .2s ease;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; margin: 0; padding: 0; }

.stg-container { max-width: var(--stg-max); margin: 0 auto; padding: 0 20px; }

/* ---------------- Header ---------------- */
.stg-header {
	background: var(--stg-surface);
	border-bottom: 1px solid var(--stg-border);
	position: sticky;
	top: 0;
	z-index: 100;
}
.stg-header-inner { display: flex; align-items: center; gap: 24px; padding: 14px 20px; }
.stg-logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; }
.stg-logo-icon { font-size: 26px; }
.stg-logo-text { color: var(--stg-primary); }
.stg-nav { flex: 1; }
.stg-nav-list { display: flex; gap: 6px; flex-wrap: wrap; }
.stg-nav-list a {
	display: flex; align-items: center; gap: 6px;
	padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 14.5px;
	color: var(--stg-text); transition: background .15s ease;
}
.stg-nav-list a:hover { background: var(--stg-bg); color: var(--stg-primary); }
.stg-header-actions { display: flex; align-items: center; gap: 8px; }
.stg-icon-btn {
	width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--stg-border);
	background: var(--stg-bg); cursor: pointer; font-size: 16px;
}
.stg-mobile-toggle { display: none; background: none; border: none; font-size: 22px; cursor: pointer; }
.stg-search-panel { display: none; padding: 12px 0; border-top: 1px solid var(--stg-border); }
.stg-search-panel.is-open { display: block; }
.stg-search-form { display: flex; gap: 8px; }
.stg-search-input { flex: 1; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--stg-border); background: var(--stg-bg); color: var(--stg-text); }
.stg-search-submit { border: none; background: var(--stg-primary); color: #fff; border-radius: 50%; width: 40px; height: 40px; cursor: pointer; }

/* ---------------- Layout / Sections ---------------- */
.stg-main { padding: 28px 20px 60px; }
.stg-ad-wrap { margin: 18px 0; text-align: center; overflow: hidden; }
.stg-ad-slot:empty { display: none; }

.stg-section { margin: 40px 0; }
.stg-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.stg-section-head h2 { display: flex; align-items: center; gap: 10px; font-size: 22px; margin: 0; }
.stg-section-icon { font-size: 22px; }
.stg-view-all {
	background: var(--stg-primary); color: #fff; padding: 8px 16px; border-radius: 999px;
	font-weight: 600; font-size: 13.5px; white-space: nowrap;
}

.stg-breadcrumb { font-size: 13.5px; color: var(--stg-text-muted); margin: 14px 0; padding: 8px 14px; background: var(--stg-surface); border-radius: 10px; display: inline-block; }
.stg-breadcrumb a { color: var(--stg-primary); }
.stg-breadcrumb .sep { opacity: .5; margin: 0 4px; }

/* ---------------- App / Game Cards ---------------- */
.stg-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.stg-card {
	background: var(--stg-surface); border: 1px solid var(--stg-border); border-radius: var(--stg-radius);
	padding: 16px; display: flex; flex-direction: column; gap: 6px; position: relative;
	box-shadow: var(--stg-shadow); transition: transform .15s ease, box-shadow .15s ease;
}
.stg-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(20,40,25,.12); }
.stg-card-badge {
	position: absolute; top: 10px; left: 10px; background: var(--stg-red); color: #fff;
	font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 6px; text-transform: uppercase;
}
.stg-card-icon { width: 72px; height: 72px; border-radius: 18px; overflow: hidden; margin: 8px auto 4px; background: var(--stg-bg); display: flex; align-items: center; justify-content: center; }
.stg-card-icon img { width: 100%; height: 100%; object-fit: cover; }
.stg-card-icon-placeholder { font-size: 34px; }
.stg-card-name { font-weight: 700; font-size: 14.5px; text-align: center; }
.stg-card-cat { text-align: center; font-size: 12px; color: var(--stg-primary); font-weight: 600; }
.stg-card-meta { display: flex; justify-content: center; gap: 12px; font-size: 12px; color: var(--stg-text-muted); margin-top: 4px; }

/* ---------------- Article Cards ---------------- */
.stg-article-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.stg-article-card { background: var(--stg-surface); border: 1px solid var(--stg-border); border-radius: var(--stg-radius); overflow: hidden; box-shadow: var(--stg-shadow); display: flex; flex-direction: column; }
.stg-article-thumb { aspect-ratio: 16/9; overflow: hidden; }
.stg-article-thumb img { width: 100%; height: 100%; object-fit: cover; }
.stg-article-title { font-weight: 700; font-size: 15.5px; padding: 14px 14px 4px; }
.stg-article-excerpt { font-size: 13px; color: var(--stg-text-muted); padding: 0 14px 16px; }

/* ---------------- Single App Page ---------------- */
.stg-app-box { background: var(--stg-surface); border: 1px solid var(--stg-border); border-radius: var(--stg-radius); box-shadow: var(--stg-shadow); padding: 24px; margin-bottom: 24px; }
.stg-app-title { font-size: 26px; margin: 0 0 16px; }
.stg-app-top { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; margin-bottom: 20px; }
.stg-app-icon { width: 120px; height: 120px; border-radius: 22px; overflow: hidden; background: var(--stg-bg); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 48px; }
.stg-app-icon img { width: 100%; height: 100%; object-fit: cover; }
.stg-app-details { flex: 1; min-width: 240px; border-collapse: collapse; }
.stg-app-details th, .stg-app-details td { text-align: left; padding: 6px 10px 6px 0; font-size: 14.5px; }
.stg-app-details th { color: var(--stg-text-muted); font-weight: 600; white-space: nowrap; }
.stg-badge { background: var(--stg-primary); color: #fff; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.stg-badge-premium { background: var(--stg-orange); }
.stg-badge-verified { background: #22c55e; }

.stg-rating { min-width: 200px; }
.stg-rating-stars { display: flex; gap: 2px; }
.stg-star { background: none; border: none; font-size: 22px; color: #d1d5db; cursor: pointer; padding: 0; }
.stg-star.is-active, .stg-star:hover { color: #f59e0b; }
.stg-submit-rating { margin-top: 8px; background: var(--stg-primary); color: #fff; border: none; padding: 7px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
.stg-rating-summary { margin-top: 8px; font-size: 13px; color: var(--stg-text-muted); }

/* ---------------- Download Flow ---------------- */
.stg-download-zone { text-align: center; margin-top: 12px; }
.stg-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	border: none; border-radius: 999px; padding: 15px 34px; font-size: 16px; font-weight: 700;
	cursor: pointer; text-decoration: none; width: 100%; max-width: 420px;
}
.stg-btn-download { background: var(--stg-primary); color: #fff; }
.stg-btn-download:hover { background: var(--stg-primary-dark); }
.stg-btn-download:disabled { opacity: .6; cursor: not-allowed; }
.stg-btn-get { background: linear-gradient(90deg, #22c55e, #16a34a); color: #fff; animation: stg-pulse 1.4s infinite; }
.stg-btn-process { background: linear-gradient(90deg, var(--stg-accent), var(--stg-purple)); color: #fff; }
.stg-btn-back { background: var(--stg-bg); color: var(--stg-text); border: 1px solid var(--stg-border); margin-top: 10px; max-width: 200px; }
@keyframes stg-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.03); } }

.stg-timer-box { margin: 18px auto; max-width: 300px; }
.stg-timer-count {
	font-size: 40px; font-weight: 800; color: var(--stg-primary);
	width: 88px; height: 88px; line-height: 88px; border-radius: 50%;
	border: 4px solid var(--stg-primary); margin: 10px auto 0;
}
.stg-timer-error { color: var(--stg-red); font-size: 13.5px; margin-top: 10px; }

.stg-app-description { background: var(--stg-surface); border: 1px solid var(--stg-border); border-radius: var(--stg-radius); padding: 24px; box-shadow: var(--stg-shadow); }
.stg-app-description h2 { margin-top: 0; }
.stg-app-short-desc { color: var(--stg-text-muted); font-size: 15px; margin: -8px 0 18px; }

/* FAQ accordion */
.stg-faq-section { background: var(--stg-surface); border: 1px solid var(--stg-border); border-radius: var(--stg-radius); padding: 24px; box-shadow: var(--stg-shadow); margin-top: 24px; }
.stg-faq-section h2 { margin-top: 0; }
.stg-faq-item { border-bottom: 1px solid var(--stg-border); padding: 14px 0; }
.stg-faq-item:last-child { border-bottom: none; }
.stg-faq-item summary { cursor: pointer; font-weight: 600; font-size: 15px; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.stg-faq-item summary::-webkit-details-marker { display: none; }
.stg-faq-item summary::after { content: '+'; font-size: 20px; color: var(--stg-primary); margin-left: 12px; }
.stg-faq-item[open] summary::after { content: '−'; }
.stg-faq-answer { padding-top: 10px; color: var(--stg-text-muted); font-size: 14.5px; }
.stg-faq-answer p:first-child { margin-top: 0; }

/* Comments */
.stg-comments { background: var(--stg-surface); border: 1px solid var(--stg-border); border-radius: var(--stg-radius); padding: 24px; box-shadow: var(--stg-shadow); margin-top: 24px; }
.stg-comment-list { margin: 0 0 20px; padding: 0; }
.stg-comment-list li { list-style: none; border-bottom: 1px solid var(--stg-border); padding: 14px 0; }
.stg-comment-list .comment-author { font-weight: 700; font-size: 14px; }
.stg-comment-list .comment-meta { font-size: 12px; color: var(--stg-text-muted); margin-bottom: 6px; }
.stg-comment-reply-title { margin-top: 0; }
.stg-comment-notes { color: var(--stg-text-muted); font-size: 13.5px; }
.stg-comment-form { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.stg-comment-form-field { display: flex; flex-direction: column; gap: 6px; width: 100%; margin: 10px 0; }
.stg-comment-form-half { width: calc(50% - 8px); }
.stg-comment-form-field label { font-weight: 600; font-size: 13.5px; }
.stg-comment-form-field input[type="text"],
.stg-comment-form-field input[type="email"],
.stg-comment-form-field input[type="url"],
.stg-comment-form-field textarea {
	width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--stg-border);
	background: var(--stg-bg); color: var(--stg-text); font-family: inherit; font-size: 14.5px; resize: vertical;
}
.stg-comment-form-field input:focus, .stg-comment-form-field textarea:focus { outline: 2px solid var(--stg-primary); outline-offset: 1px; }
.stg-comment-submit { width: auto; padding: 12px 30px; margin-top: 6px; }
@media (max-width: 600px) { .stg-comment-form-half { width: 100%; } }

/* Final download page */
.stg-final-download { text-align: center; }
.stg-final-head { display: flex; align-items: center; gap: 16px; text-align: left; margin-bottom: 22px; }
.stg-final-badges { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.stg-scanned { font-size: 13px; color: var(--stg-primary); margin: 4px 0 0; }
.stg-safety-box { text-align: left; background: var(--stg-bg); border: 1px solid var(--stg-border); border-radius: 12px; padding: 18px; margin-top: 22px; }
.stg-safety-box h3 { margin-top: 0; font-size: 15px; }
.stg-safety-box li { font-size: 13.5px; margin-bottom: 6px; }
.stg-app-details-box { text-align: left; margin-top: 18px; }
.stg-details-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 12px; }
.stg-details-grid > div { background: var(--stg-bg); border: 1px solid var(--stg-border); border-radius: 10px; padding: 12px; }
.stg-details-grid span { display: block; font-size: 12px; color: var(--stg-text-muted); }
.stg-details-grid strong { font-size: 14.5px; }

/* ---------------- Articles / Pages ---------------- */
.stg-article-single, .stg-page { background: var(--stg-surface); border: 1px solid var(--stg-border); border-radius: var(--stg-radius); padding: 26px; box-shadow: var(--stg-shadow); }
.stg-article-byline { color: var(--stg-text-muted); font-size: 13px; }
.stg-article-single-thumb { border-radius: 12px; overflow: hidden; margin: 14px 0; }
.stg-article-content img { border-radius: 10px; }

.stg-empty-state { text-align: center; padding: 60px 20px; color: var(--stg-text-muted); }
.stg-notice { text-align: center; color: var(--stg-text-muted); }
.stg-archive-title { font-size: 24px; margin-bottom: 18px; }
.stg-pagination { margin-top: 30px; text-align: center; }

/* ---------------- Footer ---------------- */
.stg-footer { background: var(--stg-surface); border-top: 1px solid var(--stg-border); margin-top: 50px; }
.stg-footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1.2fr; gap: 30px; padding: 40px 20px; }
.stg-footer-col h4 { margin-top: 0; font-size: 15px; }
.stg-footer-col a { display: block; padding: 4px 0; font-size: 13.5px; color: var(--stg-text-muted); }
.stg-address-list { padding: 0; margin: 0; }
.stg-address-list li { list-style: none; font-size: 13.5px; color: var(--stg-text-muted); padding: 4px 0; }
.stg-address-list a { display: inline; padding: 0; color: var(--stg-text-muted); }
.stg-footer-logo { margin-bottom: 10px; }
.stg-footer-bottom { border-top: 1px solid var(--stg-border); padding: 16px 20px; font-size: 13px; text-align: center; color: var(--stg-text-muted); }

/* ---------------- Responsive ---------------- */
@media (max-width: 900px) {
	.stg-footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 780px) {
	.stg-nav { position: fixed; inset: 62px 0 0 0; background: var(--stg-surface); padding: 16px 20px; transform: translateY(-120%); transition: transform .2s ease; z-index: 90; }
	.stg-nav.is-open { transform: translateY(0); }
	.stg-nav-list { flex-direction: column; }
	.stg-mobile-toggle { display: block; }
	.stg-app-top { flex-direction: column; align-items: center; text-align: center; }
	.stg-app-details { width: 100%; }
	.stg-footer-grid { grid-template-columns: 1fr; }
}
