/* ===== CONTRACTS PAGE — GRID LAYOUT ===== */
.contract-page {
    padding: 20px;
    min-height: calc(100vh - 170px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ===== THREE-COLUMN BOARD ===== */
.contract-board {
    display: grid;
    grid-template-columns: 400px 240px 400px;
    gap: 24px;
    width: max-content;
    align-items: stretch;
}

/* ===== PANELS ===== */
.contract-panel {
    background: #13131b;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.contract-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.contract-panel__title {
    font-size: 13px;
    font-weight: 700;
    color: #5a5a6a;
    letter-spacing: 2px;
}

.contract-panel__count {
    font-size: 15px;
    font-weight: 700;
    color: #f5c842;
}

.contract-panel__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.contract-panel__label {
    font-size: 12px;
    font-weight: 700;
    color: #5a5a6a;
    letter-spacing: 1.5px;
}

.contract-panel__value {
    font-size: 18px;
    font-weight: 800;
    color: #f5c842;
}

/* ===== INPUT GRID (4 columns, vertical) ===== */
.contract-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

/* Slot base */
.contract-slot {
    aspect-ratio: 3 / 4;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.25s ease;
    min-height: 90px;
}

/* Add slot */
.contract-slot--add {
    background: rgba(255, 255, 255, 0.02);
    border: 2px dashed rgba(255, 255, 255, 0.08);
    cursor: pointer;
    gap: 6px;
}

.contract-slot--add:hover {
    border-color: rgba(245, 200, 66, 0.4);
    background: rgba(245, 200, 66, 0.03);
}

.contract-slot__plus {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    border: 2px dashed rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #5a5a6a;
    transition: all 0.2s;
}

.contract-slot--add:hover .contract-slot__plus {
    color: #f5c842;
    border-color: rgba(245, 200, 66, 0.4);
}

.contract-slot__hint {
    font-size: 10px;
    color: #5a5a6a;
    font-weight: 700;
    letter-spacing: 1px;
}

/* Filled slot */
.contract-slot--filled {
    background: #1a1a24;
    border: 2px solid;
    cursor: pointer;
    padding: 6px 4px 5px;
    gap: 3px;
    overflow: hidden;
}

.contract-slot--filled:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.contract-slot--filled:hover .contract-slot__remove {
    opacity: 1;
}

.contract-slot__remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(231, 76, 60, 0.9);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 5;
}

.contract-slot__img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.4));
}

.contract-slot__name {
    font-size: 10px;
    font-weight: 600;
    color: #aaa;
    text-align: center;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
    padding: 0 2px;
    box-sizing: border-box;
}

.contract-slot__price {
    font-size: 12px;
    font-weight: 700;
}

/* Slot animation states */
.contract-slot--flash {
    box-shadow: 0 0 20px rgba(245, 200, 66, 0.6);
    border-color: #f5c842 !important;
    transform: scale(1.06);
}

.contract-slot--dissolve {
    opacity: 0;
    transform: scale(0.7);
    transition: all 0.5s ease;
}

/* ===== CENTER COLUMN ===== */
.contract-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding-top: 6px;
}

/* Chance ring */
.contract-chance {
    position: relative;
    width: 224px;
    height: 224px;
}

.contract-chance__svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.contract-chance__track {
    fill: none;
    stroke: rgba(231, 76, 60, 0.18);
    stroke-width: 6;
}

.contract-chance__progress {
    fill: none;
    stroke: #2ecc71;
    stroke-width: 6;
    stroke-dasharray: 565;
    stroke-dashoffset: 565;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.5s ease, stroke 0.3s;
    filter: drop-shadow(0 0 6px rgba(46, 204, 113, 0.3));
}

.contract-chance__inner {
    fill: #0a0a10;
    stroke: rgba(255, 255, 255, 0.04);
    stroke-width: 1;
}

.contract-chance__center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.contract-chance__value {
    font-size: 42px;
    font-weight: 800;
    color: #fff;
    line-height: 1;
}

.contract-chance__label {
    font-size: 11px;
    font-weight: 700;
    color: #5a5a6a;
    letter-spacing: 3px;
}

/* Chance animation states */
.contract-chance__needle {
    position: absolute;
    top: 8px;
    left: 50%;
    width: 4px;
    height: 28px;
    margin-left: -2px;
    background: #fff;
    border-radius: 2px;
    transform-origin: 50% 104px;
    opacity: 0;
    pointer-events: none;
    z-index: 5;
    box-shadow: 0 0 8px rgba(255,255,255,0.6), 0 0 16px rgba(255,255,255,0.3);
}

.contract-chance--spinning .contract-chance__needle {
    opacity: 1;
}

.contract-chance--result .contract-chance__progress {
    transition: filter 0.3s;
}

.contract-chance--win .contract-chance__progress {
    stroke: #2ecc71 !important;
    filter: drop-shadow(0 0 20px rgba(46, 204, 113, 0.6));
}

.contract-chance--lose .contract-chance__progress {
    stroke: #e74c3c !important;
    filter: drop-shadow(0 0 20px rgba(231, 76, 60, 0.6));
}

/* Connector line */
.contract-connector {
    width: 2px;
    height: 16px;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.1) 0px,
        rgba(255, 255, 255, 0.1) 3px,
        transparent 3px,
        transparent 6px
    );
}

/* Multiplier */
.contract-multi {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 24px;
    background: #13131b;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.contract-multi__label {
    font-size: 9px;
    font-weight: 700;
    color: #5a5a6a;
    letter-spacing: 2px;
}

.contract-multi__value {
    font-size: 24px;
    font-weight: 800;
    color: #8847ff;
}

