/* root variables defined above */

@font-face {
    font-family: "AlchemyText";
    src: url("./assets/AlchemyText.woff2") format("woff2"),
    url("./assets/AlchemyText.woff") format("woff"),
    url("./assets/AlchemyText.ttf") format("truetype");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "AlchemyDisplay";
    src: url("./assets/AlchemyDisplay.woff2") format("woff2"),
    url("./assets/AlchemyDisplay.woff") format("woff"),
    url("./assets/AlchemyDisplay.ttf") format("truetype");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: #0f1115;
    --text1: #ffffff;
    --muted: #9aa4b2;
    --accent: #6ea8fe;
    --surface: #171a21;
    --border: #2a2f3a;
}

:root {
    --bg: #0f1115;
    --muted: #9aa4b2;
    --accent: #6ea8fe;
    --surface: #171a21;
    --surface-strong: #0b0d12;
    --border: #2a2f3a;
    --on-accent: #0b0d12;
    --overlay: rgba(11, 13, 18, 0.72);
}


* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: "AlchemyText", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu,
    "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji";
    background: var(--bg);
    color: var(--text1);
}

.app {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px 16px 48px;
}

.title {
    margin: 0 0 16px;
    font-size: 20px;
    font-weight: 700;
}

.title,
.name,
.saved-title,
.section-title {
    font-family: "AlchemyDisplay", "AlchemyText", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu,
    "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

.search {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    align-items: end;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
}

.search label {
    grid-column: 1 / -1;
    font-size: 12px;
    color: var(--muted);
}

.search input[type="number"] {
    width: 100%;
    appearance: textfield;
    background: var(--surface-strong);
    color: var(--text1);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    outline: none;
}

.search input[type="number"]::-webkit-outer-spin-button,
.search input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.search button {
    padding: 10px 16px;
    border: 1px solid var(--border);
    background: var(--accent);
    color: var(--on-accent);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
}

.search button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.status {
    margin: 12px 0 0;
    min-height: 20px;
    color: var(--muted);
}

.status.error {
    color: #ff6b6b;
}

.help {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.result {
    margin-top: 12px;
    padding: 12px;
    border-radius: 12px;
    min-height: 320px;
}

/* Show decorative frame only when result has content */
.result.has-content {
    background-image: url("./assets/frame.avif");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    background-color: transparent;
}

/* Hide Telegram user banner on search screen */
#screen-search #user {
    display: none;
}

/* Card layout: three areas with the image centered */
.card {
    display: grid;
    grid-template-columns: 1fr minmax(220px, 320px) 1fr;
    gap: 16px;
    align-items: start;
}

.card-side.meta,
.card-side.attributes {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
}

.name {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 700;
}

.links {
    margin: 0 0 8px;
}

.ext-link {
    display: inline-block;
    padding: 6px 10px;
    background: var(--accent);
    color: var(--on-accent);
    border: 1px solid var(--border);
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
}

.desc {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.4;
}

.image-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px;
    position: relative;
}

.image {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 10px;
}

/* Smaller image in search results */
.result .image-wrap {
    padding: 6px;
    background: transparent;
    border: none;
}

.result .image {
    max-width: 80%;
    max-height: 260px;
}

