/*
 * 金额换算小组件
 *
 * 卡片只有 1x1 一个图标（1.6.48 起取消 2x2 卡片，历史数据也按 1x1 渲染）。
 * 弹窗里的每一处尺寸/颜色都取自 mtab 的金额转写窗口（样式作用域 data-v-8c417a94），
 * 原样复刻，别凭感觉改 —— 中途试过蓝的、苹果白卡的，最后都退回这套黑金。
 */

/* ---------- 卡片 ---------- */

/*
 * 跟日历卡一样要自己撑成 flex 列：格子是普通块级，不写这个按钮就按内容高度缩着，
 * 卡片会比两行矮一大截。
 */
.app-card--amt {
    display: flex;
    flex-direction: column;
    align-items: center;
}


/* ---------- 1x1：就是一个普通图标 ---------- */

/*
 * 骨架直接用链接图标的 .app-icon（72×72、圆角、grid 居中、overflow 裁切），
 * 图标本身是一整块黑金圆角图（123 ↔ 壹贰叁），底色交给图，别再叠一层。
 */
.app-icon.amt-mini {
    border: 0;
    padding: 0;
    cursor: pointer;
    background: transparent;
    overflow: hidden;
    box-shadow: 0 6px 16px rgba(18, 24, 38, .18);
    transition: transform .18s cubic-bezier(.2, .7, .3, 1), box-shadow .18s ease;
}

.app-icon.amt-mini:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(18, 24, 38, .22);
}

.app-icon.amt-mini img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    -webkit-user-drag: none;
}

/* 图标和名字之间的间距跟普通图标一致（.app 的 gap 是 8） */
.app-card--amt[data-size="1x1"] {
    gap: 8px;
}

/* ---------- 金额转写窗口（照 mtab 原样） ---------- */

/*
 * mtab 里这是占满整个 app 窗口的一页（height:100%，padding-top:38px 给窗口标题栏）。
 * 在主题里它是一个弹窗，所以把「占满」换成固定尺寸，其余尺寸/间距/配色一字未改。
 */
.ac-root {
    position: relative;
    width: min(980px, 100%);
    max-height: min(680px, 100%);
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    overflow: hidden;
    color: #2a1b1e;
    background: #eee5d3;
    box-shadow: 0 32px 80px rgba(10, 16, 28, .28);
    container: amount-window / inline-size;
}

.ac-root,
.ac-root * {
    box-sizing: border-box;
    min-width: 0;
}

/*
 * 窗口按钮：Windows 风，跟计算器 / 单位换算那颗是同一套数值
 * （34x30、圆角 6、透明底、hover 浅灰，关闭 hover 变 Windows 红）。
 * 原来那两颗 mtab 的 mac 红绿圆点不用了。
 */
.ac-dots {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 2;
    display: flex;
    gap: 2px;
}

.ac-dot {
    display: grid;
    place-items: center;
    width: 34px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #4b4b4b;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}

.ac-dot > svg {
    display: block;
    width: 16px;
    height: 16px;
}

.ac-dot:hover {
    background: rgba(0, 0, 0, .07);
}

.ac-dot--close {
    --cs-x-focus: #e81123;
}

.ac-dot--close:hover {
    background: #e81123;
    color: #ffffff;
}

.ac-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.ac-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 24px;
    max-width: 1060px;
    margin: auto;
    /* 上边留够，别被右上角那两颗窗口按钮压到标题 */
    padding: 46px 24px 24px;
}

.ac-workspace {
    display: flex;
    flex-direction: column;
}

.ac-section-heading,
.ac-result-top,
.ac-result-bottom,
.ac-field-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.ac-section-heading h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.4;
}

.ac-section-heading p {
    margin: 5px 0 0;
    color: #856e5d;
    font-size: 12px;
}

.ac-digit-count {
    font-size: 12.5px;
    color: #9b773b;
    white-space: nowrap;
}

.ac-input-card {
    margin-top: 20px;
}

.ac-field-label {
    font-size: 12px;
    font-weight: 500;
}

.ac-field-label span:last-child {
    font-size: 12px;
    color: #967d68;
    font-weight: 400;
}

.ac-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    margin-top: 10px;
    background: #fffaf0;
    border: 1px solid #d6b979;
    border-radius: 12px;
    transition: border-color .2s, box-shadow .2s;
}

.ac-input-wrap:focus-within {
    border-color: #a93232;
    box-shadow: 0 0 0 3px rgba(169, 50, 50, .14);
}

.ac-input-wrap.is-error {
    border-color: #9b3434;
}

.ac-currency {
    padding: 0 14px;
    border-right: 1px solid #ead8ae;
    color: #a93232;
    font-size: 12px;
    font-weight: 700;
}

.ac-input-wrap input {
    width: 100%;
    height: 56px;
    flex: 1;
    border: 0;
    padding: 0 12px;
    outline: 0;
    background: transparent;
    color: #26191c;
    font-family: inherit;
    font-size: 24px;
    line-height: 24px;
    font-variant-numeric: tabular-nums;
}

