:root {
    --brand-yellow: #F2C94C;
    --brand-yellow-dark: #E0B840;
    --brand-yellow-light: #FCE4A0;
    --bg-color: #FAFAFA;
    --text-color: #2D3436;
    --text-muted: #636E72;
    --card-bg: #FFFFFF;
    --border-color: #DFE6E9;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 10px 30px rgba(0, 0, 0, 0.08);
    --radius-lg: 16px;
    --radius-md: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    word-break: keep-all;
}

header {
    background-color: var(--brand-yellow);
    padding: 60px 24px;
    text-align: center;
    position: relative;
    overflow: hidden;
}



header h1 {
    font-size: 42px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
}

header p {
    font-size: 18px;
    color: rgba(0, 0, 0, 0.7);
    font-weight: 500;
}

.tool-nav {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    position: sticky;
    top: 0;
    z-index: 100;
    justify-content: flex-start;
    scrollbar-width: none;
    /* Hide scrollbar for Firefox */
}

/* Hide scrollbar for Chrome/Safari */
.tool-nav::-webkit-scrollbar {
    display: none;
}

@media (min-width: 768px) {
    .tool-nav {
        flex-wrap: wrap;
        justify-content: center;
        white-space: normal;
        padding: 12px 5%;
    }
}

.nav-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 20px;
    background-color: #f1f3f5;
    color: var(--text-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.nav-badge:hover {
    background-color: var(--brand-yellow-light);
    color: #000;
}

.nav-badge.active {
    background-color: var(--brand-yellow);
    color: #000;
    font-weight: 700;
}

.nav-divider {
    width: 1px;
    height: 20px;
    background-color: var(--border-color);
    margin: 0 8px;
    align-self: center;
    flex-shrink: 0;
}

main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px 100px;
}

.section-title {
    font-size: 24px;
    font-weight: 700;
    margin: 40px 0 20px;
    display: flex;
    align-items: center;
}

.section-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 24px;
    background-color: var(--brand-yellow);
    margin-right: 12px;
    border-radius: 2px;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.tool-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-soft);
}

.tool-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
    border-color: var(--brand-yellow);
}

.tool-card .icon {
    font-size: 32px;
    margin-bottom: 16px;
    display: block;
}

.tool-card h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-color);
}

.tool-card p {
    font-size: 15px;
    color: var(--text-muted);
    flex-grow: 1;
}

.badge {
    display: inline-block;
    background-color: var(--brand-yellow-light);
    color: #444;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    margin-top: 16px;
    align-self: flex-start;
}

/* Tool Page Styles */
.tool-container {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
}

.tool-header {
    margin-bottom: 30px;
    border-bottom: 2px solid var(--bg-color);
    padding-bottom: 20px;
}

.tool-header h2 {
    font-size: 28px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.tool-header h2 a.home-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.2s;
    background-color: var(--bg-color);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    /* Squircle design */
    margin-right: 4px;
}

.tool-header h2 a.home-icon:hover {
    background-color: var(--brand-yellow);
    transform: scale(1.1);
}

.tool-header h2 a.home-icon .material-icons {
    font-size: 24px;
}

.tool-header p {
    color: var(--text-muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 16px;
}

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

.btn-primary:hover {
    background-color: var(--brand-yellow-dark);
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

/* Counter Tool Styles */
.counter-group {
    margin-bottom: 24px;
}

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

.input-field {
    width: 100%;
    padding: 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 16px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: #fff;
    line-height: 1.6;
}

.input-field:focus {
    outline: none;
    border-color: var(--brand-yellow);
    box-shadow: 0 8px 16px rgba(242, 201, 76, 0.15);
}

.stats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.stat-item {
    flex: 1;
    min-width: 120px;
    background-color: #fff;
    padding: 16px 12px;
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.stat-value {
    display: block;
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 2px;
}

/* Specific colors for stat items */
.stat-item.char-all {
    border-top: 4px solid #4854ff;
}

.stat-item.char-no-space {
    border-top: 4px solid #00b894;
}

.stat-item.words {
    border-top: 4px solid #0984e3;
}

.stat-item.lines {
    border-top: 4px solid #6c5ce7;
}

.stat-item.paras {
    border-top: 4px solid #e17055;
}

.stat-item.sents {
    border-top: 4px solid #fdcb6e;
}

.stat-item.char-all .stat-value {
    color: #4854ff;
}

.stat-item.char-no-space .stat-value {
    color: #00b894;
}

.stat-item.words .stat-value {
    color: #0984e3;
}

.stat-item.lines .stat-value {
    color: #6c5ce7;
}

.stat-item.paras .stat-value {
    color: #e17055;
}

.stat-item.sents .stat-value {
    color: #d4a017;
}

.stat-label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 4px;
}

/* Tooltip Styles */
.stat-item {
    position: relative;
    cursor: help;
}

.stat-item::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background-color: #2d3436;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    width: 200px;
    line-height: 1.4;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

.stat-item::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    border: 6px solid transparent;
    border-top-color: #2d3436;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    pointer-events: none;
}

.stat-item:hover::before,
.stat-item:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Number Animation */
.stat-value.updating {
    animation: countChange 0.3s ease-out;
}

@keyframes countChange {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
        color: var(--brand-yellow-dark);
    }

    100% {
        transform: scale(1);
    }
}

