:root {
    --primary-color: #333;
    --accent-color: #FF4757;
    --bg-gradient: linear-gradient(135deg, #FFF 0%, #F8F9FA 100%);
    --card-shadow: 0 20px 40px rgba(0,0,0,0.08);
    --font-main: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-main);
    display: flex;
    height: 100vh;
    background-color: #f0f2f5;
    color: var(--primary-color);
}

.sidebar {
    width: 350px;
    background: white;
    padding: 24px;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 10;
}

.sidebar h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #1a1a1a;
}

.sidebar p {
    font-size: 14px;
    color: #666;
    margin-bottom: 24px;
    line-height: 1.4;
}

#jsonInput {
    width: 100%;
    height: 300px;
    margin-bottom: 20px;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-family: 'D2Coding', 'Consolas', monospace;
    font-size: 13px;
    resize: vertical;
    line-height: 1.5;
    background-color: #fcfcfc;
}

#jsonInput:focus {
    outline: none;
    border-color: #007bff;
    background-color: #fff;
}

button {
    padding: 14px;
    background-color: #222;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    transition: all 0.2s;
}

button:hover {
    background-color: #000;
    transform: translateY(-1px);
}

#downloadAllBtn {
    background-color: #28a745;
}

#downloadAllBtn:hover {
    background-color: #218838;
}

.main-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    background-color: #eaecef;
}

#cardContainer {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(540px, 1fr));
    gap: 40px;
    width: 100%;
    max-width: 1200px;
    padding-bottom: 40px;
}

