:root {
    --primary-color: #ffd700;
    --primary-hover: #ffea00;
    --secondary-color: #00e5ff;
    --secondary-hover: #00b8cc;
    --danger-color: #ff3366;
    --danger-hover: #cc0033;
    --text-main: #ffffff;
    --text-light: #e0e0e0;
    --card-bg: rgba(20, 10, 45, 0.75);
    --card-shadow: 0 15px 35px rgba(0, 0, 0, 0.4), 0 0 25px rgba(255, 255, 255, 0.15);
    --input-bg: rgba(255, 255, 255, 0.95);
}

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

body {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    /* 眩しすぎないよう暗さを保ちつつ、温かみのある色（深紅やテラコッタ）をミックス */
    background: linear-gradient(45deg, #2d1b4e, #6e2a40, #96482e, #31214e);
    background-size: 300% 300%;
    animation: popBackground 15s ease infinite;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-main);
}

@keyframes popBackground {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container {
    width: 100%;
    max-width: 500px;
    background: var(--card-bg);
    border-radius: 30px;
    padding: 40px;
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 3px solid rgba(255, 255, 255, 0.3);
    min-height: 500px;
    position: relative;
    margin: 20px;
}

.screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    animation: fadeIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.game-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 5px;
    color: var(--primary-color);
    text-align: center;
    text-shadow: 2px 2px 0px #ff5400, 0 0 15px rgba(255, 215, 0, 0.8);
    letter-spacing: 2px;
}

.subtitle {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 40px;
    text-align: center;
    font-weight: bold;
}

.screen-heading {
    font-size: 2rem;
    margin-bottom: 30px;
    color: var(--primary-color);
    text-align: center;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
    font-weight: 800;
    letter-spacing: 2px;
}

.input-group {
    width: 100%;
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
}

.input-group label {
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 8px;
    color: var(--text-main);
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.input-group input {
    width: 100%;
    padding: 15px 20px;
    border: 3px solid transparent;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: bold;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    outline: none;
    background: var(--input-bg);
    color: #222;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
    text-align: center;
}

.input-group input::placeholder {
    color: #aaa;
    font-weight: normal;
}

.input-group input:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 20px var(--secondary-color);
    transform: scale(1.03);
}

.btn {
    width: 100%;
    padding: 16px 20px;
    border: none;
    border-radius: 15px;
    font-size: 1.2rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    letter-spacing: 2px;
}

.primary-btn {
    background: linear-gradient(180deg, #ffd700 0%, #ff8c00 100%);
    color: #111;
    box-shadow: 0 8px 0 #cc7000, 0 12px 20px rgba(0,0,0,0.4);
    text-shadow: 0 1px 1px rgba(255,255,255,0.6);
}

.primary-btn:hover {
    transform: translateY(2px);
    box-shadow: 0 6px 0 #cc7000, 0 8px 15px rgba(0,0,0,0.4);
    background: linear-gradient(180deg, #ffe033 0%, #ff9900 100%);
}

.primary-btn:active {
    transform: translateY(8px);
    box-shadow: 0 0 0 #cc7000, 0 2px 5px rgba(0,0,0,0.4);
}

.primary-btn:disabled {
    background: #666;
    color: #aaa;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.secondary-btn {
    background: linear-gradient(180deg, #00e5ff 0%, #0099cc 100%);
    color: white;
    box-shadow: 0 8px 0 #006688, 0 12px 20px rgba(0,0,0,0.4);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.secondary-btn:hover {
    transform: translateY(2px);
    box-shadow: 0 6px 0 #006688, 0 8px 15px rgba(0,0,0,0.4);
    background: linear-gradient(180deg, #33eeff 0%, #00b3e6 100%);
}

.secondary-btn:active {
    transform: translateY(8px);
    box-shadow: 0 0 0 #006688, 0 2px 5px rgba(0,0,0,0.4);
}

.danger-btn {
    background: linear-gradient(180deg, #ff3366 0%, #cc0033 100%);
    color: white;
    box-shadow: 0 8px 0 #990026, 0 12px 20px rgba(0,0,0,0.4);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.danger-btn:hover {
    transform: translateY(2px);
    box-shadow: 0 6px 0 #990026, 0 8px 15px rgba(0,0,0,0.4);
    background: linear-gradient(180deg, #ff668c 0%, #e60039 100%);
}

.danger-btn:active {
    transform: translateY(8px);
    box-shadow: 0 0 0 #990026, 0 2px 5px rgba(0,0,0,0.4);
}

.text-btn {
    background: transparent;
    color: var(--text-light);
    box-shadow: none;
    text-decoration: underline;
    font-weight: bold;
    padding: 10px;
    margin-bottom: 0;
}

.text-btn:hover {
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
    transform: scale(1.05);
}

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }

/* Menu */
.menu-buttons {
    width: 100%;
}

/* Lobby */
.room-info-card {
    background: rgba(0, 0, 0, 0.4);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 25px;
    border: 2px dashed rgba(255,255,255,0.2);
    font-weight: bold;
    font-size: 1.2rem;
    color: white;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.5);
}

.selectable {
    user-select: text;
    letter-spacing: 5px;
    color: var(--primary-color);
    font-size: 1.8rem;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    background: rgba(0,0,0,0.5);
    padding: 5px 15px;
    border-radius: 8px;
    display: inline-block;
    margin-top: 10px;
    border: 1px solid rgba(255,215,0,0.3);
}

.players-container {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: inset 0 0 15px rgba(0,0,0,0.5);
}

.players-container h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--secondary-color);
    border-bottom: 2px dashed rgba(255,255,255,0.2);
    padding-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
}

#players-list {
    list-style: none;
}

.player-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.1);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.2s ease;
}

.player-item:hover {
    transform: scale(1.02) translateX(5px);
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255,215,0,0.5);
}

.player-icon {
    font-size: 1.5rem;
    margin-right: 15px;
}

.player-name {
    font-weight: bold;
    font-size: 1.1rem;
    flex-grow: 1;
}

.host-badge {
    background: linear-gradient(135deg, #ffd700 0%, #ff5400 100%);
    color: #fff;
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 800;
    box-shadow: 0 2px 10px rgba(255, 84, 0, 0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.lobby-actions {
    width: 100%;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
}
::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 5px;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.5);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
}

/* Title Logo Animation */
@keyframes funBounce {
    0%, 100% { transform: translateY(0) rotate(-2deg) scale(1); }
    50% { transform: translateY(-15px) rotate(2deg) scale(1.05); }
}

.game-logo {
    animation: funBounce 3s infinite ease-in-out;
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.6));
    transition: transform 0.2s;
}

.game-logo:hover {
    transform: scale(1.1) rotate(0deg);
    animation-play-state: paused;
}
