@import url('https://pp-various.pages.dev/data/fonts/udcode.css');

@import url('https://pp-various.pages.dev/data/fonts/notosansjp.css');

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

body,
.CodeMirror,
.CodeMirror pre.CodeMirror-line,
.CodeMirror pre.CodeMirror-line-like,
.preview-content {
    font-family: 'UDCode', sans-serif !important;
}

.CodeMirror {
    font-size: 14px;
}

body {
    line-height: 1.6;
    padding: 20px;
    background-color: #f5f5f5;
    overflow-y: hidden;
}

.header h1 {
    user-select: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.header {
    margin-top: -5px;
    margin-bottom: 10px;
}

.editor-container {
    display: flex;
    gap: 20px;
    height: calc(100vh - 150px); /* ヘッダーとボタンコンテナの高さを考慮 */
}

.editor-box {
    flex: 1;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
}

#markdown-input {
    width: 100%;
    height: 100%;
    border: none;
    resize: none;
    outline: none;
    font-family: "UDCode", 'Courier New', Courier, monospace !important;
    font-size: 14px;
}

#preview {
    width: 100%;
}

.preview-content {
    padding: 10px;
    font-family: "Noto Sans JP", sans-serif !important;
}

pre, code {
    font-family: "UDCode", monospace !important;
}

.button-container {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
    user-select: none;
    flex-wrap: wrap; /* PC幅でもボタンが多い場合に折り返すように念のため追加 */
}

button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    background-color: #4CAF50;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 14px; /* ボタンのフォントサイズを少し調整 */
}

button:hover {
    background-color: #45a049;
}

/* Markdown スタイル */
.preview-content h1 {
    font-size: 2em;
    margin: 0.67em 0;
}

.preview-content h2 {
    font-size: 1.5em;
    margin: 0.75em 0;
}

.preview-content h3 {
    font-size: 1.17em;
    margin: 0.83em 0;
}

.preview-content p {
    margin: 1em 0;
}

.preview-content ul,
.preview-content ol {
    margin: 1em 0;
    padding-left: 2em;
}

.preview-content li {
    margin: 0.5em 0;
}

.preview-content code {
    background-color: #f4f4f4;
    padding: 2px 4px;
    border-radius: 4px;
}

.preview-content pre {
    background-color: #f4f4f4;
    padding: 1em;
    border-radius: 4px;
    overflow-x: auto;
}

.preview-content blockquote {
    border-left: 4px solid #ccc;
    margin: 1em 0;
    padding-left: 1em;
    color: #666;
}

/* 折りたたみガターのスタイル */
.CodeMirror-foldgutter {
    width: 1.2em;
    background-color: white;
}
.CodeMirror-foldgutter-open,
.CodeMirror-foldgutter-folded {
    cursor: pointer;
}
.CodeMirror-foldgutter-open:after {
    content: "▾";
}
.CodeMirror-foldgutter-folded:after {
    content: "▸";
}
.CodeMirror-guttermarker-subtle {
    color: #666;
}

/* アクティブラインのスタイル */
.CodeMirror-activeline-background {
    background: rgba(0, 0, 0, 0.05) !important;
}

/* 検索ダイアログのスタイル */
.CodeMirror-dialog {
    background: #f5f5f5;
    padding: 5px;
    border-bottom: 1px solid #ddd;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 5px;
}

.CodeMirror {
    height: 100% !important;
    font-family: "UDCode", "Noto Sans JP", 'Courier New', Courier, monospace !important;
    font-size: 14px;
}

.CodeMirror-gutter.CodeMirror-linenumbers {
    background-color: white;
}

.CodeMirror-linenumber {
    color: #666;
}

.CodeMirror-foldmarker {
    color: #fff;
    text-shadow: #4CAF50 1px 1px 2px, #4CAF50 -1px -1px 2px, #4CAF50 1px -1px 2px, #4CAF50 -1px 1px 2px;
    font-family: "Noto Sans JP", sans-serif !important;
    line-height: .3;
    cursor: pointer;
}

@media (max-width: 768px) {
    body {
        overflow-y: auto;
        padding: 15px; /* スマホ表示時のbodyのpaddingを少し調整 */
    }

    .editor-container {
        flex-direction: column;
        height: auto;
        gap: 15px; /* エディタとプレビュー間のgapを調整 */
    }

    .editor-box {
        height: 45vh !important; /* 高さを少し調整 */
        padding: 15px; /* editor-boxのpaddingを調整 */
    }
    .editor-box:first-child { /* CodeMirror側のeditor-boxのpadding-leftを調整 */
        padding: 15px 15px 15px 0px;
    }


    .button-container {
        flex-direction: column; /* ボタンを縦に並べる */
        align-items: center; /* 中央揃え (縦並びの場合) */
        gap: 12px; /* ボタン間の縦方向の隙間 */
        margin-top: 15px; /* 上のマージン調整 */
    }

    .button-container button {
        width: 90%; /* ボタンの幅を親要素の90%に */
        max-width: 350px; /* ボタンの最大幅を設定して広がりすぎないように */
        padding: 10px 15px; /* ボタンのpaddingを少し大きく */
        font-size: 15px; /* フォントサイズも少し大きく */
    }
}

@media (max-width: 480px) {
    /* さらに小さい画面用の調整（必要に応じて） */
    .button-container button {
        width: 95%;
        font-size: 14px;
    }
    .editor-box {
        height: 40vh !important;
    }
    body {
        padding: 10px;
    }
}