/* shadcn/ui 스타일 토큰 (light) */
:root {
    --background: 0 0% 100%;
    --foreground: 222.2 47.4% 11.2%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 47.4% 11.2%;
    --primary: 222.2 47.4% 11.2%;
    --primary-foreground: 210 40% 98%;
    --secondary: 210 40% 96.1%;
    --secondary-foreground: 222.2 47.4% 11.2%;
    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 210 40% 96.1%;
    --accent-foreground: 222.2 47.4% 11.2%;
    --destructive: 0 72.2% 50.6%;
    --destructive-foreground: 210 40% 98%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 222.2 84% 4.9%;
    --success: 142.1 70.6% 45.3%;
    --radius: 0.5rem;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: "Pretendard", "Pretendard Variable", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
                 "Noto Sans KR", "Segoe UI", "Malgun Gothic", system-ui, sans-serif;
    font-feature-settings: "ss01", "cv01", "rlig" 1, "calt" 1;
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

a { color: inherit; }
button { font: inherit; color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }

.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ---------- Card ---------- */
.card {
    background: hsl(var(--card));
    color: hsl(var(--card-foreground));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.04);
    overflow: hidden;
}
.card-header {
    padding: 1.5rem 1.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}
.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0;
    letter-spacing: -0.01em;
}
.card-description {
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
    margin: 0;
}
.card-content { padding: 1.25rem 1.5rem 1.5rem; }

/* ---------- Form ---------- */
.label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: hsl(var(--foreground));
    letter-spacing: -0.005em;
}
.input {
    width: 100%;
    height: 2.5rem;
    padding: 0 0.75rem;
    font-size: 0.875rem;
    color: hsl(var(--foreground));
    background: hsl(var(--background));
    border: 1px solid hsl(var(--input));
    border-radius: calc(var(--radius) - 2px);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    outline: none;
    font-family: inherit;
}
.input::placeholder { color: hsl(var(--muted-foreground)); }
.input:focus, .input:focus-visible {
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 3px hsl(var(--ring) / 0.15);
}
.form-row { margin-bottom: 1rem; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    height: 2.5rem;
    padding: 0 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
    user-select: none;
    text-decoration: none;
    font-family: inherit;
}
.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px hsl(var(--ring) / 0.2);
}
.btn-primary {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}
.btn-primary:hover { background: hsl(var(--primary) / 0.9); }
.btn-ghost {
    background: transparent;
    color: hsl(var(--foreground));
    border-color: transparent;
}
.btn-ghost:hover { background: hsl(var(--accent)); }
.btn-full { width: 100%; }
.btn-sm { height: 2rem; padding: 0 0.75rem; font-size: 0.8125rem; }
.btn-xs {
    height: 1.5rem;
    padding: 0 0.5rem;
    font-size: 0.75rem;
    border-radius: calc(var(--radius) - 4px);
}
.btn.is-success {
    color: hsl(var(--success));
    background: hsl(var(--success) / 0.08);
}

/* ---------- Alert ---------- */
.alert {
    padding: 0.75rem 1rem;
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid transparent;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}
.alert-destructive {
    border-color: hsl(var(--destructive) / 0.4);
    background: hsl(var(--destructive) / 0.08);
    color: hsl(var(--destructive));
}

/* ---------- Auth shell ---------- */
.auth-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background:
        radial-gradient(circle at 18% -10%, hsl(222.2 47.4% 11.2% / 0.06), transparent 55%),
        radial-gradient(circle at 110% 110%, hsl(222.2 47.4% 11.2% / 0.04), transparent 60%),
        hsl(var(--background));
}
.auth-card { width: 100%; max-width: 380px; }
.auth-card .card-header { align-items: center; padding-top: 2rem; }
.auth-card .card-description { text-align: center; }
.auth-card .card-title { text-align: center; }
.auth-form { padding-top: 0.5rem; }
.brand-stack { margin-bottom: 0.25rem; }

/* ---------- Brand mark ---------- */
.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: calc(var(--radius) - 2px);
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
}

/* ---------- Topbar ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: hsl(var(--background) / 0.85);
    border-bottom: 1px solid hsl(var(--border));
    backdrop-filter: saturate(180%) blur(8px);
    -webkit-backdrop-filter: saturate(180%) blur(8px);
}
.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 3.5rem;
}
.brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}
.brand .brand-mark {
    width: 2rem;
    height: 2rem;
}
.brand-title {
    font-weight: 600;
    font-size: 0.9375rem;
    letter-spacing: -0.01em;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: hsl(var(--muted-foreground));
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    background: hsl(var(--muted));
}
.logout-form { margin: 0; display: inline-flex; }

/* ---------- Page ---------- */
.main-content {
    padding-top: 2.25rem;
    padding-bottom: 4rem;
}
.page-header { margin-bottom: 1.75rem; }
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
}
.page-subtitle {
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
    margin: 0.375rem 0 0;
}

/* ---------- Category section ---------- */
.category-section { margin-bottom: 2rem; }
.category-section:last-child { margin-bottom: 0; }
.category-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0 0 0.875rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid hsl(222.2 47.4% 11.2%);
    letter-spacing: -0.015em;
    color: hsl(222.2 60% 6%);
}

/* ---------- Grid ---------- */
.grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

/* ---------- Prototype card ---------- */
.prototype-card .card-content { padding-top: 0.5rem; }
.site-block + .site-block {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed hsl(var(--border));
}
.site-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.badge {
    display: inline-flex;
    align-items: center;
    height: 1.375rem;
    padding: 0 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: calc(var(--radius) - 2px);
    background: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
}
.link {
    color: hsl(var(--foreground));
    font-size: 0.875rem;
    text-decoration: none;
    word-break: break-all;
    border-bottom: 1px solid transparent;
    padding-bottom: 1px;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.link:hover { border-bottom-color: hsl(var(--foreground)); }

.cred-list {
    margin: 0.625rem 0 0;
    padding: 0.5rem 0.75rem;
    background: hsl(var(--muted));
    border-radius: calc(var(--radius) - 2px);
}
.cred-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.375rem 0;
    font-size: 0.8125rem;
}
.cred-item + .cred-item {
    border-top: 1px solid hsl(var(--border));
}
.cred-role {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    min-width: 3.5rem;
    flex-shrink: 0;
}
.cred-pair {
    flex: 1;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, "Cascadia Mono", "Liberation Mono", monospace;
    font-size: 0.8125rem;
    color: hsl(var(--foreground));
    background: transparent;
    padding: 0;
    word-break: break-all;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .container { padding: 0 1rem; }
    .brand-title { font-size: 0.875rem; }
    .grid { grid-template-columns: 1fr; }
    .page-title { font-size: 1.25rem; }
}
