:root {
    --bg-color: #0d0d0d;
    --text-primary: #f2f2f2;
    --text-secondary: #a0a0a0;
    --accent-color: #ffffff;
    --danger-color: #ff4d4d;
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.05);
    --input-bg: rgba(255, 255, 255, 0.05);
    --input-focus-border: rgba(255, 255, 255, 0.2);
    --font-family: 'Pretendard', 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

    /* Fluid Sizing for Responsiveness */
    --spacing-xs: clamp(0.25rem, 1vw, 0.5rem);
    --spacing-sm: clamp(0.75rem, 2vw, 1rem);
    --spacing-md: clamp(1.5rem, 4vw, 2rem);
    --spacing-lg: clamp(2.5rem, 8vw, 5rem);

    --radius-md: 12px;
    --radius-lg: 20px;

    --container-max-width: 1000px;
}

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

body {
    background-color: #050508;
    /* Deepest Space */
    /* background-image removed for clean look */

    color: var(--text-primary);
    font-family: var(--font-family);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    display: flex;
    justify-content: center;
}

/* Background Effects (Disabled in favor of body background) */
.background-effects {
    display: none;
}

/* Layout */
.app-container {
    width: 100%;
    max-width: var(--container-max-width);
    padding: 0 var(--spacing-sm);
    padding-bottom: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: max-width 0.3s ease;
}

/* Desktop Expansion: Allow wider layout on large screens for grid */
@media (min-width: 1024px) {
    :root {
        --container-max-width: 1000px;
    }
}

/* Typography */
h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 300;
    margin-bottom: var(--spacing-xs);
    text-align: center;
}

p {
    color: var(--text-secondary);
    font-size: clamp(0.9rem, 2vw, 1.05rem);
    font-weight: 400;
}

/* Hero Section */
.hero-section {
    margin-top: calc(var(--spacing-lg) * 1.5);
    margin-bottom: var(--spacing-lg);
    text-align: center;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    /* Context for absolute logo */
}

/* Cosmic Horizon Visual (Hidden as requested) */
.logo-mark {
    display: none;
}

/* Cleanup old classes */
.logo-circle {
    display: none;
}

h1 {
    position: relative;
    z-index: 30;
    /* Above black hole */
    font-size: clamp(2.5rem, 6vw, 3.5rem);
    font-weight: 800;
    /* Bolder */
    margin-bottom: var(--spacing-xs);
    text-align: center;

    /* Trendy Gradient Text */
    background: linear-gradient(180deg, #FFFFFF 20%, rgba(255, 255, 255, 0.6) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;

    letter-spacing: -0.03em;
    /* Tighter tracking */
    filter: drop-shadow(0 0 20px rgba(0, 0, 0, 0.8));
    /* Dark shadow for contrast against glowing disk */
}

#app-slogan {
    position: relative;
    z-index: 30;
    /* Above black hole */
    margin-bottom: var(--spacing-lg);
    line-height: 1.6;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
    color: var(--text-secondary);
    font-size: clamp(1rem, 2vw, 1.1rem);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    /* Readability */
}

.timer-container {
    position: relative;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 32px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 24px -1px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.timer-container:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
}

#countdown-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.flip-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.flip-card {
    background: #1e1e1e;
    /* Darker card background */
    color: var(--text-primary);
    font-family: 'Inter', monospace;
    font-variant-numeric: tabular-nums;
    /* Monospaced numbers */
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    padding: 12px 0;
    /* Changed padding to centered */
    border-radius: 8px;
    width: 80px;
    /* Fixed width prevents jitter */
    text-align: center;
    position: relative;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);

    /* Horizontal split line effect */
    background-image: linear-gradient(to bottom,
            rgba(255, 255, 255, 0.05) 50%,
            rgba(0, 0, 0, 0.2) 50%,
            rgba(0, 0, 0, 0.2) 51%,
            rgba(255, 255, 255, 0.05) 51%);
}

.flip-card::after {
    /* Subtle highlight on top edge */
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px 8px 0 0;
}

.flip-sep {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 700;
    margin-top: -4px;
    /* Align visually with center of cards */
}

