/* ライトテーマ */
:root {
    --bg: #ffffff;
    --text: #5a4a5e;
    --panel: #fff0f7;

    --btn: #bde7ff;
    --btn-hover: #a6dcff;
    --btn-text: #3a5a6e;

    --del: #ffb6c9;
    --del-hover: #ff9fb8;
    --del-text: #7a1f3d;

    --accent: #ff8fb1;
    --border-dark: #666;

    --control-height: 32px;
}

/* ダークテーマ */
body.dark {
    --bg: #2b2730;
    --text: #f2e9f1;
    --panel: #3a3440;
}

/* ダークテーマ：見出し文字色 */
body.dark h2,
body.dark header {
    color: #ffffff;
}

/* =========================
   基本
========================= */
* {
    box-sizing: border-box;
    font-family:
        "Noto Sans JP",
        "Zen Kaku Gothic New",
        "ヒラギノ丸ゴ ProN",
        "Hiragino Maru Gothic ProN",
        "游ゴシック",
        "Yu Gothic",
        "Meiryo",
        sans-serif;
}

body {
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

/* =========================
   タイトル
========================= */
header {
    background: linear-gradient(135deg, #5a3b1f, #7a5a3f);
    color: white;
    text-align: center;
    padding: 15px;
    font-size: 20px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* =========================
   メイン
========================= */
.container {
    max-width: 800px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
    width: auto !important;
}

/* =========================
   テーマ切替
========================= */
.theme-switch {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 3px;
}

/* スイッチ */
.switch {
    position: relative;
    width: 50px;
    height: 26px;
}

.switch input {
    display: none;
}

.slider {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 999px;
    cursor: pointer;
    transition: 0.3s;
}

.slider::before {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 3px;
    left: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

/* ON */
.switch input:checked + .slider {
    background: var(--btn);
}

.switch input:checked + .slider::before {
    transform: translateX(24px);
}

/* =========================
   見出し
========================= */
h2 {
    text-align: left;
    margin: 4px 0 10px;
    color: #5a3a1e;
}

/* =========================
   テキストエリア
========================= */
textarea {
    width: 100%;
    height: 180px;
    padding: 10px;
    font-size: 16px;
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border-dark);
    border-radius: 10px;
    resize: vertical;
    box-shadow: 0 1px 3px rgba(168, 229, 255, 0.35);
}

textarea:hover {
    border-color: #ff7eb6;
    box-shadow:
        0 0 0 2px rgba(255, 126, 182, 0.25),
        0 2px 6px rgba(0, 0, 0, 0.1);
}

textarea:focus {
    outline: none;
    border-color: var(--btn);
    box-shadow: 0 2px 6px rgba(0, 120, 255, 0.35);
}

textarea::placeholder {
    color: #999;
}

/* =========================
   ボタン
========================= */
.buttons {
    text-align: left;
    margin: 10px 0 8px;
}

button {
    cursor: pointer;
    border: none;
    white-space: nowrap;
    border-radius: 10px;
    height: var(--control-height);
    padding: 0 14px;
    background: var(--btn);
    color: var(--btn-text);
    box-shadow: 0 2px 4px rgba(0, 120, 255, 0.25);
    font-weight: bold;
}

button:hover {
    background: var(--btn-hover);
    box-shadow: 0 3px 6px rgba(0, 120, 255, 0.35);
}

button:active {
    transform: translateY(1px);
}

button:disabled {
    pointer-events: none;
    opacity: 0.4;
    cursor: not-allowed;
}

/* 出力ボタンの下に余白を作る */
#convertBtn {
    margin-bottom: 15px;
    padding: 10px 25px;
    height: auto;
    font-size: 15px;
}

/* =========================
   出力エリア
========================= */
.output-box {
    position: relative;
    background: var(--panel);
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* コピーボタン */
.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 12px;
    padding: 4px 10px;
}

/* 出力欄 */
#output {
    background: none;
    color: var(--text);
    font-family: "Noto Sans JP", "Zen Kaku Gothic New", sans-serif;
    font-size: 1.1em;
    border: none;
    border-radius: 0;
    padding-top: 35px;
    padding-bottom: 10px;
    box-shadow: none;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
}

/* 空表示 */
#output:empty::before {
    content: "ここにロール表が表示されます";
    color: #999;
}

/* =========================
   コピー表示
========================= */
#copyMsg {
    text-align: center;
    margin-top: 8px;
    font-weight: bold;
    color: var(--accent);
}

/* =========================
   使用方法案内テキスト
========================= */
.guide-text {
    margin: 10px auto 3px;
    padding: 0 20px;
    font-size: 14px;
    color: #666;
}

/* 上部バー（案内＋テーマ切替） */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* 使用方法テキスト */
.top-bar .guide-text {
    margin: 0;
    flex: 1;
    min-width: 200px;
}

/* =========================
   更新情報とリンク
========================= */
hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 20px 0;
}

.info {
    margin: 16px 0;
    font-size: 0.85em;
    color: #5a3a1e;
}

.info ul {
    list-style: disc;
    padding-left: 20px;
    margin: 8px 0;
}

.info li {
    margin: 4px 0;
    font-size: 0.95em;
}

body.dark .info {
    color: #f2e9f1;
}

.twitter {
    margin: 16px 0;
    font-size: 1em;
    color: var(--text);
    line-height: 1.6;
}

.twitter a {
    color: #0088dd;
    text-decoration: none;
}

.twitter a:hover {
    text-decoration: underline;
}

.credit {
    margin: 18px 0 24px;
    text-align: center;
    font-size: 0.9em;
    color: var(--text);
}

/* =========================
   スマホ閲覧時設定
========================= */
@media (max-width: 520px) {
    .container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    textarea {
        width: 100%;
        font-size: 15px;
    }

    #output {
        font-size: 1em;
    }

    h2 {
        font-size: 1.2em;
    }
}
