/* 基础样式 */
* {
    user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    box-sizing: border-box;
}

/* 添加CSS变量使样式更容易管理 */
:root {
    --decoration-color: #fff;
    --decoration-width: 12px;
    --decoration-height: 4px;
    --hover-extension: 16px;
    --animation-time: 0.1s;
    --header-height: 80px;
    --hr-height: 20px;
    --footer-height: 60px;
    --content-padding: 10px;
    --text-font: 'chsfont', serif;
    --logo-font: 'logofont', truetype;
}


body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    width: 100vw;
    background: url('images/common/bg_body.png') repeat;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.bg {
    flex: 1;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* 标题部分 */
.title {
    width: 100%;
    height: var(--header-height);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
}

.title .image-fill-text {
    font-family: 'logofont', truetype;
    font-size: min(60px, 10vw);
    font-weight: bold;
    color: #000000;
    text-align: center;
    background-image: url('images/common/bg_gold02.png');
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    background-size: 10%;
    background-position: center;
    background-repeat: repeat;
}

/* 分隔线 */
.hr {
    width: 100%;
    height: var(--hr-height);
    margin: 10px 0;
    background-image: url('images/common/hr.png');
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
}

/* 内容区域 */
.content {
    flex: 1;
    width: 100%;
    min-height: 200px;
    padding: var(--content-padding);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* 按钮区域 */
.buttons {
    width: 100%;
    max-width: 400px;
    margin: 20px auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    position: relative;
    z-index: 20;
    padding: 0 10px;
}

.btn-box {
    flex: 1;
    min-width: 120px;
    max-width: 180px;
}

/* 按钮容器 */
#cardContainer .buttons,
#signTextContainer .buttons,
#homeContainer .buttons {
    position: relative;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
}

/* 按钮样式 */
.buttons button {
    margin: 0;
}

.home-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    position: relative;
    z-index: 20;
    width: 100%;
    max-width: 400px;
    margin: 20px auto;
}

.decode, .redraw, .back, .share {
    margin: 0 !important;
}

/* 页脚 */
.footer {
    width: 100%;
    height: var(--footer-height);
    margin-top: auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 响应式调整 */
@media (max-width: 600px) {
    :root {
        --header-height: 60px;
        --hr-height: 30px;
        --footer-height: 40px;
        --content-padding: 15px;
    }

    .buttons {
        flex-direction: row;
        justify-content: center;
        gap: 15px;
        padding: 0 5px;
    }

    .btn-box {
        width: auto;
        min-width: 100px;
        max-width: 150px;
    }

    .btn_m {
        font-size: 14px;
        padding: 8px 12px;
    }

    #homeContainer #box_omikuji_draw {
        width: 300px;
        height: 300px;
    }

    #homeContainer #box_omikuji_draw .box_omikuji_shadow {
        width: 260px;
        height: 260px;
    }

    #homeContainer #box_omikuji_draw .box_omikuji_inner {
        width: 260px;
        height: 260px;
    }
}

@media (max-width: 375px) {
    #homeContainer #box_omikuji_draw {
        width: 280px;
        height: 280px;
    }

    #homeContainer #box_omikuji_draw .box_omikuji_shadow {
        width: 240px;
        height: 240px;
    }

    #homeContainer #box_omikuji_draw .box_omikuji_inner {
        width: 240px;
        height: 240px;
    }
}

/*御神签容器*/
#homeContainer {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    aspect-ratio: 1;
    max-height: 35vh;
}

#homeContainer #box_omikuji_draw {
    width: min(340px, 35vh);
    height: min(340px, 35vh);
    border-radius: 50%;
    box-shadow: 0px 2px 12px 8px rgba(0, 0, 0, 0.3) inset;
    position: relative;
    margin: 0 auto;
}

#homeContainer #box_omikuji_draw .box_omikuji_shadow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(300px, 30vh);
    height: min(300px, 30vh);
    border-radius: 50%;
    box-shadow: 0px 2px 12px 4px rgba(0, 0, 0, 0.5) inset;
    z-index: 9;
}

#homeContainer #box_omikuji_draw .box_omikuji_inner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(300px, 30vh);
    height: min(300px, 30vh);
    border-radius: 50%;
    overflow: hidden;
    z-index: 8;
    border: solid 1px rgba(233, 52, 41, 0.1);
    background-color: rgba(0, 0, 0, 0.1);
}

#homeContainer #box_omikuji_draw .box_omikuji_inner .pic_omikuji {
    width: 30px;
    box-shadow: 0px 2px 8px 4px rgba(0, 0, 0, 0.2);
    position: absolute;
    left: 0;
    top: 0;
    display: none;
}

#homeContainer .box_draw {
    margin-top: 24px;
}

#homeContainer .box_draw p {
    text-align: center;
    font-size: 16px;
    line-height: 120%;
    letter-spacing: 0.2em;
    padding-left: 0.2em;
}

#homeContainer .box_draw p .txt_sub {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    line-height: 120%;
    padding-left: 0.2em;
}
a.non-hover_img:hover img {
    filter: alpha(opacity=100);
    -moz-opacity: 1;
    opacity: 1;
  }

