:root {
    --bg: #0a0510;
    --accent: #9c27b0;
    --gold: #d4af37;
    --glass: rgba(255, 255, 255, 0.07);
    --error: #ff4d4d;
}

body {
    font-family: 'Hiragino Mincho ProN', serif;
    background: var(--bg);
    color: #eee;
    margin: 0;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.screen {
    display: none;
    padding: 80px 20px 40px;
    text-align: center;
    overflow-y: auto;
    flex: 1;
    height: 100%;
    box-sizing: border-box;
    flex-direction: column;
    align-items: center;
}

#gateway-screen {
    background-image: url('/img/title_bg.png');
    background-size: cover;
    background-position: center;
    padding-top: 60px;
}

.logo-img {
    max-width: 80%;
    height: auto;
    margin-bottom: 20px;
}

.form-box {
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
    text-align: left;
    background: var(--glass);
    padding: 25px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

input {
    width: 100%;
    padding: 12px;
    background: #000;
    border: 1px solid #444;
    color: #fff;
    border-radius: 8px;
    margin-bottom: 10px;
    box-sizing: border-box;
    font-size: 1rem;
    outline: none;
}

.main-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 16px;
    border-radius: 35px;
    cursor: pointer;
    font-weight: bold;
    width: 100%;
    margin-top: 10px;
}

.auth-btn {
    width: 100%;
    margin-bottom: 10px;
    padding: 12px;
    border-radius: 10px;
    border: none;
    font-weight: bold;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.google-icon {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    background: white;
    border-radius: 50%;
    padding: 2px;
}

.cast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    margin-top: 20px;
    width: 100%;
    max-width: 500px;
}

.cast-card {
    background: var(--glass);
    border: 1px solid #333;
    padding: 12px;
    border-radius: 15px;
    cursor: pointer;
}

.cast-card img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 8px;
}

#chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    margin-bottom: 15px;
    width: 100%;
    max-width: 600px;
}

.msg {
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 85%;
    font-size: 0.95rem;
    line-height: 1.6;
    text-align: left;
}

.msg.ai {
    background: var(--glass);
    border-left: 4px solid var(--gold);
    align-self: flex-start;
}

.msg.user {
    background: var(--accent);
    color: #fff;
    align-self: flex-end;
}

.loading-msg {
    display: none;
    align-self: flex-start;
    background: var(--glass);
    border-left: 4px solid var(--gold);
    padding: 12px 16px;
    border-radius: 18px;
    color: #ccc;
    font-style: italic;
}

.loading-icon {
    display: inline-block;
    margin-right: 8px;
    animation: blink 1.5s infinite both;
}

@keyframes blink {
    0%, 100% { opacity: 0.2; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); color: var(--gold); }
}

#end-session-area {
    display: none;
    width: 100%;
    max-width: 600px;
    padding: 10px;
    text-align: center;
}

.end-btn {
    background: #333;
    color: var(--gold);
    border: 2px solid var(--gold);
    width: 100%;
    padding: 15px;
    border-radius: 30px;
    font-weight: bold;
    cursor: pointer;
    animation: fadeIn 1s;
}

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

nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    z-index: 100;
    background: rgba(0, 0, 0, 0.8);
    align-items: center;
    backdrop-filter: blur(5px);
}

.nav-title {
    color: var(--gold);
    font-weight: bold;
    cursor: pointer;
}

.nav-ticket {
    color: var(--gold);
    cursor: pointer;
}

/* --- 予約画面の調整 (ここを重点的に修正) --- */

#day-list {
    display: flex !important;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 0 !important;
    justify-content: flex-start; /* 左詰めにする（スマホで見やすく） */
    width: 100%;
    
    /* ↓↓↓ 修正箇所：高さを確保し、余白を大きく取る ↓↓↓ */
    min-height: 60px; 
    margin-bottom: 50px !important; /* ボタンとの距離を大幅に離す */
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.slot-btn {
    padding: 8px 4px;
    border: 1px solid var(--gold);
    color: #fff;
    background: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.slot-btn:disabled {
    border-color: #333;
    color: #444;
    background: rgba(0,0,0,0.3);
    cursor: not-allowed;
}

.day-tab {
    min-width: 70px; /* タブの幅を少し広げる */
    padding: 10px;
    border: 1px solid #444;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    background: rgba(0,0,0,0.5);
    color: #fff;
    white-space: nowrap;
    flex-shrink: 0; /* 縮まないようにする */
}

.day-tab.active {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(212, 175, 55, 0.2);
}

.slot-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    
    /* ↓↓↓ 修正箇所：上部の余白を追加 ↓↓↓ */
    margin-top: 30px; 
    
    width: 100%;
    padding-bottom: 80px;
}

/* --- モーダル調整 --- */

#cast-modal,
#ticket-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    align-items: flex-end;
}

.modal-content,
.ticket-box {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    background: #1a0b2e;
    border-top: 3px solid var(--gold);
    border-radius: 30px 30px 0 0;
    padding: 30px;
    box-sizing: border-box;
    transform: translateY(100%);
    transition: 0.4s;
    max-height: 80vh;
    overflow-y: auto;
}

.active .modal-content,
.active .ticket-box {
    transform: translateY(0);
}
