:root {
    --bg-color: #fdfcfb;
    --text-primary: #1a1a1a;
    --text-secondary: #717171;
    --accent-color: #2563eb;
    --border-color: #e5e5e5;
    --card-bg: #ffffff;
    --font-sans: 'Outfit', sans-serif;
    --font-body: 'Noto Sans JP', sans-serif;
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Header */
.studio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 5%;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 10;
}

.back-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.3s;
}

.back-link:hover {
    color: var(--text-primary);
}

.logo {
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.5px;
}

.studio-nav a {
    text-decoration: none;
    color: var(--text-secondary);
    margin-left: 2rem;
    font-size: 0.9rem;
    transition: color 0.3s;
}

.studio-nav a:hover {
    color: var(--text-primary);
}

/* Hero */
.hero {
    height: 90vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 5%;
    position: relative;
}

.tool-hero {
    padding: 8rem 5% 4rem;
    text-align: center;
}

.hero h1,
.tool-hero h1 {
    font-family: var(--font-sans);
    font-size: 4rem;
    font-weight: 300;
    margin-bottom: 2rem;
    line-height: 1.1;
}

.hero h1 .serif {
    font-family: 'Times New Roman', serif;
    font-style: italic;
    font-weight: 400;
}

.hero p,
.tool-hero p {
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    font-size: 1.1rem;
}

.scroll-indicator {
    position: absolute;
    bottom: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.6;
}

.line {
    width: 1px;
    height: 60px;
    background: var(--text-secondary);
}

/* Principles */
.principles-section {
    padding: 8rem 5%;
    background: #f7f7f7;
}

.section-title {
    text-align: center;
    margin-bottom: 6rem;
}

.section-title h2 {
    font-family: var(--font-sans);
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.section-title p {
    color: var(--text-secondary);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 3rem;
    max-width: 1200px;
    margin: 0 auto;
}

.principle-card {
    background: var(--card-bg);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    transition: transform 0.4s cubic-bezier(0.2, 0, 0.2, 1);
    display: block;
    cursor: pointer;
}

.principle-card:hover {
    transform: translateY(-10px);
}

.card-visual {
    height: 200px;
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
}

/* Visuals */
.color-visual .palette {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin: -10px;
    border: 3px solid white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.p1 {
    background: #1a1a1a;
}

.p2 {
    background: #2563eb;
}

.p3 {
    background: #facc15;
}

.type-visual .Aa {
    font-family: 'Times New Roman', serif;
    font-size: 5rem;
    font-style: italic;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-image: linear-gradient(45deg, #1a1a1a, #666);
}

.space-visual {
    gap: 1rem;
}

.space-visual .box {
    background: #e5e5e5;
    border-radius: 8px;
}

.b1 {
    width: 60px;
    height: 60px;
}

.b2 {
    width: 60px;
    height: 60px;
}

.layout-visual {
    background-image: linear-gradient(#e5e5e5 1px, transparent 1px), linear-gradient(90deg, #e5e5e5 1px, transparent 1px);
    background-size: 20px 20px;
}

.grid-lines {
    width: 100%;
    height: 100%;
}

.ux-visual .target-circle-sm {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-color);
    box-shadow: 0 0 0 10px rgba(37, 99, 235, 0.2);
}


.card-content {
    padding: 2.5rem;
}

.card-content h3 {
    font-family: var(--font-sans);
    font-size: 1.4rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.card-content p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.learn-more {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-color);
}

/* Playground / Comparison */
.comparison-section {
    padding: 8rem 5%;
}

.comparison-container {
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: start;
}

.toggle-wrapper {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.toggle-label {
    font-weight: 700;
    color: #cbd5e1;
    transition: color 0.3s;
}

.toggle-label.active {
    color: var(--text-primary);
}

/* Switch CSS */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--accent-color);
}

input:checked+.slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Preview Card Styles */
.ui-preview-card {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: all 0.5s ease;
}

/* Bad Design State */
.ui-preview-card.bad {
    background: #ffff00;
    border: 5px solid red;
    font-family: 'Courier New', monospace;
    text-align: center;
    color: blue;
}

.ui-preview-card.bad .preview-header h3 {
    font-size: 1rem;
    text-decoration: underline;
    margin-bottom: 5px;
}

.ui-preview-card.bad input {
    width: 100%;
    border: 2px solid black;
    background: green;
    color: white;
    margin-bottom: 2px;
}

.ui-preview-card.bad button {
    background: purple;
    color: yellow;
    font-size: 2rem;
    border: 10px outset gray;
    cursor: wait;
    width: 100%;
}

/* Good Design State */
.ui-preview-card.good {
    background: white;
    border: 1px solid #e5e5e5;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
    font-family: var(--font-sans);
    color: #1a1a1a;
    text-align: left;
}

.ui-preview-card.good .preview-header h3 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 2rem;
}

.ui-preview-card.good .form-group {
    margin-bottom: 1.5rem;
}

.ui-preview-card.good label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #4b5563;
}

.ui-preview-card.good input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: #f9fafb;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.ui-preview-card.good input:focus {
    border-color: var(--accent-color);
}

.ui-preview-card.good button {
    width: 100%;
    padding: 1rem;
    background: var(--text-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 1rem;
    transition: opacity 0.2s;
}

.ui-preview-card.good button:hover {
    opacity: 0.9;
}

.ui-preview-card.good .preview-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.ui-preview-card.good .preview-footer a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
}

.analysis-panel h3 {
    font-family: var(--font-sans);
    margin-bottom: 1.5rem;
}

.analysis-panel ul {
    list-style: none;
}

