/* ============================================================
   ПокеКвест — оформление
   ============================================================ */

:root {
    --bg-0: #07080c;
    --bg-1: #0e1016;
    --bg-2: #151824;
    --bg-3: #1d2130;
    --line: #2b3040;
    --line-soft: #222634;

    --gold: #e6c46a;
    --gold-2: #a8842f;
    --green: #6ac25a;
    --green-2: #2f6b28;
    --orange: #f08b34;
    --orange-2: #9d4f10;
    --red: #e05a48;
    --blue: #55a8e8;
    --violet: #9a7cf0;

    --text: #d6d1c4;
    --text-dim: #8d887c;
    --text-mute: #6a655c;

    --radius: 10px;
    --shadow: 0 8px 24px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font: 14px/1.55 "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background:
        radial-gradient(1200px 600px at 50% -200px, #1d2440 0%, transparent 60%),
        radial-gradient(800px 500px at 100% 100%, #241a2e 0%, transparent 55%),
        linear-gradient(180deg, var(--bg-0), var(--bg-1));
    background-attachment: fixed;
}

/* сетка-фон */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: .35;
    background-image:
        linear-gradient(rgba(255, 255, 255, .022) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .022) 1px, transparent 1px);
    background-size: 42px 42px;
    z-index: 0;
}

/* ---------- каркас ---------- */

.wrap {
    position: relative;
    z-index: 1;
    max-width: 960px;
    margin: 0 auto;
    min-height: 100vh;
    background: linear-gradient(180deg, rgba(21, 24, 36, .92), rgba(12, 14, 20, .96));
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    box-shadow: 0 0 60px rgba(0, 0, 0, .6);
}

.page {
    padding: 14px 14px 40px;
    animation: fadeUp .35s ease;
}

/* ---------- верхняя панель ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 9px 16px;
    background: linear-gradient(180deg, #20243a, #12151f);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 4px 18px rgba(0, 0, 0, .5);
}

.logo {
    color: var(--gold);
    font-weight: 800;
    font-size: 17px;
    letter-spacing: .6px;
    text-shadow: 0 0 14px rgba(230, 196, 106, .35);
    text-decoration: none;
}
.logo:hover { color: #fff0bd; text-decoration: none; }

.money {
    display: flex;
    align-items: center;
    gap: 14px;
    font-weight: 700;
    font-size: 13px;
    color: var(--gold);
    flex-wrap: wrap;
}
.money span {
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(0, 0, 0, .35);
    border: 1px solid var(--line);
}
.money a { font-weight: 500; font-size: 12px; }

/* ---------- панели ---------- */

.panel {
    background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.panel > h2 {
    margin: 0;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--gold);
    background: linear-gradient(90deg, rgba(230, 196, 106, .12), transparent 65%);
    border-bottom: 1px solid var(--line);
    position: relative;
}
.panel > h2::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--gold), var(--gold-2));
    box-shadow: 0 0 10px rgba(230, 196, 106, .6);
}

.panel-body { padding: 13px 14px; }

/* ---------- главное меню ---------- */

.menu { padding: 0; }

.menu .item {
    display: flex;
    gap: 13px;
    align-items: center;
    padding: 12px 14px;
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid var(--line-soft);
    background: linear-gradient(90deg, rgba(255, 255, 255, .012), transparent 60%);
    transition: background .18s, transform .18s, padding-left .18s;
}
.menu .item:last-child { border-bottom: 0; }

.menu .item:hover {
    background: linear-gradient(90deg, rgba(106, 194, 90, .13), transparent 70%);
    padding-left: 20px;
    text-decoration: none;
}

.menu .ico {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: grid;
    place-items: center;
    font-size: 22px;
    border-radius: 10px;
    background: linear-gradient(145deg, #262b3d, #171a25);
    border: 1px solid var(--line);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
    transition: transform .18s;
}
.menu .item:hover .ico { transform: scale(1.08) rotate(-4deg); }

.menu .ttl {
    display: block;
    color: #f0e2b6;
    font-weight: 700;
    font-size: 15px;
}
.menu .sub {
    display: block;
    color: var(--text-dim);
    font-size: 11.5px;
}
.plus { color: var(--green); font-weight: 800; }

/* ---------- герой ---------- */

.hero {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    padding: 18px 16px 16px;
    margin-bottom: 12px;
    text-align: center;
    border: 1px solid #33405f;
    background:
        radial-gradient(520px 200px at 50% -40px, rgba(154, 124, 240, .35), transparent 70%),
        linear-gradient(180deg, #232a44, #12141d);
    box-shadow: var(--shadow);
}
.hero::after {
    content: "";
    position: absolute;
    inset: -40% -10%;
    background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, .07) 50%, transparent 60%);
    animation: sweep 6s linear infinite;
    pointer-events: none;
}
.hero-top {
    color: var(--gold);
    font-size: 11px;
    letter-spacing: 2.4px;
    text-transform: uppercase;
    opacity: .85;
}
.hero-mid {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 12px 0;
}
.ava {
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    font-size: 34px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 35%, #3b4568, #171b28);
    border: 2px solid var(--gold-2);
    box-shadow: 0 0 22px rgba(230, 196, 106, .28);
    animation: float 3.4s ease-in-out infinite;
}
.hero-team {
    display: flex;
    gap: 5px;
    justify-content: center;
    font-size: 22px;
    margin-top: 6px;
}
.hero-team span { animation: float 3s ease-in-out infinite; }
.hero-team span:nth-child(2n) { animation-delay: .4s; }
.hero-team span:nth-child(3n) { animation-delay: .8s; }

