/* ============================================================================
   Mt2Mythos game wiki -- dark Metin2 style, RTL
   ========================================================================== */

@font-face {
    font-family: 'Insula';
    src: url('/page_resources/images/INSULA__.ttf') format('truetype');
    font-display: swap;
}

/* Arabic UI face: even letter heights, short alef, modern and readable. */
@font-face {
    font-family: 'Tajawal';
    src: url('/wiki/assets/fonts/Tajawal-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Tajawal';
    src: url('/wiki/assets/fonts/Tajawal-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Tajawal';
    src: url('/wiki/assets/fonts/Tajawal-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Tajawal';
    src: url('/wiki/assets/fonts/Tajawal-ExtraBold.ttf') format('truetype');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

:root {
    --gold: #ffc260;
    --gold-2: #ffd99d;
    --gold-3: #a67800;
    --gold-4: #624700;
    --cyan: #6fe8ef;
    --red: #ff7171;
    --green: #94eb98;
    --panel: rgba(10, 11, 14, .88);
    --panel-2: rgba(18, 19, 24, .9);
    --line: rgba(166, 120, 0, .55);
    --muted: #b9ad91;
    --text: #f3e3c2;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background-color: #050506;
    background-image: linear-gradient(rgba(3, 3, 5, .88), rgba(3, 3, 5, .94)),
                      url('/page_resources/images/ingame_item_shop.jpg');
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    font-family: 'Tajawal', "Segoe UI", Tahoma, "Noto Naskh Arabic", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.85;
    direction: rtl;
    text-align: right;
    font-weight: 400;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--gold-2); text-decoration: none; }
a:hover { color: #fff; }

h1, h2, h3, h4, .font-fantasy {
    font-family: 'Tajawal', "Segoe UI", Tahoma, Arial, sans-serif;
    letter-spacing: 0;
    font-weight: 700;
}

.wiki-wrap {
    width: min(1500px, 96vw);
    margin: 0 auto;
    padding: 0 0 50px;
}

/* ------------------------------------------------------------------ header */
.site-head {
    position: sticky;
    top: 0;
    z-index: 60;
    background: linear-gradient(180deg, rgba(5, 5, 7, .98), rgba(9, 10, 13, .94));
    border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 35px rgba(0, 0, 0, .65);
    backdrop-filter: blur(8px);
}
.site-head-inner {
    width: min(1500px, 96vw);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 10px 0;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
}
.brand-mark {
    width: 46px;
    height: 46px;
    border: 1px solid var(--line);
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at 35% 25%, #3a2c12, #0b0b0c 70%);
    box-shadow: inset 0 0 18px rgba(255, 194, 96, .18);
    color: var(--gold);
    font-family: 'Insula', serif;
    font-size: 24px;
}
.brand-title {
    display: block;
    margin: 0;
    font-family: 'Insula', 'Tajawal', serif;
    font-size: 22px;
    line-height: 1.1;
    color: var(--gold);
    font-weight: 400;
    text-shadow: 0 0 14px rgba(255, 194, 96, .25);
}
.brand-sub {
    display: block;
    margin: 4px 0 0;
    font-size: 11px;
    line-height: 1.3;
    color: var(--muted);
    letter-spacing: .5px;
}
.top-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-inline-start: auto;
    justify-content: flex-end;
}
.top-nav a {
    display: block;
    padding: 6px 11px;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}
.top-nav a:hover { color: var(--gold-2); border-color: rgba(166, 120, 0, .35); background: rgba(255, 194, 96, .04); }
.top-nav a.active { color: #0b0b0c; background: linear-gradient(180deg, var(--gold-2), var(--gold)); border-color: var(--gold-3); font-weight: bold; }

/* ------------------------------------------------------------------- hero */
.hero {
    margin-top: 22px;
    padding: 30px 6px 18px;
    text-align: center;
}
.hero h1 {
    margin: 0 0 8px;
    font-size: clamp(30px, 4.5vw, 56px);
    font-weight: 800;
    color: var(--gold);
    text-shadow: 0 0 24px rgba(255, 194, 96, .18), 0 3px 0 #000;
}
.hero p {
    margin: 0 auto 22px;
    max-width: 850px;
    color: var(--muted);
    font-size: 16px;
}
.searchbar {
    display: flex;
    gap: 8px;
    max-width: 820px;
    margin: 0 auto;
    position: relative;
}
.searchbar input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 14px 18px;
    color: var(--text);
    background: rgba(8, 8, 10, .92);
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 17px;
    font-family: inherit;
    outline: none;
    box-shadow: inset 0 0 18px rgba(0, 0, 0, .55);
}
.searchbar input:focus { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(255, 194, 96, .12), inset 0 0 18px rgba(0, 0, 0, .55); }
.searchbar button {
    flex: 0 0 auto;
    padding: 0 26px;
    color: #0b0b0c;
    background: linear-gradient(180deg, var(--gold-2), var(--gold));
    border: 1px solid var(--gold-3);
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
}
.searchbar button:hover { filter: brightness(1.08); }
.search-hint {
    margin: 10px auto 0;
    max-width: 820px;
    color: #8e8471;
    font-size: 12px;
}
.search-suggest {
    position: absolute;
    z-index: 80;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    display: none;
    max-height: 430px;
    overflow: auto;
    background: #0d0e12;
    border: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .8);
    text-align: right;
}
.search-suggest.open { display: block; }
.search-suggest a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(166, 120, 0, .16);
    color: var(--text);
}
.search-suggest a:hover { background: rgba(255, 194, 96, .07); }
.search-suggest img { width: 34px; height: 34px; object-fit: contain; }
.search-suggest small { color: var(--muted); display: block; font-size: 11px; }
.search-suggest .sg-group { padding: 8px 12px 4px; color: var(--gold); font-size: 11px; letter-spacing: .5px; }

/* ------------------------------------------------------------------ panel */
.panel {
    position: relative;
    margin: 18px 0;
    padding: 18px 20px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 4px;
    box-shadow: 0 16px 45px rgba(0, 0, 0, .45), inset 0 0 45px rgba(0, 0, 0, .35);
}
.panel::before,
.panel::after {
    content: '';
    position: absolute;
    width: 26px;
    height: 26px;
    border: 1px solid rgba(255, 194, 96, .5);
    pointer-events: none;
}
.panel::before { top: 6px; right: 6px; border-left: 0; border-bottom: 0; }
.panel::after { bottom: 6px; left: 6px; border-right: 0; border-top: 0; }

.panel-head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    margin: -2px 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(166, 120, 0, .3);
}
.panel-head h2, .panel-head h3 { margin: 0; color: var(--gold); font-size: 22px; }
.panel-head .sub { color: var(--muted); font-size: 12px; }
.panel-head .spacer { margin-inline-start: auto; }