/* Input Section */
.input-section {
    width: 100%;
    max-width: 100%;
    /* Expanded to match grid */
    /* Keep input focused even on wide screens */
    margin: 0 auto;
    /* Center it */
    margin-bottom: var(--spacing-lg);
}

.input-wrapper {
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-sm) var(--spacing-md);
    /* Adjusted padding for slimmer look */
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.input-wrapper:focus-within {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--input-focus-border);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
}

textarea {
    width: 100%;
    min-height: 50px;
    /* Reduced further */
    background: transparent;
    border: none;
    resize: none;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-family: var(--font-family);
    line-height: 1.6;
    outline: none;
}

textarea::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--spacing-sm);
}

#char-count {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.3);
    font-family: 'Inter', monospace;
}

button {
    cursor: pointer;
    border: none;
    padding: 12px 24px;
    border-radius: 100px;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: var(--font-family);
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);

    /* Touch target optimization */
    min-height: 48px;
    min-width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#btn-throw {
    background: var(--text-primary);
    color: var(--bg-color);
}

#btn-throw:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.15);
}

#btn-throw:active:not(:disabled) {
    transform: translateY(0);
}

#btn-throw:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

/* List Section */
.list-section {
    width: 100%;
}

.trash-grid {
    column-count: 1;
    column-gap: var(--spacing-sm);
}

/* Tablet & Desktop Masonry */
@media (min-width: 768px) {
    .trash-grid {
        column-count: 2;
        column-gap: var(--spacing-md);
    }
}

@media (min-width: 1024px) {
    .trash-grid {
        column-count: 3;
    }
}

.trash-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    animation: slideUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    opacity: 0;
    transform: translateY(20px);
    transition: transform 0.3s ease, background 0.3s ease;

    /* Masonry Item Styles */
    display: inline-block;
    width: 100%;
    margin-bottom: var(--spacing-sm);
    break-inside: avoid;
    vertical-align: top;
    /* Ensure alignment */
}

@media (min-width: 768px) {
    .trash-card {
        margin-bottom: var(--spacing-md);
    }
}

.trash-card:hover {
    transform: scale(1.02);
    background: rgba(255, 255, 255, 0.08);
    /* More visible hover state */
}

.trash-card p {
    color: var(--text-primary);
    font-size: 1rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.trash-timestamp {
    display: block;
    margin-top: var(--spacing-sm);
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
    text-align: right;
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    /* Span all columns */
    text-align: center;
    padding: var(--spacing-lg) 0;
    opacity: 0.5;
    font-style: italic;
}

/* Footer */
footer {
    width: 100%;
    margin-top: var(--spacing-lg);
    text-align: center;
    border-top: 1px solid var(--card-border);
    padding-top: var(--spacing-md);

    /* Ensure footer doesn't get too wide on desktop */
    max-width: 800px;
}

#footer-privacy {
    font-size: 0.8rem;
    margin-bottom: var(--spacing-sm);
    line-height: 1.5;
    word-break: keep-all;
    /* Avoid awkward breaks in Korean */
}

.copyright {
    font-size: 0.75rem;
    opacity: 0.5;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    padding: var(--spacing-sm);
    /* Prevent touching edges on mobile */
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: #1a1a1a;
    width: 100%;
    max-width: 400px;
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.modal-overlay:not(.hidden) .modal-content {
    transform: scale(1);
}

#modal-title {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

#modal-body {
    margin-bottom: var(--spacing-md);
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
}

.modal-actions button {
    flex: 1;
    /* Match widths on mobile */
}

.btn-secondary {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-primary {
    background: var(--text-primary);
    color: var(--bg-color);
}

.btn-primary:hover {
    background: #ffffff;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

/* Animations */
.fade-in {
    opacity: 0;
    animation: fadeIn 1s ease forwards;
}

.delay-1 {
    animation-delay: 0.2s;
}

.delay-2 {
    animation-delay: 0.4s;
}

.delay-3 {
    animation-delay: 0.6s;
}

.delay-4 {
    animation-delay: 0.8s;
}

.delay-5 {
    animation-delay: 1.0s;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hidden {
    display: none !important;
}

/* Particle Effects for Deletion */
canvas {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1001;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}