:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --pink: #ec4899;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-header: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --font-main: 'Inter', 'Noto Sans JP', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-main);
    line-height: 1.5;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-container {
    padding: 1.5rem;
    max-width: 100%;
    margin: 0 auto;
    flex: 1;
    width: 100%;
}

.recovery-plan {
    margin-top: 1rem;
    padding: 0.5rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px dashed var(--error);
    border-radius: 8px;
    color: var(--error);
    font-size: 1.1rem;
    text-align: center;
    font-weight: 700;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}
/* ヘッダー */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-header);
    padding: 1rem 2rem;
    border-radius: 16px;
    margin-bottom: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
}

.app-title-area {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.app-title-area h1 {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(90deg, #60a5fa, #34d399);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

#clock-display {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-muted);
}

/* フロアセクション */
.floor-section {
    margin-bottom: 1.5rem;
}

.floor-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
    padding-left: 0.5rem;
    border-left: 6px solid var(--primary);
}

.floor-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
}

/* カードレイアウト */
.area-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr); /* 10カラムベースで配置を統一 */
    gap: 1rem;
    max-width: 2400px; /* 4Kモニターでも適正な密度を保つ */
    margin: 0 auto;
}

.area-card {
    background-color: var(--bg-card);
    border-radius: 20px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
    grid-column: span 2; /* 通常は2カラム分（1/5幅） */
    
    display: flex;
    flex-direction: column;
    min-height: 230px; /* カードの高さを一覧で統一 */
}

.area-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

.area-card.behind {
    border-color: rgba(239, 68, 68, 0.5);
    background: linear-gradient(135deg, var(--bg-card), rgba(239, 68, 68, 0.05));
}

.area-card.ahead {
    border-color: rgba(16, 185, 129, 0.5);
    background: linear-gradient(135deg, var(--bg-card), rgba(16, 185, 129, 0.05));
}

.area-name {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 0.75rem;
    padding-right: 7rem; /* バッジとの重なりを避けるための余白 */
}

.area-wave {
    font-size: 1.1rem;
    background: var(--border);
    padding: 2px 8px;
    border-radius: 6px;
    color: var(--text-muted);
}

/* メトリクス表示 */
.metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.metric-item {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
}

.metric-label {
    display: block;
    font-size: 1.0rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.metric-value {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
}

.metric-unit {
    font-size: 1.1rem;
    margin-left: 2px;
}

/* 進捗バー */
.progress-container {
    height: 12px;
    background: var(--border);
    border-radius: 6px;
    position: relative;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.time-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--warning);
    box-shadow: 0 0 8px var(--warning);
    z-index: 10;
    pointer-events: none;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #60a5fa);
    width: 0%;
    transition: width 0.5s ease;
}

/* カードの状態別スタイル */
.area-card.inactive {
    opacity: 0.6;
    filter: grayscale(0.8);
    border-style: dashed;
}

.area-card.shipping {
    border-color: var(--pink);
    background: linear-gradient(135deg, var(--bg-card), rgba(236, 72, 153, 0.05));
    grid-column: span 4; /* 出荷全体は4カラム分（2倍幅） */
}

.last-update {
    font-size: 1.0rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    text-align: right;
}

/* リード・ビハインド */
.status-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 6px 14px;
    border-radius: 99px;
    font-weight: 800;
    font-size: 1.1rem;
}

.badge-behind { background-color: var(--danger); color: white; }
.badge-ahead { background-color: var(--secondary); color: white; }
.badge-on { background-color: var(--warning); color: white; }

/* 入力画面用 */
.setup-container {
    max-width: 600px;
    margin: 4rem auto;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.form-control {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: white;
    padding: 1rem;
    border-radius: 12px;
    font-size: 1.2rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 800;
    width: 100%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.area-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.area-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    text-align: center;
    font-weight: 700;
}

.area-btn.active {
    background: var(--primary);
    border-color: var(--primary);
}

/* モーダル等 */
.hidden { display: none !important; }

/* フッターシグネチャー */
.signature-footer {
    text-align: center;
    margin-top: auto;
    padding-bottom: 1rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: var(--text-muted);
    opacity: 0.5;
    letter-spacing: 0.3em;
    font-weight: 700;
}
