:root {
    --primary: #3b82f6;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text-main: #334155;
    --text-heading: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --accent-user: #3b82f6;
    --accent-admin: #ef4444;
    --accent-dev: #8b5cf6;
}

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

body { 
    font-family: 'Inter', 'Noto Sans JP', sans-serif; 
    background-color: var(--bg); 
    color: var(--text-main); 
    line-height: 1.7; 
    -webkit-font-smoothing: antialiased;
}

header { 
    background: rgba(255, 255, 255, 0.85); 
    backdrop-filter: blur(12px); 
    border-bottom: 1px solid var(--border); 
    position: sticky; 
    top: 0; 
    z-index: 100; 
    padding: 1rem 2rem; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

.logo { 
    font-size: 1.25rem; 
    font-weight: 700; 
    color: var(--text-heading); 
    text-decoration: none; 
    display: flex; 
    align-items: center; 
    gap: 0.5rem; 
}

.container { 
    display: flex;
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 3rem 2rem; 
    gap: 4rem; 
}

.container.portal {
    display: block;
    max-width: 1000px;
    padding: 4rem 1.5rem;
    text-align: center;
}

h1 { 
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 1rem; 
    color: var(--text-heading); 
    letter-spacing: -0.025em;
}

p.desc { 
    color: var(--text-muted); 
    margin-bottom: 4rem; 
    font-size: 1.125rem; 
}

.role-cards { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 2rem; 
}

.role-card { 
    background: var(--surface); 
    border-radius: 20px; 
    padding: 3rem 2rem; 
    border: 1px solid var(--border); 
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05); 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    text-decoration: none; 
    color: inherit; 
    position: relative;
    overflow: hidden;
}

.role-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.3s;
}

.role-card.user::before { background: var(--accent-user); opacity: 1; }
.role-card.admin::before { background: var(--accent-admin); opacity: 1; }
.role-card.dev::before { background: var(--accent-dev); opacity: 1; }

.role-card:hover { 
    transform: translateY(-8px); 
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1); 
}

.role-icon { font-size: 3.5rem; margin-bottom: 1.5rem; }
.role-title { font-size: 1.25rem; font-weight: 700; color: var(--text-heading); margin-bottom: 0.75rem; }
.role-desc { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 2rem; flex-grow: 1; line-height: 1.6; }

.role-btn { 
    padding: 0.75rem 1.5rem; 
    border-radius: 10px; 
    font-weight: 600; 
    font-size: 0.95rem; 
    color: #fff; 
    width: 100%; 
    text-align: center;
    transition: opacity 0.2s;
}
.role-card:hover .role-btn { opacity: 0.9; }

.btn-user { background-color: var(--accent-user); }
.btn-admin { background-color: var(--accent-admin); }
.btn-dev { background-color: var(--accent-dev); }

.back-link, .back-to-portal { 
    display: inline-block; 
    text-decoration: none; 
    color: var(--text-muted); 
    font-weight: 500; 
    transition: all 0.2s; 
    padding: 0.5rem 1rem;
    border-radius: 8px;
}
.back-link { margin-top: 4rem; }
.back-to-portal { font-size: 0.95rem; }
.back-link:hover, .back-to-portal:hover { color: var(--text-heading); background: #f1f5f9; }

.sidebar { 
    width: 280px; 
    flex-shrink: 0; 
    position: sticky; 
    top: 100px; 
    height: max-content;
    max-height: calc(100vh - 120px); 
    overflow-y: auto; 
}
.sidebar-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    padding-left: 1rem;
}
.sidebar ul { list-style: none; }
.sidebar li { margin-bottom: 0.25rem; }
.sidebar a { 
    text-decoration: none; 
    color: var(--text-muted); 
    font-size: 0.95rem; 
    font-weight: 500; 
    display: block; 
    padding: 0.6rem 1rem; 
    border-radius: 8px; 
    transition: all 0.2s ease; 
}

