body {
    margin: 0;
    display: flex;
    flex-direction: column;
    font-family: 'ヒラギノ角ゴ Pro W6', 'Hiragino Kaku Gothic Pro','メイリオ', 'Meiryo', '游ゴシック', 'Yu Gothic', 'ＭＳ Ｐゴシック', 'MS PGothic', sans-serif;
    height: 100vh;
    height: 100svh;
}

/*top画面が出ているときにiphoneで裏をスクロールさせない。*/
body:not(.in_room) {
    position: fixed;
}

header {
    background-color: #666;
    color: white;
    padding: 4px 0;
}

body.my_own header p::before {
    content: '管理者モード';
    color: red;
    background-color: #dadada;
    padding: 2px;
    border-radius: 2px;
    margin-right: 8px;
    font-size: 10px;
}

.header_title {
    display: flex;
    padding: 0 4px;
}
.header_title img{
    cursor: pointer;
    width:24px;
}
.header_title>div{
    flex:1
}

main {
    flex: 1;
    min-height: 100px;
}

#t_head {
    width: 100%;
    display: none;
}

#room_title {
    font-weight: normal;
    font-size: 18px;
    text-align: center;
    margin: 0;
    line-height: 110%;
}

header p {
    font-size: 12px;
    margin:0;
    text-align: center;
}

#cur_t {
    margin: 0;
}

/*threadが１つの時は表示しない*/
.multi_thread #t_head {
   display: block;
}

#connoba_thread_heading {
    display: flex;
    align-items: center;
}
.my_own:not(.multi_thread) #connoba_thread_heading {
    font-size: 12px;
}

.multi_thread #thread_selector_box {
    display: block;
    position: initial;
    width: initial;
    overflow: auto;
}
.my_own:not(.multi_thread) #thread_selector_box {
    width: 34px;
    min-width: 10px;
    display: block;
}

.multi_thread #to_thread {
    display: block;
}

#room_container {
    height: 100%
}

#variable_size {
    display: flex;
    flex-direction: column;
    /*height: 560px;      標準高さは variable_sizeではなく #topic_box:480pxで */
    max-width: 100%;    /* サイズ変更後のスマホ表示　*/
    min-width: 100%;    /* サイズ変更後のスマホ表示　*/
    transition: height .3s;
}

#topic_box {
    /*min-height: 480px;*/
    height: 480px;      /* defaultのサイズ */
    /*flex:1; defualtでは flexは付けずに、この高さが基準。PCでresizeされた時は flex:1に。。*/
    transition: all .3s;
    overflow: hidden;
    position: relative;
    background-color: #fff0f0;
    border-top: solid 1px #ccc;     /* pc sizeでは上下左右に */
}
#topic_box>div {
    height: 100%;
}

.expand #topic_box {
    flex: 1;
    min-height: 480px;  /* transition時に縮まないように */
    overflow-y: scroll;  /* 横方向のスクロールは出さない */
}

.topic_back {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
    position: absolute;
    width: 100%;
}
.topic_back li{
    /*min-height: 48px;    topic増やした時に縮まる必要がある。*/
    height: 48px;
    border-bottom: solid 1px #ccc;
    box-sizing: border-box;
}
.no_topic_msg {
    color: #888;
    margin-left: 20px;
}
.non_empty .no_topic_msg {
    display:none;
}

#room_info {
    padding: 0 4px 4px;
    box-sizing: border-box;
    overflow-y: scroll;
    max-width: 100%;        /* jsで手動resize対応するが、window幅が変わった時でもはみ出させない */
    position: relative;
}
#room_info.connecting {
    background: url(img/loading.gif) no-repeat center;
    background-size: 32px;
}
body.disconnected #room_info.connecting {
    background: none;
}

