:root {
    --header-height: 10dvh;
    --footer-height: 10dvh;
    --main-height: 80dvh;
    /* デフォルト（縦画面）は幅(dvw)を基準にする */
    --base-size: 1dvw;
}

/* 横画面では高さ(dvh)を基準にする */
@media (orientation: landscape) {
    :root {
        --base-size: 1dvh;
    }
}

body {
    margin: 0;
    font-family: sans-serif;
    background-color: #f0f0f0;
    color: #333;
    overflow: hidden; /* スクロール禁止 */
}

header {
    height: var(--header-height);
    width: 100dvw;
    background-color: #9B2A2A;
    color: white;
    text-shadow: calc(0.2 * var(--base-size)) calc(0.2 * var(--base-size)) RGBA(0, 0, 0, 0.35); 
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 calc(0.5 * var(--base-size)) calc(1 * var(--base-size)) rgba(0,0,0,0.1);
    z-index: 6;
}

h1, h2 {
    margin: 0;
    padding: calc(0.5 * var(--base-size)); /* パディングをさらに縮小 */
    text-align: center;
}

h1 {
    font-size: calc(5.8 * var(--base-size)); /* フォントサイズを少し縮小 */
}

h2 {
    font-size: calc(5.6 * var(--base-size)); /* フォントサイズを少し縮小 */
    color: #B84242;
}

main {
    width: 100dvw;
    height: var(--main-height);
    overflow: hidden; /* スクロール禁止 */
}

#seireki-to-gengoo, #gengoo-to-seireki {
    display: flex;
    width: 100%;
    height: 100%; /* 高さを100%に固定 (80dvhに相当) */
}

#input-section, #result-section,
#gengoo-input-section, #gengoo-result-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: calc(2 * var(--base-size)); /* パディングを大幅に縮小 */
    box-sizing: border-box;
}

#input-section, #gengoo-input-section {
    background-color: #F5E8E8;
}
#年月日{
    display: flex;
    }
#result-section, #gengoo-result-section {
    background-color: #E7c3c7;
}

.input-group {
    margin: calc(1.0 * var(--base-size)) 0; /* マージンを縮小 */
    width: 80%;
    max-width: none;
}

.input-group label {
    display: block;
    margin-bottom: calc(0.5 * var(--base-size)); /* マージンを縮小 */
    font-size: calc(4.8 * var(--base-size)); /* フォントサイズを縮小 */
}

.input-group input, .input-group select {
    width: 90%;
    padding: calc(0.5 * var(--base-size)); /* パディングを縮小 */
    border-radius: calc(1 * var(--base-size));
    border: calc(0.3 * var(--base-size)) solid #ccc;
    font-size: calc(4.8 * var(--base-size)); /* フォントサイズを縮小 */
    text-align: center;
}

#result-display, #gengoo-result-display {
    font-size: calc(5 * var(--base-size));
    font-weight: bold;
    text-align: center;
    margin-top: calc(0.5 * var(--base-size)); /* 上部マージンをさらに削減 */
    width: 100%;
}

#result-display p, #gengoo-result-display p {
    margin: calc(0.2 * var(--base-size)) 0; /* p要素の上下マージンをさらに削減 */
    line-height: 1.2;
}

#result-display .note {
    font-size: calc(3.8 * var(--base-size)); /* .noteのフォントサイズを拡大 */
    font-weight: normal;
    color: #2c3e50;
    margin-top: calc(0.2 * var(--base-size)); /* .noteの上部マージンをさらに削減 */
    display: block;
}

footer {
    height: var(--footer-height);
    width: 100dvw;
    background-color: #2c3e50;
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    bottom: 0;
    left: 0;
    z-index: 6;
}

#switch-button {
    padding: calc(1.6 * var(--base-size)) calc(4 * var(--base-size));
    font-size: calc(4.4 * var(--base-size));
    color: white;
    background-color: #B84242;
    border: none;
    border-radius: calc(1 * var(--base-size));
    cursor: pointer;
    transition: background-color 0.3s;
}

#switch-button:hover {
    background-color: #2980b9;
}

.hidden {
    display: none !important;
}

/* Portrait Layout (縦画面) */
@media (orientation: portrait) {
    #seireki-to-gengoo, #gengoo-to-seireki {
        flex-direction: column;
    }
    #input-section, #result-section,
    #gengoo-input-section, #gengoo-result-section {
        width: 100dvw;
        /* 高さを40dvhに固定 (mainの半分) */
        height: 40dvh; 
        justify-content: center;
    }
}

/* Landscape Layout (横画面) */
@media (orientation: landscape) {
    #seireki-to-gengoo, #gengoo-to-seireki {
        flex-direction: row;
    }
    #input-section, #result-section,
    #gengoo-input-section, #gengoo-result-section {
        width: 50dvw;
        height: 100%; /* 横並びのときは高さ100% (80dvh) */
        justify-content: center;
    }
}

