/* Same look as the original catalogue, rebuilt to work on phones. */

:root {
    --page: #f0f0f0;
    --panel: #fff;
    --text: #222;
    --muted: #6b7280;
    --bar: #333;
    --line: #ddd;
    --accent: #ff0000;
    --accent-dark: #c40000;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --radius: 6px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Arial, sans-serif;
    line-height: 1.4;
    color: var(--text);
    background: var(--page);
}

img { max-width: 100%; }

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

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

/* --- Top bar, menu and footer -------------------------------------------- */

.topbar {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    height: 56px;
    padding: 0 max(16px, calc((100% - 800px) / 2));
    color: #fff;
    background: var(--bar);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.brand { display: flex; align-items: center; gap: 0.6rem; min-width: 0; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-logo { flex: none; width: 36px; height: 36px; border-radius: 8px; }
.brand-name {
    font-size: 1.15rem;
    font-weight: bold;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.brand-area {
    flex: none;
    padding: 2px 10px;
    font-size: 0.8rem;
    font-weight: bold;
    color: #fff;
    background: var(--accent);
    border-radius: 999px;
}
.brand-area:hover { text-decoration: none; background: var(--accent-dark); }

.menu { margin-left: auto; }
.menu-button {
    display: grid;
    align-content: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    padding: 0 10px;
    list-style: none;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    cursor: pointer;
}
.menu-button::-webkit-details-marker { display: none; }
.menu-button span { display: block; height: 2px; background: #fff; border-radius: 2px; transition: transform 0.15s, opacity 0.15s; }
.menu-button:hover, .menu[open] .menu-button { background: rgba(255, 255, 255, 0.1); }
.menu[open] .menu-button span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu[open] .menu-button span:nth-child(2) { opacity: 0; }
.menu[open] .menu-button span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.menu-panel {
    position: absolute;
    top: 100%;
    right: max(16px, calc((100% - 800px) / 2));
    z-index: 10;
    display: grid;
    min-width: 230px;
    padding: 0.4rem 0;
    margin-top: 6px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
.menu-panel a { padding: 0.65rem 1.1rem; color: var(--text); }
.menu-panel a:hover { background: #f3f3f3; color: var(--accent); text-decoration: none; }
.menu-panel hr { width: 100%; margin: 0.3rem 0; border: 0; border-top: 1px solid var(--line); }

.site-footer {
    padding: 1rem;
    font-size: 0.9rem;
    text-align: center;
    color: #ddd;
    background: var(--bar);
}

.subheader {
    max-width: 800px;
    margin: 18px auto 10px;
    padding: 0 16px;
    text-align: center;
}
.subheader h2 { font-size: clamp(1.2rem, 4vw, 1.5rem); }
.subheader p { margin: 0.25rem 0 0; color: var(--muted); }

/* --- Main panel ---------------------------------------------------------- */

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 22px 2rem 2rem;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.note {
    text-align: center;
    font-weight: bold;
    margin: 0 0 1rem;
}

.muted { color: var(--muted); font-weight: normal; }
.empty { text-align: center; color: var(--muted); padding: 2rem 0; }

/* --- Cards (categories and games) ---------------------------------------- */

.card {
    display: flex;
    gap: 25px;
    align-items: flex-start;
    padding: 1rem;
    margin-bottom: 1rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-icon {
    flex: none;
    width: 96px;
    height: 96px;
    margin-left: 15px;
    object-fit: contain;
    border-radius: 4px;
}
.card-icon-large { width: 128px; height: 128px; }

.card-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.card-body h2 { margin-bottom: 10px; font-size: 1.4rem; }
.card-body h2 a { color: var(--text); }
.card-text { margin: 0.5rem 0; }
.clamp {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.9rem;
}

.stage-links { margin: 1rem 0 0; line-height: 2; }
.stage-links a { padding: 4px 0; white-space: nowrap; }
.sep { color: var(--muted); margin: 0 0.25rem; }

.count {
    display: inline-block;
    min-width: 1.5em;
    padding: 0 0.4em;
    font-size: 0.75rem;
    line-height: 1.5;
    text-align: center;
    color: #fff;
    background: var(--muted);
    border-radius: 999px;
}

.details {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 2px 0.75rem;
    margin: 0.5rem 0;
    font-size: 9pt;
}
.details dt { font-weight: bold; }
.details dd { margin: 0; }

.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin: 0 0 0.5rem; }

.btn,
button,
.button {
    display: inline-block;
    padding: 0.5rem 1rem;
    font: inherit;
    font-weight: bold;
    color: #fff;
    background: var(--accent);
    border: 0;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
}
.btn:hover, button:hover, .button:hover { background: var(--accent-dark); color: #fff; text-decoration: none; }
.btn-big { padding: 0.75rem 1.5rem; font-size: 1.1rem; }
.btn-light, button.btn-light { color: var(--text); background: #e5e5e5; }
.btn-light:hover, button.btn-light:hover { color: var(--text); background: #d4d4d4; }
.btn-danger, button.btn-danger { background: #7f1d1d; }

.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.5rem 0 0; }
.tag { font-size: 0.8rem; color: var(--muted); }

.badge {
    display: inline-block;
    padding: 1px 8px;
    font-size: 0.75rem;
    color: #7c2d12;
    background: #ffedd5;
    border-radius: 999px;
}

/* --- Game lists: compact rows -------------------------------------------- */

.game-row {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 0 14px;
    align-items: center;
    padding: 0.7rem;
    margin-bottom: 0.6rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.game-row-icon img { display: block; width: 64px; height: 64px; object-fit: contain; border-radius: 6px; }
.game-row-body { min-width: 0; }
.game-row-body h2 {
    margin: 0;
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.game-row-body h2 a { color: var(--text); }
.game-row-facts { margin: 2px 0 0; font-size: 0.8rem; color: var(--muted); }
.game-row-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 4px 0 0;
    font-size: 0.9rem;
}
.game-row .tags { margin-top: 4px; }
.game-row-action { padding: 0.45rem 1rem; }

/* --- Filters and search -------------------------------------------------- */

.list-tools { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 1rem; }
.list-tools input[type=search] { flex: 1 1 200px; min-width: 0; }
.list-tools .sort { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; color: var(--muted); }
.list-tools .sort select { width: auto; }

.filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.9rem;
    color: var(--text);
    background: #f3f3f3;
    border: 1px solid var(--line);
    border-radius: 999px;
}
.chip:hover { text-decoration: none; border-color: var(--accent); }
.chip.active { color: #fff; background: var(--bar); border-color: var(--bar); }
.chip.active .count { background: var(--accent); }
.chip-small { padding: 0.25rem 0.7rem; font-size: 0.85rem; }

.search { display: flex; gap: 0.5rem; margin: 0 0 1.25rem; }
.search input { flex: 1; min-width: 0; }

/* --- Home page ----------------------------------------------------------- */

.about { font-size: 1.05rem; margin-bottom: 1.25rem; }
.card[id] { scroll-margin-top: 1rem; }
.mini-list { margin: 0.5rem 0 0.75rem; padding-left: 1.2rem; }
.mini-list li { margin-bottom: 0.25rem; }

/* --- Game page ----------------------------------------------------------- */

.section { margin-top: 1.5rem; }
.section h3 { margin-bottom: 0.5rem; padding-bottom: 0.25rem; border-bottom: 1px solid var(--line); }
.versions { padding-left: 1.2rem; }
.versions li { margin-bottom: 0.5rem; }
.feedback { padding: 0.75rem 0; border-top: 1px solid var(--line); }

/* --- Forms --------------------------------------------------------------- */

.form { display: grid; gap: 1rem; margin-bottom: 1rem; }
.form label { display: grid; gap: 0.3rem; font-weight: bold; }
.form .hint { font-weight: normal; font-size: 0.85rem; color: var(--muted); }
.form fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem 1rem; }
.form legend { font-weight: bold; padding: 0 0.25rem; }
.check, .form label.check { display: flex; align-items: center; gap: 0.5rem; font-weight: normal; }
.inline-options { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }

input[type=text], input[type=search], input[type=password], input[type=url], input[type=number], select, textarea {
    width: 100%;
    padding: 0.55rem 0.7rem;
    font: inherit;
    font-weight: normal;
    color: var(--text);
    background: #fff;
    border: 1px solid #bbb;
    border-radius: var(--radius);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
textarea { resize: vertical; }

.hp { position: absolute; left: -9999px; }

.flash { padding: 0.75rem 1rem; margin-bottom: 1rem; border-radius: var(--radius); }
.flash-success { background: #dcfce7; color: #14532d; }
.flash-error { background: #fee2e2; color: #7f1d1d; }
.flash-info { background: #e0f2fe; color: #0c4a6e; }

/* --- Admin --------------------------------------------------------------- */

.admin-nav {
    display: flex;
    gap: 0.25rem;
    padding: 4px;
    margin-bottom: 0.5rem;
    overflow-x: auto;
    background: #f3f3f3;
    border-radius: 10px;
}
.admin-tab {
    flex: none;
    padding: 0.5rem 0.9rem;
    font-weight: bold;
    color: var(--text);
    border-radius: 7px;
    white-space: nowrap;
}
.admin-tab:hover { background: #e5e5e5; text-decoration: none; }
.admin-tab.active { color: #fff; background: var(--bar); }
.admin-tab-plain { margin-left: auto; font-weight: normal; color: var(--muted); }

.admin-subnav {
    display: flex;
    gap: 1.25rem;
    padding: 0 0.5rem;
    margin-bottom: 1.25rem;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
}
.admin-subnav a {
    flex: none;
    padding: 0.6rem 0;
    color: var(--muted);
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}
.admin-subnav a:hover { color: var(--text); text-decoration: none; }
.admin-subnav a.active { color: var(--text); font-weight: bold; border-bottom-color: var(--accent); }
.admin-list { list-style: none; padding: 0; margin: 0; }
.admin-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--line);
}
.admin-list img { width: 40px; height: 40px; object-fit: contain; }
.admin-list .grow { flex: 1; min-width: 180px; }
.admin-list .actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.inline-form { display: inline; }
.avatar {
    display: grid;
    place-items: center;
    flex: none;
    width: 40px;
    height: 40px;
    font-weight: bold;
    color: #fff;
    background: var(--bar);
    border-radius: 50%;
}
.badge-dark { color: #fff; background: var(--bar); }
.order-buttons { display: grid; gap: 4px; }
.order-buttons button { width: 34px; height: 30px; padding: 0; line-height: 1; }
button:disabled, button:disabled:hover { opacity: 0.35; cursor: default; background: #e5e5e5; }
.link-button {
    padding: 0;
    color: var(--accent);
    background: none;
    font-weight: normal;
}
.link-button:hover { background: none; color: var(--accent); text-decoration: underline; }

.dropzone {
    display: grid;
    place-items: center;
    gap: 0.5rem;
    padding: 2rem 1rem;
    text-align: center;
    border: 2px dashed #bbb;
    border-radius: var(--radius);
    background: #fafafa;
    cursor: pointer;
}
.dropzone.dragging { border-color: var(--accent); background: #fff5f5; }
.dropzone input[type=file] { max-width: 100%; }
.progress { width: 100%; height: 12px; }
.help { padding: 0.75rem 1rem; background: #f7f7f7; border-left: 4px solid var(--accent); border-radius: 4px; }
.preview-icon { width: 96px; height: 96px; object-fit: contain; border: 1px solid var(--line); border-radius: 4px; }

/* --- Phones -------------------------------------------------------------- */

@media (max-width: 600px) {
    .container { padding: 16px; }
    .card { gap: 12px; padding: 0.75rem; }
    .card-icon { width: 64px; height: 64px; margin-left: 0; }
    .card-icon-large { width: 88px; height: 88px; }
    .card-body h2 { font-size: 1.15rem; margin-bottom: 6px; }
    .stage-links .sep { display: none; }
    .stage-links { display: flex; flex-direction: column; line-height: 1.6; }
    .stage-links a { padding: 6px 0; }
    .topbar { height: 52px; gap: 0.5rem; }
    .brand-logo { width: 32px; height: 32px; }
    .brand-name { font-size: 1rem; }
    .menu-panel { left: 8px; right: 8px; min-width: 0; }
    .subheader { margin: 14px auto 8px; }
    .game-row { grid-template-columns: 52px 1fr auto; gap: 0 10px; padding: 0.55rem; }
    .game-row-icon img { width: 52px; height: 52px; }
    .game-row-body h2 { font-size: 1rem; }
    .game-row-text { -webkit-line-clamp: 1; }
    .game-row .tags { display: none; }
    .game-row-action { padding: 0.4rem 0.75rem; font-size: 0.9rem; }
    .admin-nav, .admin-subnav { flex-wrap: wrap; overflow-x: visible; }
    .admin-subnav { gap: 0 1rem; }
    .admin-tab { padding: 0.45rem 0.7rem; }
    .filters { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
    .chip { flex: none; }
}