/* Level badge (styled similar to round-orange counter) */
.level-badge {
    background-image: url("./assets/round-orange.avif");
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    width: min(36px, 18px + 18 * (var(--app-width, 100vw) - 520px) / 1400, 18px + 18 * (var(--app-height, 100vh) - 357px) / 723);
    height: min(36px, 18px + 18 * (var(--app-width, 100vw) - 520px) / 1400, 18px + 18 * (var(--app-height, 100vh) - 357px) / 723);
    bottom: 0;
    position: absolute;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

@media (max-width: 430px), (max-height: 430px) {
    .level-badge {
        background-image: url("./assets/round-orange.avif");
    }
}

.level-badge span {
    text-align: center;
    text-shadow: 0 .257px .771px rgba(0, 0, 0, .61);
    color: #000;
    -webkit-text-stroke: .25px #000;
    position: relative;
    font-size: min(20px, 10px + 10 * (var(--app-width, 100vw) - 520px) / 1400, 10px + 10 * (var(--app-height, 100vh) - 357px) / 723);
    font-style: normal;
    font-weight: 500;
    line-height: min(20px, 10px + 10 * (var(--app-width, 100vw) - 520px) / 1400, 10px + 10 * (var(--app-height, 100vh) - 357px) / 723);
}

.level-badge span:before {
    position: absolute;
    content: attr(data-value);
    color: #fedfbb;
    -webkit-text-stroke: 0 #000;
}

.section-title {
    margin: 0 0 8px;
    font-size: 14px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.attr-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.attr-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
}

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

.attr-value {
    font-weight: 600;
}

/* Actions */
.actions {
    margin-top: 8px;
}

.save-btn {
    padding: 8px 12px;
    border: 1px solid var(--border);
    background: var(--accent);
    color: var(--on-accent);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
}

.save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Responsive tweaks */
@media (max-width: 720px) {
    .card {
        grid-template-columns: 1fr;
    }

    .image-wrap {
        order: -1;
    }
}

/* Saved dashboard */
.saved {
    margin-top: 16px;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
}

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

.saved-card {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 10px;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    position: relative;
    overflow: hidden;
}

.thumb-wrap {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.rarity-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6) inset, 0 1px 2px rgba(0, 0, 0, 0.4);
}

.rarity-legendary {
    background: linear-gradient(135deg, #ffd700, #ff9a00);
}

.rarity-epic {
    background: linear-gradient(135deg, #b067ff, #6a00ff);
}

.rarity-rare {
    background: linear-gradient(135deg, #00b4ff, #006aff);
}

.rarity-common {
    background: linear-gradient(135deg, #9aa4b2, #6b7280);
}

.thumb {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.saved-meta {
    min-width: 0;
}

.saved-title {
    font-weight: 700;
    margin-bottom: 4px;
}

.saved-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.saved-row .label {
    color: var(--muted);
}

/* Hover actions overlay */
.saved-actions {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    gap: 10px;
    background: var(--overlay);
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease-out;
}

.saved-card.actions-visible .saved-actions {
    opacity: 1;
    pointer-events: auto;
}

.act-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
}

.act-btn img {
    width: 20px;
    height: 20px;
    display: block;
}

.act-element {
    background: var(--accent);
}

.act-delete {
    background: var(--surface);
}

/* Potion enhancements */
.potion-ic {
    width: 14px;
    height: 14px;
    vertical-align: -2px;
    margin-right: 6px;
}

.potion-attr .attr-value,
.saved-row .potion-value,
.saved-total #potion-total {
    font-weight: 800;
}

/* Top navigation */
.topnav {
    display: grid;
    grid-auto-flow: column;
    justify-content: start;
    gap: 8px;
    margin: 0 0 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 6px;
}

.nav-btn {
    display: inline-grid;
    grid-auto-flow: column;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    background: var(--surface-strong);
    color: var(--text1);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
}

.nav-btn.active {
    background: var(--accent);
    color: var(--on-accent);
}

.nav-ic {
    width: 18px;
    height: 18px;
    display: block;
}

/* Inline SVG fallback sizing */
.nav-ic-svg {
    display: none;
    width: 18px;
    height: 18px;
    line-height: 0;
}

/* Screens */
.screen {
    display: none;
}

.screen.visible {
    display: block;
}


/* Dashboard background */
.dashboard {
    background-image: url("./assets/frame.avif");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 100% 100%; /* stretch to container width and height */
    background-color: transparent;
    border-radius: 12px;
    padding: 12px;
    min-height: 320px;
}

/* Remove dark underlays inside dashboard so frame stays visible */
.dashboard .saved,
.dashboard .saved-card,
.dashboard .thumb-wrap {
    background: transparent;
    border: none;
}

/* Empty state */
.empty {
    margin-top: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.empty-title {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 700;
}

.empty-text {
    margin: 0 0 12px;
    color: var(--muted);
}

.empty-actions {
    display: flex;
    justify-content: center;
}

.dashboard .empty {
    background: transparent;
    border: none;
}

/* Custom cursor */
body {
    cursor: url("./assets/cursor.png"), auto;
}

a, button, .nav-btn, .save-btn, input, select, textarea, .ext-link {
    cursor: url("./assets/cursor.png"), pointer;
}

