:root {
    --bg-color: #0b0f19;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);

    --accent-color: #3b82f6; /* Blue for regular jobs */
    --accent-senior: #8b5cf6; /* Purple for senior jobs */
    --accent-special: #f59e0b; /* Gold for special jobs */

    --font-main: 'Noto Sans JP', 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.15) 0%, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.app-header {
    padding: 16px 0;
    border-bottom: 1px solid var(--card-border);
    background: rgba(11, 15, 25, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.app-header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 1px;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.header-name {
    margin-left: 8px;
    padding: 2px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: rgba(96, 165, 250, 0.12);
    border: 1px solid rgba(96, 165, 250, 0.3);
    border-radius: 20px;
    -webkit-text-fill-color: #93c5fd;
    color: #93c5fd;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.nav-username {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--card-border);
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.3);
}

.nav-link.nav-link-own {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
    color: #60a5fa;
}

/* Main Layout */
main {
    flex: 1;
}

main.container {
    padding: 20px 20px;
}

.characters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
}

/* Character Card (Glassmorphism) */
.character-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 24px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.character-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

.character-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.char-name-input {
    background: transparent;
    border: none;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.25);
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    width: 6em;
    outline: none;
    padding: 0 2px 2px;
    transition: border-color 0.2s;
}

.char-name-input:focus {
    border-bottom-color: #60a5fa;
}

/* Job Section */
.job-category {
    margin-bottom: 24px;
}

.job-category-title {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 600;
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 4px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 4px;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-main);
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.tab-btn[data-tab="0"].active { background: var(--accent-color); color: #fff; }
.tab-btn[data-tab="1"].active { background: var(--accent-senior); color: #fff; }
.tab-btn[data-tab="2"].active { background: var(--accent-special); color: #fff; }

/* Tab Panels */
.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* Accents per panel */
.tab-panel[data-panel="0"] .job-category { --theme-color: var(--accent-color); }
.tab-panel[data-panel="1"] .job-category { --theme-color: var(--accent-senior); }
.tab-panel[data-panel="2"] .job-category { --theme-color: var(--accent-special); }


.job-item {
    margin-bottom: 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 12px 16px;
}

.job-name {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 10px;
    color: #fff;
    display: flex;
    justify-content: space-between;
}

/* Custom Range Slider */
.status-row {
    margin-bottom: 12px;
}

.status-row:last-child {
    margin-bottom: 0;
}

.status-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.range-value {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    color: #fff;
}

.custom-range {
    position: relative;
    width: 100%;
}

.custom-range input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    padding: 0;
    margin: 0;
}

/* Slider Track Fill */
.custom-range input[type="range"]::before {
    content: '';
    position: absolute;
    height: 6px;
    border-radius: 3px;
    background: var(--theme-color, var(--accent-color));
    width: var(--val, 0%);
    top: 0;
    left: 0;
    pointer-events: none;
    box-shadow: 0 0 10px var(--theme-color, var(--accent-color));
}

.custom-range input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    position: relative;
    z-index: 2;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
    transition: transform 0.1s;
}

.custom-range input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.custom-range input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    border: none;
    position: relative;
    z-index: 2;
}

/* Submit Button */
.submit-wrapper {
    text-align: center;
    margin-top: 20px;
}

.btn-submit {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: #fff;
    border: none;
    padding: 16px 40px;
    font-size: 1.2rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    border-radius: 30px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
    transition: all 0.3s ease;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
}

.btn-submit:active {
    transform: translateY(1px);
}

/* Summary Section */
.summary {
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ①上段: SVGリングチャート × 3 + 総合スコア */
.summary-top {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    min-width: 0;
}

.ring-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 24px 16px 20px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ring-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.ring-svg {
    width: 110px;
    height: 110px;
    filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.4));
}

.ring-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.04em;
}

.score-card {
    justify-content: center;
    box-shadow: 0 0 24px rgba(139, 92, 246, 0.12), 0 0 48px rgba(59, 130, 246, 0.08);
}

.score-pct {
    font-family: 'Outfit', sans-serif;
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, #60a5fa, #c084fc, #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-unit {
    font-size: 1.4rem;
}

/* ②下段: レーダーチャート + サイドパネル */
.summary-bottom {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 16px;
    min-width: 0;
}

.chart-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px 24px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    min-width: 0;
    overflow: hidden;
}

.chart-title {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 14px;
}

.chart-wrap {
    position: relative;
    width: 100%;
    height: 280px;
    overflow: hidden;
}

.chart-wrap canvas {
    max-width: 100%;
}

.side-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* プログレスバー */
.progress-item {
    display: grid;
    grid-template-columns: 3.8rem 1fr 3.2rem;
    align-items: center;
    gap: 10px;
}

.progress-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.progress-bar {
    height: 7px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.char-avg-fill-bar {
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
}

.progress-count {
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-align: right;
    font-family: 'Outfit', sans-serif;
}

@media (max-width: 768px) {
    /* 上段: 2×2グリッド（スコアカードはこころ道MAXの右） */
    .summary-top { grid-template-columns: repeat(2, 1fr); }
    .score-pct   { font-size: 2.4rem; }

    /* 下段: スタック、コンパクトなサイドパネルを先に表示 */
    .summary-bottom              { grid-template-columns: 1fr; }
    .chart-card:not(.side-stats) { order: 2; }
    .side-stats                  { order: 1; }
    .chart-wrap                  { height: 220px; }
    .progress-item               { grid-template-columns: 3.5rem 1fr 3rem; }
}

/* Shared form styles (auth pages + settings) */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-group input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1rem;
    transition: border-color 0.2s;
    outline: none;
}

.form-group input:focus {
    border-color: #60a5fa;
}

.btn-auth {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: #fff;
    border: none;
    padding: 14px;
    font-size: 1rem;
    font-family: var(--font-main);
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 8px;
    transition: opacity 0.2s;
}

.btn-auth:hover {
    opacity: 0.9;
}

.auth-error {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 8px;
    padding: 12px 16px;
    color: #fca5a5;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.auth-success {
    background: rgba(52, 211, 153, 0.15);
    border: 1px solid rgba(52, 211, 153, 0.4);
    border-radius: 8px;
    padding: 12px 16px;
    color: #6ee7b7;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

/* Auth card (login / register) */
.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
    margin: 20px auto;
}

.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 40px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.auth-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 28px;
    background: linear-gradient(135deg, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.4;
}

.auth-link {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-link a {
    color: #60a5fa;
    text-decoration: none;
}

.auth-link a:hover {
    text-decoration: underline;
}

/* Settings page */
.settings-wrap {
    max-width: 560px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.settings-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 32px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.settings-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.settings-section-title .material-symbols-outlined {
    font-size: 1.3rem;
    color: #60a5fa;
}

/* Footer */
.app-footer {
    padding: 20px 0;
    text-align: center;
    border-top: 1px solid var(--card-border);
    background: rgba(11, 15, 25, 0.5);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .characters-grid {
        grid-template-columns: 1fr;
    }
}
