html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
    font-family: -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
}

/*
 * 要件へのフィードバック対応: 「ヘルプウィンドウが見切れている」。vh/dvhのような
 * ビューポート単位のCSS計算や、window.innerHeightをJavaScriptで測ってpxを
 * 動的に設定するやり方をいずれも試したが直らなかったため、静的なCSSファイルに
 * 記述し直す。position:fixedの要素に top と bottom を両方指定すると、ブラウザ自身が
 * その間の実際の高さを計算してくれる(ビューポート単位の計算にもJavaScriptによる
 * 測定にも頼らない、最も確実な方法)。max-height は大画面で間延びしすぎないための
 * 上限として残す。
 */

.dharma-help-button {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(0, 0, 0, 0.4);
    color: rgba(255, 255, 255, 0.4);
    font-size: 15px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    z-index: 20;
}

.dharma-help-panel {
    position: fixed;
    top: 56px;
    right: 16px;
    width: min(320px, 80vw);
    overflow-y: auto;
    padding: 16px 18px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(10, 10, 14, 0.88);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    color: #ffffff;
    font-family: "ShipporiMincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
    font-size: 13px;
    line-height: 1.9;
    backdrop-filter: blur(4px);
    z-index: 20;
    display: none;
    pointer-events: auto;
}

.dharma-help-panel.is-open {
    display: block;
}

.dharma-help-instructions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 8px 0;
}

.dharma-key-cluster {
    display: grid;
    grid-template-columns: repeat(3, 30px);
    grid-template-rows: repeat(2, 30px);
    gap: 4px;
    margin: 6px 0;
}

.dharma-key-cluster img {
    width: 30px;
    height: 30px;
}

.dharma-help-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* key-enter.svg は実物のEnterキーに近い横長のviewBoxのため、他のキー(正方形)と
   同じ幅を指定すると縦方向にレターボックスされて小さく見える。高さだけを揃え、
   幅は縦横比に応じて自動で決める。 */
.dharma-key-wide {
    height: 30px;
}

.dharma-key-square {
    width: 30px;
    height: 30px;
}

.dharma-help-divider {
    margin: 12px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.4);
}

.dharma-help-button-row {
    display: flex;
    gap: 8px;
}

.dharma-help-action-button {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.8);
    font-family: "ShipporiMincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
    font-size: 13px;
    cursor: pointer;
    flex: 1;
    text-align: center;
}

.dharma-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 30;
    padding: 16px;
    box-sizing: border-box;
}

.dharma-dialog-overlay.is-open {
    display: flex;
}

.dharma-dialog {
    width: min(360px, 92vw);
    /* HelpPanel.ts の ResizeObserver が root の実サイズから継続的に上書きする。
       ここでの値はJS実行前の初期値(保険)。 */
    max-height: 480px;
    padding: 18px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(20, 20, 24, 0.92);
    color: rgba(255, 255, 255, 0.85);
    font-family: "ShipporiMincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-sizing: border-box;
    overflow-y: auto;
}

.dharma-terms-dialog {
    width: min(480px, 92vw);
    /* HelpPanel.ts の ResizeObserver が root の実サイズから継続的に上書きする。
       ここでの値はJS実行前の初期値(保険)。 */
    max-height: 600px;
    padding: 18px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(20, 20, 24, 0.92);
    color: rgba(255, 255, 255, 0.85);
    font-family: "ShipporiMincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-sizing: border-box;
    backdrop-filter: blur(6px);
    overflow-y: auto;
}

.dharma-dialog-heading {
    font-size: 14px;
}

.dharma-terms-heading {
    font-size: 14px;
    flex-shrink: 0;
}

.dharma-feedback-textarea {
    width: 100%;
    min-height: 120px;
    resize: vertical;
    box-sizing: border-box;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(0, 0, 0, 0.3);
    color: #ffffff;
    font-family: "ShipporiMincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
    font-size: 13px;
}

.dharma-dialog-status {
    min-height: 1.2em;
}

.dharma-dialog-button-row {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.dharma-dialog-button {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    font-family: "ShipporiMincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
    font-size: 13px;
    cursor: pointer;
}

.dharma-dialog-button.is-primary {
    border: 1px solid rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.dharma-terms-body {
    overflow-y: auto;
    white-space: pre-line;
    line-height: 1.8;
    padding-right: 4px;
}

.dharma-terms-close-button {
    align-self: flex-end;
    flex-shrink: 0;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    font-family: "ShipporiMincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
    font-size: 13px;
    cursor: pointer;
}