.analysis-panel li {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
    position: relative;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.analysis-panel li::before {
    content: '•';
    color: var(--accent-color);
    position: absolute;
    left: 0;
    font-weight: 700;
}

.studio-footer {
    padding: 4rem 5%;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* --- Tool Styles (Color, Type, etc.) --- */
/* (Reused from previous step, ensuring Layout & UX styles are added) */

/* Color Page */
.color-tool-section {
    max-width: 1000px;
    margin: 0 auto 6rem;
    padding: 0 5%;
}

.color-inputs {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
    justify-content: center;
}

.color-inputs input[type="color"] {
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.generated-palette {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.palette-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
}

.palette-card .swatch {
    height: 120px;
    width: 100%;
}

.palette-card .info {
    padding: 1.5rem;
}

.palette-card .label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.palette-card .code {
    font-family: monospace;
    font-weight: 700;
    color: var(--text-primary);
    background: #f3f4f6;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.preview-mockup {
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    background: #f9fafb;
}

.mockup-container {
    background: var(--bg-light, #fff);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.mockup-header {
    background: var(--primary, #2563eb);
    color: white;
    padding: 1rem 2rem;
    font-weight: 700;
}

.mockup-hero {
    padding: 3rem 2rem;
    text-align: center;
}

.mockup-hero h2 {
    color: var(--text-primary, #1a1a1a);
    margin-bottom: 1.5rem;
}

.mockup-btn {
    background: var(--accent, #facc15);
    color: var(--text-primary, #1a1a1a);
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 8px;
    font-weight: 700;
}

/* Typography Page */
.type-tool-section {
    max-width: 1000px;
    margin: 0 auto 6rem;
    padding: 0 5%;
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 4rem;
}

.controls {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
    align-self: start;
}

.control-group {
    margin-bottom: 2rem;
}

.control-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.control-group input[type="range"] {
    width: 100%;
}

.control-group select {
    width: 100%;
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.type-preview {
    background: white;
    padding: 4rem;
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
}

.type-preview p.meta {
    font-size: 0.8rem;
    color: #9ca3af;
    margin-bottom: 2rem;
    border-left: 2px solid #e5e5e5;
    padding-left: 0.5rem;
}

/* Interactions Page */
.gallery-section {
    max-width: 1200px;
    margin: 0 auto 6rem;
    padding: 0 5%;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 3rem;
}

.interaction-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
}

.preview-area {
    height: 200px;
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
}

.card-info {
    padding: 1.5rem;
}

.card-info h3 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.card-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.btn-interaction {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 6px;
    background: var(--text-primary);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-bounce:hover {
    transform: scale(1.1);
}

.btn-load {
    position: relative;
    width: 100px;
    height: 40px;
}

.btn-load .loader {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.btn-load.loading .btn-text {
    visibility: hidden;
}

.btn-load.loading .loader {
    display: block;
}

.btn-load.success {
    background-color: #34d399;
}

.btn-load.success:after {
    content: 'Wait for it...';
    font-size: 0.8rem;
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Toggle IOS */
.toggle-switch {
    display: inline-block;
    width: 50px;
    height: 28px;
    position: relative;
    margin: 0 10px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-track {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e5e5e5;
    border-radius: 28px;
    transition: .3s;
}

.slider-track:before {
    content: "";
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: .3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.toggle-switch input:checked+.slider-track {
    background-color: #34d399;
}

.toggle-switch input:checked+.slider-track:before {
    transform: translateX(22px);
}

/* Animated Input */
.input-wrapper {
    position: relative;
    margin-top: 15px;
}

.input-anim {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    outline: none;
}

.label-anim {
    position: absolute;
    left: 10px;
    top: 10px;
    color: #999;
    pointer-events: none;
    transition: 0.2s ease all;
}

.input-anim:focus~.label-anim,
.input-anim:not(:placeholder-shown)~.label-anim {
    top: -20px;
    font-size: 0.8rem;
    color: var(--accent-color);
}

/* Layout Page */
.layout-tool-section {
    max-width: 1000px;
    margin: 0 auto 6rem;
    padding: 0 5%;
}

.controls-bar {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.switch-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    cursor: pointer;
}

.layout-workspace {
    position: relative;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    height: 600px;
    overflow: hidden;
    padding: 24px;
    /* 8 * 3 */
}

.grid-overlay-8pt,
.grid-overlay-cols {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: none;
}

.grid-overlay-8pt {
    background-image:
        linear-gradient(rgba(37, 99, 235, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(37, 99, 235, 0.1) 1px, transparent 1px);
    background-size: 8px 8px;
    z-index: 10;
}

.grid-overlay-cols {
    display: none;
    /* Flex overridden by JS */
    padding: 0 24px;
    max-width: 1000px;
    margin: 0 auto;
    left: 50%;
    transform: translateX(-50%);
    gap: 24px;
    z-index: 5;
}

.col {
    flex: 1;
    background: rgba(234, 179, 8, 0.15);
    height: 100%;
}

.mock-content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.mock-card {
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    background: #fafafa;
}

.mock-img {
    height: 160px;
    /* 8 * 20 */
    background: #e5e5e5;
}

.mock-text {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.layout-info {
    margin-top: 4rem;
    background: #f0f9ff;
    padding: 2rem;
    border-radius: 12px;
    border-left: 4px solid var(--accent-color);
}

/* UX Page */
.ux-tool-section {
    max-width: 900px;
    margin: 0 auto 6rem;
    padding: 0 5%;
}

.law-container {
    margin-bottom: 6rem;
}

.law-desc {
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.game-container {
    background: white;
    padding: 1rem;
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
}

@media (max-width: 768px) {
    .type-tool-section {
        grid-template-columns: 1fr;
    }

    .hero h1,
    .tool-hero h1 {
        font-size: 2.5rem;
    }

    .mock-content {
        grid-template-columns: 1fr;
    }
}