* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', sans-serif;
    overflow: hidden;
}

.toast-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px 40px;
    border-radius: 10px;
    font-size: 24px;
    font-weight: bold;
    z-index: 9999;
    animation: toastFadeInOut 1.5s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

@keyframes toastFadeInOut {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

.page {
    display: none;
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
}

.page.active {
    display: block;
}

/* 主界面样式 */
.main-background
{
width: 100vw;
height: 100vh;
background: url("/tool/jgbcxt.webp");
background-size: 100% 100%;
background-position: center;
background-repeat: no-repeat;
background-attachment: fixed;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
transition: background 0.3s ease;
overflow: hidden;
position: fixed;
top: 0;
left: 0;
}

.main-content {
    text-align: center;
    color: white;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding: 50px 0;
    padding-bottom: 80px;
}

.main-title {
    display: none;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    transition: opacity 0.3s ease;
    margin-top: 100px;
}

.sub-title {
    display: none;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    opacity: 0.9;
    margin-top: 20px;
}

.button-container {
    display: flex;
    gap: 30px;
    justify-content: center;
    padding: 20px 0;
    flex-shrink: 0;
}

.btn {
    padding: 15px 30px;
    font-size: 1.2em;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: white;
    background: #27ae60;
}

.btn-settings {
    background: #27ae60;
    backdrop-filter: blur(10px);
}

.btn-enter {
    background: #27ae60;
}

.btn-back {
    background: #27ae60;
}

/* 答题界面的返回按钮 */
#riddle-page .btn-back {
    padding: 10px 20px;
    font-size: 1em;
    min-width: 120px;
}

.btn-apply {
    background: #27ae60;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

/* 设置弹窗样式 */
.settings-modal-content {
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.settings-modal-content h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
}

.save-success-message {
    background-color: #27ae60;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 20px;
    animation: fadeInOut 2s ease;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(-10px); }
    15% { opacity: 1; transform: translateY(0); }
    85% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-10px); }
}

.setting-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.setting-section h3 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.instructions {
    background-color: #fff3cd;
    border: 2px solid #ffc107;
    border-left: 5px solid #ffc107;
    padding: 15px;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: bold;
    line-height: 1.8;
    border-radius: 5px;
}

.instructions p {
    margin: 8px 0;
    color: #333;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.setting-item label {
    font-weight: bold;
    color: #34495e;
    min-width: 120px;
}

.setting-item input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 200px;
}

.setting-item input[type="color"] {
    width: 60px;
    height: 40px;
    padding: 2px;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
}

.setting-item input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.setting-item input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.setting-item button {
    padding: 6px 12px;
    margin-left: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 14px;
}

.setting-item button:hover {
    background: #e9ecef;
}

/* 灯谜展示界面样式 */
.riddle-background
{
width: 100vw;
height: 100vh;
background: url("/tool/dabj.webp");
background-size: 100% 100%;
background-position: center;
background-repeat: no-repeat;
background-attachment: fixed;
padding: 0;
overflow: hidden;
position: fixed;
top: 0;
left: 0;
display: flex;
flex-direction: column;
justify-content: space-between;
}

.riddle-header {
    text-align: center;
    color: white;
    padding: 10px 0;
    flex-shrink: 0;
}

.display-main-title {
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.display-sub-title {
    opacity: 0.9;
}

.riddle-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 8px;
    width: 100vw;
    height: calc(100vh - 170px);
    padding: 0 5px;
    box-sizing: border-box;
    overflow: hidden;
    flex: 1;
}

.riddle-card
{
background: url("/tool/mtbj.webp");
background-size: 100% 100%;
background-position: center;
background-repeat: no-repeat;
border-radius: 8px;
padding: 0;
cursor: pointer;
transition: all 0.3s ease;
display: flex;
flex-direction: column;
min-height: 140px;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
position: relative;
overflow: hidden;
}

.riddle-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

/* 卡片占位行 */
.card-placeholder {
    height: 35px;
    background: transparent;
    flex-shrink: 0;
}

/* 卡片内容区域 */
.card-content {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 6px;
    height: 100%;
    box-sizing: border-box;
    margin: 0;
    min-height: 0;
}

.riddle-card .category {
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-size: 16px;
    text-align: center;
    flex-shrink: 0;
    min-width: 18px;
    max-width: 35px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 4px;
    padding: 3px;
    box-sizing: border-box;
    line-height: 1.2;
    align-self: center;
    text-combine-upright: digits;
}

.riddle-card .category .digit-group,
.riddle-card .author .digit-group {
    display: inline-block !important;
    writing-mode: horizontal-tb !important;
    text-orientation: upright;
    font-size: 0.85em !important;
    line-height: 1 !important;
    vertical-align: baseline !important;
    unicode-bidi: embed;
    direction: ltr;
    white-space: nowrap !important;
    word-break: keep-all !important;
}

.riddle-card .riddle-text .digit-group {
    display: inline-block !important;
    writing-mode: horizontal-tb !important;
    text-orientation: upright;
    font-size: inherit !important;
    line-height: 1 !important;
    vertical-align: baseline !important;
    unicode-bidi: embed;
    direction: ltr;
    white-space: nowrap !important;
    word-break: keep-all !important;
}

.riddle-card .riddle-text.short-riddle {
    align-items: center;
    justify-content: center;
    height: 100%;
}
.riddle-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 4px;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    flex-grow: 2;
    overflow: visible;
    height: 100%;
    align-self: center;
}

.riddle-card .riddle-text {
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-weight: bold;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    word-break: break-all;
    overflow-wrap: break-word;
    max-width: 100%;
    overflow: visible;
    line-height: 1.1;
    min-width: 0;
    box-sizing: border-box;
    padding: 0;
    gap: 2px;
    white-space: normal;
    text-combine-upright: digits;
}