#current_time {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 24px;
    background-color: #eee;
}
p#status_message {
    margin: 0;
    padding: 2px 0;
}
h2#room_info_title {
    font-size: 14px;
    margin: 0;
}
.room_info_box {
    display: flex;
    align-items: flex-start;
    gap: 4px;
}
.room_info_box p {
    margin:0;
    font-size: 12px;
    color: #888;
}
#room_owner_thumb {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: solid 1px #888;
    object-fit: cover;
    margin-top: 4px;
}
.room_info_line {
    display: flex;
    flex-wrap: wrap;
    gap: 0 6px;
    align-items: center;
}
.room_info_box span {
    margin-left: 2px;
    color: #444;
    font-size: 14px;
}
body:not(.my_own) #room_info_max {
    display: none;
}
p#room_type {
    border: solid 1px #888;
    border-radius: 3px;
    padding: 1px 2px;
    font-size: 10px;
}
p#room_info_desc {
    /* display: inline; */
    margin: 0;
}

.newmsg {
    /*height: 200px; topic行数によって可変に。*/
    box-sizing: border-box;
    bottom: 0;
    background-color: #fffff0;
    background-size: 24px;
    padding: 6px 6px 16px;
    border: solid 1px #cccccc;
}

#selected_topics {
    background-color: #666;
    /*height:32px;*/
    /*min-height: 32px;*/ /* flexboxで縮めないため */
}

#room_container.filtered #selected_topics {
    background-color: #006;
}

#selected_topics ul{
    display: flex;
    gap: 6px;
    padding: 8px;
    margin: 0;
    flex-wrap: wrap;
    list-style-type: none;
    flex:1;
    /*min-height: 22px;*/
}
#selected_topics li{
    background-color: #eee;
    color: #444;
    border-radius: 10px;
    padding: 1px 4px;
    font-size: 13px;
    cursor: pointer;
    z-index: 2; /* must be upper to arrow plane */
}

#selected_topics li::before {
    content: 'x';
    margin-right: 4px;
    color: #888;
}

#selected_topics>div {
    display: flex;
    align-items: center;
}

#selected_topics .tcancel {
    background: url(img/x-slim-white.svg) no-repeat right 6px center;
    background-size: 24px;
    width: 30px;
    height: 20px;
    padding-left: 2px;
    cursor: pointer;
    display: none;
}

#room_container.filtered  .tcancel {
    display: block;
}

#msgtext {
    width: 100%;
    margin-bottom: 5px;
    height: 80px;
    box-sizing: border-box;
}

#msglength_remained {
    font-size: 12px;
    margin-left: 8px;
}

#msglength_remained.over {
    font-weight: bold;
    color: red;
}

.msg_admin:not(.my_own) #msgtext {
    display: none;
}

#dummy_msgtext {
    display: none;
    width: 100%;
    margin-bottom: 5px;
    height: 40px;
}
.msg_admin:not(.my_own) #dummy_msgtext {
    display: block;
}
.my_own #msgtext {
    display: inline;
}

#account_dialog {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background-color: #000000c0;
    align-items: center;
    justify-content: center;
    z-index: 300;
}
#account_dialog.open {
    display: flex;
}

#profeel_dialog {
    display: none;
    background-color: white;
    border: solid 1px gray;
    padding: 20px;
}


#profeel_dialog.open {
    display: block;
}

#my_profeel {
    margin-bottom: 8px;
}

#to_thread {
    display: none;
    margin: 0 -6px;
    padding: 2px 4px;
    background-color: #ccc;
    margin: 0 -6px 4px;
}

#to_thread::before {
    content: '選択中のチャンネル: ';
    color: #666;
    font-size: 12px;
}

#tag_list {
    background: url(img/hashtag_icon_color.svg) no-repeat left 8px center;
    padding: 4px 4px 4px 36px;
    margin: 0 -6px 8px;
    display: none;
    background-color: #eee;
    overflow-wrap: anywhere;
}
#tag_list.non-empty {
    display: block;
}
.no_tag {
    background: url(img/hashtag_icon_gray.svg) no-repeat left 10px center;
    padding: 4px 4px 4px 36px;
    margin: 8px -6px;
    background-color: #eee;
    color: red;
    /*color: #a0a0a0;*/
}
#tag_list+.no_tag {
    display: block;
}

