:root {
    --bg-gradient: linear-gradient(135deg, #110e0d 0%, #2a1f1a 100%);
    --primary-color: #b8860b;
    --primary-hover: #996515;
    --secondary-color: #8b0000;
    --secondary-hover: #5c0000;
    --danger-color: #ab1f1f;
    --danger-hover: #801212;
    --success-color: #2e663a;
    --text-main: #e8dbce;
    --text-light: #b09e8f;
    --glass-bg: rgba(20, 15, 12, 0.85);
    --glass-border: rgba(184, 134, 11, 0.3);
    --glass-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);
}

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

body {
    font-family: 'Noto Serif JP', 'Cinzel', serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-main);
    overflow-x: hidden;
}

/* Background animated elements */
body::before, body::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    animation: float 10s infinite ease-in-out alternate;
}
body::before {
    width: 400px;
    height: 400px;
    background: rgba(184, 60, 11, 0.15); /* 炎のようなオレンジ赤 */
    top: -100px;
    left: -100px;
}
body::after {
    width: 300px;
    height: 300px;
    background: rgba(139, 0, 0, 0.15); /* 深紅 */
    bottom: -50px;
    right: -50px;
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(30px) scale(1.1); }
}

.container {
    width: 100%;
    max-width: 900px;
    background: var(--glass-bg);
    border-radius: 24px;
    padding: 30px;
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    min-height: 600px;
    position: relative;
    margin: 20px;
}

.screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.game-title {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 10px;
    background: linear-gradient(to right, #e8c056, #b8860b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    letter-spacing: 4px;
    font-family: 'Cinzel', 'Noto Serif JP', serif;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.8));
}

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

.screen-heading {
    font-size: 2rem;
    margin-bottom: 30px;
    color: #e2e8f0;
    text-align: center;
    font-weight: 700;
}

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

.input-group label {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-light);
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    font-size: 1rem;
    color: white;
    transition: all 0.3s ease;
    outline: none;
}

.input-group input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(184, 134, 11, 0.25);
    background: rgba(20, 15, 12, 0.8);
}

.btn {
    width: 100%;
    max-width: 320px;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 16px;
    letter-spacing: 1px;
}

.primary-btn {
    background: linear-gradient(135deg, #8b0000, #5c0000);
    color: #e8dbce;
    border: 1px solid var(--primary-color);
    box-shadow: 0 4px 15px rgba(139, 0, 0, 0.4);
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(184, 134, 11, 0.4);
    filter: brightness(1.2);
    border-color: #ffd700;
}

.primary-btn:disabled {
    background: #475569;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.secondary-btn {
    background-color: rgba(184, 134, 11, 0.1);
    color: #e8dbce;
    border: 1px solid rgba(184, 134, 11, 0.4);
}

.secondary-btn:hover {
    background-color: rgba(184, 134, 11, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(184, 134, 11, 0.2);
}

.danger-btn {
    background-color: rgba(139, 0, 0, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(139, 0, 0, 0.4);
}

.danger-btn:hover {
    background-color: rgba(139, 0, 0, 0.4);
    color: white;
    box-shadow: 0 4px 15px rgba(139, 0, 0, 0.3);
}

.text-btn {
    background: transparent;
    color: var(--text-light);
    box-shadow: none;
    text-decoration: none;
}

.text-btn:hover {
    color: white;
}

/* Options */
.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 500px;
}
.option-label {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: 0.2s;
    font-size: 0.9rem;
}
.option-label:hover {
    background: rgba(255,255,255,0.1);
}
.option-label input {
    margin-right: 8px;
}

/* Lobby */
.room-info-card {
    background: rgba(30, 20, 15, 0.7);
    padding: 15px 30px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 25px;
    border: 1px solid var(--glass-border);
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 2px;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.5);
}
.selectable {
    user-select: text;
    color: #e8c056;
}
.players-container {
    width: 100%;
    max-width: 500px;
    background: rgba(30, 20, 15, 0.6);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid var(--glass-border);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}
.player-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    transition: 0.2s;
}
.player-item:hover {
    background: rgba(255, 255, 255, 0.08);
}
.host-badge {
    background: rgba(184, 134, 11, 0.3);
    color: #ffd700;
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: bold;
    border: 1px solid rgba(184, 134, 11, 0.5);
}

