/* Property Tycoon Game Styles — Full Rewrite */

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#game-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: #1a1a2e;
}

#game-canvas {
    max-width: 100%;
    max-height: 100%;
}

/* ===== Overlay Wrapper (scaled DOM layer) ===== */
.game-overlay-wrapper {
    position: absolute;
    top: 50%; left: 50%;
    width: 900px; height: 700px;
    transform: translate(-50%, -50%) scale(var(--game-scale, 1));
    transform-origin: center center;
    pointer-events: none;
    z-index: 10;
}
.game-overlay-wrapper > * { pointer-events: auto; }

/* ===== Shared Modal Backdrop ===== */
.modal-backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

/* ===== Game Action Buttons ===== */
.game-actions {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 100;
}

.game-btn {
    padding: 10px 22px;
    font-size: 14px;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.game-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.15);
}

.game-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.game-btn.roll {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    color: #fff;
}

.game-btn.buy {
    background: linear-gradient(135deg, #6f42c1, #5a32a3);
    color: #fff;
}

.game-btn.auction {
    background: linear-gradient(135deg, #ffc107, #d39e00);
    color: #1a1a2e;
}

.game-btn.end-turn {
    background: linear-gradient(135deg, #17a2b8, #117a8b);
    color: #fff;
}

.game-btn.pay {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: #fff;
}

.game-btn.manage {
    background: linear-gradient(135deg, #6c757d, #545b62);
    color: #fff;
}

.game-btn.trade {
    background: linear-gradient(135deg, #fd7e14, #dc6502);
    color: #fff;
}

.game-btn.build {
    background: linear-gradient(135deg, #20c997, #17a881);
    color: #fff;
}

.game-btn.sm {
    padding: 6px 14px;
    font-size: 12px;
}

/* ===== Property Card Popup ===== */
.property-card {
    background: #fff;
    border-radius: 12px;
    width: 260px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    animation: pop-in 0.25s ease;
}

.property-card .header {
    padding: 14px;
    text-align: center;
    color: #fff;
    font-weight: bold;
    font-size: 15px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.property-card .content {
    padding: 16px;
    color: #333;
}

.property-card .price {
    font-size: 22px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 12px;
    color: #1a1a2e;
}

.property-card .rent-table {
    width: 100%;
    font-size: 12px;
    border-collapse: collapse;
}

.property-card .rent-table td {
    padding: 3px 0;
    border-bottom: 1px solid #eee;
}

.property-card .rent-table td:last-child {
    text-align: right;
    font-weight: bold;
}

.property-card .buttons {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.property-card .buttons button {
    flex: 1;
}

/* ===== Setup Modal ===== */
.setup-modal {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(22, 33, 62, 0.98);
    padding: 28px;
    border-radius: 16px;
    border: 1px solid rgba(111, 66, 193, 0.5);
    text-align: center;
    z-index: 200;
    min-width: 300px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.setup-modal h3 {
    color: #fff;
    margin: 0 0 20px 0;
    font-size: 22px;
}

.setup-modal .option-group {
    margin-bottom: 16px;
    text-align: left;
}

.setup-modal label {
    color: #ccc;
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
}

.setup-modal select {
    width: 100%;
    padding: 9px;
    border: 2px solid #6f42c1;
    border-radius: 6px;
    background-color: #16213e;
    color: #fff;
    font-size: 14px;
}

.setup-modal select option {
    background-color: #16213e;
    color: #fff;
}

.setup-modal .start-btn {
    padding: 14px 50px;
    background: linear-gradient(135deg, #20c997, #17a881);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
}

.setup-modal .start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(32, 201, 151, 0.5);
}

/* ===== Auction Modal ===== */
.auction-modal {
    background: rgba(22, 33, 62, 0.98);
    padding: 28px;
    border-radius: 16px;
    border: 1px solid rgba(111, 66, 193, 0.5);
    text-align: center;
    min-width: 320px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: pop-in 0.3s ease;
}

.auction-modal h3 {
    color: #fff;
    margin: 0 0 8px 0;
    font-size: 20px;
}

.auction-modal .property-name {
    color: #ffc107;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 16px;
}

.auction-modal .current-bid {
    color: #28a745;
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 6px;
}

.auction-modal .bidder {
    color: #aaa;
    margin-bottom: 16px;
    font-size: 13px;
}

.auction-modal .timer-bar {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
    margin-bottom: 16px;
    overflow: hidden;
}

.auction-modal .timer-bar .fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #ffc107, #dc3545);
    border-radius: 3px;
    transition: width 0.1s linear;
}

.auction-modal .bid-input {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 12px;
}

.auction-modal input {
    width: 110px;
    padding: 10px;
    border: 2px solid #6f42c1;
    border-radius: 6px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 16px;
    text-align: center;
}

.auction-modal .bid-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* ===== Mortgage Modal ===== */
.mortgage-modal {
    background: rgba(22, 33, 62, 0.98);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid rgba(111, 66, 193, 0.5);
    min-width: 340px;
    max-width: 420px;
    max-height: 500px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: pop-in 0.3s ease;
}

.mortgage-modal h3 {
    color: #fff;
    margin: 0 0 16px 0;
    text-align: center;
    font-size: 18px;
}

.mortgage-modal .property-list {
    max-height: 340px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.mortgage-modal .prop-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    gap: 8px;
}

.mortgage-modal .prop-item .color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mortgage-modal .prop-item .prop-name {
    color: #fff;
    font-size: 13px;
    flex: 1;
}

.mortgage-modal .prop-item .prop-name.mortgaged {
    color: #888;
    text-decoration: line-through;
}

.mortgage-modal .prop-item .prop-value {
    color: #28a745;
    font-size: 12px;
    font-weight: bold;
    min-width: 50px;
    text-align: right;
}

.mortgage-modal .prop-item button {
    padding: 4px 10px;
    font-size: 11px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.mortgage-modal .prop-item button.mortgage-btn {
    background: #ffc107;
    color: #1a1a2e;
}

.mortgage-modal .prop-item button.unmortgage-btn {
    background: #28a745;
    color: #fff;
}

/* ===== House Build Modal ===== */
.house-build-modal {
    background: rgba(22, 33, 62, 0.98);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid rgba(32, 201, 151, 0.5);
    min-width: 340px;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: pop-in 0.3s ease;
}

.house-build-modal h3 {
    color: #fff;
    margin: 0 0 16px 0;
    text-align: center;
    font-size: 18px;
}

.house-build-modal .group-section {
    margin-bottom: 14px;
    background: rgba(0,0,0,0.25);
    border-radius: 8px;
    padding: 10px 12px;
}

.house-build-modal .group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.house-build-modal .group-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

.house-build-modal .group-name {
    color: #fff;
    font-weight: bold;
    font-size: 14px;
}

.house-build-modal .build-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 0;
    color: #ccc;
    font-size: 13px;
}

.house-build-modal .build-row .houses-display {
    display: flex;
    gap: 3px;
    align-items: center;
}

.house-build-modal .build-row .house-icon {
    width: 10px;
    height: 10px;
    background: #28a745;
    border-radius: 2px;
    display: inline-block;
}

.house-build-modal .build-row .hotel-icon {
    width: 14px;
    height: 10px;
    background: #dc3545;
    border-radius: 2px;
    display: inline-block;
}

.house-build-modal .build-controls {
    display: flex;
    gap: 4px;
    align-items: center;
}

.house-build-modal .build-controls button {
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.house-build-modal .build-controls .build-add {
    background: #28a745;
    color: #fff;
}

.house-build-modal .build-controls .build-sell {
    background: #dc3545;
    color: #fff;
}

.house-build-modal .build-controls button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ===== Trade Modal ===== */
.trade-modal {
    background: rgba(22, 33, 62, 0.98);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid rgba(253, 126, 20, 0.5);
    min-width: 480px;
    max-width: 560px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: pop-in 0.3s ease;
}

.trade-modal h3 {
    color: #fff;
    margin: 0 0 12px 0;
    text-align: center;
    font-size: 18px;
}

.trade-modal .player-select {
    margin-bottom: 14px;
    text-align: center;
}

.trade-modal .player-select select {
    padding: 8px 12px;
    border: 2px solid #fd7e14;
    border-radius: 6px;
    background-color: #16213e;
    color: #fff;
    font-size: 14px;
}

.trade-modal .player-select select option {
    background-color: #16213e;
    color: #fff;
}

.trade-columns {
    display: flex;
    gap: 14px;
    margin-bottom: 14px;
}

.trade-column {
    flex: 1;
    background: rgba(0,0,0,0.25);
    padding: 12px;
    border-radius: 8px;
}

.trade-column h4 {
    color: #20c997;
    margin: 0 0 8px 0;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.trade-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    color: #fff;
    font-size: 12px;
}

.trade-item input[type="checkbox"] {
    accent-color: #6f42c1;
}

.trade-money-input {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    color: #28a745;
    font-size: 13px;
}

.trade-money-input input {
    width: 80px;
    padding: 5px 8px;
    border: 1px solid #6f42c1;
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 13px;
    text-align: center;
}

.trade-modal .trade-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* ===== Jail Modal ===== */
.jail-modal {
    background: rgba(22, 33, 62, 0.98);
    padding: 28px;
    border-radius: 16px;
    border: 2px solid #dc3545;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: pop-in 0.3s ease;
    min-width: 280px;
}

.jail-modal h3 {
    color: #dc3545;
    margin: 0 0 16px 0;
    font-size: 20px;
}

.jail-modal p {
    color: #fff;
    margin: 0 0 16px 0;
    font-size: 14px;
}

.jail-modal .jail-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* ===== Winner Overlay ===== */
.winner-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 300;
    animation: fade-in 0.5s ease;
}

@keyframes fade-in {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

.winner-overlay h2 {
    color: #ffd700;
    font-size: 40px;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
    margin: 0 0 10px 0;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { text-shadow: 0 0 20px rgba(255, 215, 0, 0.3); }
    50% { text-shadow: 0 0 40px rgba(255, 215, 0, 0.7); }
}

.winner-overlay .subtitle {
    color: #20c997;
    font-size: 18px;
    margin-bottom: 8px;
}

.winner-overlay .stats {
    color: #fff;
    font-size: 15px;
    margin-bottom: 24px;
    line-height: 1.8;
    text-align: center;
}

@keyframes pop-in {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* ===== Hidden Utility ===== */
.hidden {
    display: none !important;
}

/* ====================================================================== */
/* MULTIPLAYER UI — menu tabs, lobby card, turn banner, chat overlay       */
/* ====================================================================== */

/* Main mode menu (3 cards: SP / vs AI / Online MP) */
.pt-mode-menu {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(22, 33, 62, 0.98);
    padding: 26px;
    border-radius: 16px;
    border: 1px solid rgba(111, 66, 193, 0.5);
    text-align: center;
    z-index: 200;
    min-width: 340px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.pt-mode-menu h3 {
    color: #fff;
    margin: 0 0 6px 0;
    font-size: 22px;
}

.pt-mode-menu .pt-sub {
    color: #aaa;
    font-size: 12px;
    margin-bottom: 18px;
}

.pt-mode-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 8px;
}

.pt-mode-btn {
    padding: 14px 18px;
    font-size: 15px;
    font-weight: bold;
    border: 1px solid rgba(111, 66, 193, 0.5);
    border-radius: 8px;
    background: rgba(111, 66, 193, 0.15);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pt-mode-btn:hover:not(:disabled) {
    background: rgba(111, 66, 193, 0.35);
    transform: translateY(-1px);
    border-color: #6f42c1;
}

.pt-mode-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.pt-mode-btn.primary {
    background: linear-gradient(135deg, #6f42c1, #5a32a3);
    border-color: #6f42c1;
}

.pt-mode-btn.primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #7d50d1, #6a42b3);
    box-shadow: 0 4px 15px rgba(111, 66, 193, 0.5);
}

.pt-mode-btn.back {
    background: rgba(108, 117, 125, 0.3);
    border-color: rgba(108, 117, 125, 0.4);
    font-size: 12px;
    padding: 8px 14px;
    margin-top: 8px;
}

.pt-mp-status {
    margin-top: 10px;
    padding: 6px 12px;
    color: #20c997;
    font-size: 13px;
    min-height: 18px;
    text-align: center;
}

/* Invite card */
.pt-invite-card {
    margin-top: 14px;
    padding: 14px;
    background: rgba(111, 66, 193, 0.15);
    border: 1px solid rgba(111, 66, 193, 0.5);
    border-radius: 10px;
    text-align: center;
}

.pt-invite-card h4 {
    color: #fff;
    margin: 0 0 10px 0;
    font-size: 14px;
}

.pt-invite-code {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 1.8rem;
    font-weight: bold;
    color: #ffc107;
    letter-spacing: 5px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    margin-bottom: 10px;
}

.pt-invite-actions {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.pt-invite-hint {
    color: #aaa;
    font-size: 12px;
    font-style: italic;
}

/* Lobby waiting room */
.pt-lobby-wait {
    margin-top: 14px;
    padding: 14px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(32, 201, 151, 0.4);
    border-radius: 10px;
    text-align: center;
}

.pt-wait-label {
    color: #20c997;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.pt-player-list {
    margin-bottom: 10px;
    text-align: left;
    max-height: 160px;
    overflow-y: auto;
}

.pt-player-entry {
    padding: 7px 10px;
    margin: 3px 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
}

/* Turn banner (MP only) */
.pt-turn-banner {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 18px;
    background: rgba(0,0,0,0.75);
    color: #ffc107;
    font-size: 14px;
    font-weight: bold;
    border-radius: 14px;
    border: 1px solid rgba(255, 193, 7, 0.4);
    z-index: 120;
    letter-spacing: 0.5px;
    pointer-events: none;
}

.pt-turn-banner.pt-turn-me {
    color: #20c997;
    border-color: rgba(32, 201, 151, 0.6);
    box-shadow: 0 0 12px rgba(32, 201, 151, 0.4);
}

/* Chat overlay (T key) */
.pt-chat-log {
    position: absolute;
    left: 12px;
    bottom: 80px;
    width: 340px;
    max-width: 45%;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 110;
    pointer-events: none;
    font-family: 'Courier New', monospace;
    opacity: 0.85;
    transition: opacity 0.2s;
}

.pt-chat-log.active { opacity: 1; }

.pt-chat-line {
    background: rgba(0, 0, 0, 0.6);
    color: #eaf6ff;
    padding: 4px 8px;
    border-left: 2px solid #20c997;
    font-size: 13px;
    line-height: 1.3;
    word-wrap: break-word;
}

.pt-chat-name {
    color: #20c997;
    font-weight: bold;
    margin-right: 4px;
}

.pt-chat-form {
    position: absolute;
    left: 12px;
    bottom: 12px;
    width: 360px;
    max-width: 45%;
    z-index: 115;
    display: none;
}

.pt-chat-form input {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid #20c997;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-size: 13px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    box-sizing: border-box;
}

/* Rematch waiting button state */
.winner-overlay .game-btn.pending {
    opacity: 0.6;
    cursor: not-allowed;
}

.winner-overlay .winner-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 14px;
}

