* {
    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;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* 로그인 화면 */
.login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #667eea;
    font-size: 2em;
}

.login-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.login-tab-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 8px;
    font-weight: bold;
    transition: all 0.3s;
}

.login-tab-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.login-form {
    display: none;
}

.login-form.active {
    display: block;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s;
    font-weight: bold;
}

.btn-primary {
    background: #667eea;
    color: white;
    width: 100%;
    margin-bottom: 10px;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #4caf50;
    color: white;
    width: 100%;
}

.btn-secondary:hover {
    background: #45a049;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #da190b;
}

.guest-btn {
    background: #ff9800;
    color: white;
    width: 100%;
    margin-top: 10px;
}

.guest-btn:hover {
    background: #e68900;
}

.error-msg {
    color: #f44336;
    margin-bottom: 15px;
    text-align: center;
    font-weight: bold;
}

.success-msg {
    color: #4caf50;
    margin-bottom: 15px;
    text-align: center;
    font-weight: bold;
}

/* 게임 화면 */
.game-screen {
    display: none;
}

.game-screen.active {
    display: block;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    margin-bottom: 15px;
    font-size: 2em;
    flex: 1;
}

.user-info {
    display: flex;
    justify-content: center;
    gap: 30px;
    font-size: 1.2em;
    flex: 1;
}

.user-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1em;
}

.logout-btn {
    background: #f44336;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
}

.logout-btn:hover {
    background: #da190b;
}

.tabs {
    display: flex;
    background: #f0f0f0;
    border-bottom: 2px solid #ddd;
}

.tab-btn {
    flex: 1;
    padding: 15px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    background: #e0e0e0;
}

.tab-btn.active {
    background: white;
    border-bottom-color: #667eea;
    font-weight: bold;
}

.tab-content {
    display: none;
    padding: 30px;
}

.tab-content.active {
    display: block;
}

h2 {
    margin-bottom: 20px;
    color: #667eea;
}

h3 {
    margin-bottom: 15px;
    color: #764ba2;
}

.equipment-slots {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.equipment-slot {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
}

.slot {
    min-height: 150px;
    background: white;
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.equipment-item {
    text-align: center;
    padding: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    width: 100%;
}

.item-name {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 5px;
}

.item-stats {
    font-size: 0.9em;
    opacity: 0.9;
}

.inventory {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.inventory-item {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.3s;
}

.inventory-item:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.inventory-item.equipped {
    border-color: #4caf50;
    background: #e8f5e9;
}

.item-level {
    display: inline-block;
    background: #ff9800;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    margin-bottom: 5px;
}

.upgrade-section {
    max-width: 600px;
}

.upgrade-select {
    margin-bottom: 20px;
}

.upgrade-select select {
    width: 100%;
    padding: 10px;
    font-size: 1em;
    border: 2px solid #ddd;
    border-radius: 5px;
    margin-top: 10px;
}

.upgrade-info {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}

.current-item {
    margin-bottom: 20px;
}

.upgrade-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stat {
    background: white;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    font-weight: bold;
}

.stat span:last-child {
    color: #667eea;
}

.battle-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.player-stats, .opponent-select {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
}

.stat-display {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-display div {
    background: white;
    padding: 10px;
    border-radius: 5px;
    font-weight: bold;
}

.opponent-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid #e0e0e0;
}

.opponent-item:hover {
    border-color: #667eea;
    transform: translateY(-2px);
}

.opponent-item strong {
    color: #667eea;
}

.battle-result {
    grid-column: 1 / -1;
    background: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}

.battle-log {
    background: white;
    padding: 15px;
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 0.9em;
}

.battle-log div {
    margin-bottom: 5px;
    padding: 5px;
}

.battle-log .win {
    color: #4caf50;
    font-weight: bold;
}

.battle-log .lose {
    color: #f44336;
    font-weight: bold;
}

.market-section {
    max-width: 800px;
}

.sell-section {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.sell-section select {
    width: 100%;
    padding: 10px;
    font-size: 1em;
    border: 2px solid #ddd;
    border-radius: 5px;
    margin-top: 10px;
}

.ranking-section {
    max-width: 800px;
}

.ranking-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.ranking-list {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
}

.ranking-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ranking-item.top {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    font-weight: bold;
}

.ranking-item.top-3 {
    background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 100%);
}

.ranking-item.top-10 {
    background: linear-gradient(135deg, #cd7f32 0%, #e8c5a0 100%);
}

.ranking-number {
    font-size: 1.5em;
    font-weight: bold;
    color: #667eea;
    min-width: 50px;
}

.ranking-info {
    flex: 1;
    margin-left: 20px;
}

.ranking-stats {
    text-align: right;
}

@media (max-width: 768px) {
    .equipment-slots {
        grid-template-columns: 1fr;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .tab-btn {
        min-width: 120px;
    }

    header {
        flex-direction: column;
    }

    .user-info {
        margin-top: 15px;
    }
}