* {
    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;
}

.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: var(--hy-theme-bg);
}

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

.icon-button,
.language-button {
    display: grid;
    width: 44px;
    height: 40px;
    place-items: center;
    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);
}

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

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

.wallet-content {
    gap: 12px;
}

.wallet-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 4px;
    border: 1px solid var(--hy-theme-line);
    border-radius: var(--hy-theme-radius-control);
    background: var(--hy-theme-surface);
}

.wallet-tabs button {
    min-height: 40px;
    border: 0;
    border-radius: calc(var(--hy-theme-radius-control) - 4px);
    background: transparent;
    color: var(--hy-theme-muted);
    font-weight: 700;
}

.wallet-tabs button[aria-selected='true'] {
    background: var(--hy-theme-primary-soft);
    color: var(--hy-theme-primary-deep);
}

.wallet-balance-card,
.amount-card {
    display: grid;
    gap: 8px;
    padding: 18px;
}

.wallet-balance-card > span,
.amount-card > label,
.amount-card > small {
    color: var(--hy-theme-muted);
    font-size: 13px;
}

.wallet-balance-card strong {
    overflow-wrap: anywhere;
    color: var(--hy-theme-text);
    font-size: clamp(27px, 8vw, 38px);
    line-height: 1.1;
}

.wallet-balance-card small {
    color: var(--hy-theme-primary-deep);
}

.amount-input-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 12px;
    border: 1px solid var(--hy-theme-line);
    border-radius: var(--hy-theme-radius-control);
    background: var(--hy-theme-surface-soft);
}

.amount-input-row > span {
    color: var(--hy-theme-primary-deep);
}

.amount-input-row input,
.address-label input {
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--hy-theme-text);
    font: inherit;
}

.amount-input-row input {
    width: 100%;
    font-size: 18px;
    font-weight: 750;
}

.amount-input-row button {
    border: 0;
    background: transparent;
    color: var(--hy-theme-primary-deep);
    font-weight: 750;
}

.conversion-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--hy-theme-muted);
    font-size: 13px;
}

.conversion-row strong {
    color: var(--hy-theme-text);
    font-size: 15px;
}

#sellerPanel,
#usdtPanel,
.history-section {
    display: grid;
    gap: 12px;
}

#sellerPanel[hidden],
#usdtPanel[hidden] {
    display: none;
}

.section-heading h2 {
    margin: 2px 0;
    color: var(--hy-theme-text);
    font-size: 16px;
}

.section-heading p {
    margin: 4px 0 0;
    color: var(--hy-theme-muted);
    font-size: 12px;
    line-height: 1.5;
}

.seller-list,
.history-list {
    display: grid;
    gap: 10px;
}

.seller-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px;
    border: 1px solid var(--hy-theme-line);
    border-radius: var(--hy-theme-radius-card);
    background: var(--hy-theme-surface);
    color: var(--hy-theme-text);
    text-align: start;
    box-shadow: var(--hy-theme-shadow);
}

.seller-card[aria-pressed='true'] {
    border-color: var(--hy-theme-primary-strong);
    box-shadow: 0 0 0 2px var(--hy-theme-focus-ring);
}

.seller-avatar {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    overflow: hidden;
    border-radius: var(--hy-theme-radius-circle);
    background: var(--hy-theme-primary-soft);
    color: var(--hy-theme-primary-deep);
    font-weight: 800;
}

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

.seller-copy {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.seller-copy strong,
.seller-copy span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.seller-copy span,
.seller-ratio {
    color: var(--hy-theme-muted);
    font-size: 12px;
}

.seller-check {
    color: var(--hy-theme-primary-deep);
    font-size: 20px;
}

.wallet-submit,
.secondary-submit {
    min-height: 48px;
    border-radius: var(--hy-theme-radius-control);
    font-weight: 800;
}

.wallet-submit {
    border: 0;
    background: var(--hy-theme-button);
    color: white;
    box-shadow: var(--hy-theme-button-shadow);
}

.secondary-submit {
    border: 1px solid var(--hy-theme-primary-strong);
    background: var(--hy-theme-primary-soft);
    color: var(--hy-theme-primary-deep);
}

.wallet-submit:disabled,
.secondary-submit:disabled {
    background: var(--hy-theme-button-disabled);
    color: var(--hy-theme-button-disabled-text);
    box-shadow: none;
}

.address-status,
.address-label {
    padding: 14px;
    border: 1px solid var(--hy-theme-line);
    border-radius: var(--hy-theme-radius-control);
    background: var(--hy-theme-surface);
}

.address-status {
    color: var(--hy-theme-muted);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.address-status.has-address {
    color: var(--hy-theme-primary-deep);
}

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

.address-label input {
    padding: 6px 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.history-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 12px;
    padding: 14px;
    border: 1px solid var(--hy-theme-line);
    border-radius: var(--hy-theme-radius-control);
    background: var(--hy-theme-surface);
}

.history-item strong {
    color: var(--hy-theme-text);
}

.history-item .history-amount {
    color: var(--hy-theme-danger);
    font-weight: 800;
}

.history-item small {
    grid-column: 1 / -1;
    color: var(--hy-theme-muted);
}

.empty-state {
    display: grid;
    gap: 5px;
    padding: 20px;
    border: 1px dashed var(--hy-theme-line);
    border-radius: var(--hy-theme-radius-card);
    color: var(--hy-theme-muted);
    text-align: center;
}

.empty-state[hidden] {
    display: none;
}

body.is-busy button,
body.is-busy input {
    pointer-events: none;
}
