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

body {
    background: #000;
    color: #333;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Dialog container */
.page-dialog {
    width: 750px;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 50px rgba(0,0,0,0.8);
    position: relative;
}

/* Header */
.dialog-header {
    background: transparent;
    padding: 0 24px;
    display: flex;
    align-items: flex-end;
    height: 44px;
    position: relative;
    padding-bottom: 4px;
}

.dialog-header-title {
    font-size: 17px;
    font-weight: 400;
    color: #ddd;
}

.dialog-header-avatar {
    position: absolute;
    left: 50%;
    bottom: 5px;
    transform: translateX(-50%);
    width: 48px;
    height: 48px;
    border: 2px solid #777;
    background: #444;
    overflow: hidden;
    z-index: 2;
}

.dialog-header-avatar img { width: 100%; height: 100%; }

.dialog-header-time {
    margin-left: auto;
    font-size: 15px;
    color: #ccc;
}

/* Tab bar */
.tab-bar {
    background: linear-gradient(180deg, #5a5a6a 0%, #4a4a5a 100%);
    display: flex;
    align-items: stretch;
    height: 32px;
    border-bottom: none;
}

.tab-item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    color: #aaa;
    text-decoration: none;
    border-right: 1px solid #3a3a4a;
}

.tab-item:last-child { border-right: none; }
.tab-item:hover { background: rgba(255,255,255,0.05); color: #ccc; }

.tab-item.active {
    background: #fff;
    color: #333;
}

/* Bottom bar */
.dialog-bottom {
    background: linear-gradient(180deg, #444 0%, #333 100%);
    border-top: 1px solid #555;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.bottom-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #ccc;
}

.btn-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    color: rgba(0,0,0,0.6);
    line-height: 1;
    border: 3px solid rgba(180,180,180,0.6);
    box-shadow: 0 2px 4px rgba(0,0,0,0.5), inset 0 2px 4px rgba(255,255,255,0.35), inset 0 -1px 3px rgba(0,0,0,0.15);
    text-shadow: 0 1px 0 rgba(255,255,255,0.2);
    flex-shrink: 0;
}

.btn-a {
    background: radial-gradient(circle at 50% 35%, #c2e872 0%, #8cc63f 40%, #5a9e1e 80%, #4a8818 100%);
    border-color: rgba(140,198,63,0.5);
}
.btn-b {
    background: radial-gradient(circle at 50% 35%, #f09090 0%, #d95555 40%, #c03030 80%, #a02525 100%);
    border-color: rgba(217,85,85,0.5);
}
.btn-x {
    background: radial-gradient(circle at 50% 35%, #9cc8f0 0%, #5a9fd4 40%, #3a80b8 80%, #2a6a9a 100%);
    border-color: rgba(90,159,212,0.5);
    color: #fff;
    font-weight: bold;
}
.btn-y {
    background: radial-gradient(circle at 50% 35%, #f0d868 0%, #d4b030 40%, #b89818 80%, #9a8010 100%);
    border-color: rgba(212,176,48,0.5);
    color: #fff;
    font-weight: bold;
}

/* Avatar Picker */
.avatar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 100;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.85);
}

.avatar-overlay.show { display: flex; }

@keyframes avatarPopIn {
    0% { transform: scale(0.7); opacity: 0; }
    60% { transform: scale(1.02); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes avatarPopOut {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(0.7); opacity: 0; }
}

.avatar-dialog {
    width: 700px;
    max-width: 90vw;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
    animation: avatarPopIn 0.25s ease-out forwards;
}

.avatar-dialog.closing {
    animation: avatarPopOut 0.2s ease-in forwards;
}

.avatar-header {
    background: transparent;
    padding: 0 24px 4px;
    display: flex;
    align-items: flex-end;
    height: 44px;
    position: relative;
}

.avatar-header-title {
    font-size: 17px;
    font-weight: 400;
    color: #ddd;
}

.avatar-header-preview {
    position: absolute;
    left: 50%;
    bottom: 5px;
    transform: translateX(-50%);
    width: 48px;
    height: 48px;
    border: 2px solid #777;
    background: #444;
    overflow: hidden;
    z-index: 2;
}

.avatar-header-preview img { width: 100%; height: 100%; }

.avatar-header-time {
    margin-left: auto;
    font-size: 15px;
    color: #ccc;
}

.avatar-body {
    display: flex;
    height: 380px;
    overflow: hidden;
}

.avatar-grid-col {
    width: 55%;
    background: linear-gradient(180deg, #e0e0e0 0%, #d4d4d4 100%);
    padding: 16px;
    overflow-y: auto;
    border-right: 1px solid #aaa;
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.avatar-option {
    width: 100%;
    aspect-ratio: 1;
    border: 3px solid transparent;
    cursor: pointer;
    background: #ccc;
    overflow: hidden;
    transition: border-color 0.15s;
}

.avatar-option img {
    width: 100%;
    height: 100%;
    display: block;
}

.avatar-option:hover {
    border-color: #7fba00;
}

.avatar-option.selected {
    border-color: #7fba00;
    box-shadow: 0 0 0 2px #7fba00;
}

.avatar-info-col {
    width: 45%;
    background: linear-gradient(160deg, #8a8a9a 0%, #7a7a8a 30%, #6e6e7e 100%);
    display: flex;
    flex-direction: column;
}

.avatar-profile-card {
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.avatar-profile-tag {
    background: linear-gradient(180deg, #e88020 0%, #d07018 100%);
    padding: 6px 14px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

.avatar-profile-stats {
    display: flex;
    padding: 10px 14px;
    gap: 12px;
    background: rgba(255,255,255,0.08);
}

.avatar-profile-img {
    width: 56px;
    height: 56px;
    background: #555;
    border: 1px solid #777;
    flex-shrink: 0;
    overflow: hidden;
}

.avatar-profile-img img { width: 100%; height: 100%; }

.avatar-stat-list {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    flex: 1;
}

.avatar-stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #ddd;
}

.avatar-stat-label { color: #ccc; }
.avatar-stat-value { font-weight: 600; color: #fff; display: flex; align-items: center; gap: 4px; }

.avatar-description {
    padding: 16px 14px;
    font-size: 14px;
    color: #ccc;
    line-height: 1.5;
    flex: 1;
}

.avatar-bottom {
    background: linear-gradient(180deg, #333 0%, #222 100%);
    border-top: 1px solid #444;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .avatar-dialog { width: 95vw; max-width: 95vw; }
    .avatar-body { flex-direction: column; height: auto; max-height: 70vh; overflow-y: auto; }
    .avatar-grid-col { width: 100%; border-right: none; padding: 12px; overflow-y: visible; }
    .avatar-info-col { width: 100%; display: none; }
    .avatar-grid { grid-template-columns: repeat(5, 1fr); gap: 6px; }
    .avatar-option { border-width: 2px; }
    .avatar-header { padding: 0 12px 4px; }
    .avatar-header-title { font-size: 14px; }
    .avatar-bottom { padding: 8px 12px; gap: 16px; }
}

/* Credit */
.credit {
    position: fixed;
    bottom: 12px;
    left: 16px;
    font-size: 11px;
    color: #555;
    z-index: 9999;
}

/* Mobile */
@media (max-width: 600px) {
    body { padding: 16px; align-items: center; justify-content: center; }

    .page-dialog {
        width: 100%;
        max-width: 100%;
        max-height: none;
        box-shadow: none;
    }

    .dialog-header-title { font-size: 18px; }
    .dialog-header-time { font-size: 14px; }
    .dialog-header-avatar { width: 40px; height: 40px; }
    .credit { font-size: 10px; }
}