/* Game Area */
.game-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(30, 20, 15, 0.7);
    padding: 15px 20px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}
.deck-info {
    font-weight: bold;
    color: #e8c056;
}

.game-main {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}
.opponents-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.opponent-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 15px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.opponent-card.is-dead {
    opacity: 0.5;
    background: rgba(239, 68, 68, 0.1);
}
.opponent-card.is-protected {
    border-color: #ffd700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.my-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: rgba(30, 20, 15, 0.7);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    align-items: center;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}
.my-role-img {
    width: 120px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}
.hand-area {
    display: flex;
    gap: 15px;
    justify-content: center;
}
.action-card {
    width: 100px;
    cursor: pointer;
    border-radius: 8px;
    transition: 0.3s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}
.action-card:hover {
    transform: translateY(-10px) scale(1.05);
    box-shadow: 0 10px 25px rgba(0,0,0,0.7);
}

.game-log {
    background: rgba(10, 5, 0, 0.5);
    padding: 15px;
    border-radius: 12px;
    max-height: 150px;
    overflow-y: auto;
    font-size: 0.9rem;
    color: #e8dbce;
    border: 1px solid rgba(184, 134, 11, 0.2);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}
.modal-content {
    background: var(--glass-bg);
    padding: 30px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    width: 90%;
    max-width: 400px;
    text-align: center;
}
.target-select {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    background: rgba(30, 20, 15, 0.9);
    color: #e8dbce;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    outline: none;
}

/* Animation Overlay */
#animation-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    opacity: 1;
    transition: opacity 0.3s;
}

#animation-overlay.hidden {
    display: none !important;
}

.anim-card-left, .anim-card-right {
    opacity: 0;
    transform: scale(1.5);
    transition: all 0.5s ease-out;
}

.anim-card-left.active, .anim-card-right.active {
    opacity: 1;
    transform: scale(1);
}

.anim-card-left img, .anim-card-right img {
    height: 350px;
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
    object-fit: contain;
}

.anim-result {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 10001;
}

.anim-result div {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes chaos-shake {
    0% { transform: scale(1.2) rotate(0deg) translate(0, 0); }
    10% { transform: scale(1.2) rotate(10deg) translate(-10px, -10px); }
    20% { transform: scale(1.2) rotate(-10deg) translate(10px, -10px); }
    30% { transform: scale(1.2) rotate(20deg) translate(-10px, 10px); }
    40% { transform: scale(1.2) rotate(-20deg) translate(10px, 10px); }
    50% { transform: scale(1.2) rotate(30deg) translate(15px, -15px); }
    60% { transform: scale(1.2) rotate(-30deg) translate(-15px, 15px); }
    70% { transform: scale(1.2) rotate(60deg) translate(20px, -20px); }
    80% { transform: scale(1.2) rotate(-60deg) translate(-20px, 20px); }
    90% { transform: scale(1.2) rotate(180deg) translate(0, 0); }
    100% { transform: scale(1.2) rotate(360deg) translate(0, 0); }
}

.chaos-shaking {
    animation: chaos-shake 0.5s infinite linear;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.9);
    color: #fbbf24;
    padding: 10px 20px;
    border-radius: 5px;
    border: 1px solid rgba(251, 191, 36, 0.5);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    font-size: 0.9rem;
    font-weight: bold;
    z-index: 99999;
    transition: bottom 0.3s ease-in-out, opacity 0.3s ease-in-out;
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
}

.toast.show {
    bottom: 30px;
    opacity: 1;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Slash Effect */
.slash-container {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 350px;
    height: 350px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 20;
}
.slash-line-1, .slash-line-2 {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 12px;
    background: #ef4444;
    box-shadow: 0 0 20px #ef4444, 0 0 40px #ef4444;
    border-radius: 6px;
    transform-origin: center;
}
.slash-line-1 {
    transform: translate(-50%, -50%) rotate(45deg);
}
.slash-line-2 {
    transform: translate(-50%, -50%) rotate(-45deg);
}
.slash-container.active .slash-line-1 {
    animation: slash-anim 0.4s ease-out forwards;
}
.slash-container.active .slash-line-2 {
    animation: slash-anim 0.4s ease-out forwards 0.15s;
}
@keyframes slash-anim {
    0% { width: 0; opacity: 1; }
    50% { width: 120%; opacity: 1; }
    100% { width: 120%; opacity: 0; }
}