.footer-links {
    margin-top: 10px;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
    font-weight: 500;
}

.footer-links a:hover {
    color: var(--brand-yellow-dark);
}

/* Markdown Preview Helper */
.preview-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 30px;
}

.preview-box {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.preview-label {
    background-color: var(--bg-color);
    padding: 0 16px;
    height: 44px;
    /* Fixed height for consistency */
    font-size: 13px;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #e17055;
    transition: all 0.2s;
    padding: 4px;
    border-radius: 4px;
}

.delete-btn:hover {
    background-color: rgba(225, 112, 85, 0.1);
    transform: scale(1.1);
}

#markdown-input {
    width: 100%;
    height: 600px;
    padding: 20px;
    border: none;
    resize: none;
    font-family: 'Fira Code', 'Cascadia Code', Consolas, Monaco, monospace;
    font-size: 14px;
    line-height: 1.6;
}

#markdown-input:focus {
    outline: none;
}

#markdown-output {
    height: 600px;
    padding: 20px;
    overflow-y: auto;
    background-color: #fff;
    font-size: 15px;
    line-height: 1.7;
}

/* Markdown Content Styling */
#markdown-output h1,
#markdown-output h2,
#markdown-output h3 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 700;
}

#markdown-output h1 {
    font-size: 2em;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.3em;
}

#markdown-output h2 {
    font-size: 1.5em;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.3em;
}

#markdown-output p {
    margin-bottom: 16px;
}

#markdown-output code {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: monospace;
}

#markdown-output pre {
    background-color: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 16px;
}

#markdown-output blockquote {
    border-left: 4px solid #dfe6e9;
    padding-left: 16px;
    color: #636e72;
    font-style: italic;
}

#markdown-output img {
    max-width: 100%;
    border-radius: 8px;
}

#markdown-output table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 16px;
}

#markdown-output th,
#markdown-output td {
    border: 1px solid #dfe6e9;
    padding: 8px 12px;
}

#markdown-output th {
    background-color: #f8f9fa;
}

@media (max-width: 900px) {
    .preview-split {
        grid-template-columns: 1fr;
    }
}

/* Image Cutter Specific Styles */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 60px 20px;
    text-align: center;
    transition: all 0.2s;
    background-color: #fff;
    cursor: pointer;
    margin-bottom: 30px;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--brand-yellow);
    background-color: rgba(242, 201, 76, 0.05);
}

.upload-zone .material-icons {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.intensity-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 30px;
}

.intensity-option {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background-color: #fff;
}

.intensity-option input {
    display: none;
}

.intensity-option:hover {
    border-color: var(--brand-yellow);
}

.intensity-option.active {
    border-color: var(--brand-yellow);
    background-color: rgba(242, 201, 76, 0.1);
    font-weight: 700;
}

.file-list {
    margin-top: 30px;
}

.file-item {
    display: flex;
    align-items: center;
    background-color: #fff;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    position: relative;
    transition: all 0.2s;
}

.file-item:hover {
    border-color: #ced4da;
}

.file-item .file-info {
    flex-grow: 1;
    font-size: 14px;
    margin-right: 15px;
}

.file-item .file-status {
    font-size: 13px;
    color: var(--text-muted);
    min-width: 60px;
    text-align: right;
}

.remove-file {
    margin-left: 15px;
    cursor: pointer;
    color: #ced4da;
    transition: color 0.2s;
    font-size: 20px;
    line-height: 1;
}

.remove-file:hover {
    color: #e17055;
}

.progress-container {
    height: 6px;
    background-color: #f1f3f5;
    border-radius: 3px;
    margin-top: 8px;
    overflow: hidden;
    width: 100%;
}

.progress-bar {
    height: 100%;
    background-color: var(--brand-yellow);
    width: 0%;
    transition: width 0.3s;
}

.action-buttons {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

#start-conversion,
#download-all {
    padding: 16px 60px;
    font-size: 18px;
    width: 100%;
    max-width: 300px;
}

/* Global Progress Styles */
.global-progress-container {
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    display: none;
    /* Initially hidden */
}

.global-status-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 12px;
}

.global-status-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-color);
}

.global-status-count {
    font-size: 14px;
    color: var(--text-muted);
}

.global-progress-bar-wrapper {
    height: 12px;
    background-color: #f1f3f5;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 12px;
}

.global-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-yellow), #f2994a);
    width: 0%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.global-current-task {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.global-current-task .material-icons {
    font-size: 16px;
    margin-right: 6px;
    color: var(--brand-yellow);
}

@media (max-width: 600px) {
    .intensity-selector {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    header {
        padding: 40px 20px;
    }

    header h1 {
        font-size: 32px;
    }

    .tool-grid {
        grid-template-columns: 1fr;
    }
}