* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2em;
    margin-bottom: 10px;
}

.status {
    font-size: 0.9em;
    opacity: 0.9;
}

main {
    padding: 30px;
}

section {
    margin-bottom: 30px;
}

h2 {
    color: #333;
    margin-bottom: 20px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

h3 {
    color: #555;
    margin: 20px 0 15px 0;
}

h4 {
    color: #666;
    margin: 15px 0 10px 0;
    font-size: 1em;
}

footer {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    color: #666;
    font-size: 0.9em;
}

/* 設定セクション */
.config-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 15px;
}

.config-grid label {
    display: flex;
    flex-direction: column;
    font-size: 0.9em;
    color: #555;
}

.config-grid input {
    margin-top: 5px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95em;
}

/* STB管理セクション */
.stb-manager {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.stb-manager input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95em;
}

/* STB一覧 */
.stb-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stb-card {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.stb-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

.stb-card .stb-id {
    font-size: 1.4em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
}

.stb-card .stb-status {
    font-size: 0.85em;
    color: #666;
}

.stb-card .status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75em;
    font-weight: bold;
    margin-top: 8px;
}

.status-badge.connected {
    background: #d4edda;
    color: #155724;
}

.status-badge.disconnected {
    background: #f8d7da;
    color: #721c24;
}

.loading {
    text-align: center;
    color: #999;
    padding: 40px;
    font-style: italic;
}

/* STB詳細表示 */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.status-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.status-item label {
    display: block;
    font-size: 0.85em;
    color: #666;
    margin-bottom: 5px;
}

.status-value {
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
}

/* プロセス一覧 */
.process-list {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin: 20px 0;
}

.process-list ul {
    list-style: none;
}

.process-list li {
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.process-list li:last-child {
    border-bottom: none;
}

.process-status {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
}

.process-status.running {
    background: #d4edda;
    color: #155724;
}

.process-status.stopped {
    background: #f8d7da;
    color: #721c24;
}

.feature-log-panel {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin: 20px 0;
}

.feature-log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.feature-log-list {
    list-style: none;
}

.feature-log-list li {
    padding: 12px 10px;
    border-bottom: 1px solid #e0e0e0;
    display: grid;
    grid-template-columns: max-content 60px 1fr 125px;
    gap: 12px;
    align-items: start;
    font-size: 0.85em;
    grid-auto-rows: auto;
    word-wrap: break-word;
    white-space: normal;
}

.feature-log-list li:last-child {
    border-bottom: none;
}

.log-category {
    font-weight: 600;
    color: #555;
    min-width: 250px;
    max-width: 250px;
    word-break: break-word;
    white-space: normal;
    overflow-wrap: break-word;
}

.log-level {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    text-align: center;
    font-size: 0.75em;
    font-weight: bold;
    white-space: nowrap;
}

.log-level.info {
    background: #d1ecf1;
    color: #0c5460;
}

.log-level.warn {
    background: #fff3cd;
    color: #856404;
}

.log-level.error {
    background: #f8d7da;
    color: #721c24;
}

.log-message {
    color: #333;
    word-break: break-word;
    white-space: normal;
    overflow-wrap: break-word;
}

.log-time {
    color: #666;
    font-size: 0.8em;
    white-space: nowrap;
}

/* 制御パネル */
.control-panel {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    margin: 20px 0;
}

.control-group {
    margin-bottom: 20px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-group>label {
    display: block;
    font-weight: 600;
    color: #555;
    margin-bottom: 10px;
}

.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.slider-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.volume-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.volume-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

#volumeValue {
    min-width: 35px;
    font-weight: bold;
    color: #667eea;
}

/* ボタン */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    transition: all 0.2s ease;
    margin: 5px;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-control {
    background: #28a745;
    color: white;
    padding: 8px 16px;
    font-size: 0.9em;
}

.btn-control:hover {
    background: #218838;
}