/* ========================================
   withny-style Streaming Platform CSS
   ======================================== */

:root {
    /* Primary Colors */
    --primary: #e94560;
    --primary-light: #ff6b8a;
    --primary-dark: #c73a52;

    /* Background Colors */
    --bg-main: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #fef2f4;
    --bg-input: #f8f9fa;
    --bg-dark: #1a1a2e;

    /* Text Colors */
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --text-light: #ffffff;

    /* Border Colors */
    --border-light: #f0f0f0;
    --border-medium: #e0e0e0;

    /* Status Colors */
    --live: #ff4757;
    --offline: #95a5a6;
    --scheduled: #3498db;
    --success: #2ecc71;
    --warning: #f39c12;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

    /* Spacing */
    --sidebar-width: 240px;
    --header-height: 60px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
}

body {
    font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Yu Gothic', sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
}

img {
    max-width: 100%;
    height: auto;
}

/* ========================================
   Layout
   ======================================== */

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
    opacity: 0.6;
}

.logo-icon {
    width: 32px;
    height: 32px;
}

/* Top Bar - extends beyond sidebar */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 150;
}

.top-bar .logo {
    opacity: 0.6;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-header-logout {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--border-medium);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-header-logout:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-header-logout:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.sidebar.with-top-bar {
    top: 56px;
    height: calc(100vh - 56px);
}

.main-content.with-top-bar {
    margin-top: 56px;
}

/* User Info in Sidebar */
.user-section {
    padding: 20px;
    border-bottom: 1px solid var(--border-light);
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.user-points {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.user-points span {
    color: var(--primary);
    font-weight: 600;
}

/* Point Purchase Buttons */
.point-buttons {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-point-purchase {
    width: 100%;
    padding: 10px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    transition: var(--transition-fast);
}

.btn-point-purchase.primary {
    background: var(--primary);
    color: white;
}

.btn-point-purchase.primary:hover {
    background: var(--primary-dark);
}

.btn-point-purchase.outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-point-purchase.outline:hover {
    background: var(--bg-hover);
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    padding: 8px 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-secondary);
    transition: var(--transition-fast);
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.nav-item.active {
    background: var(--bg-hover);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}

.nav-item-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* Header */
.header {
    height: var(--header-height);
    background: var(--bg-main);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border-radius: 24px;
    padding: 8px 16px;
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border-light);
    transition: var(--transition-fast);
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.1);
}

.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-icon {
    color: var(--text-muted);
    margin-right: 8px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    position: relative;
}

.header-btn:hover {
    background: var(--bg-input);
}

.header-btn .badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-input);
    overflow: hidden;
    cursor: pointer;
}

/* Page Content */
.page-content {
    padding: 24px;
}

/* ========================================
   Components
   ======================================== */

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    transition: var(--transition-fast);
    cursor: pointer;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-medium);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-favorite {
    background: var(--primary);
    color: white;
    border-radius: 20px;
    padding: 8px 16px;
}

.btn-favorite:hover {
    background: var(--primary-dark);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* Stream Card */
.stream-card {
    cursor: pointer;
}

.stream-thumbnail {
    position: relative;
    aspect-ratio: 16/9;
    background: var(--bg-dark);
    overflow: hidden;
}

.stream-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stream-thumbnail-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: var(--text-muted);
    font-size: 2rem;
}