/* 交互元素 */
button, select {
    pointer-events: auto;
    cursor: pointer;
}

.picker-container {
    width: 150px;
    height: 46px;
    position: relative;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    cursor: pointer;
}

.draw-manually {
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    position: absolute;
    top: 0;
    left: 0;
}

.draw-Daily, .decode, .redraw, .back, .share {
    display: block;
    background-size: contain;
}

/* 状态样式 */
.home-buttons {
    display: none;
}

body[data-state="home"] .home-buttons {
    display: flex;
}

[data-state="card"] .home-buttons,
[data-state="text"] .home-buttons {
    display: none;
}

/* 按钮样式 */
.buttons button {
    margin: 0 20px;
}

.home-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 20;
}

.decode, .redraw {
    margin: 0 30px !important;
}

button.btn_m,
a.btn_m {
    border: solid 1px rgba(255, 255, 255, 0.2);
    padding: 1px;
    letter-spacing: 0.2em;
    text-align: center;
    font-family: "SimSun", sans-serif;
    font-size: 18px;
    line-height: 100%;
    display: inline-block;
    position: relative;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2),
                inset 0 1px 2px rgba(255, 255, 255, 0.2);
    transform: translateY(0);
}

.btn_m .btn_inner,
a.btn_m .btn_inner {
    color: #fff;
    padding: 0.6em 1em;
    display: block;
    transition: all 0.3s;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

button.btn_m,
input[type=button].btn_m,
input[type=reset].btn_m,
input[type=submit].btn_m,
button.btn_s,
input[type=button].btn_s,
input[type=reset].btn_s,
input[type=submit].btn_s {
    background-color: transparent;
    border-radius: 0;
    color: #fff;
}

.btn_m:hover,
a.btn_m:hover {
    border-color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3),
                inset 0 1px 3px rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.btn_m:active,
a.btn_m:active {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1),
                inset 0 1px 1px rgba(255, 255, 255, 0.1);
    transform: translateY(1px);
}

/* 按钮文本样式 */
.btn_inner {
    white-space: nowrap;
    display: inline-block;
    font-size: 16px;
}

/* 不同语言的按钮文本大小 */
[data-lang="eng"] .btn_inner,
[data-lang="jpn"] .btn_inner,
[data-lang="chs"] .btn_inner {
    font-size: 16px;
}

@media (max-width: 600px) {
    .btn_inner {
        font-size: 14px;
    }

    [data-lang="eng"] .btn_inner,
    [data-lang="jpn"] .btn_inner,
    [data-lang="chs"] .btn_inner {
        font-size: 14px;
    }
}

/* 通用按钮装饰样式 */
.decorated-button {
    position: relative;
}

/* 所有角落装饰的基础样式 */
.decorated-button:before,
.decorated-button:after,
.decorated-button .corner-tr:before,
.decorated-button .corner-tr:after,
.decorated-button .corner-bl:before,
.decorated-button .corner-bl:after,
.decorated-button .corner-br:before,
.decorated-button .corner-br:after {  
    content: "";
    display: inline-block;
    background-color: #fff;
    position: absolute;
    transition: all 0.1s;
}

/* 左上角 */
.decorated-button:before {  
    width: 12px;
    height: 4px;
    top: -1px;
    left: -1px;
}
.decorated-button:after {   
    width: 4px;
    height: 12px;
    top: -1px;
    left: -1px;
}

/* 右上角 */
.decorated-button .corner-tr:before {  
    width: 12px;
    height: 4px;
    top: -1px;
    right: -1px;
}
.decorated-button .corner-tr:after {   
    width: 4px;
    height: 12px;
    top: -1px;
    right: -1px;
}

/* 悬停效果 */
.decorated-button:hover:before {
    top: -4px;
    left: -4px;
    width: 16px;
}
.decorated-button:hover:after {
    top: -4px;
    left: -4px;
    height: 16px;
}

/* 右上角悬停效果 */
.decorated-button:hover .corner-tr:before {
    top: -4px;
    right: -4px;
    width: 16px;
}
.decorated-button:hover .corner-tr:after {
    top: -4px;
    right: -4px;
    height: 16px;
}

/* 左下角 */
.decorated-button .corner-bl:before {  
    width: 12px;
    height: 4px;
    bottom: -1px;
    left: -1px;
}
.decorated-button .corner-bl:after {   
    width: 4px;
    height: 12px;
    bottom: -1px;
    left: -1px;
}

/* 右下角 */
.decorated-button .corner-br:before {  
    width: 12px;
    height: 4px;
    bottom: -1px;
    right: -1px;
}
.decorated-button .corner-br:after {   
    width: 4px;
    height: 12px;
    bottom: -1px;
    right: -1px;
}

/* 左下角悬停效果 */
.decorated-button:hover .corner-bl:before {
    bottom: -4px;
    left: -4px;
    width: 16px;
}
.decorated-button:hover .corner-bl:after {
    bottom: -4px;
    left: -4px;
    height: 16px;
}

