:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --font-main: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.15) 0px, transparent 50%);
    color: var(--text-color);
    font-family: var(--font-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 2rem 1rem;
}

.app-container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

header {
    text-align: center;
}

header h1 {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

header h1 span {
    font-weight: 400;
}

header p {
    color: var(--text-muted);
}

.settings-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: var(--glass-shadow);
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.input-group input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-color);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.goals-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.goal-input-wrap label {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.25rem;
}

.goal-input-wrap input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.5rem;
    color: var(--text-color);
    font-size: 0.875rem;
}

.button-group {
    display: flex;
    gap: 1rem;
}

button {
    flex: 1;
    padding: 1rem;
    border-radius: 0.75rem;
    border: none;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-heading);
}

.primary-btn {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.39);
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.23);
}

.primary-btn:active {
    transform: translateY(0);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.amida-wrapper {
    position: relative;
    display: inline-block;
}

.canvas-container {
    position: relative;
    background: var(--card-bg);
    backdrop-filter: blur(8px);
    border-radius: 1.5rem;
    border: 1px solid var(--border-color);
    padding: 2rem;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: auto;
}

canvas {
    max-width: 100%;
    cursor: crosshair;
}

.start-buttons-overlay {
    position: absolute;
    top: 40px;
    /* script.jsのconfig.paddingに合わせる */
    left: 40px;
    /* script.jsのconfig.paddingに合わせる */
    right: 40px;
    height: 0;
    pointer-events: none;
}

.start-btn {
    pointer-events: auto;
    position: absolute;
    transform: translate(-50%, -50%);
    /* 中心で配置 */
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.start-btn:hover {
    transform: translate(-50%, -50%) scale(1.2);
    /* 修正: translateを維持したままscale */
    box-shadow: 0 0 15px var(--primary-color);
}

.result-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border-radius: 1.5rem;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    text-align: center;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-placeholder {
    color: var(--text-muted);
    font-style: italic;
}

#result-display {
    font-size: 1.5rem;
    font-weight: 700;
}

.user-name {
    color: var(--primary-color);
}

.arrow {
    margin: 0 1rem;
    color: var(--text-muted);
}

.goal-text {
    background: linear-gradient(to right, #facc15, #f59e0b);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
        border-color: var(--primary-color);
    }

    100% {
        transform: scale(1);
    }
}

.result-card.pulse {
    animation: pulse 0.5s ease-out;
}

/* スクロールバーのカスタマイズ */
.canvas-container::-webkit-scrollbar {
    height: 8px;
}

.canvas-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.canvas-container::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

/* レスポンシブ調整 */
@media (max-width: 600px) {
    header h1 {
        font-size: 2rem;
    }

    .settings-card {
        padding: 1.5rem;
    }

    .goals-container {
        grid-template-columns: repeat(2, 1fr);
    }
}