* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
    background: var(--hy-theme-bg);
    color: var(--hy-theme-text);
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        'Segoe UI',
        sans-serif;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.fami-host-center {
    background:
        radial-gradient(
            circle at 16% 5%,
            var(--hy-theme-primary-soft),
            transparent 32%
        ),
        var(--hy-theme-bg);
}

.center-header {
    position: sticky;
    z-index: 20;
    top: 0;
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    align-items: center;
    min-height: calc(64px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 12px 0;
    border-bottom: 1px solid var(--hy-theme-line);
    background: color-mix(in srgb, var(--hy-theme-bg) 88%, transparent);
    backdrop-filter: blur(18px);
}

.center-header h1 {
    margin: 0;
    font-size: 22px;
    line-height: 1.2;
    text-align: center;
}

.icon-button,
.language-button {
    display: grid;
    place-items: center;
    width: 44px;
    height: 40px;
    border: 0;
    border-radius: var(--hy-theme-radius-language);
    background: var(--hy-theme-surface);
    color: var(--hy-theme-text);
    box-shadow: var(--hy-theme-shadow);
}

.icon-button span {
    font-size: 38px;
    font-weight: 300;
    line-height: 30px;
}

.language-switcher {
    position: relative;
}

.language-button {
    font-size: 13px;
    font-weight: 800;
}

.language-menu {
    position: absolute;
    top: 46px;
    right: 0;
    overflow: hidden;
    width: 64px;
    border: 1px solid var(--hy-theme-line);
    border-radius: var(--hy-theme-radius-small);
    background: var(--hy-theme-surface);
    box-shadow: var(--hy-theme-modal-shadow);
}

.language-menu button {
    width: 100%;
    padding: 10px;
    border: 0;
    background: transparent;
    color: var(--hy-theme-text);
}

.language-menu button.is-active {
    background: var(--hy-theme-primary-soft);
    color: var(--hy-theme-primary-deep);
}

.profile-card,
.contact-card,
.balance-card {
    display: flex;
    align-items: center;
    padding: 18px;
}

.avatar-shell {
    display: grid;
    flex: 0 0 76px;
    place-items: center;
    overflow: hidden;
    width: 76px;
    height: 76px;
    border: 3px solid var(--hy-theme-primary);
    border-radius: 50%;
    background: var(--hy-theme-primary-soft);
    color: var(--hy-theme-primary-deep);
    font-size: 30px;
    font-weight: 800;
}

.avatar-shell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 5px;
    margin-inline-start: 16px;
}

.profile-copy strong {
    overflow: hidden;
    font-size: 21px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-copy > span:not(.agency-pill) {
    color: var(--hy-theme-muted);
    font-size: 13px;
}

.agency-pill {
    align-self: flex-start;
    padding: 5px 10px;
    border-radius: var(--hy-theme-radius-pill);
    background: var(--hy-theme-primary-soft);
    color: var(--hy-theme-primary-deep);
    font-size: 12px;
    font-weight: 750;
}

.contact-card {
    gap: 14px;
}

.contact-icon {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 50%;
    background: color-mix(
        in srgb,
        var(--hy-theme-success) 14%,
        var(--hy-theme-surface)
    );
    color: var(--hy-theme-success);
    font-size: 20px;
}

.contact-card > div {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 3px;
}

.contact-card > div span {
    overflow: hidden;
    color: var(--hy-theme-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contact-card > button {
    border: 0;
    background: transparent;
    color: var(--hy-theme-primary-deep);
    font-weight: 750;
}

.balance-card {
    justify-content: space-between;
    gap: 18px;
}

.balance-card > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 8px;
}

.card-label,
.section-title-row span {
    color: var(--hy-theme-muted);
    font-size: 13px;
}

.balance-value {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-wrap: anywhere;
    font-size: clamp(20px, 6vw, 30px);
}

.primary-action {
    min-width: 94px;
    min-height: 42px;
    padding: 0 18px;
    border: 0;
    border-radius: var(--hy-theme-radius-pill);
    background: var(--hy-theme-button);
    color: white;
    box-shadow: var(--hy-theme-button-shadow);
    font-weight: 750;
}

.section-title-row {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.section-title-row h2 {
    margin: 0;
    font-size: 19px;
}

.guild-filter-bar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 12px;
}

.guild-filter-bar button {
    padding: 5px 4px;
    font-size: 11px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: hidden;
}

.metrics-grid article {
    display: flex;
    min-height: 104px;
    align-items: center;
    justify-content: center;
    padding: 14px 8px;
    border-right: 1px solid var(--hy-theme-line);
    border-bottom: 1px solid var(--hy-theme-line);
    flex-direction: column;
    gap: 8px;
    text-align: center;
}

.metrics-grid article:nth-child(3n) {
    border-right: 0;
}

.metrics-grid article:nth-last-child(-n + 2) {
    border-bottom: 0;
}

.metrics-grid article strong {
    color: var(--hy-theme-text);
    font-size: 19px;
}

.metrics-grid article span {
    color: var(--hy-theme-muted);
    font-size: 12px;
    line-height: 1.35;
}

.stats-status {
    margin-bottom: 10px;
    padding: 11px 14px;
    border: 1px solid var(--hy-theme-line);
    border-radius: var(--hy-theme-radius-small);
    background: var(--hy-theme-primary-soft);
    color: var(--hy-theme-primary-deep);
    font-size: 13px;
}

.edit-dialog {
    width: min(420px, calc(100vw - 32px));
    padding: 0;
    border: 0;
    border-radius: var(--hy-theme-radius-modal);
    background: var(--hy-theme-surface);
    color: var(--hy-theme-text);
    box-shadow: var(--hy-theme-modal-shadow);
}

.edit-dialog::backdrop {
    background: rgb(25 18 38 / 45%);
}

.edit-dialog form {
    display: grid;
    gap: 18px;
    padding: 22px;
}

.edit-dialog h2 {
    margin: 0;
    font-size: 20px;
}

.edit-dialog label {
    display: grid;
    gap: 8px;
    color: var(--hy-theme-muted);
    font-size: 13px;
}

.edit-dialog input {
    width: 100%;
    min-height: 46px;
    padding: 0 13px;
    border: 1px solid var(--hy-theme-line);
    border-radius: var(--hy-theme-radius-control);
    outline: none;
    background: var(--hy-theme-surface-soft);
    color: var(--hy-theme-text);
}

.edit-dialog input:focus {
    border-color: var(--hy-theme-primary-strong);
    box-shadow: 0 0 0 4px var(--hy-theme-focus-ring);
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.dialog-actions button:not(.primary-action) {
    min-height: 42px;
    padding: 0 18px;
    border: 1px solid var(--hy-theme-line);
    border-radius: var(--hy-theme-radius-pill);
    background: var(--hy-theme-surface);
    color: var(--hy-theme-text);
}

[dir='rtl'] .language-menu {
    right: auto;
    left: 0;
}

@media (max-width: 420px) {
    .guild-filter-bar {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .metrics-grid article:nth-child(3n) {
        border-right: 1px solid var(--hy-theme-line);
    }

    .metrics-grid article:nth-child(2n) {
        border-right: 0;
    }

    .metrics-grid article:nth-last-child(-n + 2) {
        border-bottom: 0;
    }
}