.hero-power {
    position: relative;
    z-index: 1;
    display: inline-block;
    padding: 5px 18px;
    border-radius: 22px;
    font-weight: 800;
    color: #ffe9a8;
    background: rgba(0, 0, 0, .45);
    border: 1px solid var(--gold-2);
    text-shadow: 0 0 10px rgba(255, 220, 130, .5);
}

/* ---------- кнопки ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    border: 1px solid #3f8a36;
    background: linear-gradient(180deg, #6dc45c, var(--green-2));
    color: #fff;
    font: 700 13px/1 "Segoe UI", Roboto, Arial, sans-serif;
    letter-spacing: .3px;
    cursor: pointer;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .55);
    box-shadow: 0 4px 0 #1d4a19, 0 6px 14px rgba(0, 0, 0, .4);
    transition: transform .12s, box-shadow .12s, filter .15s;
    text-decoration: none;
}
.btn:hover { filter: brightness(1.12); text-decoration: none; }
.btn:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #1d4a19, 0 3px 8px rgba(0, 0, 0, .4);
}

.btn.orange {
    border-color: #b35c16;
    background: linear-gradient(180deg, #ff9b3f, var(--orange-2));
    box-shadow: 0 4px 0 #6d3608, 0 6px 14px rgba(0, 0, 0, .4);
}
.btn.orange:active { box-shadow: 0 1px 0 #6d3608; }

.btn.gray {
    border-color: #4a4f5f;
    background: linear-gradient(180deg, #545a6d, #333846);
    box-shadow: 0 4px 0 #22252f, 0 6px 14px rgba(0, 0, 0, .35);
}
.btn.gray:active { box-shadow: 0 1px 0 #22252f; }

.btn.small { padding: 6px 12px; font-size: 11.5px; box-shadow: 0 3px 0 rgba(0, 0, 0, .35); }

.btn:disabled {
    opacity: .42;
    cursor: not-allowed;
    filter: grayscale(.5);
    box-shadow: none;
    transform: none;
}

/* ---------- формы ---------- */

.form label {
    display: block;
    margin-bottom: 11px;
    color: var(--text-dim);
    font-size: 12px;
    letter-spacing: .3px;
}

.form input[type="text"],
.form input[type="password"],
.form input:not([type]) {
    display: block;
    width: 100%;
    margin-top: 5px;
    padding: 10px 12px;
    color: #eae4d4;
    font: 14px "Segoe UI", Roboto, Arial, sans-serif;
    background: #0c0e15;
    border: 1px solid var(--line);
    border-radius: 8px;
    outline: none;
    transition: border-color .16s, box-shadow .16s;
}
.form input:focus {
    border-color: var(--gold-2);
    box-shadow: 0 0 0 3px rgba(230, 196, 106, .14);
}