.stream-status {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    gap: 6px;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-badge.live {
    background: var(--live);
    color: white;
    animation: pulse 2s infinite;
}

.status-badge.scheduled {
    background: var(--scheduled);
    color: white;
}

.status-badge.offline {
    background: rgba(0,0,0,0.6);
    color: white;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.stream-viewers {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stream-info {
    padding: 12px;
}

.stream-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.stream-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.streamer-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-input);
    overflow: hidden;
}

.streamer-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.streamer-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stream-time {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Stream Card Icon with Speech Bubble */
.stream-icon-container {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.stream-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid white;
    background: var(--bg-input);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.stream-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stream-icon svg {
    width: 100%;
    height: 100%;
    padding: 8px;
}

.stream-speech-bubble {
    position: relative;
    background: white;
    padding: 6px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
    max-width: 150px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    word-break: break-word;
}

.stream-speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 16px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid white;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    padding: 0 24px;
    background: var(--bg-main);
    border-bottom: 1px solid var(--border-light);
    overflow-x: auto;
}

.tab {
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.tab:hover {
    color: var(--primary);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

/* Section Header */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 700;
}

.section-title-icon {
    color: var(--primary);
}

.section-link {
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.section-link:hover {
    color: var(--primary);
}

/* Grid Layouts */
.stream-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.schedule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

/* Banner Slider */
.banner-slider {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 24px;
}

.banner-slide {
    display: none;
    aspect-ratio: 3/1;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

.banner-slide.active {
    display: block;
}

.banner-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.banner-nav {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.banner-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
}

.banner-dot.active {
    background: white;
    width: 24px;
    border-radius: 4px;
}

/* Notice Board */
.notice-board {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.notice-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: var(--transition-fast);
}

.notice-item:hover {
    background: var(--bg-hover);
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
}

.notice-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.notice-item:first-child {
    padding-top: 0;
}

.notice-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.notice-tag {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--bg-input);
    color: var(--text-secondary);
}

.notice-tag.event {
    background: #fff3cd;
    color: #856404;
}

.notice-tag.info {
    background: #cce5ff;
    color: #004085;
}

.notice-tag.important {
    background: #f8d7da;
    color: #721c24;
}

.notice-tag.warning {
    background: #fff3cd;
    color: #856404;
}

.notice-tag.campaign {
    background: #d4edda;
    color: #155724;
}

.notice-title {
    flex: 1;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.notice-item:hover .notice-title {
    color: var(--primary);
}

/* ========================================
   Viewer Page Styles
   ======================================== */

.viewer-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 0;
    height: calc(100vh - var(--header-height));
}

.viewer-main {
    display: flex;
    flex-direction: column;
    background: var(--bg-dark);
    overflow: hidden;
}

.video-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    flex-shrink: 0;
}

.video-container {
    width: 100%;
    height: 100%;
}

.video-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.8);
    color: white;
    gap: 16px;
}

.video-overlay.hidden {
    display: none;
}

.video-overlay-icon {
    font-size: 4rem;
    opacity: 0.8;
}

.video-overlay-text {
    font-size: 1.2rem;
    opacity: 0.9;
}

.video-overlay-subtext {
    font-size: 0.9rem;
    opacity: 0.6;
}

/* Video Status Bar */
.video-status-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent);
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
}

.status-bar-viewers {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
}

.status-bar-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-bar-status.live {
    background: var(--live);
}

.status-bar-status.offline {
    background: var(--offline);
}

.status-bar-time {
    font-size: 0.85rem;
    opacity: 0.8;
}

.status-bar-points {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
}

/* Stream Info Below Video */
.stream-detail-info {
    padding: 16px 20px;
    background: var(--bg-main);
    border-bottom: 1px solid var(--border-light);
}

.stream-detail-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.stream-detail-meta {
    display: flex;
    align-items: center;
    gap: 16px;
}

.streamer-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.streamer-info .streamer-avatar {
    width: 40px;
    height: 40px;
}

.streamer-info .streamer-name {
    font-weight: 600;
    color: var(--primary);
}

.stream-detail-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Chat Panel */
.chat-panel {
    display: flex;
    flex-direction: column;
    background: var(--bg-main);
    border-left: 1px solid var(--border-light);
    height: 100%;
}

.chat-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-card);
}

.chat-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    transition: var(--transition-fast);
}

.chat-tab:hover {
    color: var(--primary);
}

.chat-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Pinned Comment */
.pinned-comment {
    padding: 12px 16px;
    background: var(--bg-hover);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    gap: 8px;
}

.pinned-icon {
    color: var(--primary);
}

.pinned-content {
    flex: 1;
}

.pinned-user {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.85rem;
}

.pinned-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}

.chat-message {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.chat-message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-input);
    flex-shrink: 0;
}

.chat-message-content {
    flex: 1;
}

.chat-message-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.chat-message-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.chat-message-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.chat-message-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.chat-message.system {
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
}

/* Chat Input */
.chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-card);
}

.chat-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-medium);
    border-radius: 20px;
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition-fast);
    background: var(--bg-input);
}