/* PWA Install Button Styling */
#install-button {
    display: none; /* Hidden by default */
    position: fixed;
    bottom: calc(5 * var(--base-size));
    right: calc(5 * var(--base-size));
    background-color: #2ecc71;
    color: white;
    border: none;
    padding: calc(2 * var(--base-size)) calc(4 * var(--base-size));
    border-radius: calc(1 * var(--base-size));
    font-size: calc(3.5 * var(--base-size));
    cursor: pointer;
    box-shadow: 0 calc(0.5 * var(--base-size)) calc(1 * var(--base-size)) rgba(0,0,0,0.2);
}

#install-button:hover {
    background-color: #27ae60;
}
@media (max-aspect-ratio: 100/100) {
    /*縦*/ 
	h1 {
		color:white;
		font-size:3dvh;
	}
	#hamburger_menu{
		position:absolute;
		top:0.5dvh;
		left:1vw;
		font-size:6dvh;
		color:white;
	}
	#help{
		position:absolute;
		top:0.5dvh;
		right:1vw;
		font-size:6dvh;
		color:white;
	}
	nav{
		position:absolute;
		top:0;
		left:0;
		width:0;
		height:100dvh;
		background-color:#EFEFEF;
		transition: all 0.5s;
		font-size:0;
		z-index:8;
        color:black;
	}
	#クリアーカーテン{
		position:absolute;
		top:0;
		left:0;
		width:0;
		height:100dvh;
        background-color:#0007;
		transition: width 0.5s;
		z-index:7;
	}
	#ダークカーテン弐{
		position:absolute;
		top:0;
		left:0;
		width:0;
		height:100dvh;
        background-color:#0007;
		transition: width 0.5s;
		z-index:7;
	}
	#黒板消し右用{
		position:absolute;
		top:10dvh;
		left:0;
		width:0;
		height:90dvh;
        background-color:#FFF7;
		transition: width 0.5s;
		z-index:7;
	}
	#黒板消し左用{
		position:absolute;
		top:10dvh;
		right:0;
		width:0;
		height:90dvh;
        background-color:#FFFF;
		transition: width 0.5s;
		z-index:8;
	}
    #ヘルプエリア{
		position:absolute;
		top:10dvh;
		right:10vw;;
		width:80vw;;
		height:0dvh;
        background-color:#FFFF;
		transition: height 0.5s;
		z-index:8;
        overflow:scroll;
        color:black;
    }
    #ヘルプエリア h2{
        margin-left:3vw;
        margin-right:3vw;
        font-size:2.5dvh;
    }
    #ヘルプエリア h3{
        margin-left:3vw;
        margin-right:3vw;
        font-size:2.5dvh;
        color:blue;
    }
    #ヘルプエリア img{
        width:26vw;
        height:26vw;
        margin-left:13vw;
    }
    #ヘルプエリア p{
        margin-left:2.5vw;
        margin-right:2.5vw;
        font-size:2.5dvh;
    }
}
@media (min-aspect-ratio: 100/100) {
    /*PC等横置き*/ 
	h1 {
		color:white;
		font-size:6dvh;
	}
	#hamburger_menu{
		position:absolute;
		top:0.5dvh;
		left:1dvh;
		font-size:6dvh;
		color:white;
	}
	#help{
		position:absolute;
		top:0.5dvh;
		right:1dvh;
		font-size:6dvh;
		color:white;
	}
	nav{
		position:absolute;
		top:0;
		left:0;
		width:0;
		height:100dvh;
		background-color:#EFEFEF;
		transition: all 0.5s;
		font-size:0;
		z-index:8;
        color:black;
	}
	#クリアーカーテン{
		position:absolute;
		top:0;
		left:0;
		width:0;
		height:100dvh;
        background-color:#0007;
		transition: width 0.5s;
		z-index:7;
	}
	#ダークカーテン弐{
		position:absolute;
		top:0;
		left:0;
		width:0;
		height:100dvh;
        background-color:#0007;
		transition: width 0.5s;
		z-index:7;
	}
	#黒板消し右用{
		position:absolute;
		top:10dvh;
		left:0;
		width:0;
		height:90dvh;
        background-color:#FFF7;
		transition: width 0.5s;
		z-index:7;
	}
	#黒板消し左用{
		position:absolute;
		top:10dvh;
		right:0;
		width:0;
		height:90dvh;
        background-color:#FFFF;
		transition: width 0.5s;
		z-index:8;
	}
    #ヘルプエリア{
		position:absolute;
		top:10dvh;
		right:20vw;;
		width:60vw;;
		height:0dvh;
        background-color:#FFFF;
		transition: height 0.5s;
		z-index:8;
        overflow:scroll;
        color:black;
    }
    #ヘルプエリア h2{
        margin-left:3vw;
        margin-right:3vw;
        font-size:3vw;
    }
    #ヘルプエリア h3{
        margin-left:3vw;
        margin-right:3vw;
        font-size:3vw;
        color:blue;
    }
    #ヘルプエリア img{
        width:20vw;
        height:20vw;
        margin-left:10vw;
    }
    #ヘルプエリア p{
        margin-left:3vw;
        margin-right:3vw;
        font-size:3vw;
    }
    button{
        font-size:5dvh;
    }
    #text-input {
        font-size: 10vw;
    }
}