/* ------------------------------------------------------------------ cards */
.stat-grid, .cat-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.stat {
    padding: 16px;
    text-align: center;
    background: linear-gradient(180deg, rgba(30, 27, 20, .65), rgba(10, 10, 12, .8));
    border: 1px solid rgba(166, 120, 0, .35);
    border-radius: 4px;
}
.stat b { display: block; color: var(--gold); font-size: 28px; line-height: 1.2; font-family: 'Insula', sans-serif; }
.stat span { color: var(--muted); font-size: 12px; }

.cat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(180deg, rgba(35, 30, 20, .55), rgba(10, 10, 12, .82));
    border: 1px solid rgba(166, 120, 0, .35);
    border-radius: 4px;
    color: var(--text);
    transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.cat-card:hover { transform: translateY(-2px); border-color: var(--gold); background: linear-gradient(180deg, rgba(55, 44, 24, .6), rgba(12, 12, 14, .9)); }
.cat-card .ico {
    width: 46px; height: 46px; flex: 0 0 46px; display: grid; place-items: center;
    border: 1px solid rgba(166, 120, 0, .4); border-radius: 50%;
    background: rgba(0, 0, 0, .35); color: var(--gold); font-size: 22px;
}
.cat-card b { display: block; color: var(--gold-2); font-size: 15px; }
.cat-card small { color: var(--muted); font-size: 11px; }