.fortune-card {
    width: 540px;
    height: 675px;
    background:
        radial-gradient(120% 90% at 100% 0%, rgba(59, 130, 246, 0.18) 0%, rgba(59, 130, 246, 0) 55%),
        linear-gradient(180deg, #fff9ec 0%, #fff4d8 100%);
    border-radius: 26px;
    box-shadow: 0 14px 28px rgba(17, 24, 39, 0.18);
    padding: 30px 30px 92px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    border: 2px solid #111827;
}

.bg-emoji {
    position: absolute;
    top: auto;
    left: auto;
    bottom: -48px;
    right: -48px;
    transform: none;
    font-size: 320px;
    opacity: 0.26;
    pointer-events: none;
    z-index: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    filter: saturate(1.1) drop-shadow(0 10px 16px rgba(15, 23, 42, 0.16));
}

.fortune-card.horse .bg-emoji,
.fortune-card.rabbit .bg-emoji {
    bottom: -40px;
    right: -40px;
}

.bg-emoji .emoji {
    width: 320px;
    height: 320px;
}

.card-header, 
.teaser-section, 
.years-grid {
    position: relative;
    z-index: 1;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px dashed rgba(17, 24, 39, 0.3);
}

.header-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.date-text {
    font-size: 13px;
    color: #334155;
    font-weight: 800;
    letter-spacing: 0.3px;
}

.zodiac-title {
    font-size: 38px;
    font-weight: 800;
    color: #111827;
    margin: 0;
    letter-spacing: -1.6px;
    line-height: 1.05;
    display: flex;
    align-items: flex-end;
    gap: 6px;
    flex-wrap: wrap;
}

.zodiac-title .emoji {
    height: 1.2em;
    width: 1.2em;
    margin: 0;
    vertical-align: middle;
}

.social-chip {
    font-size: 11px;
    color: #111827;
    background: #fde68a;
    font-weight: 900;
    letter-spacing: 0.3px;
    padding: 5px 9px;
    border-radius: 999px;
    border: 1.5px solid #111827;
    box-shadow: 0 2px 0 #111827;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.brand-icons {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    line-height: 1;
}

.brand-icon img {
    width: 100%;
    height: 100%;
    display: block;
}

.brand-handle {
    font-weight: 900;
    letter-spacing: 0.2px;
}

.rank-score {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding-top: 4px;
}

.rank-badge {
    background: var(--theme-color, #FF4757);
    color: #ffffff;
    padding: 5px 11px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 13px;
    margin-bottom: 4px;
    border: 1.5px solid #111827;
    box-shadow: 0 2px 0 #111827;
    letter-spacing: -0.1px;
}

.score-text {
    font-size: 34px;
    font-weight: 900;
    color: #0f172a;
    line-height: 0.95;
    letter-spacing: -0.8px;
}

.score-label {
    font-size: 12px;
    color: #334155;
    font-weight: 700;
    margin-left: 2px;
}

.teaser-section {
    margin-bottom: 16px;
}

.teaser-text {
    font-size: 18px;
    line-height: 1.36;
    color: #111827;
    font-weight: 900;
    word-break: keep-all;
    letter-spacing: -0.8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.72);
    border: 2px solid rgba(17, 24, 39, 0.2);
    border-radius: 12px;
}

.years-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.card-footer {
    position: absolute;
    left: 30px;
    right: 30px;
    bottom: 24px;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.year-item {
    display: flex;
    flex: 1;
    align-items: center;
    padding: 9px 10px;
    background-color: rgba(255, 255, 255, 0.88);
    border: 1.5px solid rgba(17, 24, 39, 0.2);
    border-radius: 10px;
    box-shadow: 0 2px 0 rgba(17, 24, 39, 0.2);
}

.year-label {
    font-family: 'Pretendard';
    font-weight: 700;
    color: #ffffff;
    background-color: var(--theme-color, #FF4757);
    font-size: 12px;
    min-width: auto;
    padding: 4px 7px;
    border-radius: 999px;
    margin-right: 9px;
    border: 1px solid rgba(17, 24, 39, 0.35);
    white-space: nowrap;
    display: inline-block;
}

.year-desc {
    font-size: 13px;
    color: #1f2937;
    line-height: 1.28;
    word-break: keep-all;
    font-weight: 600;
    letter-spacing: -0.2px;
}

.footer {
    display: none;
}

.intro-card {
    background:
        radial-gradient(160% 100% at 100% 0%, rgba(34, 197, 94, 0.2) 0%, rgba(34, 197, 94, 0) 50%),
        linear-gradient(180deg, #fffaf0 0%, #fff4d6 100%);
    color: #1f2937;
    border: 2px solid #111827;
    box-shadow: 0 14px 28px rgba(17, 24, 39, 0.2);
    border-radius: 28px;
    font-synthesis-weight: none;
    font-synthesis-style: none;
}

.intro-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    z-index: 2;
}

.intro-label-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.intro-kicker {
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 1px;
    color: #334155;
    background: #dbeafe;
    border: 1.5px solid #0f172a;
    border-radius: 999px;
    padding: 4px 10px;
    width: fit-content;
}

.intro-label {
    font-size: 42px;
    font-weight: 900;
    letter-spacing: -1.6px;
    line-height: 1;
    color: #0f172a;
}

.intro-page {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
    background: #fde68a;
    border-radius: 999px;
    padding: 7px 14px;
    border: 2px solid #0f172a;
    box-shadow: 0 3px 0 #0f172a;
    width: 78px;
    text-align: center;
    box-sizing: border-box;
}

.intro-date {
    margin-top: 16px;
    font-size: 33px;
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -1.1px;
    color: #111827;
    z-index: 2;
}

.intro-zodiac-list {
    margin-top: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    flex: 1;
    z-index: 2;
}

.intro-zodiac-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-direction: column;
    border-radius: 14px;
    padding: 10px 12px 8px;
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
    background: #ffffff;
    border: 2px solid #0f172a;
    box-shadow: 0 4px 0 #0f172a;
    min-height: 76px;
    letter-spacing: -0.7px;
    gap: 4px;
}

.intro-zodiac-item .emoji {
    width: 1em;
    height: 1em;
    margin-right: 8px;
}

.intro-zodiac-main {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    line-height: 1.05;
    min-height: 30px;
    font-weight: 900;
}

.intro-zodiac-years {
    margin-top: 13px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.1px;
    color: #334155;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    align-items: center;
    min-height: 56px;
    align-content: flex-start;
}

.intro-year-pill {
    display: inline-block;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(15, 23, 42, 0.2);
    border-radius: 999px;
    padding: 2px 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
    font-variant-numeric: tabular-nums;
    min-width: 56px;
    text-align: center;
}

.intro-bottom {
    margin-top: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 2;
    position: absolute;
    left: 30px;
    right: 30px;
    bottom: 24px;
}

.intro-hint {
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.9px;
    color: #334155;
}

.intro-footer {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-align: right;
    letter-spacing: 0.3px;
}

.intro-card .intro-zodiac-item:nth-child(1) {
    background: #dbeafe;
}

.intro-card .intro-zodiac-item:nth-child(2) {
    background: #dcfce7;
}

.intro-card .intro-zodiac-item:nth-child(3) {
    background: #fef3c7;
}

.intro-card .intro-zodiac-item:nth-child(4) {
    background: #fee2e2;
}

.intro-card .intro-zodiac-item:nth-child(5) {
    background: #e0e7ff;
}

.intro-card .intro-zodiac-item:nth-child(6) {
    background: #ccfbf1;
}

.intro-card .intro-zodiac-item .emoji {
    filter: drop-shadow(0 2px 0 rgba(15, 23, 42, 0.14));
}

.intro-card .intro-footer {
    margin-top: auto;
    opacity: 0.92;
}