/* выбор стартера */
.starters {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 12px 0 14px;
}
.starter {
    display: block;
    text-align: center;
    padding: 13px 6px;
    background: linear-gradient(180deg, #1b1f2c, #12141d);
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
    transition: transform .16s, border-color .16s, box-shadow .16s;
}
.starter:hover {
    transform: translateY(-3px);
    border-color: var(--gold-2);
    box-shadow: 0 8px 18px rgba(0, 0, 0, .45);
}
.starter input { display: none; }
.starter .s-ico { font-size: 32px; display: block; margin-bottom: 4px; }
.starter b { display: block; color: #f0e2b6; font-size: 13px; }
.starter small { display: block; color: var(--text-mute); font-size: 10.5px; }

.starter:has(input:checked) {
    border-color: var(--gold);
    background: linear-gradient(180deg, #2b2a1c, #17181f);
    box-shadow: 0 0 0 2px rgba(230, 196, 106, .3), 0 8px 20px rgba(0, 0, 0, .45);
}

/* ---------- бой ---------- */

.grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.fighter {
    position: relative;
    padding: 12px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background:
        radial-gradient(300px 140px at 50% 0%, rgba(85, 168, 232, .10), transparent 70%),
        linear-gradient(180deg, var(--bg-3), #12141d);
    box-shadow: var(--shadow);
}
.grid2 .fighter:nth-child(2) {
    background:
        radial-gradient(300px 140px at 50% 0%, rgba(224, 90, 72, .12), transparent 70%),
        linear-gradient(180deg, var(--bg-3), #12141d);
}

.f-name {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: #f0e6c6;
}
.f-ico {
    font-size: 46px;
    text-align: center;
    margin: 10px 0;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .6));
    animation: float 3s ease-in-out infinite;
}

/* полосы HP */
.hpbar {
    height: 15px;
    border-radius: 8px;
    overflow: hidden;
    background: #080a0f;
    border: 1px solid #333a4d;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, .8);
}
.hpbar i {
    display: block;
    height: 100%;
    background: linear-gradient(180deg, #8ce06a, #2f8a34);
    box-shadow: 0 0 12px rgba(106, 194, 90, .55);
    transition: width .35s ease;
}
.hpbar.enemy i {
    background: linear-gradient(180deg, #f2725c, #8f2c1c);
    box-shadow: 0 0 12px rgba(224, 90, 72, .55);
}
.hp-text {
    margin-top: 4px;
    text-align: right;
    font-size: 11px;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}

.tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 20px;
    font-size: 10.5px;
    font-weight: 600;
    color: #c9bd97;
    background: #232735;
    border: 1px solid #343a4c;
    vertical-align: middle;
}

/* журнал */
.log {
    max-height: 250px;
    overflow-y: auto;
    padding: 10px 12px;
    border-radius: 8px;
    background: #0a0c12;
    border: 1px solid var(--line-soft);
    font-size: 12.5px;
    color: #bfb9ab;
}
.log div {
    padding: 3px 0;
    border-bottom: 1px dashed rgba(255, 255, 255, .05);
    animation: fadeUp .25s ease;
}
.log div:last-child { border-bottom: 0; }

.team-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 10px;
}
.mon {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    background: #171a24;
    border: 1px solid var(--line);
}
.mon.dead {
    opacity: .32;
    text-decoration: line-through;
    filter: grayscale(1);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    margin-top: 12px;
}
.actions form {
    display: inline-flex;
    gap: 7px;
    flex-wrap: wrap;
}

/* ---------- покемоны ---------- */

.pokecard {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    padding: 11px 12px;
    margin-bottom: 9px;
    border-radius: 10px;
    background: linear-gradient(180deg, #191d29, #13161f);
    border: 1px solid var(--line);
    transition: transform .16s, border-color .16s;
}
.pokecard:hover {
    transform: translateX(3px);
    border-color: var(--gold-2);
}
.pokecard:last-child { margin-bottom: 0; }

.pico {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: grid;
    place-items: center;
    font-size: 26px;
    border-radius: 10px;
    background: radial-gradient(circle at 50% 35%, #2c3247, #14171f);
    border: 1px solid var(--line);
}

.bar {
    height: 9px;
    margin-top: 5px;
    border-radius: 5px;
    overflow: hidden;
    background: #080a0f;
    border: 1px solid #303648;
}
.bar i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--gold-2), var(--gold));
    box-shadow: 0 0 10px rgba(230, 196, 106, .45);
    transition: width .35s ease;
}

/* ---------- магазин ---------- */

table.shop {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}
table.shop tr {
    border-bottom: 1px solid var(--line-soft);
}
table.shop tr:last-child { border-bottom: 0; }
table.shop tr:hover { background: rgba(255, 255, 255, .022); }
table.shop td {
    padding: 10px 6px;
    vertical-align: middle;
}
table.shop td:first-child {
    width: 46px;
    font-size: 24px;
    text-align: center;
}
table.shop b { color: #f0e2b6; }

/* ---------- служебные тексты ---------- */

.muted { color: var(--text-dim); font-size: 11.5px; }
.ok {
    color: #8fd07f;
    font-size: 12.5px;
    font-weight: 700;
}
.err {
    color: #ff8b7a;
    font-size: 12.5px;
    font-weight: 700;
}

select {
    padding: 6px 8px;
    font: 12px "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--text);
    background: #0c0e15;
    border: 1px solid var(--line);
    border-radius: 6px;
    outline: none;
}
select:focus { border-color: var(--gold-2); }

/* полоса прокрутки */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #0b0d13; }
::-webkit-scrollbar-thumb {
    background: #2b3143;
    border-radius: 6px;
    border: 2px solid #0b0d13;
}
::-webkit-scrollbar-thumb:hover { background: var(--gold-2); }

/* ---------- анимации ---------- */

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}
@keyframes sweep {
    from { transform: translateX(-60%); }
    to { transform: translateX(60%); }
}

/* ---------- адаптив ---------- */

@media (max-width: 640px) {
    .page { padding: 10px 10px 30px; }
    .grid2 { grid-template-columns: 1fr; }
    .starters { grid-template-columns: 1fr; }
    .topbar { flex-direction: column; align-items: flex-start; gap: 6px; }
    .money { gap: 8px; font-size: 12px; }
    .btn { padding: 9px 14px; }
    .pokecard > div:last-child { width: 100% !important; }
    .f-ico { font-size: 40px; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
