:root {
    --bg-canvas: #131314;
    --bg-panel: #1e1f20;
    --bg-surface: #282a2c;
    --bg-hover: #333538;
    --border-color: #333537;
    --border-hover: #444746;
    --text-primary: #e3e3e3;
    --text-secondary: #9aa0a6;
    --star-gold: #fbbf24;
}

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

body {
    background-color: var(--bg-canvas);
    color: var(--text-primary);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
    height: 100vh;
    width: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.workspace-grid {
    width: 100%;
    max-width: 1880px;
    height: 100vh;
    padding: 14px 16px;
    display: grid;
    grid-template-columns: minmax(0, 1.68fr) minmax(0, 1fr) 330px;
    gap: 14px;
    align-items: stretch;
}

.panel-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px 16px;
    min-width: 0;
}

.section-heading {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.left-column {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    height: 100%;
}

.flagship-stack {
    display: grid;
    grid-template-rows: repeat(3, minmax(0, 1fr));
    gap: 12px;
    height: 100%;
    min-height: 0;
}

.project-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    display: grid;
    grid-template-columns: minmax(240px, 48%) minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    transition: border-color 0.15s ease;
}

.project-card:hover {
    border-color: var(--border-hover);
}

.media-frame {
    width: min(100%, calc((100vh - 124px) * 16 / 27));
    aspect-ratio: 16 / 9;
    justify-self: center;
    border-radius: 8px;
    overflow: hidden;
    background: #0b0c0d;
    border: 1px solid var(--border-color);
    position: relative;
}

.video-wrapper iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.image-wrapper {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

.zoom-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(19, 19, 20, 0.9);
    border: 1px solid var(--border-hover);
    color: var(--text-primary);
    font-size: 0.68rem;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 5px;
}

.project-info {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    min-height: 0;
    min-width: 0;
    padding: 4px 2px;
}

.project-top {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.project-title {
    font-size: clamp(0.95rem, 1.05vw, 1.12rem);
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.25;
}

.project-desc {
    font-size: clamp(0.76rem, 0.85vw, 0.86rem);
    line-height: 1.48;
    color: var(--text-secondary);
}

.project-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.neutral-btn {
    text-decoration: none;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-hover);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 6px 13px;
    border-radius: 7px;
    white-space: nowrap;
    transition: background 0.15s ease;
}

.neutral-btn:hover {
    background: var(--bg-hover);
}

.project-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.proj-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 3px 8px;
    border-radius: 5px;
}

.lang-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.center-column {
    display: grid;
    grid-template-rows: minmax(0, 0.92fr) minmax(0, 1.08fr);
    gap: 12px;
    min-height: 0;
    min-width: 0;
    height: 100%;
}

.reviews-panel,
.other-projects-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.rating-header,
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 9px;
    flex-shrink: 0;
}

.rating-score-block {
    display: flex;
    align-items: center;
    gap: 10px;
}

.score-number {
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: "JetBrains Mono", monospace;
    line-height: 1;
}

.stars-row {
    color: var(--star-gold);
    font-size: 0.86rem;
    letter-spacing: 2px;
}