/* ------------------------------------------------------------------ items */
.item-line {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(166, 120, 0, .14);
    color: var(--text);
}
.item-line:last-child { border-bottom: 0; }
.item-line:hover { background: rgba(255, 194, 96, .05); }
.item-icon {
    position: relative;
    width: 40px; height: 40px; flex: 0 0 40px; display: block;
    background: radial-gradient(circle, rgba(80, 62, 28, .28), rgba(0, 0, 0, .3));
    border: 1px solid rgba(166, 120, 0, .25);
    border-radius: 4px;
    overflow: hidden;
}
.item-icon img {
    position: absolute; inset: 2px;
    width: calc(100% - 4px); height: calc(100% - 4px);
    object-fit: contain; display: block;
}
.item-icon.lg { width: 78px; height: 78px; flex-basis: 78px; }
.item-icon.lg img { inset: 4px; width: calc(100% - 8px); height: calc(100% - 8px); }
.item-icon[data-tip], .item-hero h1[data-tip], .family-head h3[data-tip] { cursor: help; }
.item-name { font-weight: bold; color: var(--gold-2); }
.item-name.p1 { color: #fff; }
.item-name.p5 { color: #ffe36e; }
.item-name.p9 { color: #ff9d3c; }
.item-meta { color: var(--muted); font-size: 12px; }


.filter-row {
    display: flex; align-items: center; flex-wrap: wrap;
    gap: 5px; margin: 0 0 10px;
}
.filter-row .filter-label {
    color: var(--muted); font-size: 11px; margin-inline-end: 3px;
}
.badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 20px;
    border: 1px solid rgba(166, 120, 0, .35);
    color: var(--muted);
    font-size: 11px;
    line-height: 1.7;
    white-space: nowrap;
}
.badge.gold { color: var(--gold); border-color: rgba(255, 194, 96, .45); }
.badge.cyan { color: var(--cyan); border-color: rgba(111, 232, 239, .35); }
.badge.green { color: var(--green); border-color: rgba(148, 235, 152, .35); }
.badge.new { color: #ffe08a; border-color: rgba(255, 194, 96, .6); background: rgba(255, 194, 96, .12); }
.group-title {
    margin: 16px 0 8px;
    padding-bottom: 6px;
    font-size: 14px;
    font-weight: 700;
    color: var(--gold);
    border-bottom: 1px solid var(--line);
}
.group-title:first-child { margin-top: 4px; }
.badge.red { color: var(--red); border-color: rgba(255, 113, 113, .4); }

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
table.wiki-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
table.wiki-table th, table.wiki-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(166, 120, 0, .18);
    text-align: right;
    vertical-align: middle;
}
table.wiki-table th {
    color: var(--gold);
    background: rgba(255, 194, 96, .05);
    font-weight: bold;
    font-size: 12.5px;
    white-space: nowrap;
}
table.wiki-table tr:hover td { background: rgba(255, 194, 96, .035); }
table.wiki-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.wiki-table .icon-cell { width: 48px; }

/* --------------------------------------------------------------- item page */
.item-hero {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
}
.item-hero .head { flex: 1 1 320px; min-width: 0; }
.item-hero h1 { margin: 0 0 4px; font-size: clamp(24px, 3vw, 38px); color: var(--gold); }
.item-hero .desc { color: #d9c9a8; font-style: italic; margin: 10px 0 0; }
.item-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
    margin-top: 14px;
}
.fact {
    padding: 8px 10px;
    background: rgba(0, 0, 0, .25);
    border: 1px solid rgba(166, 120, 0, .22);
    border-radius: 3px;
    font-size: 12px;
}
.fact b { display: block; color: var(--gold-2); font-size: 13px; }
.fact span { color: var(--muted); font-size: 11px; }

.bonus-list { display: flex; flex-direction: column; gap: 4px; }
.bonus-list .b { color: var(--green); }
.bonus-list .b.neg { color: var(--red); }

.source-block { margin-top: 14px; }
.source-block h3 { color: var(--gold); font-size: 18px; margin: 0 0 8px; }
.source-block .empty { color: var(--muted); font-size: 13px; padding: 8px 0; }
.source-chest {
    margin: 10px 0;
    padding: 12px;
    border: 1px solid rgba(166, 120, 0, .28);
    border-radius: 4px;
    background: rgba(255, 194, 96, .025);
}
.source-chest .ch-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.source-chest .ch-head b { color: var(--gold-2); }
.source-chest .ch-body { margin-top: 8px; }

/* ------------------------------------------------------------ upgrade chain */
.family {
    margin: 14px 0 22px;
    padding: 14px;
    border: 1px solid rgba(166, 120, 0, .3);
    border-radius: 4px;
    background: rgba(0, 0, 0, .2);
}
.family-head {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    margin-bottom: 12px;
}
.family-head h3 { margin: 0; color: var(--gold); font-size: 19px; }
.family-head .spacer { margin-inline-start: auto; }
.chain {
    display: flex;
    gap: 8px;
    align-items: stretch;
    overflow-x: auto;
    padding: 4px 2px 12px;
    scrollbar-color: var(--gold-4) #111;
}
.step {
    flex: 0 0 178px;
    width: 178px;
    padding: 9px;
    border: 1px solid rgba(166, 120, 0, .32);
    border-radius: 4px;
    background: linear-gradient(180deg, rgba(28, 24, 17, .65), rgba(8, 8, 10, .75));
    position: relative;
}
.step:not(:last-child)::after {
    content: '◀';
    position: absolute;
    top: 42%;
    left: -12px;
    color: var(--gold-3);
    font-size: 16px;
    z-index: 2;
}
.step .st-head { display: flex; align-items: center; gap: 7px; }
.step .st-head .item-icon { width: 36px; height: 36px; flex-basis: 36px; }
.step .st-name { font-size: 12.5px; font-weight: bold; color: var(--gold-2); line-height: 1.3; }
.step .st-plus {
    position: absolute; top: 6px; left: 7px;
    color: var(--cyan); font-size: 12px; font-weight: bold;
    font-family: 'Insula', sans-serif;
}
.step .reqs { margin-top: 8px; display: flex; flex-direction: column; gap: 3px; }
.req {
    display: flex; align-items: center; gap: 5px;
    font-size: 11px; color: #d8c9aa;
}
.req img { width: 22px; height: 22px; object-fit: contain; }
.req b { color: var(--gold-2); font-weight: bold; }
.step .cost { margin-top: 7px; font-size: 11px; color: var(--gold); }
.step .cost .muted { color: var(--muted); }
.step .prob { font-size: 11px; color: var(--green); }
.step .prob.low { color: #ffb36b; }
.step .st-level { margin-top: 3px; color: var(--muted); font-size: 10px; }
.step .st-src {
    margin-top: 5px; padding-top: 4px;
    border-top: 1px dashed rgba(166, 120, 0, .2);
    color: var(--cyan); font-size: 10px; line-height: 1.35;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.step.transform { border-color: rgba(111, 232, 239, .45); }
.step.transform .st-name { color: var(--cyan); }
.step .t-label { font-size: 10px; color: var(--cyan); margin-bottom: 4px; }

/* ------------------------------------------------------------------ misc */
.grid-2 { display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.mt0 { margin-top: 0; }
.mb0 { margin-bottom: 0; }
.nowrap { white-space: nowrap; }
.sep { height: 1px; background: rgba(166, 120, 0, .25); margin: 14px 0; }

.pager {
    display: flex; gap: 5px; flex-wrap: wrap; justify-content: center;
    margin: 18px 0 4px;
}
.pager a, .pager span {
    min-width: 34px; text-align: center; padding: 5px 9px;
    border: 1px solid rgba(166, 120, 0, .3); border-radius: 3px;
    font-size: 13px;
}
.pager a:hover { border-color: var(--gold); background: rgba(255, 194, 96, .06); }
.pager .cur { color: #0b0b0c; background: var(--gold); border-color: var(--gold); font-weight: bold; }
.pager .off { color: #6d6557; }

.empty-state {
    padding: 30px 16px;
    text-align: center;
    color: var(--muted);
}
.empty-state b { display: block; color: var(--gold); font-size: 20px; margin-bottom: 6px; }

.notice {
    padding: 10px 14px;
    border-right: 3px solid var(--gold);
    background: rgba(255, 194, 96, .06);
    color: #e7d5af;
    font-size: 13px;
    margin: 12px 0;
}
.notice.event { border-color: var(--cyan); background: rgba(111, 232, 239, .06); }

/* ------------------------------------------------------------------ tooltip */
.wiki-tip {
    position: fixed;
    z-index: 200;
    display: none;
    width: min(360px, 92vw);
    padding: 12px 14px;
    background: linear-gradient(180deg, #1a1711, #09090b);
    border: 1px solid var(--gold-3);
    border-radius: 4px;
    box-shadow: 0 18px 55px rgba(0, 0, 0, .85);
    pointer-events: none;
    font-size: 12.5px;
    line-height: 1.6;
}
.wiki-tip.open { display: block; }
.wiki-tip .tip-name { color: var(--gold); font-size: 15px; font-weight: bold; margin-bottom: 4px; }
.wiki-tip .tip-meta { color: var(--muted); font-size: 11px; margin-bottom: 7px; }
.wiki-tip .tip-bonus { color: var(--green); }
.wiki-tip .tip-desc { color: #d4c3a0; font-style: italic; margin-top: 7px; border-top: 1px solid rgba(166, 120, 0, .25); padding-top: 7px; }
.wiki-tip .tip-src { color: var(--cyan); font-size: 11px; margin-top: 6px; }

/* ------------------------------------------------------------------ footer */
.site-foot {
    margin-top: 30px;
    padding: 22px 0 10px;
    border-top: 1px solid rgba(166, 120, 0, .28);
    color: #7f7665;
    font-size: 12px;
    text-align: center;
}
.site-foot a { color: var(--muted); }

/* --------------------------------------------------------------- responsive */
@media (max-width: 900px) {
    .site-head-inner { flex-wrap: wrap; }
    .top-nav { width: 100%; justify-content: flex-start; margin: 4px 0 0; }
    .grid-2 { grid-template-columns: 1fr; }
    .item-hero { gap: 12px; }
}
@media (max-width: 560px) {
    body { font-size: 14px; }
    .wiki-wrap { width: 100%; padding: 0 8px 35px; }
    .site-head-inner { width: 100%; padding: 8px; }
    .hero { padding-top: 18px; }
    .searchbar { flex-direction: column; }
    .searchbar button { padding: 10px; }
    .panel { padding: 14px 12px; }
    .step { flex-basis: 160px; width: 160px; }
}

/* thin scrollbars */
.chain::-webkit-scrollbar, .table-wrap::-webkit-scrollbar { height: 8px; }
.chain::-webkit-scrollbar-track, .table-wrap::-webkit-scrollbar-track { background: #111; }
.chain::-webkit-scrollbar-thumb, .table-wrap::-webkit-scrollbar-thumb { background: var(--gold-4); border-radius: 6px; }