.ac-input-placeholder {
    position: absolute;
    left: 64px;
    top: 50%;
    transform: translateY(-58%);
    color: #b7a78c;
    font-size: 17px;
    line-height: 24px;
    pointer-events: none;
}

.ac-input-placeholder[hidden] {
    display: none;
}

.ac-clear {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    margin-right: 12px;
    border: 0;
    border-radius: 50%;
    background: #ead9b8;
    color: #7e252c;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
}

.ac-clear[hidden] {
    display: none;
}

.ac-preview-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
    color: #967e6b;
    font-size: 12.5px;
}

.ac-preview-line strong {
    color: #8e2f34;
    font-size: 12px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.ac-quick-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 16px;
}

.ac-quick-label {
    font-size: 12px;
    color: #92765d;
    margin-right: 4px;
}

.ac-quick-row button {
    border: 1px solid #d7bd82;
    border-radius: 6px;
    padding: 5px 8px;
    color: #7d292f;
    background: #fbf3e3;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.ac-quick-row button:hover {
    border-color: #a93232;
    background: #f1dfbe;
}

.ac-quick-row b {
    font-weight: 400;
    margin-left: 3px;
}

.ac-result-card {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 175px;
    margin-top: 22px;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #b78a3f;
    background: linear-gradient(145deg, #1a1416 0%, #2b1c20 100%);
    color: #f6e7c4;
    box-shadow: 0 8px 20px rgba(65, 24, 24, .16);
}

.ac-result-state {
    font-size: 12px;
    color: #d4a950;
    letter-spacing: .08em;
}

.ac-result-value {
    flex: 1;
    padding: 22px 0;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.6;
    overflow-wrap: anywhere;
    user-select: text;
}

.ac-result-value.placeholder {
    color: #bca882;
    font-size: 16px;
    font-weight: 400;
}

.ac-result-card.is-error {
    border-color: #d06b57;
}

.ac-result-card.is-error .ac-result-value {
    color: #ef9a78;
}

.ac-result-bottom {
    font-size: 12px;
    color: #c8ae7b;
}

.ac-copy {
    padding: 8px 14px;
    border: 0;
    border-radius: 7px;
    color: #fff8e8;
    background: #a93232;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.ac-copy:disabled {
    opacity: .45;
    cursor: default;
}

.ac-aside {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ac-aside-card {
    padding: 17px;
    border: 1px solid #c9a75f;
    border-radius: 12px;
    background: #fbf3e1;
}

.ac-aside-card h2 {
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 600;
}

.ac-rule-card {
    color: #f8e9c7;
    background: linear-gradient(145deg, #1b1517 0%, #302025 100%);
    border-color: #5b3830;
    box-shadow: inset 4px 0 #a93232;
}

.ac-rule-card h2 {
    color: #f8e9c7;
}

.ac-rule-row {
    display: flex;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid #503137;
}

.ac-rule-row:nth-of-type(3) {
    border-bottom: 0;
}

.ac-rule-num {
    color: #d3a64d;
    font-size: 12px;
}

.ac-rule-row b {
    display: block;
    font-size: 12.5px;
    font-weight: 500;
}

.ac-rule-row small {
    display: block;
    margin-top: 4px;
    color: #d0b78d;
    font-size: 12px;
    line-height: 1.6;
}

/* mtab 那份是 5 列，但线上截图是 4 列（零壹贰叁 / 肆伍陆柒 / 捌玖），按截图来 */
.ac-reference-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
}

.ac-reference-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 7px 0;
    border-radius: 5px;
    background: #ead9b3;
    color: #6e242a;
}

.ac-reference-item b {
    font-size: 16px;
    font-weight: 600;
}

.ac-reference-item span {
    font-size: 11.5px;
    color: #9b7c48;
    margin-top: 2px;
}

.ac-unit-list {
    display: flex;
    justify-content: space-between;
    padding-top: 12px;
    color: #8c6e43;
    font-size: 12px;
}

.ac-copy:focus-visible,
.ac-quick-row button:focus-visible,
.ac-clear:focus-visible,
.ac-dot:focus-visible {
    outline: 2px solid #a93232;
    outline-offset: 2px;
}

/* mtab 的容器查询：窗口窄了就单列、aside 变两列再变一列 */
@container amount-window (max-width: 720px) {
    .ac-content {
        grid-template-columns: minmax(0, 1fr);
        padding: 30px 20px 20px;
        gap: 18px;
    }

    .ac-aside {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@container amount-window (max-width: 440px) {
    .ac-content {
        padding: 28px 16px 16px;
    }

    .ac-aside {
        grid-template-columns: minmax(0, 1fr);
    }

    .ac-section-heading h1 {
        font-size: 20px;
    }

    .ac-result-card {
        padding: 16px;
    }

    .ac-input-wrap input {
        font-size: 20px;
    }

    .ac-result-value {
        font-size: 21px;
    }
}

/* 手机上弹窗贴边，跟日历弹窗一致 */
@media (max-width: 820px) {
    .ac-root {
        width: 100%;
        max-height: 100%;
        height: 100%;
        border-radius: 0;
    }
}
