        /* Base Reset & Colors */
        :root {
            --bg-body: #0f172a;
            --bg-panel: #1e293b;
            --bg-input: #0f172a;
            --text-muted: #94a3b8;
            --border-color: #334155;
            --accent-blue: #2563eb;
            --accent-blue-hover: #3b82f6;
            --accent-green: #065f46;
            --text-result: #60a5fa;
            --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
        }

        .toolcontainer {
            margin: 0 auto;
        }

        /* Layout Grid */
        .main-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 1.5rem;
            align-items: start;
        }

        @media (min-width: 1024px) {
            .main-grid {
                grid-template-columns: 1fr 1fr;
            }
        }

        /* Panels */
        .panel {
            background-color: var(--bg-panel);
            padding: 1.5rem;
            border-radius: 1rem;
            border: 1px solid var(--border-color);
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        }

        .sticky-panel {
            display: flex;
            flex-direction: column;
        }

        @media (min-width: 1024px) {
            .sticky-panel {
                position: sticky;
                top: 2rem;
            }
        }

        label {
            display: block;
            font-size: 0.875rem;
            font-weight: 600;
            margin-bottom: 0.5rem;
            color: #cbd5e1;
        }

        /* Inputs */
        textarea, input[type="text"] {
            width: 100%;
            background-color: var(--bg-input);
            border: 1px solid var(--border-color);
            border-radius: 0.75rem;
            padding: 0.75rem 1rem;
            font-size: 0.875rem;
            transition: all 0.2s;
            outline: none;
        }

        textarea:focus, input[type="text"]:focus {
            border-color: var(--accent-blue);
            box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
        }

        textarea {
            resize: vertical;
            font-family: var(--font-mono);
        }

        #templateInput {
            height: 12rem;
        }

        #resultOutput {
            flex-grow: 1;
            color: var(--text-result);
            cursor: not-allowed;
            min-height: 450px; /* スマホでの高さ保証 */
        }

        @media (min-width: 1024px) {
            #resultOutput {
                min-height: 500px;
            }
        }

        /* Replacement Rules */
        .rules-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1rem;
        }

        .rule-row {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            margin-bottom: 0.75rem;
            animation: fadeIn 0.2s ease-out;
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(5px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .rule-row input {
            flex: 1;
            min-width: 0;
        }

        .rule-arrow {
            color: var(--text-muted);
            font-weight: bold;
        }

        /* Buttons */
        button {
            cursor: pointer;
            border: none;
            border-radius: 0.5rem;
            transition: all 0.2s;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-weight: 500;
        }

        #addRuleBtn {
            background-color: var(--accent-blue);
            color: white;
            padding: 0.4rem 0.75rem;
            font-size: 0.75rem;
        }

        #addRuleBtn:hover {
            background-color: var(--accent-blue-hover);
        }

        #copyBtn {
            background-color: #334155;
            color: #f1f5f9;
            border: 1px solid #475569;
            padding: 0.4rem 0.75rem;
            font-size: 0.75rem;
        }

        #copyBtn:hover {
            background-color: #475569;
        }

        #copyBtn.success {
            background-color: var(--accent-green);
            color: #d1fae5;
            border-color: #064e3b;
        }

        .remove-btn {
            background: transparent;
            color: var(--text-muted);
            padding: 0.5rem;
            flex-shrink: 0;
        }

        .remove-btn:hover {
            color: #f87171;
        }

        /* Scrollbar */
        ::-webkit-scrollbar { width: 8px; }
        ::-webkit-scrollbar-track { background: #1e293b; }
        ::-webkit-scrollbar-thumb { background: #475569; border-radius: 4px; }
        ::-webkit-scrollbar-thumb:hover { background: #64748b; }