.score-sub {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.reviews-stack {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 9px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.review-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 9px;
    padding: 11px 13px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.review-top {
    display: flex;
    align-items: center;
    gap: 9px;
}

.review-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

.review-author-line {
    display: flex;
    align-items: center;
    gap: 6px;
}

.review-author {
    font-size: 0.81rem;
    font-weight: 600;
}

.review-stars {
    color: var(--star-gold);
    font-size: 0.74rem;
    letter-spacing: 1px;
}

.review-handle {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.review-text {
    font-size: 0.76rem;
    line-height: 1.42;
    color: var(--text-primary);
}

.secondary-repos-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.secondary-repo-item {
    text-decoration: none;
    color: inherit;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 9px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    gap: 5px;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.secondary-repo-item:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
}

.sec-repo-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.sec-repo-name {
    font-size: clamp(0.84rem, 0.9vw, 0.95rem);
    font-weight: 600;
    font-family: "JetBrains Mono", monospace;
    color: var(--text-primary);
}

.sec-repo-desc {
    font-size: clamp(0.73rem, 0.78vw, 0.8rem);
    color: var(--text-secondary);
    line-height: 1.38;
}

.more-projects-btn {
    text-decoration: none;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-hover);
    border-radius: 8px;
    padding: 9px 14px;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
    transition: background 0.15s ease;
}

.more-projects-btn:hover {
    background: var(--bg-hover);
}

.profile-sidebar {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    gap: 10px;
}

.tg-profile-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 4px 0 2px 0;
}

.tg-avatar-img {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-hover);
    background: var(--bg-surface);
    margin-bottom: 10px;
}

.tg-name {
    font-size: 1.18rem;
    font-weight: 700;
    color: var(--text-primary);
}

.tg-status {
    font-size: 0.76rem;
    color: var(--text-secondary);
    margin-top: 3px;
}

.tg-divider {
    height: 1px;
    background: var(--border-color);
    width: 100%;
    flex-shrink: 0;
}

.tg-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tg-section-label {
    font-size: 0.69rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tg-contacts-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.tg-contact-row {
    text-decoration: none;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 7px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    width: 100%;
    color: var(--text-primary);
    transition: background 0.15s ease, border-color 0.15s ease;
}

.tg-contact-row:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
}

.tg-contact-handle {
    font-size: 0.79rem;
    font-weight: 500;
    font-family: "JetBrains Mono", monospace;
    color: var(--text-primary);
}

.tg-contact-type {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.languages-bar,
.tech-tags-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.lang-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.73rem;
    font-weight: 500;
}

.stack-tag {
    font-size: 0.68rem;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 3px 7px;
    border-radius: 5px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.86);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}

.modal-backdrop.open {
    display: flex;
}

.modal-content {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.modal-content img {
    max-width: 100%;
    max-height: 82vh;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.modal-close-btn {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-hover);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.modal-caption {
    width: 100%;
    text-align: center;
    font-size: 0.84rem;
    color: var(--text-secondary);
}

.copy-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-hover);
    font-weight: 600;
    font-size: 0.78rem;
    padding: 8px 14px;
    border-radius: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1100;
}

.copy-toast.visible {
    opacity: 1;
}

@media (max-height: 839px), (max-width: 1240px) {
    body {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
        align-items: flex-start;
    }
    .workspace-grid {
        height: auto;
        min-height: 100vh;
        grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr) 310px;
    }
    .flagship-stack {
        height: auto;
        grid-template-rows: auto;
    }
    .project-card {
        min-height: 220px;
    }
    .media-frame {
        width: 100%;
    }
    .center-column {
        height: auto;
        grid-template-rows: auto auto;
    }
    .reviews-panel,
    .other-projects-panel {
        height: auto;
        overflow: visible;
    }
    .reviews-stack,
    .secondary-repos-stack {
        overflow: visible;
    }
    .profile-sidebar {
        height: auto;
        justify-content: flex-start;
        overflow: visible;
    }
}

@media (max-width: 1024px) {
    .workspace-grid {
        grid-template-columns: 1fr;
    }
    .profile-sidebar {
        order: 1;
    }
    .left-column {
        order: 2;
    }
    .center-column {
        order: 3;
    }
    .tg-contacts-list {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
}

@media (max-width: 680px) {
    .workspace-grid {
        padding: 10px;
        gap: 12px;
    }
    .project-card {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 10px;
    }
    .project-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .neutral-btn {
        text-align: center;
    }
    .tg-avatar-img {
        width: 78px;
        height: 78px;
    }
    .tg-contacts-list {
        grid-template-columns: 1fr;
    }
    .rating-header {
        flex-wrap: wrap;
        gap: 8px;
    }
}