* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px 0;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
    }
    
    .main-content {
        max-width: 900px;
        margin-left: auto;
        margin-right: auto;
    }
    
    /* Баннер на полную ширину даже при центрированном контенте */
    .pets-banner {
        max-width: 100vw;
        margin-left: calc(-50vw + 50%);
        margin-right: calc(-50vw + 50%);
    }
}

header {
    text-align: left;
    color: white;
    margin-bottom: 20px;
    padding-left: 20px;
    padding-right: 20px;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

header h1 {
    font-size: 1.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    padding: 0;
    line-height: 1.2;
    flex: 1;
    min-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* На мобильных устройствах всегда разрешаем перенос */
@media (max-width: 768px) {
    header h1 {
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        max-width: 100% !important;
    }
}

@media (min-width: 1400px) {
    header h1 {
        font-size: 1.6em;
    }
}

@media (min-width: 1200px) {
    header h1 {
        font-size: 1.5em;
    }
}

@media (min-width: 992px) {
    header {
        max-width: 900px;
        margin-left: auto;
        margin-right: auto;
        padding-left: 0;
        padding-right: 0;
        align-items: center;
    }
    
    header h1 {
        font-size: 1.4em;
        max-width: calc(100% - 300px); /* Оставляем место для переключателя языков и Telegram */
    }
}

/* Header Buttons Container */
.header-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Language Switcher */
.language-switcher {
    display: flex;
    gap: 5px;
    margin-top: 5px;
}

/* Telegram Button */
.telegram-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #0088cc;
    border: 2px solid #0088cc;
    color: white;
    padding: 8px 15px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.3s;
    margin-top: 5px;
}

.telegram-btn:hover {
    background: #0077b3;
    border-color: #0077b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 136, 204, 0.5);
}

.telegram-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.telegram-btn span {
    white-space: nowrap;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.3s;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.lang-btn.active {
    background: rgba(255, 255, 255, 0.4);
    border-color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
    padding: 0 20px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    box-sizing: border-box;
}

.main-content {
    background: white;
    border-radius: 15px;
    margin-top: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    width: 100%;
}

@media (min-width: 992px) {
    .main-content {
        padding: 40px;
    }
}

/* Анимированная лента с петарами */
.pets-banner {
    overflow: hidden;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    margin-top: 0;
    margin-bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px 0;
    position: relative;
    width: 100vw;
    min-height: 220px;
    display: block;
}

.pets-banner::before,
.pets-banner::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100px;
    z-index: 10;
    pointer-events: none;
}

.pets-banner::before {
    left: 0;
    background: linear-gradient(to right, rgba(102, 126, 234, 1), rgba(102, 126, 234, 0));
}

.pets-banner::after {
    right: 0;
    background: linear-gradient(to left, rgba(118, 75, 162, 1), rgba(118, 75, 162, 0));
}

.pets-track {
    display: flex;
    animation: scroll-horizontal 60s linear infinite;
    -webkit-animation: scroll-horizontal 60s linear infinite;
    white-space: nowrap;
    padding-left: 50px;
    min-height: 200px;
    align-items: center;
    will-change: transform;
    -webkit-will-change: transform;
}

@keyframes scroll-horizontal {
    0% {
        transform: translateX(0);
        -webkit-transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
        -webkit-transform: translateX(-50%);
    }
}

@-webkit-keyframes scroll-horizontal {
    0% {
        -webkit-transform: translateX(0);
    }
    100% {
        -webkit-transform: translateX(-50%);
    }
}

.pet-item {
    flex-shrink: 0;
    display: -webkit-inline-flex;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 20px;
    margin: 0 14px;
    background: white;
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    min-width: 200px;
    transition: transform 0.3s;
    -webkit-transition: -webkit-transform 0.3s;
    visibility: visible;
    opacity: 1;
    position: relative;
}

.pet-item:hover {
    transform: translateY(-5px);
    -webkit-transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

/* изображения карточек (увеличены еще на 25%) */
.pet-item img {
    width: 141px;
    height: 141px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 10px;
    background-color: #f0f0f0;
    display: block;
}

.pet-name {
    font-size: 1em;
    color: #555;
    margin-bottom: 5px;
    font-weight: 600;
    white-space: nowrap;
}

.pet-price {
    font-size: 1.3em;
    color: #667eea;
    font-weight: bold;
    white-space: nowrap;
}

.player-note {
    margin-top: 8px;
    font-size: 13px;
    color: #555;
}
.player-note strong {
    font-weight: 700;
    color: #333;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.stats, .user-info {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.stats h3, .user-info h3 {
    margin-bottom: 15px;
    color: #667eea;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-item strong {
    color: #764ba2;
    font-size: 1.2em;
}

.connection-panel {
    margin-top: 0;
    margin-bottom: 30px;
}

@media (min-width: 992px) {
    .connection-panel {
        max-width: 800px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .instructions-block {
        max-width: 100%;
    }
    
    .input-group {
        max-width: 500px;
    }
    
    #connect-btn {
        max-width: 500px;
        width: 100%;
    }
}

/* Instructions Block */
.instructions-block {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border: 2px solid #667eea30;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
}

.instructions-block h3 {
    color: #667eea;
    font-size: 1.3em;
    margin-bottom: 15px;
    font-weight: 700;
}

.instructions-content p {
    margin: 8px 0;
    color: #555;
    line-height: 1.6;
}

.instructions-content p:last-child {
    margin-top: 15px;
    font-weight: 600;
    color: #667eea;
    font-size: 1.05em;
}

.inventory-panel, .evaluation-panel, .trade-panel, .result-panel {
    margin-bottom: 30px;
}

@media (min-width: 992px) {
    .inventory-panel {
        max-width: 900px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .inventory-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 20px;
    }
    
}

/* Стили для блока ожидания/призыва зайти на сервер */
.waiting-block {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    grid-template-columns: none !important;
}

.waiting-block > div {
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100%;
}

.waiting-block > div > div {
    text-align: center !important;
    margin: 0 auto !important;
}

.waiting-block > div p {
    text-align: center !important;
    width: 100%;
    max-width: 100%;
    margin-left: auto !important;
    margin-right: auto !important;
}

.waiting-block > div a {
    text-align: center !important;
    display: inline-block !important;
    margin: 0 auto !important;
}

@media (min-width: 992px) {
    .waiting-block > div {
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
        padding: 40px !important;
    }
}

@media (max-width: 768px) {
    .waiting-block > div {
        padding: 30px 20px !important;
    }
    
    .waiting-block > div p {
        font-size: 16px !important;
    }
    
    .waiting-block > div a {
        padding: 14px 24px !important;
        font-size: 1.1em !important;
    }
}

h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.input-group input, .input-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.input-group input:focus, .input-group select:focus {
    outline: none;
    border-color: #667eea;
}

.game-select {
    background-color: white;
    cursor: pointer;
}

.game-select:hover {
    border-color: #667eea;
}

.btn-primary, .btn-secondary, .btn-success {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(17, 153, 142, 0.4);
}

.status {
    margin-top: 15px;
    padding: 10px;
    border-radius: 8px;
    background: #f0f0f0;
    min-height: 40px;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}


.inventory-item {
    background: #f9f9f9;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.inventory-item:hover {
    border-color: #667eea;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.inventory-item.selected {
    border-color: #667eea;
    background: #f0f0ff;
}

/* Демо-версия инвентаря */
.inventory-info {
    font-size: 1.1em;
    color: #555;
    margin-bottom: 20px;
    padding: 10px;
    background: #f0f9ff;
    border-left: 4px solid #667eea;
    border-radius: 8px;
}

.inventory-item-demo {
    background: linear-gradient(135deg, #f5f7fa 0%, #ffffff 100%);
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

.inventory-item-demo:hover {
    border-color: #667eea;
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.2);
}

.inventory-item-demo img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #f0f0f0;
}

.item-icon {
    font-size: 2em;
    margin-bottom: 8px;
    display: none;
}

.inventory-item-demo strong {
    display: block;
    font-size: 1em;
    color: #333;
    margin-bottom: 8px;
}

.inventory-item-demo p {
    font-size: 1.2em;
    color: #667eea;
    font-weight: bold;
    margin: 0;
}

.total-estimate {
    margin-top: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    text-align: center;
}

.total-estimate h3 {
    color: white;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.total-price-box {
    background: white;
    padding: 20px 40px;
    border-radius: 8px;
    display: inline-block;
}

.total-label {
    font-size: 1.2em;
    color: #555;
    margin-right: 20px;
}

.total-amount {
    font-size: 2em;
    color: #667eea;
    font-weight: bold;
}

.selected-items {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.selected-item {
    background: white;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.total-value {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #ddd;
    font-size: 1.3em;
}

.total-value strong {
    color: #667eea;
    font-size: 1.5em;
}

.trade-status {
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: #f0f0f0;
    border-radius: 15px;
    overflow: hidden;
    margin-top: 20px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.result-content {
    text-align: center;
    padding: 30px;
    background: #f9f9f9;
    border-radius: 8px;
}

.result-content p {
    font-size: 1.2em;
    margin-bottom: 15px;
}

.result-content strong {
    color: #11998e;
    font-size: 1.5em;
}

.transaction-id {
    color: #666;
    font-size: 0.9em;
}

#user-details p {
    margin-bottom: 10px;
}

@media (max-width: 1200px) {
    header h1 {
        font-size: 2em;
    }
    
    .pet-item { 
        min-width: 188px; 
    }
    .pet-item img {
        width: 118px;
        height: 118px;
    }
}

@media (max-width: 992px) {
    header h1 {
        font-size: 1.8em;
    }
    
    .pet-item { 
        min-width: 175px; 
    }
    .pet-item img {
        width: 110px;
        height: 110px;
    }
    
    .pet-name {
        font-size: 0.9em;
    }
    
    .pet-price { font-size: 1.15em; }
}

@media (max-width: 1024px) {
    header h1 {
        font-size: 1.8em;
    }
    
    header p {
        font-size: 1em;
    }
}

@media (max-width: 768px) {
    .inventory-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    header h1 {
        font-size: 1.6em;
        padding: 0 15px;
    }
    
    header p {
        font-size: 0.95em;
        padding: 0 15px;
    }
    
    .pet-item { 
        min-width: 163px; 
        margin: 0 10px; 
    }
    .pet-item img {
        width: 94px;
        height: 94px;
    }
    
    .pet-name {
        font-size: 0.85em;
    }
    
    .pet-price {
        font-size: 1em;
    }
    
    .pets-banner::before,
    .pets-banner::after {
        width: 60px;
    }
    
    .pets-track {
        padding-left: 40px;
    }
}

@media (max-width: 768px) {
    header {
        flex-direction: row;
        align-items: flex-start;
        padding-left: 15px;
        padding-right: 15px;
        gap: 8px;
    }
    
    header h1 {
        font-size: 1.1em;
        width: auto;
        flex: 1;
        margin-bottom: 0;
        white-space: normal !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
        line-height: 1.3;
        min-width: 0;
        overflow: visible !important;
        text-overflow: clip !important;
        display: block;
    }
    
    .header-buttons {
        flex-direction: column;
        align-items: flex-end;
        gap: 8px;
    }
    
    .language-switcher {
        margin-top: 0;
        margin-bottom: 0;
    }
    
    .telegram-btn {
        margin-top: 0;
        padding: 6px 12px;
        font-size: 0.8em;
    }
    
    .telegram-btn span {
        display: none;
    }
    
    .lang-btn {
        padding: 5px 10px;
        font-size: 0.75em;
    }
}

@media (max-width: 480px) {
    header {
        padding-left: 10px;
        padding-right: 10px;
        gap: 6px;
        align-items: flex-start;
    }
    
    header h1 {
        font-size: 0.95em;
        padding: 0;
        line-height: 1.3;
        white-space: normal !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
        min-width: 0;
        overflow: visible !important;
        text-overflow: clip !important;
        display: block;
    }
    
    header p {
        font-size: 0.9em;
        padding: 0;
    }
    
    .lang-btn {
        padding: 5px 10px;
        font-size: 0.75em;
    }
    
    .header-buttons {
        gap: 6px;
    }
    
    .language-switcher {
        gap: 4px;
    }
    
    .telegram-btn {
        padding: 5px 10px;
        font-size: 0.75em;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .pets-banner {
        margin: -15px -15px 15px -15px;
        padding: 15px 0;
    }
    
    .pet-item {
        min-width: 120px;
        padding: 10px 15px;
        margin: 0 8px;
    }
    
    .pet-icon {
        font-size: 2em;
    }
    
    .pet-name {
        font-size: 0.8em;
    }
    
    .pet-price {
        font-size: 0.95em;
    }
}