#tag_list.non-empty+.no_tag {
    display: none;
}

#tag_list span {
    border: solid 1px #808080;
    padding: 2px;
    margin-right: 6px;
    border-radius: 6px;
    background-color: white;
}

.tags span {
    color: white;
    font-size: 10px;
    background-color: #a0a0a0;
    border-radius: 10px;
    padding: 2px 4px;
    margin: 0 3px;
}
.tags span.hit {
    background-color: #fa6365;
}
#write_button, #close_button {
    position: fixed;
    right: 12px;
    bottom: 12px;
    background-color: #666;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: solid 1px white;
}
#write_button img{
    width: 24px;
}
#close_button img{
    width: 40px;
}

#newmsg {
    display: none;
    position: fixed;
    bottom:0;
    width: 100%;
    box-sizing: border-box;
    background-color: #fffff0;
    border-top: solid 1px #888;
    padding: 4px;
    z-index: 2;
}
body.writing_mode #newmsg {
    display: block;
}


#all_thread {
    padding-left: 6px;
}

#append_thread {
    /*color: white;*/
    background: url(img/plus.svg) no-repeat left center #dddddd;
    padding: 6px 6px 6px 16px;
    cursor: pointer;
}
#topics_end {
    background-color: #ccc;
    padding: 3px 0;
}
.expand #topics_end img {
    transform: scaleY(-1);
}
#topics_end img {
    width: 20px;
    display: block;
    margin: 0 auto;
}

.new_topic {
    display: flex;
    gap: 5px;
    margin: 2px 0;
    /*padding-left: 30px;*/
}

div#error {
    display: none;
    position: fixed;
    top: 0px;
    background-color: #000000a0;
    width: 100vw;
    height: 100vh;
    left: 0;
    color: #fd5555;
    font-size: 24px;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 20;
}

body.disconnected div#error{
    display: flex;
}

#tags {
    display: none;  // α1.0ではtopicなし
}

#drop_down_thread {
    width: 16px;
    margin-right: 4px;
    transition: transform .3s;
}

.thread_close #drop_down_thread {
    transform: scaleY(-1);
}

#thread_selector_box {
    display: none;
    transition: height .3s; /* set by js */
    overflow-y: hidden;
    background-color: #eee;
    height:0;
}

.connoba_topics {
    overflow: hidden;
}

#msg_box {
    border-top: solid 1px #ccc;
    background-color: #f8f8f8;
}
#msg_stable {   /* coming guide位置を固定させるため */
    position: relative;
    overflow: hidden;
    flex: 3;
}
#msg_container {
    height: auto;
    overflow-y: initial;
}
#room_container.filtered #msg_container {
    border-left: solid 8px #006;
}
#coming_guide,
#coming_guide_down,
#coming_guide_up {
    display: none;
    left: 50%;
    transform: translate(-50%, 0);
    border: solid 1px black;
    border-radius: 14px;
    padding: 2px 8px 2px 24px;
    background-color: #e0e0ff;
    font-weight: normal;
    font-size: 14px;
    background-repeat: no-repeat;
    background-size: 20px;
    background-position: left 2px center;
    z-index: 3;
}
#coming_guide {
    position: absolute;
    top: 60px;
    background-image: url(img/caret_gray.png);
    background-size: 16px;
    background-position: left 5px center;
}
#coming_guide_down {
    position: fixed;
    bottom: 60px;
    background-image: url(img/caret-bottom.svg);
}
#coming_guide_up {
    position: fixed;
    top: 60px;
    background-image: url(img/caret-top.svg);
}

#connoba_message_list {
    border: none;
}
#status_message p.warn_msg,
#top_screen p.warn_msg {
    color: red;
    margin: 0;
}

#arrow_plane {
    position: fixed;
    top:0;
    left:0;
    pointer-events: none;
    opacity: 0.2;
    transition: opacity 1s;
    z-index:1; /* must behide .topic_more and .selected_each */
}
#arrow_plane.active {
    opacity: 1;
}

