/*取消選取*/
* {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

html {
    font-size: 16px;
    touch-action: manipulation;
}

body {
    height: 100%;
    touch-action: manipulation;
    overscroll-behavior-y: none;
}

/* 取消下拉更新 */
@media screen and (pointer: coarse) {
    @supports (-webkit-backdrop-filter: blur(1px)) and (overscroll-behavior-y: none) {
        html {
            min-height: 100.3%;
            overscroll-behavior-y: none;
        }
    }
}

@media screen and (pointer: coarse) {
    @supports (-webkit-backdrop-filter: blur(1px)) and (not (overscroll-behavior-y: none)) {
        html {
            height: 100%;
            overflow-x: hidden;
        }

        body {
            margin: 0;
            max-height: 100%;
            overflow: auto;
            -webkit-overflow-scrolling: touch;
        }
    }
}

h1 {
    font-size: 20px;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(90deg, #9e67f8, #0ad49e);
    padding: 8px 36px;
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    text-align: center;
    margin: 8px auto;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
}

/* ===== 關鍵布局部分 - 使用最高優先級 ===== */

.tab-content {
    height: calc(100vh - 38px) !important;
    overflow: hidden !important;
}

/* 只對顯示中的 tab-pane 使用 flexbox */
.tab-content > .tab-pane.active,
.tab-content > .tab-pane.show {
    height: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

/* 預設所有直接子元素不收縮 */
.tab-content > .tab-pane.active > div,
.tab-content > .tab-pane.show > div {
    flex-shrink: 0 !important;
}

/* expression 使用 flex 佔滿剩餘空間 */
.tab-content > .tab-pane.active > .expression,
.tab-content > .tab-pane.show > .expression {
    flex: 1 1 auto !important;
    flex-shrink: 1 !important;
    min-height: 0 !important;
    height: auto !important;
}

.expression {
    font-size: 11vh;
    font-family: math, monospace;
    background-color: #f5f5f5 !important;
    text-align: right;
    word-wrap: break-word;
    padding: 4px 8px;
    overflow-y: auto;
    transition: font-size 0.3s ease;
}

.expression::selection {
    background-color: #065378;
    color: white;
}



.nowrap{
    white-space: nowrap;
    display: inline-block;
}

.rounded-circle{
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

@font-face {
    font-family: "ErikaType";
    src: url("webfonts/ErikaType.woff2") format("woff2");
}

@font-face {
    font-family: "CourierPrime";
    src: url("webfonts/CourierPrime.woff2") format("woff2");
}

.num_button {
    font-family: CourierPrime, monospace;
    font-size: 7.5vh;
    text-align: center;
    font-weight: bold;
    width: 100%;
}

/* btn3d */
.btn3d {
    position: relative;
    top: -6px;
    border: 0;
    transition: all 40ms linear;
    padding: 0 4px;
    line-height: 30px;
    height: 30px;
    margin-bottom: 4px;
}

.btn3d:active:focus,
.btn3d:focus:hover,
.btn3d:focus {
    -moz-outline-style: none;
    outline: medium none;
}

.btn3d:active,
.btn3d.active {
    top: 2px;
}

.btn3d.btn-white {
    color: #666666;
    box-shadow: 0 0 0 1px #ebebeb inset, 0 0 0 2px rgba(255, 255, 255, 0.10) inset, 0 8px 0 0 #f5f5f5, 0 8px 8px 1px rgba(0, 0, 0, .2);
    background-color: #fff;
}

.btn3d.btn-white:active,
.btn3d.btn-white.active {
    color: #666666;
    box-shadow: 0 0 0 1px #ebebeb inset, 0 0 0 1px rgba(255, 255, 255, 0.15) inset, 0 1px 3px 1px rgba(0, 0, 0, .1);
    background-color: #fff;
}

.btn3d.btn-default {
    color: #666666;
    box-shadow: 0 0 0 1px #ebebeb inset, 0 0 0 2px rgba(255, 255, 255, 0.10) inset, 0 8px 0 0 #BEBEBE, 0 8px 8px 1px rgba(0, 0, 0, .2);
    background-color: #f9f9f9;
}

.btn3d.btn-default:active,
.btn3d.btn-default.active {
    color: #666666;
    box-shadow: 0 0 0 1px #ebebeb inset, 0 0 0 1px rgba(255, 255, 255, 0.15) inset, 0 1px 3px 1px rgba(0, 0, 0, .1);
    background-color: #f9f9f9;
}

.btn3d.btn-dark {
    color: #ffffff;
    box-shadow: 0 0 0 1px #606060 inset, 0 0 0 2px rgba(255, 255, 255, 0.10) inset, 0 8px 0 0 #303030, 0 8px 8px 1px rgba(0, 0, 0, .2);
    background-color: #4d4d4d;
}

.btn3d.btn-dark:active,
.btn3d.btn-dark.active {
    color: #ffffff;
    box-shadow: 0 0 0 1px #606060 inset, 0 0 0 1px rgba(255, 255, 255, 0.15) inset, 0 1px 3px 1px rgba(0, 0, 0, .1);
    background-color: #4d4d4d;
}

.btn3d.btn-primary {
    box-shadow: 0 0 0 1px #417fbd inset, 0 0 0 2px rgba(255, 255, 255, 0.15) inset, 0 8px 0 0 #4D5BBE, 0 8px 8px 1px rgba(0, 0, 0, 0.5);
    background-color: #4274D7;
}

.btn3d.btn-primary:active,
.btn3d.btn-primary.active {
    box-shadow: 0 0 0 1px #417fbd inset, 0 0 0 1px rgba(255, 255, 255, 0.15) inset, 0 1px 3px 1px rgba(0, 0, 0, 0.3);
    background-color: #4274D7;
}

.btn3d.btn-success {
    box-shadow: 0 0 0 1px #31c300 inset, 0 0 0 2px rgba(255, 255, 255, 0.15) inset, 0 8px 0 0 #5eb924, 0 8px 8px 1px rgba(0, 0, 0, 0.5);
    background-color: #78d739;
}

.btn3d.btn-success:active,
.btn3d.btn-success.active {
    box-shadow: 0 0 0 1px #30cd00 inset, 0 0 0 1px rgba(255, 255, 255, 0.15) inset, 0 1px 3px 1px rgba(0, 0, 0, 0.3);
    background-color: #78d739;
}

.btn3d.btn-info {
    box-shadow: 0 0 0 1px #00a5c3 inset, 0 0 0 2px rgba(255, 255, 255, 0.15) inset, 0 8px 0 0 #348FD2, 0 8px 8px 1px rgba(0, 0, 0, 0.5);
    background-color: #39B3D7;
}

.btn3d.btn-info:active,
.btn3d.btn-info.active {
    box-shadow: 0 0 0 1px #00a5c3 inset, 0 0 0 1px rgba(255, 255, 255, 0.15) inset, 0 1px 3px 1px rgba(0, 0, 0, 0.3);
    background-color: #39B3D7;
}

.btn3d.btn-warning {
    box-shadow: 0 0 0 1px #d79a47 inset, 0 0 0 2px rgba(255, 255, 255, 0.15) inset, 0 8px 0 0 #D79A34, 0 8px 8px 1px rgba(0, 0, 0, 0.5);
    background-color: #FEAF20;
}

.btn3d.btn-warning:active,
.btn3d.btn-warning.active {
    box-shadow: 0 0 0 1px #d79a47 inset, 0 0 0 1px rgba(255, 255, 255, 0.15) inset, 0 1px 3px 1px rgba(0, 0, 0, 0.3);
    background-color: #FEAF20;
}

.btn3d.btn-danger {
    box-shadow: 0 0 0 1px #b93802 inset, 0 0 0 2px rgba(255, 255, 255, 0.15) inset, 0 8px 0 0 #AA0000, 0 8px 8px 1px rgba(0, 0, 0, 0.5);
    background-color: #D73814;
}

.btn3d.btn-danger:active,
.btn3d.btn-danger.active {
    box-shadow: 0 0 0 1px #b93802 inset, 0 0 0 1px rgba(255, 255, 255, 0.15) inset, 0 1px 3px 1px rgba(0, 0, 0, 0.3);
    background-color: #D73814;
}

.btn3d.btn-magick {
    color: #fff;
    box-shadow: 0 0 0 1px #9a00cd inset, 0 0 0 2px rgba(255, 255, 255, 0.15) inset, 0 8px 0 0 #9823d5, 0 8px 8px 1px rgba(0, 0, 0, 0.5);
    background-color: #bb39d7;
}

.btn3d.btn-magick:active,
.btn3d.btn-magick.active {
    box-shadow: 0 0 0 1px #9a00cd inset, 0 0 0 1px rgba(255, 255, 255, 0.15) inset, 0 1px 3px 1px rgba(0, 0, 0, 0.3);
    background-color: #bb39d7;
}

.nav-link {
    padding: 6px 14px;
}

.btn.waves-effect {
    width: 100%;
    padding: 0;
}

.btn.waves-effect > i {
    font-size: 7vh;
}

.fa-solid.fa-delete-left {
    color: #ff9f15;
}

.waves-effect.rounded-circle {
    background-color: #fff;
}

/* tab_6 特殊處理 - 不使用 flex */
#tab_6 {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 1rem;
    display: block !important;
}

.result {
    display: inline-block;
    text-align: right;
    font-size: 7vh;
    height: 11vh;
    line-height: 11vh;
    padding: 0;
    color: #4963df;
    font-weight: bold;
    text-overflow: ellipsis;
    overflow: hidden;
    width: 50vw;
}
.money_rates_source{
    position: absolute;
    top: -14px;
    left: 0;
    background-color: #fff;
    padding: 0 4px;
    border-radius: 10px;
    border: 1px solid #ddd;
}
.money_rates_target{
    position: absolute;
    top: -14px;
    left: calc(50%);
    background-color: #fff;
    padding: 0 4px;
    border-radius: 10px;
    border: 1px solid #ddd;
}