body.manual-user .sidebar a:hover { background-color: var(--surface); color: var(--accent-user); box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
body.manual-admin .sidebar a:hover { background-color: var(--surface); color: var(--accent-admin); box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
body.manual-dev .sidebar a:hover { background-color: var(--surface); color: var(--accent-dev); box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }

.content { flex: 1; min-width: 0; }
section { 
    background: var(--surface); 
    border-radius: 20px; 
    padding: 3rem; 
    margin-bottom: 3rem; 
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05); 
    border: 1px solid var(--border); 
    scroll-margin-top: 100px;
}

h2, h3, h4 { color: var(--text-heading); margin-bottom: 1rem; font-weight: 700; }
h2 { 
    font-size: 1.875rem; 
    padding-bottom: 1rem; 
    margin-bottom: 2rem; 
    border-bottom: 2px solid #f1f5f9; 
    position: relative;
}

body.manual-user h2::after { content: ''; position: absolute; left: 0; bottom: -2px; width: 60px; height: 2px; background-color: var(--accent-user); }
body.manual-admin h2::after { content: ''; position: absolute; left: 0; bottom: -2px; width: 60px; height: 2px; background-color: var(--accent-admin); }
body.manual-dev h2::after { content: ''; position: absolute; left: 0; bottom: -2px; width: 60px; height: 2px; background-color: var(--accent-dev); }

h3 { 
    font-size: 1.25rem; 
    margin-top: 2.5rem; 
    color: var(--text-heading);
    display: flex; 
    align-items: center; 
    gap: 0.5rem;
}
p { margin-bottom: 1.25rem; }

.highlight {
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.9em;
}
body.manual-user .highlight { background-color: #eff6ff; color: #1e3a8a; }
body.manual-admin .highlight { background-color: #fef2f2; color: #991b1b; }
body.manual-dev .highlight { background-color: #faf5ff; color: #6b21a8; }

ul.feature-list { list-style-type: none; margin-bottom: 1.5rem; }
ul.feature-list li { position: relative; margin-bottom: 1rem; padding-left: 2rem; }
ul.feature-list li::before { 
    content: "✓"; 
    position: absolute; 
    left: 0; 
    font-weight: bold; 
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.8rem;
    top: 2px;
}
body.manual-user ul.feature-list li::before { color: var(--accent-user); background: #eff6ff; }
body.manual-admin ul.feature-list li::before { color: var(--accent-admin); background: #fef2f2; }
body.manual-dev ul.feature-list li::before { color: var(--accent-dev); background: #faf5ff; }

.step-box { 
    background: #f8fafc; 
    border: 1px solid var(--border); 
    padding: 1.5rem 2rem; 
    border-radius: 0 12px 12px 0; 
    margin-bottom: 2rem; 
    margin-top: 1rem; 
}
body.manual-user .step-box { border-left: 4px solid var(--accent-user); }
body.manual-admin .step-box { border-left: 4px solid var(--accent-admin); }
body.manual-dev .step-box { border-left: 4px solid var(--accent-dev); }

.step-box h4 { margin-bottom: 1rem; font-size: 1.1rem; }
.step-box ol, .step-box ul { padding-left: 1.5rem; margin-bottom: 0; }
.step-box li { margin-bottom: 0.75rem; }
.step-box li:last-child { margin-bottom: 0; }

.notice {
    padding: 1rem 1.5rem;
    border-radius: 0 8px 8px 0;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}
body.manual-user .notice { background-color: #fffbeb; border-left: 4px solid #f59e0b; }
body.manual-dev .notice { background-color: #f8fafc; border-left: 4px solid var(--accent-dev); }

html { scroll-behavior: smooth; }

@media (max-width: 1024px) { 
    .container { flex-direction: column; padding: 2rem 1.5rem; gap: 2rem; }
    .container.portal { padding: 2rem 1.5rem; } 
    .sidebar { width: 100%; height: auto; position: static; max-height: none; } 
    .sidebar ul { display: flex; flex-wrap: wrap; gap: 0.5rem; } 
    .sidebar li { margin-bottom: 0; }
    section { padding: 2rem; } 
}
