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

:root {
    --primary-color: #4a90e2;
    --secondary-color: #50c878;
    --danger-color: #e74c3c;
    --text-color: #333;
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --border-color: #e1e8ed;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.15);
    --theme-primary: #667eea;
    --theme-secondary: #764ba2;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, var(--theme-primary) 0%, var(--theme-secondary) 100%);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    padding: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--bg-color);
    box-shadow: var(--shadow-hover);
    overflow: hidden;
    position: relative;
}

header {
    background: linear-gradient(135deg, var(--theme-primary) 0%, var(--theme-secondary) 100%);
    color: white;
    padding: 30px 20px;
    text-align: center;
    margin: 0;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.95;
    margin-bottom: 15px;
}

.theme-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.theme-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.theme-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.theme-btn.active {
    background: rgba(255, 255, 255, 0.4);
    border-color: white;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.daily-quote {
    margin-top: 15px;
    font-style: italic;
    opacity: 0.9;
    font-size: 0.95em;
}

main {
    padding: 30px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

section {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

section:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

section h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.5em;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
}

.input-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    font-family: inherit;
}

.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: #357abd;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
    margin: 5px;
    flex: 1;
    min-width: 120px;
}

.btn-secondary:hover {
    background: #45b869;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(80, 200, 120, 0.4);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
    padding: 8px 15px;
    font-size: 0.9em;
}

.btn-danger:hover {
    background: #c0392b;
}

.result-box {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 10px;
    border-left: 4px solid var(--primary-color);
    display: none;
}

.result-box.show {
    display: block;
    animation: slideIn 0.5s ease;
}

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

.result-box h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.3em;
}

.result-box .dday-number {
    font-size: 2.5em;
    font-weight: bold;
    color: var(--primary-color);
    margin: 10px 0;
}

.result-box .dday-text {
    font-size: 1.2em;
    color: var(--text-color);
}

.detailed-time {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.time-item {
    text-align: center;
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    min-width: 80px;
    transition: transform 0.3s ease;
}

.time-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.time-value {
    display: block;
    font-size: 2em;
    font-weight: bold;
    color: var(--primary-color);
    transition: all 0.3s ease;
}

.number-animate {
    display: inline-block;
}

.number-rolling {
    animation: numberRoll 0.8s ease-out;
}

.number-pulse {
    animation: numberPulse 0.3s ease;
}

@keyframes numberRoll {
    0% {
        transform: translateY(-20px) rotateX(90deg);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateY(0) rotateX(0deg);
        opacity: 1;
    }
}

@keyframes numberPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
        color: var(--secondary-color);
    }
}

.time-label {
    display: block;
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
}

.animate-count {
    animation: countPulse 0.5s ease;
}

@keyframes countPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.share-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.share-btn {
    background: #6c757d;
    color: white;
    padding: 8px 15px;
    font-size: 0.9em;
    flex: 1;
    min-width: 120px;
}

.share-btn:hover {
    background: #5a6268;
}

.quick-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.memo-section textarea {
    resize: vertical;
    min-height: 100px;
}

.memo-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.memo-actions .btn {
    flex: 1;
}

.memos-list {
    display: grid;
    gap: 15px;
    margin-top: 20px;
}

.memo-item {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid var(--secondary-color);
}

.memo-date {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 8px;
}

.memo-text {
    color: var(--text-color);
    line-height: 1.6;
}

.memo-actions-inline {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.memo-actions-inline .btn {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.9em;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: none;
    letter-spacing: 0;
}

.memo-actions-inline .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.memo-actions-inline .btn-danger {
    background: var(--danger-color);
}

.memo-actions-inline .btn-danger:hover {
    background: #c0392b;
}

.memo-actions-inline .share-btn {
    background: #6c757d;
}

.memo-actions-inline .share-btn:hover {
    background: #5a6268;
}

.widget-section {
    grid-column: span 1;
}

.widget-result {
    margin-top: 20px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 10px;
    display: none;
}

.widget-result.show {
    display: block;
}

.widget-preview,
.widget-code {
    margin-bottom: 20px;
}

.widget-code textarea {
    font-size: 0.9em;
    resize: vertical;
}

.ad-container {
    margin: 20px auto;
    text-align: center;
    padding: 10px;
}

.ad-top {
    margin-top: 0;
}

.ad-bottom {
    margin-bottom: 20px;
}


footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: 30px;
}

footer p {
    margin: 0;
    font-size: 0.9em;
}

/* 반응형 디자인 */
@media (min-width: 768px) {
    main {
        grid-template-columns: 1fr 1fr;
    }
    
    .calculator-section {
        grid-column: span 1;
    }
    
    .quick-calc-section,
    .memo-section,
    .widget-section {
        grid-column: span 2;
    }
}

@media (min-width: 1024px) {
    main {
        grid-template-columns: 1fr 1fr;
    }
    
    header h1 {
        font-size: 3em;
    }
    
    .quick-buttons {
        justify-content: center;
    }
    
    .btn-secondary {
        flex: 0 1 auto;
    }
    
    .share-buttons {
        justify-content: center;
    }
}

@media (max-width: 767px) {
    header {
        padding: 20px 15px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .quick-buttons {
        flex-direction: column;
    }
    
    .btn-secondary {
        width: 100%;
        margin: 5px 0;
    }
    
    .share-buttons {
        flex-direction: column;
    }
    
    .share-btn {
        width: 100%;
    }
    
    .detailed-time {
        gap: 10px;
    }
    
    .time-item {
        min-width: 70px;
        padding: 10px 15px;
    }
    
    .time-value {
        font-size: 1.5em;
    }
    
    .memo-actions-inline {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .memo-actions-inline .btn {
        height: 44px;
        font-size: 0.95em;
    }
}

/* 로딩 애니메이션 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(74, 144, 226, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
