:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --primary-soft: #eff6ff;

    --positive: #15803d;
    --positive-soft: #dcfce7;
    --negative: #dc2626;
    --negative-soft: #fee2e2;
    --warning: #d97706;
    --warning-soft: #fef3c7;

    --background: #f6f7f9;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --surface-strong: #eef2f7;
    --text-main: #111827;
    --text-sub: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --border-color: var(--border);

    --input-bg: #ffffff;
    --radius: 8px;
    --radius-lg: 8px;
    --header-height: 56px;
    --header-bg: rgba(255, 255, 255, 0.94);
    --header-border: rgba(148, 163, 184, 0.28);

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 8px 18px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 18px 42px rgba(15, 23, 42, 0.16);
}

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}

article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
    display: block;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
}

body {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    background: var(--background);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    letter-spacing: 0;
    -webkit-font-smoothing: antialiased;
}

ol, ul {
    list-style: none;
}

blockquote, q {
    quotes: none;
}

blockquote:before, blockquote:after,
q:before, q:after {
    content: '';
    content: none;
}

table {
    border-collapse: collapse;
    border-spacing: 0;
}

button,
input,
textarea,
select {
    font: inherit;
    letter-spacing: 0;
}

button {
    color: inherit;
}

a {
    color: inherit;
}

strong {
    font-weight: 700;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 0.92em;
}

.visually-hidden {
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
}

.app-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.25rem;
    flex: 1;
}

.page {
    display: grid;
    gap: 1rem;
    align-content: start;
}

.btn {
    min-height: 36px;
    padding: 0.45rem 0.8rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    background: transparent;
    color: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--surface);
    color: var(--text-main);
    border-color: var(--border);
}

.btn-secondary:hover {
    background-color: var(--surface-muted);
    border-color: var(--border-strong);
}

.btn.active,
.btn-secondary.active {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary);
}

.card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1rem;
}

.styled-input {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: var(--input-bg);
    padding: 0.48rem 0.7rem;
    color: var(--text-main);
    font-size: 0.94rem;
    font-weight: 500;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.styled-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.styled-input::placeholder,
textarea::placeholder,
input::placeholder {
    color: var(--text-muted);
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    color: var(--text-main);
    font-weight: 800;
    letter-spacing: 0;
}

.page-title {
    font-size: clamp(1.35rem, 2vw, 1.65rem);
    font-weight: 800;
    line-height: 1.25;
}

.text-positive {
    color: var(--positive) !important;
}

.text-negative {
    color: var(--negative) !important;
}

footer {
    margin-top: 1rem;
    padding: 1.4rem 0;
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.72);
    color: var(--text-sub);
    font-size: 0.8rem;
}

.footer-container {
    max-width: 1200px;
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex: initial;
}