/* Button */
.contract-btn {
    padding: 14px 36px;
    font-family: inherit;
    color: #1a1a1a;
    background: linear-gradient(135deg, #f5c842, #ff6b35);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.3s, opacity 0.3s;
    box-shadow: 0 4px 24px rgba(245, 200, 66, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 100%;
}

.contract-btn__icon {
    font-size: 16px;
    line-height: 1;
}

.contract-btn__text {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 1.5px;
}

.contract-btn__sub {
    font-size: 10px;
    font-weight: 600;
    color: rgba(26, 26, 26, 0.55);
}

.contract-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(245, 200, 66, 0.5);
}

.contract-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===== TARGET (right panel) ===== */
.contract-panel--target {
    justify-content: stretch;
}

.contract-panel--target .contract-target {
    flex: 1;
}

.contract-target {
    width: 100%;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 2px dashed rgba(255, 255, 255, 0.08);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.3s, transform 0.2s;
    min-height: 220px;
    padding: 28px 16px;
}

.contract-target:hover {
    border-color: rgba(245, 200, 66, 0.3);
    transform: translateY(-3px);
}

.contract-target__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #5a5a6a;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
}

.contract-target__plus {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    border: 2px dashed rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: #5a5a6a;
}

.contract-target__filled {
    width: 140px;
    aspect-ratio: 3 / 4;
    border-radius: 12px;
    border: 2px solid;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 8px;
    background: #1a1a24;
    gap: 6px;
    overflow: hidden;
}

.contract-target__filled img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    filter: drop-shadow(0 3px 8px rgba(0,0,0,0.5));
}

.contract-target__name {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
    padding: 0 4px;
    box-sizing: border-box;
}

.contract-target__price {
    font-size: 18px;
    font-weight: 700;
}

/* Result overlay */
.contract-result {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.contract-result.active {
    opacity: 1;
    pointer-events: auto;
}

.contract-result__content {
    background: #13131b;
    border-radius: 20px;
    padding: 40px 50px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    animation: contractPop 0.4s ease;
}

@keyframes contractPop {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.contract-result__icon {
    font-size: 56px;
}

.contract-result__title {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 2px;
}

.contract-result__title--win {
    color: #2ecc71;
    text-shadow: 0 0 30px rgba(46, 204, 113, 0.4);
}

.contract-result__title--lose {
    color: #e74c3c;
    text-shadow: 0 0 30px rgba(231, 76, 60, 0.4);
}

.contract-result__skin {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: #ccc;
}

.contract-result__skin img {
    width: 160px;
    height: 160px;
    object-fit: contain;
    filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.6));
}

.contract-result__price {
    font-size: 22px;
    font-weight: 700;
    color: #f5c842;
}

.contract-result__lost-text {
    color: #8a8a9a;
    font-size: 15px;
    font-weight: 600;
}

.contract-result__lost-detail {
    color: #6a6a7a;
    font-size: 12px;
    max-width: 350px;
    line-height: 1.4;
}

.contract-result__btn {
    margin-top: 12px;
    padding: 14px 40px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    color: #1a1a1a;
    background: linear-gradient(135deg, #f5c842, #ff6b35);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: transform 0.2s, box-shadow 0.3s;
}

.contract-result__btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(245, 200, 66, 0.4);
}

/* Modals */
.contract-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: calc(15vh + 80px);
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.contract-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.contract-modal__content {
    background: #13131b;
    border-radius: 20px;
    padding: 30px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    gap: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    animation: contractPop 0.3s ease;
}

.contract-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.contract-modal__header h2 {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.contract-modal__close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: #8a8a9a;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
}

.contract-modal__close:hover {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.contract-modal__filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.contract-filter {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    color: #8a8a9a;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.contract-filter:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.contract-filter.active {
    color: #f5c842;
    border-color: rgba(245, 200, 66, 0.4);
    background: rgba(245, 200, 66, 0.1);
}

.contract-modal__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    overflow-y: auto;
    max-height: 50vh;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(245, 200, 66, 0.3) rgba(255, 255, 255, 0.04);
}

.contract-modal__grid::-webkit-scrollbar {
    width: 6px;
}

.contract-modal__grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 3px;
}

.contract-modal__grid::-webkit-scrollbar-thumb {
    background: rgba(245, 200, 66, 0.3);
    border-radius: 3px;
    transition: background 0.2s;
}

.contract-modal__grid::-webkit-scrollbar-thumb:hover {
    background: rgba(245, 200, 66, 0.5);
}

.contract-modal__card {
    background: #1a1a24;
    border-radius: 12px;
    border: 2px solid;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.3s;
    overflow: hidden;
    min-width: 0;
}

.contract-modal__card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.contract-modal__card img {
    width: 90px;
    height: 90px;
    object-fit: contain;
}

.contract-modal__card-name {
    font-size: 11px;
    font-weight: 600;
    color: #ccc;
    text-align: center;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.contract-modal__card-price {
    font-size: 13px;
    font-weight: 700;
}

.contract-modal__empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #5a5a6a;
    font-size: 15px;
    padding: 40px;
}

/* Login overlay */
.login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.login-card {
    background: #13131b;
    border-radius: 20px;
    padding: 50px 40px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.login-card__avatar {
    width: 80px;
    border-radius: 50%;
}

.login-card__title {
    font-size: 24px;
    font-weight: 800;
    color: #fff;
}

.login-card__subtitle {
    color: #5a5a6a;
    font-size: 14px;
}

.login-card__btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 30px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    background: #171a21;
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.2s;
}

.login-card__btn:hover {
    background: #1e222d;
}

.login-card__steam-icon {
    width: 24px;
}
