/* Page-specific layouts. */

/* Tabs (messages, editor) */
.tabs { display: flex; gap: 2px; margin-bottom: -1px; position: relative; flex-wrap: wrap; }
.tabs a, .tabs button {
    background: linear-gradient(#f6f6f6, #e1e1e1);
    border: 1px solid var(--border);
    border-bottom: 0;
    padding: 5px 12px;
    font: bold 12px Arial, Helvetica, sans-serif;
    color: #555;
    cursor: pointer;
    border-radius: 0;
}
.tabs a:hover, .tabs button:hover { color: #000; text-decoration: none; }
.tabs a.active, .tabs button.active { background: #fff; color: var(--header-text); position: relative; top: 1px; }
.tabs + .panel { margin-top: 0; }

/* Home */
.home-welcome { display: flex; gap: 14px; align-items: flex-start; }
.home-avatar { flex: none; }
.home-welcome-text { flex: 1; }

/* Games */
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.game-card { border: 1px solid var(--border-light); padding: 6px; color: var(--text); }
.game-card:hover { border-color: #6aa0d8; text-decoration: none; }
.game-thumb { background: #dfe5ec; aspect-ratio: 16 / 9; overflow: hidden; }
.game-thumb img { width: 100%; height: 100%; object-fit: cover; }
.game-thumb-large { width: 320px; flex: none; }
.game-name { font-weight: bold; color: var(--link); margin-top: 4px; }
.game-meta { font-size: 11px; color: var(--muted); }
.game-details { display: flex; gap: 14px; }

/* Catalog & inventory */
.catalog-layout { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: start; }
.catalog-cats a { display: block; padding: 5px 9px; border-bottom: 1px solid #eee; font-size: 12px; }
.catalog-cats a:last-child { border-bottom: 0; }
.catalog-cats a.active { background: #e2ecf8; font-weight: bold; }
.catalog-main { min-width: 0; }

.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
.item-card { border: 1px solid var(--border-light); padding: 7px; text-align: center; color: var(--text); background: #fff; }
a.item-card:hover { border-color: #6aa0d8; text-decoration: none; }
.item-card.equipped { border: 2px solid var(--green); padding: 6px; background: #f6fbf4; }
.item-card .item-thumb { margin: 0 auto; }
.item-name { display: block; font-weight: bold; color: var(--link); margin-top: 5px; word-break: break-word; font-size: 12px; }
.item-meta { font-size: 11px; color: var(--muted); }
.item-price { font-size: 12px; color: var(--green); font-weight: bold; margin-top: 2px; }
.item-card form { margin-top: 5px; }
.owned-tag { display: inline-block; background: #e4f4e0; border: 1px solid #9ccc8f; color: #24561a; font-size: 10px; padding: 0 4px; font-weight: bold; }

.item-details { display: flex; gap: 16px; }
.item-preview { width: 280px; flex: none; }
.item-info { flex: 1; }
.price { color: var(--green); font-size: 15px; }
.buy-box { border: 1px solid var(--border-light); background: #f7f9fb; padding: 10px; margin-top: 6px; }
.owned-msg { font-weight: bold; color: #24561a; margin-bottom: 8px; }

.inventory-preview .avatar-viewport { max-width: 300px; margin: 0 auto; }

/* Develop */
.develop-create { display: flex; gap: 16px; }
.develop-create form { flex: 1; min-width: 0; }
.develop-preview { width: 260px; flex: none; }

/* Profile */
.profile-layout { display: grid; grid-template-columns: 330px 1fr; gap: 12px; align-items: start; }
.profile-actions { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.profile-desc { max-height: 240px; overflow-y: auto; }
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; }
.user-card { text-align: center; font-size: 11px; display: flex; flex-direction: column; align-items: center; gap: 3px; word-break: break-all; }

/* Friends */
.friend-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border-light); }
.friend-row:last-child { border-bottom: 0; }
.friend-info { flex: 1; min-width: 0; }
.friend-name { font-weight: bold; }
.friend-actions { display: flex; gap: 4px; }
.search-results { border-top: 1px solid var(--border-light); padding-top: 6px; }
.search-results div { padding: 2px 0; }

/* Messages */
.message-body { border: 1px solid var(--border-light); background: #fafafa; padding: 10px; min-height: 80px; margin: 8px 0; }

/* Auth */
.auth-panel .form input { max-width: 100%; }

@media (max-width: 760px) {
    .catalog-layout, .profile-layout { grid-template-columns: 1fr; }
    .item-details, .develop-create, .game-details, .home-welcome { flex-direction: column; }
    .item-preview, .develop-preview, .game-thumb-large { width: 100%; }
}

/* Error and maintenance pages */
.error-page .panel-body { display: flex; gap: 24px; align-items: center; padding: 24px; }
.error-figure { flex: none; }
.error-text h1 { font-size: 24px; margin-bottom: 6px; }
.error-code { color: #888; font-size: 12px; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; }
.error-links { margin-top: 14px; }
.maintenance .error-text h1 { font-size: 28px; }
@media (max-width: 760px) {
    .error-page .panel-body { flex-direction: column; text-align: center; }
}
code { background: #f1f1f1; border: 1px solid #ddd; padding: 0 3px; font-size: 12px; }