.riddle-card .riddle-text .digit-group {
    display: inline-block !important;
    writing-mode: horizontal-tb !important;
    text-orientation: upright;
    font-size: 0.85em !important;
    line-height: 1 !important;
    vertical-align: baseline !important;
    unicode-bidi: embed;
    direction: ltr;
    white-space: nowrap !important;
    word-break: keep-all !important;
}

.riddle-line {
    writing-mode: vertical-rl;
    text-orientation: upright;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    max-width: 100%;
    overflow: hidden;
    line-height: 1.1;
    height: auto;
}

.riddle-card .author {
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-size: 16px;
    text-align: center;
    flex-shrink: 0;
    min-width: 18px;
    max-width: 50px;
    word-break: break-all;
    overflow-wrap: break-word;
    margin: 0 2px;
    padding: 1px;
    box-sizing: border-box;
    text-combine-upright: digits;
}

.digits-inline {
    display: inline !important;
    writing-mode: horizontal-tb !important;
    transform: none !important;
    font-size: 0.75em;
    line-height: 1;
    vertical-align: middle;
    letter-spacing: -1px;
}

.digit-h {
    display: inline !important;
    writing-mode: horizontal-tb !important;
    text-orientation: upright;
    font-size: 0.85em !important;
    line-height: 1 !important;
    vertical-align: baseline !important;
    unicode-bidi: embed;
    direction: ltr;
}

.digit-group {
    display: inline-block !important;
    writing-mode: horizontal-tb !important;
    text-orientation: upright;
    font-size: 0.85em !important;
    line-height: 1 !important;
    vertical-align: baseline !important;
    unicode-bidi: embed;
    direction: ltr;
    white-space: nowrap !important;
    word-break: keep-all !important;
}

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 灯谜详情弹窗样式 */
.riddle-detail-content {
    background-color: transparent;
    margin: 0;
    padding: 0;
    border-radius: 0;
    width: auto;
    height: auto;
    max-width: 90%;
    max-height: 90%;
    position: relative;
    animation: slideIn 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#riddle-detail-card
{
width: 580px;
/* 原卡片232px的2.5倍 */
    height: 738px;
/* 原卡片295px的2.5倍 */
    margin: 0 auto;
background: url("/tool/mtbj.webp");
background-size: 100% 100%;
background-position: center;
background-repeat: no-repeat;
}

#riddle-detail-card .card-placeholder {
    height: 88px;  /* 原35px的2.5倍 */
    background: transparent;
    flex-shrink: 0;
}

#detail-category {
    min-width: 60px;
    max-width: 100px;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    margin: 0 10px;
    padding: 8px;
    text-combine-upright: digits;
}

#detail-category .digit-group,
#detail-author .digit-group {
    display: inline-block !important;
    writing-mode: horizontal-tb !important;
    text-orientation: upright;
    font-size: 0.85em !important;
    line-height: 1 !important;
    vertical-align: baseline !important;
    unicode-bidi: embed;
    direction: ltr;
    white-space: nowrap !important;
    word-break: keep-all !important;
}

#detail-riddle .digit-group {
    display: inline-block !important;
    writing-mode: horizontal-tb !important;
    text-orientation: upright;
    font-size: 0.85em !important;
    line-height: 1 !important;
    vertical-align: baseline !important;
    unicode-bidi: embed;
    direction: ltr;
    white-space: nowrap !important;
    word-break: keep-all !important;
}

#detail-riddle {
    font-size: 60px;
    text-combine-upright: digits;
}

#detail-author {
    font-size: 45px;
    min-width: 45px;
    max-width: 60px;
    margin: 0 10px;
    padding: 8px;
    text-combine-upright: digits;
    align-self: flex-start;
}

/* 作者谜底同一列容器 */
.author-answer-column {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    min-width: 80px;
    max-width: 120px;
    height: 100%;
    position: relative;
}

.author-answer-column.show-answer .author {
    align-self: flex-start;
}

.author {
    margin-top: 0;
}

.detail-answer {
    writing-mode: vertical-rl;
    text-orientation: upright;
    text-align: center;
    font-size: 60px;
    color: #e74c3c;
    font-weight: bold;
    margin: 0 10px;
    padding: 8px;
    background: none;
    border: none;
    min-width: 60px;
    max-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    flex-shrink: 0;
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

.detail-button-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}

.btn-view-answer {
    background-color: #e74c3c;
    color: white;
    padding: 12px 30px;
    font-size: 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.btn-view-answer:hover {
    background-color: #c0392b;
}

.btn-close-detail {
    background-color: #95a5a6;
    color: white;
    padding: 12px 30px;
    font-size: 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.btn-close-detail:hover {
    background-color: #7f8c8d;
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(-50px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .riddle-grid {
        grid-template-columns: repeat(6, 1fr);
        grid-template-rows: repeat(4, 1fr);
        width: 100vw;
        height: calc(100vh - 60px);
        padding: 0 5px;
        gap: 6px;
    }
}

@media (max-width: 768px) {
    .riddle-grid {
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: repeat(6, 1fr);
        width: 100vw;
        height: calc(100vh - 50px);
        padding: 0 3px;
        gap: 4px;
    }
    
    .display-main-title {
        font-size: 1.4em;
    }
    
    .display-sub-title {
        font-size: 0.9em;
    }
}

    .button-container {
        flex-direction: row;
        gap: 15px;
        flex-wrap: wrap;
        justify-content: center;
        padding: 15px 0;
    }
    
    .btn {
        min-width: 120px;
        padding: 12px 20px;
        font-size: 1em;
    }
}