:root {
    --bg-color: #0f172a;
    --bg-gradient: radial-gradient(circle at top right, #1e1b4b, #0f172a);
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #334155;
    --secondary-hover: #475569;
    --attention-color: #ef4444;
    --attention-hover: #dc2626;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --success-color: #10b981;
    --font-family: 'Noto Sans JP', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.app-container {
    width: 100%;
    max-width: 480px;
    height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* ================= View Transitions ================= */
.view {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: scale(0.95);
    padding: 20px;
}

.view.active {
    opacity: 1;
    pointer-events: all;
    transform: scale(1);
}

/* ================= Glassmorphism Panel ================= */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px 30px;
    width: 100%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ================= Typography & Inputs ================= */
h1.logo {
    font-size: 2.5rem;
    font-weight: 900;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
    letter-spacing: 2px;
}

h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
    margin: 20px 0;
}

.input-group label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 700;
}

input[type="text"] {
    background: rgba(15, 23, 42, 0.6);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
    font-size: 1.2rem;
    color: white;
    outline: none;
    transition: all 0.3s ease;
    text-align: center;
    font-family: inherit;
    font-weight: 700;
}

input[type="text"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

/* ================= Buttons ================= */
button {
    font-family: inherit;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 16px 24px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    width: 100%;
}

button:active {
    transform: scale(0.97) translateY(2px);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.primary-btn {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.primary-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
    transform: translateY(-2px);
}

.secondary-btn {
    background: var(--secondary-color);
    color: white;
}

.secondary-btn:hover:not(:disabled) {
    background: var(--secondary-hover);
}

.attention-btn {
    background: var(--attention-color);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

.attention-btn:hover:not(:disabled) {
    background: var(--attention-hover);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
}

.pulse {
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(99, 102, 241, 0); }
    100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

/* ================= Lists & Players ================= */
.players-container {
    background: rgba(0,0,0,0.2);
    border-radius: 16px;
    padding: 20px;
    margin: 10px 0;
}

.player-count {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--glass-border);
}

.player-list, .mini-player-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.player-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.05);
    padding: 12px 16px;
    border-radius: 12px;
    animation: slide-in 0.4s ease forwards;
    opacity: 0;
    transform: translateY(10px);
}

@keyframes slide-in {
    to { opacity: 1; transform: translateY(0); }
}

.player-name {
    font-weight: 700;
}

.player-me {
    color: #c084fc;
}

.status-badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--secondary-color);
    color: white;
}

.status-badge.ready {
    background: var(--success-color);
}

.status-badge.waiting {
    background: var(--attention-color);
}

/* ================= Specific Views ================= */
.room-label {
    font-size: 0.8rem;
    letter-spacing: 2px;
    color: var(--primary-color);
    font-weight: 900;
}

.hint-text, .word-hint, .discussion-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.word-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.02));
    border: 1px solid rgba(255,255,255,0.2);
    padding: 40px 20px;
    border-radius: 20px;
    margin: 20px 0;
    box-shadow: inset 0 0 20px rgba(255,255,255,0.05);
}

.glow-text {
    font-size: 2.5rem;
    font-weight: 900;
    text-shadow: 0 0 20px rgba(255,255,255,0.5);
    letter-spacing: 4px;
}

/* ================= Timer ================= */
.timer-display {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 20px auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.timer-ring {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: rgba(255,255,255,0.1);
    stroke-width: 8;
}

.ring-progress {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283; /* 2 * pi * 45 */
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
}

.ring-progress.warning {
    stroke: var(--attention-color);
}

.timer-text {
    font-size: 2rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    z-index: 2;
}

/* ================= Results ================= */
.result-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 20px 0;
}

.result-card {
    background: rgba(255,255,255,0.05);
    padding: 20px;
    border-radius: 16px;
    position: relative;
    border: 1px solid var(--glass-border);
}

.role-badge {
    position: absolute;
    top: -10px;
    left: 20px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
    background: #475569;
}

.majority-badge {
    background: var(--primary-color);
}

.minority-badge {
    background: var(--attention-color);
}

.glow-red {
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
}

.result-word {
    font-size: 1.8rem;
    font-weight: 900;
    margin-top: 10px;
}

.result-player-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.result-player-item:last-child {
    border: none;
}

.is-minority {
    color: var(--attention-color);
    font-weight: 900;
}

/* ================= Modal ================= */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 100;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    width: 90%;
    max-width: 400px;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-icon {
    font-size: 3rem;
    margin-bottom: -10px;
}

.modal-actions {
    display: flex;
    gap: 16px;
    margin-top: 10px;
}

/* Util */
.icon-pulse {
    font-size: 4rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

/* かりずまい ポータルへ戻るリンク */
.home-link{position:fixed;top:10px;left:12px;z-index:50;font-size:13px;color:#fff;background:rgba(0,0,0,.35);padding:6px 10px;border-radius:999px;text-decoration:none;backdrop-filter:blur(4px)}
.home-link:hover{background:rgba(0,0,0,.55)}
