:root {
            --bg-body: #f8fafc;
            --bg-container: #ffffff;
            --border-color: #e2e8f0;
            --text-primary: #1e293b;
            --text-secondary: #64748b;
            
            --btn-copy-bg: #0f172a;
            --btn-copy-text: #f8fafc;
            --btn-copy-hover: #1e293b;
            
            --btn-clear-border: #fca5a5;
            --btn-clear-text: #dc2626;
            --btn-clear-hover: #fef2f2;
            
            --status-bg: #f1f5f9;
            --save-on-color: #10b981;
            --save-off-color: #f43f5e;
            
            --toast-bg: #0f172a;
            --toast-text: #f8fafc;
            --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
            --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
        }

        .dark {
            --bg-body: #12141a;
            --bg-container: #1a1d24;
            --border-color: #2e3440;
            --text-primary: #eceff4;
            --text-secondary: #d8dee9;
            
            --btn-copy-bg: #eceff4;
            --btn-copy-text: #2e3440;
            --btn-copy-hover: #ffffff;
            
            --btn-clear-border: #4c1d1d;
            --btn-clear-text: #fca5a5;
            --btn-clear-hover: rgba(76, 29, 29, 0.3);
            
            --status-bg: #2e3440;
            --save-on-color: #a3be8c;
            --save-off-color: #bf616a;
            
            --toast-bg: #eceff4;
            --toast-text: #2e3440;
            --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
        }

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

        html, body {
            height: 100%;
            overflow: hidden;
            background-color: var(--bg-body);
            color: var(--text-primary);
            font-family: var(--font-sans);
            transition: background-color 0.3s ease, color 0.3s ease;
        }

        /* コンテナレイアウト */
        .app-container {
            display: flex;
            flex-direction: column;
            max-width: 1024px;
            width: 100%;
            height: 100%;
            margin: 0 auto;
            padding: 16px 16px 8px 16px;
        }

        @media (min-width: 768px) {
            .app-container {
                padding: 24px 24px 16px 24px;
            }
        }

        /* ヘッダー */
        header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 12px;
            flex-shrink: 0;
        }

        .logo-area {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .logo-dot {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background-color: #10b981;
            box-shadow: 0 0 8px #10b981;
        }

        h1 {
            font-size: 1.125rem;
            font-weight: 600;
            letter-spacing: 0.05em;
            color: var(--text-primary);
        }

        .badge {
            font-size: 0.75rem;
            background-color: var(--status-bg);
            color: var(--text-secondary);
            padding: 2px 8px;
            border-radius: 4px;
            font-weight: 500;
        }

        /* ツールバー */
        .toolbar {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .icon-btn {
            background: transparent;
            border: none;
            cursor: pointer;
            padding: 8px;
            border-radius: 8px;
            color: var(--text-secondary);
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background-color 0.2s ease, color 0.2s ease;
        }

        .icon-btn:hover {
            background-color: var(--status-bg);
            color: var(--text-primary);
        }

        .icon-btn svg {
            width: 20px;
            height: 20px;
            fill: none;
            stroke: currentColor;
            stroke-width: 2;
            stroke-linecap: round;
            stroke-linejoin: round;
        }

        .font-btn-text {
            font-weight: bold;
            font-size: 0.875rem;
        }

        /* エディターエリア */
        .editor-wrapper {
            flex-1: 1;
            flex-grow: 1;
            position: relative;
            border: 1px solid var(--border-color);
            background-color: var(--bg-container);
            border-radius: 16px;
            box-shadow: var(--shadow);
            display: flex;
            flex-direction: column;
            overflow: hidden;
            transition: border-color 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
        }

        .editor-wrapper:hover {
            box-shadow: 0 4px 12px -1px rgb(0 0 0 / 0.1);
        }

        textarea {
            flex-grow: 1;
            width: 100%;
            padding: 24px;
            background: transparent;
            border: none;
            outline: none;
            resize: none;
            color: var(--text-primary);
            line-height: 1.7;
            font-size: 1.125rem;
            overflow-y: auto;
            transition: font-size 0.2s ease, color 0.3s ease;
        }

        @media (min-width: 768px) {
            textarea {
                padding: 32px;
            }
        }

        .font-sans-custom {
            font-family: var(--font-sans);
        }

        .font-mono-custom {
            font-family: var(--font-mono);
        }

        /* フッター・コントロール */
        footer {
            margin-top: 12px;
            flex-shrink: 0;
            display: flex;
            flex-direction: column;
            gap: 12px;
            font-size: 0.875rem;
            color: var(--text-secondary);
        }

        @media (min-width: 640px) {
            footer {
                flex-direction: row;
                align-items: center;
                justify-content: space-between;
            }
        }

        .stats-area {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 16px;
            font-size: 0.75rem;
        }

        .stat-val {
            font-weight: 600;
            color: var(--text-primary);
        }

        /* セーブ状態ボタン */
        .save-toggle-btn {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 4px 8px;
            border-radius: 4px;
            background-color: var(--status-bg);
            border: none;
            cursor: pointer;
            color: var(--text-secondary);
            font-weight: 500;
            transition: background-color 0.2s ease;
        }

        .save-toggle-btn:hover {
            background-color: var(--border-color);
        }

        .status-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
        }

        .status-dot.active {
            background-color: var(--save-on-color);
            box-shadow: 0 0 6px var(--save-on-color);
        }

        .status-dot.inactive {
            background-color: var(--save-off-color);
            box-shadow: 0 0 6px var(--save-off-color);
            animation: pulse 1.5s infinite alternate;
        }

        @keyframes pulse {
            0% { opacity: 0.4; }
            100% { opacity: 1; }
        }

        /* 履歴関係 */
        .history-wrapper {
            position: relative;
        }

        .history-btn {
            background: none;
            border: none;
            color: #4f46e5;
            cursor: pointer;
            font-size: 0.75rem;
            display: flex;
            align-items: center;
            gap: 2px;
            font-weight: 500;
        }

        .history-btn:hover {
            text-decoration: underline;
        }

        .dark .history-btn {
            color: #818cf8;
        }

        .history-menu {
            display: none;
            position: absolute;
            left: 0;
            bottom: 24px;
            width: 256px;
            background-color: var(--bg-container);
            border: 1px solid var(--border-color);
            border-radius: 12px;
            box-shadow: var(--shadow);
            z-index: 50;
            max-height: 192px;
            overflow-y: auto;
            padding: 4px 0;
        }

        .history-menu.show {
            display: block;
        }

        .history-item-btn {
            width: 100%;
            text-align: left;
            padding: 10px;
            background: none;
            border: none;
            border-bottom: 1px solid var(--border-color);
            cursor: pointer;
            display: flex;
            flex-direction: column;
            gap: 2px;
            transition: background-color 0.15s ease;
        }

        .history-item-btn:last-child {
            border-bottom: none;
        }

        .history-item-btn:hover {
            background-color: var(--status-bg);
        }

        .history-time {
            font-size: 0.65rem;
            font-weight: 600;
            color: var(--text-secondary);
        }

        .history-preview {
            font-size: 0.75rem;
            color: var(--text-primary);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            width: 100%;
        }

        .history-empty {
            padding: 12px;
            text-align: center;
            color: var(--text-secondary);
            font-size: 0.75rem;
        }

        /* アクションボタン */
        .action-area {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .btn {
            border-radius: 12px;
            font-weight: 500;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            transition: transform 0.1s ease, background-color 0.2s ease, border-color 0.2s ease;
        }

        .btn:active {
            transform: scale(0.97);
        }

        .btn-clear-wrapper {
            position: relative;
            overflow: hidden;
            border-radius: 12px;
        }

        .btn-clear {
            padding: 10px 16px;
            border: 1px solid var(--btn-clear-border);
            color: var(--btn-clear-text);
            background-color: transparent;
            font-size: 0.75rem;
        }

        .btn-clear:hover {
            background-color: var(--btn-clear-hover);
        }

        .clear-progress-bar {
            position: absolute;
            bottom: 0;
            left: 0;
            height: 3px;
            background-color: #ef4444;
            width: 0%;
            transition: width 0.08s linear;
        }

        .btn-copy {
            padding: 10px 24px;
            background-color: var(--btn-copy-bg);
            color: var(--btn-copy-text);
            border: none;
            font-size: 0.875rem;
            box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
        }

        .btn-copy:hover {
            background-color: var(--btn-copy-hover);
        }

        /* トーストメッセージ */
        .toast {
            position: absolute;
            top: 16px;
            left: 50%;
            transform: translate(-50%, -10px);
            background-color: var(--toast-bg);
            color: var(--toast-text);
            padding: 8px 16px;
            border-radius: 10px;
            font-size: 0.875rem;
            font-weight: 500;
            box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.3);
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            display: flex;
            align-items: center;
            gap: 6px;
            z-index: 100;
        }

        .toast.show {
            opacity: 1;
            transform: translate(-50%, 0);
        }

        .toast svg {
            width: 16px;
            height: 16px;
            stroke: #10b981;
            stroke-width: 3;
            fill: none;
        }

        /* スクロールバー装飾 */
        ::-webkit-scrollbar {
            width: 6px;
            height: 6px;
        }
        ::-webkit-scrollbar-track {
            background: transparent;
        }
        ::-webkit-scrollbar-thumb {
            background: var(--border-color);
            border-radius: 3px;
        }
        ::-webkit-scrollbar-thumb:hover {
            background: var(--text-secondary);
        }