.chat-input:focus {
    border-color: var(--primary);
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.chat-actions {
    display: flex;
    gap: 4px;
}

.chat-action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.chat-action-btn:hover {
    background: var(--bg-input);
    color: var(--primary);
}

.chat-action-btn.send {
    background: var(--primary);
    color: white;
}

.chat-action-btn.send:hover {
    background: var(--primary-dark);
}

/* Ranking Panel */
.ranking-panel {
    display: none;
    padding: 16px;
}

.ranking-panel.active {
    display: block;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.ranking-rank {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.ranking-rank.gold {
    background: linear-gradient(135deg, #ffd700, #ffb700);
    color: #333;
}

.ranking-rank.silver {
    background: linear-gradient(135deg, #c0c0c0, #a0a0a0);
    color: #333;
}

.ranking-rank.bronze {
    background: linear-gradient(135deg, #cd7f32, #b06d2a);
    color: white;
}

.ranking-user {
    flex: 1;
    font-weight: 500;
}

.ranking-points {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
}

/* ========================================
   Profile Page Styles
   ======================================== */

.profile-header {
    position: relative;
}

.profile-banner {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    overflow: hidden;
}

.profile-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info {
    padding: 0 24px;
    margin-top: -60px;
    position: relative;
}

.profile-avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid white;
    background: var(--bg-card);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.profile-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-details {
    margin-top: 16px;
}

.profile-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.profile-username {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.profile-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.profile-stat {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.profile-stat strong {
    color: var(--text-primary);
}

.profile-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.profile-tag {
    padding: 4px 12px;
    background: var(--bg-input);
    border-radius: 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.profile-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 1200px) {
    .viewer-layout {
        grid-template-columns: 1fr 320px;
    }
}

@media (max-width: 992px) {
    :root {
        --sidebar-width: 200px;
    }

    .viewer-layout {
        grid-template-columns: 1fr;
    }

    .chat-panel {
        display: none;
    }

    .chat-panel.mobile-open {
        display: flex;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 320px;
        z-index: 200;
        box-shadow: var(--shadow-lg);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: var(--transition-normal);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .page-content {
        padding: 16px;
    }

    .stream-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 12px;
    }

    .banner-slider {
        border-radius: 0;
        margin: 0 -16px 16px;
    }
}

/* ========================================
   Utility Classes
   ======================================== */

.text-primary { color: var(--primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }

.bg-primary { background: var(--primary); }
.bg-light { background: var(--bg-input); }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.hidden { display: none !important; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ========================================
   Market Product Card Styles
   ======================================== */

.market-product-card {
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: var(--transition-normal);
    cursor: pointer;
    max-width: 140px;
}

.market-product-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--primary);
}

.market-product-thumbnail {
    position: relative;
    aspect-ratio: 1/1;
    background: var(--bg-dark);
    overflow: hidden;
    max-height: 100px;
}

.market-product-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.market-product-thumbnail-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: var(--text-muted);
}

.market-product-thumbnail-placeholder svg {
    width: 24px;
    height: 24px;
}

.market-product-type-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    padding: 2px 5px;
    background: rgba(0,0,0,0.7);
    color: white;
    border-radius: 3px;
    font-size: 0.6rem;
    font-weight: 600;
}

.market-product-purchased-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    padding: 2px 5px;
    background: var(--success);
    color: white;
    border-radius: 3px;
    font-size: 0.6rem;
    font-weight: 600;
}

.market-product-info {
    padding: 8px;
}

.market-product-title {
    font-weight: 600;
    font-size: 0.75rem;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.market-product-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
}

.market-product-broadcaster {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.65rem;
    color: var(--text-secondary);
}

.market-product-broadcaster-avatar {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bg-input);
    overflow: hidden;
}

.market-product-broadcaster-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.market-product-price {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
}

.market-product-sales {
    font-size: 0.6rem;
    color: var(--text-muted);
}

/* Market grid - smaller cards */
#marketGrid.stream-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 140px));
    gap: 12px;
}

/* Product Detail Modal */
.product-detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.product-detail-modal.show {
    opacity: 1;
    visibility: visible;
}

.product-detail-content {
    background: var(--bg-card);
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.product-detail-header {
    position: relative;
}

.product-detail-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    z-index: 10;
}

.product-detail-close:hover {
    background: rgba(0,0,0,0.7);
}

.product-detail-preview {
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-detail-preview img,
.product-detail-preview video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.product-detail-preview-blur {
    filter: blur(20px);
    opacity: 0.5;
}

.product-detail-body {
    padding: 24px;
}

.product-detail-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.product-detail-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 20px;
}

.product-detail-broadcaster {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-input);
    border-radius: 8px;
    margin-bottom: 20px;
}

.product-detail-broadcaster-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    overflow: hidden;
}

.product-detail-broadcaster-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-detail-broadcaster-name {
    font-weight: 600;
    color: var(--primary);
}

.product-detail-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.product-detail-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.product-detail-buy-btn {
    padding: 12px 32px;
    font-size: 1rem;
}