.footer-meta,
.footer-links {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.footer-inline-link {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 700;
}

.footer-inline-link:hover {
    color: var(--primary);
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(4px);
}

.modal-content {
    width: min(100%, 420px);
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    padding: 1.25rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.modal-text {
    margin: 0.65rem 0 1rem;
    color: var(--text-sub);
    font-size: 0.92rem;
    line-height: 1.6;
}

.feedback-modal {
    overflow: auto;
}

.feedback-modal-content {
    width: min(92vw, 460px);
    margin: min(10vh, 4rem) auto;
    padding: 1.25rem;
}

.feedback-modal-title {
    margin-bottom: 0.5rem;
    font-size: 1.08rem;
    font-weight: 800;
}

.feedback-modal-description {
    margin-bottom: 0.4rem;
    color: var(--text-sub);
    font-size: 0.9rem;
    line-height: 1.5;
}

.feedback-modal-warning {
    margin-bottom: 0.85rem;
    color: var(--negative);
    font-size: 0.84rem;
    font-weight: 700;
}

.feedback-modal-textarea {
    width: 100%;
    min-height: 120px;
    margin-bottom: 0.85rem;
    padding: 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    resize: vertical;
    color: var(--text-main);
    background: var(--surface);
}

.feedback-modal-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.feedback-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.feedback-modal-btn {
    min-height: 34px;
    padding: 0.42rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
}

.feedback-modal-btn-secondary {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-main);
}

.feedback-modal-btn-primary {
    border: 1px solid var(--primary);
    background: var(--primary);
    color: #ffffff;
}

.site-header {
    height: var(--header-height);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--header-border);
    background-color: var(--header-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.header-content {
    width: 100%;
    max-width: 1200px;
    height: 100%;
    margin: 0 auto;
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.header-left {
    min-width: 0;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 1.4rem;
}

.brand {
    height: 100%;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 800;
    line-height: 1;
}

.brand:hover {
    color: var(--primary);
}

.brand-icon,
.brand-icon img {
    display: block;
}

.brand-icon img {
    width: 28px;
    height: 28px;
    border-radius: 7px;
}

.brand-word {
    font-size: 1rem;
    letter-spacing: 0;
}

.desktop-nav {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-link {
    height: 100%;
    display: inline-flex;
    align-items: center;
    border-bottom: 2px solid transparent;
    color: var(--text-sub);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    transition: color 0.16s ease, border-color 0.16s ease;
}

.nav-link:hover {
    color: var(--text-main);
    border-color: var(--primary);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-auth-form {
    display: inline-flex;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-main);
    font-size: 0.86rem;
}

.greeting {
    color: var(--text-sub);
    font-weight: 500;
}

.profile-link {
    color: var(--text-main);
    font-weight: 800;
    text-decoration: none;
}

.profile-link:hover {
    color: var(--primary);
}

.btn-auth {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.7rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.btn-auth.btn-login {
    background-color: var(--text-main);
    color: #ffffff;
}

.btn-auth.btn-login:hover {
    background-color: #020617;
}

.btn-auth.btn-logout {
    background-color: var(--surface-muted);
    color: var(--text-sub);
    border-color: var(--border);
}

.btn-auth.btn-logout:hover {
    color: var(--text-main);
    border-color: var(--border-strong);
}

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    z-index: 101;
}

.mobile-menu-btn span {
    display: block;
    width: 16px;
    height: 2px;
    margin: 0 auto;
    border-radius: 999px;
    background-color: var(--text-main);
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background-color: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.22s ease;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

.mobile-menu-wrapper {
    position: absolute;
    top: 0;
    right: -300px;
    width: min(300px, 86vw);
    height: 100%;
    z-index: 10000;
    border-left: 1px solid var(--border);
    background-color: var(--surface);
    box-shadow: -12px 0 32px rgba(15, 23, 42, 0.12);
    transition: right 0.22s ease;
}

.mobile-menu-overlay.active .mobile-menu-wrapper {
    right: 0;
}

.mobile-menu-content {
    width: 100%;
    height: 100%;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.close-menu-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-sub);
    cursor: pointer;
}

.close-menu-btn:hover {
    color: var(--text-main);
}

.mobile-user-info {
    margin-bottom: 1rem;
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: var(--surface-muted);
}

.user-profile-mobile {
    margin-bottom: 0.6rem;
    color: var(--text-main);
    font-size: 0.92rem;
}

.mobile-nickname {
    font-weight: 800;
}

.btn-mobile-profile {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-sub);
    font-size: 0.84rem;
    font-weight: 700;
    text-decoration: none;
}

.mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 0.55rem 0.1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    font-size: 0.98rem;
    font-weight: 700;
    text-decoration: none;
}

.mobile-nav-link:hover {
    color: var(--primary);
}

.mobile-auth-actions {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-mobile-auth {
    width: 100%;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: var(--radius);
    text-align: center;
    font-size: 0.92rem;
    font-weight: 700;
    text-decoration: none;
}

.btn-mobile-auth.btn-login {
    background-color: var(--text-main);
    color: #ffffff;
}

.btn-mobile-auth.btn-logout {
    background-color: var(--surface-muted);
    color: var(--text-main);
    border-color: var(--border);
}

.tooltip-container {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.tooltip-text {
    visibility: hidden;
    width: 220px;
    position: absolute;
    z-index: 20;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 0.55rem 0.65rem;
    border-radius: var(--radius);
    background-color: #0f172a;
    color: #ffffff;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.45;
    opacity: 0;
    box-shadow: var(--shadow-md);
    transition: opacity 0.16s ease;
}

.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: #0f172a transparent transparent transparent;
}

.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background-color: var(--surface-muted);
    color: var(--text-sub);
    font-size: 0.75rem;
    font-weight: 800;
    cursor: help;
}

.tooltip-inline {
    margin-left: 0.45rem;
}

.help-tooltip {
    visibility: hidden;
    width: min(320px, 84vw);
    position: absolute;
    z-index: 30;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: var(--surface);
    color: var(--text-main);
    text-align: left;
    font-size: 0.85rem;
    line-height: 1.55;
    white-space: normal;
    opacity: 0;
    box-shadow: var(--shadow-lg);
    transition: opacity 0.16s ease;
}

.help-tooltip::after {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 7px;
    border-style: solid;
    border-color: transparent transparent var(--surface) transparent;
}

.tooltip-container:hover .tooltip-text,
.tooltip-container:hover .help-tooltip,
.tooltip-container:focus-within .tooltip-text,
.tooltip-container:focus-within .help-tooltip {
    visibility: visible;
    opacity: 1;
}

.help-tooltip ol {
    padding-left: 1.1rem;
    margin: 0.5rem 0 0;
}

.help-tooltip li {
    margin-bottom: 0.25rem;
}

.portfolio-modal {
    display: none;
    animation: portfolioModalFadeIn 0.16s ease-out;
}

.portfolio-modal .modal-content {
    width: min(100%, 420px);
    padding: 1.25rem;
    text-align: left;
    animation: portfolioModalSlideUp 0.18s ease-out;
}

.portfolio-modal h3 {
    margin: 0 0 1rem;
    color: var(--text-main);
    font-size: 1.16rem;
    font-weight: 800;
}

.portfolio-modal .modal-actions {
    margin-top: 1rem;
}

.portfolio-modal .modal-actions .btn {
    min-width: 0;
}

@keyframes portfolioModalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@media (max-width: 900px) {
    .desktop-nav,
    .desktop-user-menu {
        display: none;
    }

    .mobile-menu-btn {
        display: flex;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    .app-container {
        padding: 1rem;
    }

    .header-content {
        padding: 0 1rem;
    }

    .footer-container {
        align-items: flex-start;
        flex-direction: column;
        padding: 0 1rem;
    }

    .modal-actions,
    .feedback-modal-actions {
        flex-wrap: wrap;
    }

    .modal-actions .btn,
    .feedback-modal-btn {
        flex: 1 1 120px;
    }
}