@media screen and (min-width:768px) {
    /*body {*/
    /*    overflow: hidden; スマホ横向きで操作できなくなってしまうのでやめた */
    /*}*/
    #room_container {
        height: 100%;
        display: flex;
        /*flex-wrap: wrap;*/
        /*align-items: flex-start;*/
    }
    #topic_container {
        flex: 4;
        /*max-width: 480px;*/
        margin-top: 4px;
        margin-left: 4px;
        min-width: 280px;
        display:flex;
        flex-direction: column;
    }
    #topic_container.expand {
        height: 100%;
    }
    #variable_size {   /* 独立してresize効くように２重に */
        overflow: hidden;
        resize: both;
        width: 60vw; /* resizeが効くように、比率をやめた */
        /*height: 550px; 初期値は設定せず→resizeするまではtopicに応じて高くなるように*/
        min-height: 555px;
        max-width: 100%;
        min-width: 280px;
    }
    #topic_box.resized {
        flex: 1;
    }
    .expand div#variable_size {
        height: 100%!important; /* resizeで直接指定されているheightを上書き */
    }
    #room_info {
        min-height: 100px;
    }

    .expand #room_info {
        display: none;
    }

    #msg_stable {   /* coming guide位置を固定させるため */
        position: relative;
        flex: 3;
        min-width: 280px;
    }
    #msg_container {
        /*flex: 3; msg_stableに移動 */
        /*height: calc(100vh - 90px); flexboxで置き換え*/
        height: 100%;  /* msg_stableに合わせるため */
        /*min-width: 280px; msg_stableへ*/
        overflow-y: auto;
        /*height: 100%;*/
        margin: 4px;
        border: solid 1px #ccc;
    }

    #msg_box {
        flex:1;
        /*border: solid 1px #ccc;*/
        /*margin: 4px;*/
        height: 100%;
        box-sizing: border-box;
        border-top-type: none;
    }

    #newmsg {
        position: absolute;
        width: calc(100% - 10px);
    }

    /*#connoba_message_list {*/
    /*    border:none;*/
    /*}*/
    #topic_box {
        border: solid 1px #ccc
    }
    #thread_selector_box {
        margin-bottom: 8px;
        /*border: solid 1px #888;*/
        max-width: 192px;
        width: 15%;
        min-width: 120px;
    }
    #drop_down_thread {
        display: none;
    }
    /*#topic_boxについているので２重にならないように削除*/
    /*.expand .connoba_topics {*/
    /*    overflow: scroll;*/
    /*}*/
    #thread_selector_box {  /* responsiveでjsで書かれていてても上書き */
        height: auto !important;
    }
}
@media screen and (max-width:767px) {
    #variable_size {
        /*height: 550px!important;*/
        /*height: auto;*/
    }
    #coming_guide {
        position: fixed;
    }
    .new_topic {
        padding: 2px;
    }
    .expand #variable_size {
        height: 100%!important;
    }
    .expand+#msg_stable {
        display: none;
    }
    .connoba_topics li {
        height: 48px!important;
    }
    #topic_container.expand {
        height: 100%;
    }

    #topic_container.expand+#msg_container {
        display: none;
    }
    .expand #room_info {
        display: none;
    }
    /*スマホの場合、topicの帯が出るとスペース的に厳しいのと、途中の表現が誤解を生むので消す。*/
    #room_container.filtered #room_info {
        display: none;
    }

    .my_own:not(.multi_thread) #thread_selector_box {
        width: 100%;
    }
    .my_own #t_head {
        display: block;
    }
    .my_own:not(.multi_thread) #connoba_thread_title {
        font-size: 16px;
    }
    .my_own:not(.multi_thread) #connoba_auto,
    .my_own:not(.multi_thread) #connoba_next,
    .my_own:not(.multi_thread) #connoba_prev {
        display: none;
    }
}