/* 右下角悬停效果 */
.decorated-button:hover .corner-br:before {
    bottom: -4px;
    right: -4px;
    width: 16px;
}
.decorated-button:hover .corner-br:after {
    bottom: -4px;
    right: -4px;
    height: 16px;
}


/* 签文容器样式 */
#signTextContainer {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
}

#signText {
    width: 100%;
    font-family: var(--text-font);
    line-height: 1.3;
    color: #333;
    text-align: left;
}

.sign-header {
    font-size: 1.5em;
    font-weight: bold;
    text-align: center;
    margin-top: 10px;
    margin-bottom: 10px;
    color: #d4145a;
    font-family: var(--logo-font);
}

.sign-section {
    margin: 8px 0;
    padding: 8px;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.8);
}

.sign-section h3 {
    font-size: 1.5em;
    color: #333;
    margin: 0 0 8px 0;
    padding-bottom: 3px;
    border-bottom: 2px solid #d4145a;
    text-align: center;
}

.sign-section p {
    margin: 0;
    padding: 5px;
    line-height: 1.8;
    white-space: pre-line;
    text-align: left;
}

/* 签诗部分居中 */
.sign-section:nth-of-type(1) {
    text-align: center;
}

.sign-section:nth-of-type(1) p {
    text-align: center;
    padding: 5px;
    line-height: 1.8;
    white-space: pre-line;
}

/* 翻译和建议部分左对齐 */
.sign-section:nth-of-type(n+2) p {
    text-align: left;
    padding: 5px;
    line-height: 1.8;
    white-space: pre-line;
}

.poem-text {
    text-align: center !important;
    padding: 5px;
    line-height: 1.8;
    white-space: normal !important;
}

.poem-line {
    text-align: center;
    margin: 5px 0;
    display: block;
}

/* 响应式调整 */
@media (max-width: 600px) {
    #signTextContainer {
        padding: 15px;
        margin: 15px;
    }

    .sign-header {
        font-size: 1.3em;
    }

    .sign-section {
        margin: 5px 0;
        padding: 5px;
    }

    .sign-section h3 {
        font-size: 1em;
        margin: 0 0 5px 0;
        padding-bottom: 10px;
    }
}

/* 文本样式 */
.sign-text {
    background: #ffffff;
    font-size: 1.2em;
    width: 70%;
    height: 100%;
    max-width: 700px;
    max-height: 55vh;
    box-sizing: border-box;
    border: #E12613 8px double;
    font-family: 'chsfont', serif;
    padding: 0.8em;
    margin: auto;
    margin-top: 10px;
    overflow-y: auto;
    white-space: pre-wrap;
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 字体设置 */
@font-face {
    font-family: 'logofont';
    src: url('/fonts/logo.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'chsfont';
    src: url('/fonts/chs.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* 卡片和图标样式 */
.icons, .card {
    width: 100%;
    height: 100%;
    max-width: 340px;
    max-height: 340px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    margin: 20px 0;
}

#cardContainer {
    width: 100%;
    height: 340px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 5px 0;
}

#signTextContainer {
    width: 100%;
    max-width: 600px;
    margin: 5px auto;
    padding: 5px;
    text-align: center;
}

#signText {
    font-family: 'chsfont', sans-serif;
    font-size: 20px;
    line-height: 1;
    white-space: pre-wrap;
}

/* 主页容器样式 */
#homeContainer {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* 按钮文本不换行 */
.btn_inner {
    white-space: nowrap;
    display: inline-block;
}

.btn_m {
    width: 100%;
    white-space: nowrap;
    font-size: 16px;
    padding: 10px 15px;
}

@media (max-width: 600px) {

    .btn-box {
        width: auto;
        min-width: 110px;
        max-width: none;
        flex: 0 1 auto;
    }

    .btn_m {
        width: auto;
        font-size: 14px;
        padding: 8px 12px;
        white-space: nowrap;
    }

    .buttons {
        flex-direction: row;
        justify-content: center;
        gap: 10px;
        padding: 0 5px;
        flex-wrap: nowrap;
    }

}

/* 语言切换 */
.language-switch {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.lang-btn {
    cursor: pointer;
    user-select: none;
}

.lang-btn .btn_inner {
    padding: 0.4em 0.8em !important;
    font-size: 14px !important;
    letter-spacing: 0.1em !important;
    display: flex;
    align-items: center;
}

.lang-icon {
    height: 20px;
    width: auto;
    vertical-align: middle;
}

.arrow {
    font-size: 10px;
    margin-left: 4px;
    opacity: 0.8;
}

.lang-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 1001;
}

.lang-option {
    display: block;
    padding: 8px 16px;
    text-decoration: none;
    color: #fff;
    font-size: 14px;
    white-space: nowrap;
    transition: all 0.2s;
    cursor: pointer;
    user-select: none;
}

.lang-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* 移动端适配 */
@media (max-width: 600px) {
    .language-switch {
        top: 10px;
        right: 10px;
    }
    
    .lang-btn {
        font-size: 12px !important;
    }
    
    .lang-btn .btn_inner {
        padding: 0.3em 0.6em !important;
        font-size: 12px !important;
    }
    
    .lang-option {
        padding: 6px 12px;
        font-size: 12px;
    }
}
