/* CSSカスタムプロパティ（デザインシステム） */
:root {
    --bg-gradient: linear-gradient(135deg, #0f172a, #1e1b4b);
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --accent: #f43f5e;
    --accent-hover: #e11d48;
    --success: #10b981;
    --focus-ring: #38bdf8;
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --font-main: 'Noto Sans JP', sans-serif;
    --font-eng: 'Outfit', sans-serif;
}

/* リセット & ベーススタイル */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3 {
    font-family: var(--font-eng), var(--font-main);
    font-weight: 700;
    letter-spacing: -0.025em;
    text-align: center;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    background: linear-gradient(to right, #a5b4fc, #6366f1, #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
}

h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    text-align: left;
}

/* アクセシビリティ：スクリーンリーダー用非表示 */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* スキップリンク */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 8px;
    z-index: 100;
    transition: top 0.2s;
}
.skip-link:focus {
    top: 0;
}

/* 共通カードレイアウト */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* フォーム要素 */
.form-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: left;
}

input[type="text"] {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--focus-ring);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.3);
}

/* ボタン */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.9rem 1.5rem;
    border-radius: 8px;
    border: none;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
}

.btn:active {
    transform: scale(0.98);
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px var(--focus-ring);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #818cf8);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.18);
}

.btn-danger {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.3);
}
.btn-danger:hover {
    background: var(--accent-hover);
}

/* 区切り線 */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.85rem;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.divider:not(:empty)::before { margin-right: .5em; }
.divider:not(:empty)::after { margin-left: .5em; }

/* リストとアイテム */
.player-list {
    list-style: none;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.player-item {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.player-name {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge {
    font-size: 0.75rem;
    padding: 0.1rem 0.5rem;
    border-radius: 12px;
    font-weight: 700;
}

.badge-host {
    background: #eab308;
    color: #1e1b4b;
}

.badge-me {
    background: var(--primary);
    color: white;
}

.status-badge {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* 投票フォーム用スタイル */
.vote-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.vote-label {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    position: relative;
}

.vote-label:hover {
    background: rgba(255, 255, 255, 0.08);
}

.vote-radio {
    margin-right: 1rem;
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--primary);
}

.vote-radio:focus-visible + span {
    outline: 2px solid var(--focus-ring);
    outline-offset: 4px;
}

/* お題確認ボックス */
.word-display-box {
    background: rgba(99, 102, 241, 0.1);
    border: 2px dashed var(--primary);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1.5rem;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.word-text {
    font-size: 1.75rem;
    font-weight: 800;
    color: white;
    letter-spacing: 0.05em;
    margin-top: 0.5rem;
}

/* コピーエリア */
.copy-box {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

/* 結果テーブル */
.result-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.result-table th, .result-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.result-table th {
    color: var(--text-secondary);
    font-weight: 500;
}

/* タイマー */
.timer-box {
    font-family: var(--font-eng);
    font-size: 2rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 1rem;
    color: var(--accent);
    text-shadow: 0 0 10px rgba(244, 63, 94, 0.3);
}

/* ユーティリティ */
[hidden] {
    display: none !important;
}

.text-center {
    text-align: center;
}
.mb-4 {
    margin-bottom: 1rem;
}

/* アクセシビリティ：フォーカスの視認性向上 */
*:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

/* ログ履歴 */
.log-item {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    text-align: left;
}
.log-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.3rem;
    margin-bottom: 0.3rem;
}
.log-item-date {
    font-size: 0.75rem;
    opacity: 0.7;
    font-family: var(--font-eng);
}
.log-badge {
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    color: white;
}
.log-badge.citizen {
    background: var(--primary);
}
.log-badge.wolf {
    background: var(--accent);
}
.log-item-details {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.log-players {
    font-size: 0.8rem;
    background: rgba(0, 0, 0, 0.15);
    padding: 0.4rem;
    border-radius: 6px;
    margin-top: 0.3rem;
    word-break: break-all;
}
.logs-scrollbar::-webkit-scrollbar {
    width: 6px;
}
.logs-scrollbar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}
.logs-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
.logs-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}
