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

html {
    height: 100%;
}

body {
    font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, var(--bg-start, #f8e1e8) 0%, var(--bg-end, #e8d5e4) 100%);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 6px 10px;
    color: #333;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

header {
    text-align: center;
    color: #5c4a52;
    padding: 4px 0;
    margin-bottom: 6px;
}

header h1 {
    font-size: 1.5em;
    margin-bottom: 2px;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

.subtitle {
    font-size: 0.8em;
    opacity: 0.88;
    color: #6a5a62;
}

main {
    background: #fffbf8;
    border-radius: 14px;
    padding: 10px 14px;
    box-shadow: 0 4px 16px rgba(180, 150, 160, 0.15);
    margin-bottom: 8px;
}

.input-section h2,
.result-section h2 {
    color: #c9a0b8;
    margin-bottom: 4px;
    font-size: 1.15em;
}

.hint {
    color: #666;
    margin-bottom: 8px;
    font-size: 0.85em;
}

.form-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px 12px;
}

.form-group {
    margin-bottom: 0;
}

.form-group label {
    display: inline-block;
    width: 52px;
    font-weight: bold;
    color: #555;
    font-size: 0.9em;
}

.form-group input,
.form-group select {
    padding: 6px 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.95em;
    width: 56px;
    max-width: 64px;
    transition: border-color 0.3s;
}

.form-group select {
    width: 180px;
    max-width: 200px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #d4b5c4;
}

.form-group .unit {
    margin-left: 4px;
    color: #666;
    font-size: 0.9em;
}

.btn-submit,
.btn-reset {
    background: linear-gradient(135deg, #f8b4c4 0%, #e8a8d0 100%);
    color: #5c4a52;
    border: none;
    padding: 8px 20px;
    font-size: 0.95em;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 0;
    margin-left: 0;
    margin-right: auto;
}

.btn-submit { margin-bottom: 2px; }

.btn-submit:hover,
.btn-reset:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 18px rgba(248, 180, 196, 0.5);
}

.btn-submit:active,
.btn-reset:active {
    transform: translateY(0);
}

.result-card {
    background: linear-gradient(135deg, #fff0e8 0%, #ffe0d8 100%);
    padding: 12px 16px;
    border-radius: 12px;
    margin: 8px 0;
    text-align: center;
}

.result-name {
    font-size: 1.5em;
    font-weight: bold;
    color: #b87a8a;
    margin-bottom: 6px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.08);
}

.result-meaning {
    font-size: 0.9em;
    line-height: 1.5;
    color: #555;
}

.calculation-details {
    background: #fef8f5;
    padding: 10px 12px;
    border-radius: 10px;
    margin: 8px 0;
}

.calculation-details h3 {
    color: #c9a0b8;
    margin-bottom: 6px;
    font-size: 1em;
}

.detail-item {
    padding: 4px 0;
    border-bottom: 1px dashed #ddd;
    font-size: 0.9em;
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: bold;
    color: #555;
    margin-right: 8px;
}

.result-section .btn-reset,
.error-section .btn-reset {
    display: block;
    margin: 8px auto 0;
    padding: 8px 20px;
    font-size: 0.95em;
}

.error-section {
    text-align: center;
    padding: 16px 12px;
}

.error-section p {
    color: #e74c3c;
    font-size: 1em;
    margin-bottom: 10px;
}

footer {
    margin-top: 8px;
    background: #fffbf8;
    border-radius: 14px;
    padding: 10px 12px;
    box-shadow: 0 4px 16px rgba(180, 150, 160, 0.12);
    margin-bottom: 10px;
}

.info-section {
}

.info-section h3 {
    color: #c9a0b8;
    margin-bottom: 4px;
    text-align: center;
    font-size: 1.05em;
}

.hint-footer {
    text-align: center;
    margin-bottom: 4px;
    font-size: 0.8em;
}

.btn-restore-now {
    margin-left: 10px;
    padding: 6px 14px;
    font-size: 0.85em;
    color: #b87a8a;
    background: rgba(248, 180, 196, 0.35);
    border: 1px solid rgba(212, 181, 200, 0.6);
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.btn-restore-now:hover {
    background: rgba(248, 180, 196, 0.5);
    color: #9a6a78;
}

.gods-legend-title {
    margin-top: 8px;
    margin-bottom: 4px;
}

.twelve-hours-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin: 0 auto 8px auto;
    padding: 4px;
}

.hour-card {
    background: linear-gradient(135deg, var(--card-bg-start, #f5ebe8) 0%, var(--card-bg-end, #efe5e8) 100%);
    border-radius: 8px;
    padding: 6px 8px;
    transition: transform 0.2s, box-shadow 0.2s, background 0.25s ease;
    border: 2px solid transparent;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hour-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(200, 170, 180, 0.3);
}

.hour-card.current {
    border-color: #b87a8a;
    border-width: 3px;
    box-shadow: 0 0 0 3px rgba(184, 122, 138, 0.3), 0 4px 16px rgba(184, 122, 138, 0.4);
    transform: scale(1.05);
    filter: brightness(1.08);
}

.hour-card-content {
    text-align: center;
    font-size: 0.8em;
    line-height: 1.3;
}

.hour-card-content .hour-name { font-size: 1em; font-weight: bold; color: #333; margin-bottom: 1px; }
.hour-card-content .hour-range { margin: 0 0 2px 0; font-size: 0.8em; color: #888; }
.hour-card-content .liu-shen { font-size: 0.95em; margin: 2px 0; font-weight: bold; color: #b87a8a; }
.hour-card-content .time-badge { margin: 1px 0; font-size: 0.75em; }
.hour-card-content .suggest-suitable { margin-top: 2px; font-size: 0.75em; color: #2d6a4f; line-height: 1.2; }
.hour-card-content .suggest-unsuitable { margin-top: 1px; font-size: 0.75em; color: #a8594f; line-height: 1.2; }
.hour-card-content .current-badge { margin-top: 2px; font-size: 0.75em; }

.hour-card .hour-name {
    font-weight: bold;
    color: #333;
    font-size: 1em;
    line-height: 1.2;
}

.hour-card .hour-range {
    font-size: 0.85em;
    color: #888;
    margin: 0 0 2px 0;
    line-height: 1.15;
}

/* 工作时间：9–19 点（巳午未申酉）；睡觉时间：23–5 点（子丑寅）— 扇形内用 工/睡 标注 */
.hour-card .time-badge {
    display: inline-block;
    font-size: 0.65em;
    padding: 1px 5px;
    border-radius: 8px;
    margin: 2px 0 1px 0;
    line-height: 1.2;
}
.hour-card .work-badge {
    color: #5a8f6e;
    background: rgba(168, 230, 207, 0.5);
}
.hour-card .sleep-badge {
    color: #6b8fa8;
    background: rgba(184, 212, 227, 0.5);
}

.hour-card .liu-shen {
    font-size: 1.05em;
    color: #b87a8a;
    font-weight: bold;
    line-height: 1.2;
}

.hour-card .brief {
    font-size: 0.9em;
    color: #666;
    line-height: 1.25;
    margin-top: 1px;
}

.hour-card .suggest-suitable {
    font-size: 0.85em;
    color: #2d6a4f;
    margin-top: 2px;
    line-height: 1.15;
}

.hour-card .suggest-unsuitable {
    font-size: 0.85em;
    color: #a8594f;
    margin-top: 1px;
    line-height: 1.15;
}

.hour-card .current-badge {
    display: inline-block;
    font-size: 0.8em;
    color: #fff;
    background: linear-gradient(135deg, #b87a8a 0%, #9a6a78 100%);
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 2px;
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(184, 122, 138, 0.4);
}

.gods-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    justify-content: center;
}

.god-item {
    background: #fef8f5;
    padding: 4px 8px;
    border-radius: 8px;
    text-align: center;
    flex: 1 1 70px;
    min-width: 60px;
    max-width: 120px;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid rgba(212, 181, 200, 0.3);
}

.god-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 10px rgba(200, 170, 180, 0.2);
}

.god-item strong {
    display: block;
    font-size: 0.9em;
    color: #b87a8a;
    margin-bottom: 2px;
}

.god-item p {
    color: #7a6a70;
    font-size: 0.7em;
    line-height: 1.3;
}

@media (max-width: 500px) {
    header h1 { font-size: 1.3em; }
    .form-group select { width: 160px; max-width: 180px; }
    .twelve-hours-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 380px) {
    .twelve-hours-grid { grid-template-columns: repeat(2, 1fr); }
    .hour-card { min-height: 100px; }
}

/* 矮屏：隐藏部分卡片内容以省高度 */
@media (max-height: 720px) {
    .hour-card { min-height: 75px; padding: 5px 6px; }
    .hour-card-content { font-size: 0.75em; }
    .hour-card-content .suggest-suitable,
    .hour-card-content .suggest-unsuitable { font-size: 0.7em; }
}

@media (max-height: 620px) {
    .hour-card { min-height: 65px; padding: 4px 6px; }
    .hour-card-content { font-size: 0.7em; }
    .hour-card-content .suggest-suitable,
    .hour-card-content .suggest-unsuitable { display: none; }
    .god-item p { display: none; }
    .gods-legend-title { margin-top: 4px; margin-bottom: 2px; }
}

@media (max-height: 520px) {
    .result-section .calculation-details { display: none; }
    .result-card { padding: 8px 12px; }
    .result-name { font-size: 1.25em; }
}
