.mobile_footer{
  display: none;
}

.mobile_header {
  display: none;
}

#mobile_consider_btn {
  display: none;
}

.mobile_record_consider_btn {
  display: none;
}

@media screen and (max-width: 600px) {
  body.mobile-home,
  body.mobile-board,
  body.mobile-home *,
  body.mobile-board * {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .main {
    margin: 0;
    width: 100%;
    height: auto;
    display: block;
  }

  body {
    margin: 0;
    overflow-x: hidden;
    padding-bottom: calc(56px + env(safe-area-inset-bottom));
  }

  body.game_page{
    overflow: hidden;
    height: 100dvh;
  }

  .game,
  .menu {
    width: 100%;
    min-height: 100vh;
  }

  .view{
    background: #eef3f8;
  }

  .common_modal {
    top: 40%;
  }

  /* モード中の .main 縦を中央配置 */
  body.mobile-home .main-home,
  body.mobile-board .main-board {
    position: fixed;
    left: 0;
    right: 0;
    top: calc(env(safe-area-inset-top) + 34px); /* 余白4px含む */
    bottom: calc(env(safe-area-inset-bottom) + 60px); /* 余白4px含む */

    display: flex;
    justify-content: center;
    align-items: center;
  }

  /* ホーム本体 / ゲーム本体 共通 */
  body.mobile-home .menu,
  body.mobile-board .game {
    display: block;
    min-height: 0;
    transform-origin: center;
  }

  body.mobile-board .game_stage {
    width: 440px;
    height: 530px;
  }

  body.mobile-board:not(.play-screen) .game_stage {
    height: 645px;
  }

  /* ホーム本体 */
  body.mobile-home .menu {
    width: 320px;
  }
  /* ゲーム本体 */
  body.mobile-board .game {
    width: 440px;
  }

  /* ホーム表示中 */
  body.mobile-home .main-board {
    display: none;
  }

  body.mobile-home .main-home {
    display: flex;
  }

  .logo{
    visibility: hidden;
  }

  #inf_user{
    visibility: hidden;
  }

  /* 盤面表示中 */
  body.mobile-board .main-home {
    display: none;
  }

  body.mobile-board .main-board {
    display: flex;
  }

  /* PC下部ボタン非表示 */
  .game_menu{
    display: none;
  }

  /* スマホ：ホーム側の履歴操作ボタンは非表示 */
  body.mobile-home #record_operation {
    display: none;
  }

  /* 初期は全部非表示 */
  #mobile_friend_btn,
  #mobile_pvp_btn,
  #mobile_bot_btn,
  #mobile_resign_btn,
  #mobile_next_game_btn,
  #mobile_consider_btn {
    display: none;
  }

  /* HOME */
  body.mobile-home #mobile_friend_btn,
  body.mobile-home #mobile_pvp_btn,
  body.mobile-home #mobile_bot_btn {
    display: block;
  }

  /* PLAY */
  body.mobile-board.play-screen #mobile_resign_btn,
  body.mobile-board.play-screen #mobile_next_game_btn {
    display: block;
  }

  body.mobile-board.play-screen #record_operation {
    display: none;
  }

  /* RECORD */
  body.mobile-board:not(.play-screen) #mobile_consider_btn {
    display: block;
  }

  #mobile_consider_btn.active {
    background: #4caf50;
    color: white;
  }

  /* 下ボタン消す */
  body.mobile-home .second_menu {
    display: none;
  }

  /* menu全体縮める */
  body.mobile-home .menu {
    height: auto;
    min-height: 0;
    padding-bottom: 20px;
  }

  /* main_menu外側 */
  body.mobile-home .main_menu {
    background: transparent;
    height: var(--home-main-height, 440px);
  }

  /* content_panel高さ */
  body.mobile-home .content_panel {
    height: var(--home-content-height, 372px);
  }

  /* content高さ */
  body.mobile-home .tab_content {
    height: 100%;
  }

  /* 履歴内部 */
  body.mobile-home #consider2 {
    height: 100%;
  }
  /* 履歴内部 相手側 */
  body.mobile-home #consider2_opt {
    height: calc(100% - 30px);
  }

  /* スマホ用 棋譜エリア */
  #mobile_kifu_area{
    width: 440px;
    display: flex;
    justify-content: center;
  }

  /* ホーム側では非表示 */
  body.mobile-home #kifu_wrap{
    display: none;
  }

  /* スマホ：棋譜を盤面側で通常表示する */
  body.mobile-board #mobile_kifu_area {
    width: 440px;
    height: 115px;
    display: flex;
    justify-content: center;
    position: relative;
  }

  body.mobile-board #mobile_kifu_area #kifu_wrap {
    position: relative;
    left: auto;
    bottom: auto;
    transform: none;

    width: 100%;
    height: 115px;

    display: block;
    pointer-events: auto;
  }

  body.mobile-board #kifu_bar {
    display: none;
  }

  body.mobile-board #kifu_wrap.hide .kifu_body {
    transform: translateY(0);
    pointer-events: auto;
  }

  body.mobile-board #mobile_kifu_area #game_record {
    top: 0;
    overflow-y: auto;

    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: none;
    grid-auto-rows: 34px;
    gap: 5px;
    padding: 0 9px;

    pointer-events: auto;
  }

  .kifu_body {
    margin-top: 6px;
  }

  .game_record_move{
    height: 30px;
    font-size: 18px;
  }

  #record_area{
    display: none;
  }

  body.mobile-home #record_area.hide {
    display: none;
  }

  body.mobile-board.play-screen #record_area {
    display: none;
  }

  body.mobile-board.play-screen #mobile_kifu_area {
    display: none;
  }

  body.mobile-board .pc_record_consider_btn {
    display: none;
  }

  body.mobile-board .mobile_record_consider_btn {
    display: flex;
  }

  body.mobile-home .mobile_record_consider_btn {
    display: none;
  }

  body.mobile-board .pc_record_consider_btn {
    display: none !important;
  }

  .mobile_footer #mobile_consider_btn.active {
    background: #4caf50 !important;
    color: white !important;
  }

  .mobile_header {
    display: none;
  }

  body.mobile-home .mobile_header,
  body.mobile-board .mobile_header {
    position: fixed;
    top: env(safe-area-inset-top);
    left: 0;
    width: 100%;
    height: 30px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 14px;
    box-sizing: border-box;

    z-index: 99999;
  }

  .mobile_logo{
    display: flex;
    align-items: center;

    height: 30px;
    padding: 0;

    font-family: 'Atkinson Hyperlegible Mono', monospace;
    font-size: 20px;
    font-weight: 500;
    letter-spacing: 1px;

    color: #3f4650;
    line-height: 1;
  }

  .mobile_logo .green{
    color: #2e8b57;
  }

  /* フリー対戦のロゴだけ大きくする */
  body.free-mode .free_logo_link {
    font-size: 22px;
  }

  /* フリー対戦ロゴの白黒アイコン */
  body.free-mode .free_logo_stone {
    width: 9px;
    height: 24px;

    display: inline-flex;
    flex-shrink: 0;
    overflow: hidden;

    margin-right: 7px;

    border: 1px solid #333;
    border-radius: 2px;
    box-sizing: border-box;
  }

  body.free-mode .free_logo_stone::before,
  body.free-mode .free_logo_stone::after {
    content: "";
    width: 50%;
    height: 100%;
    display: block;
  }

  body.free-mode .free_logo_stone::before {
    background: #111;
  }

  body.free-mode .free_logo_stone::after {
    background: #fff;
  }

  #mobile_page_btn {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #555;
    text-decoration: none;
    font-size: 18px;
  }

  #mobile_page_btn .material-icons{
    font-size: 22px;
  }

  /* スマホ下部ボタンの枠 */
  .mobile_footer{
    position: fixed;
    left: 0;
    bottom: env(safe-area-inset-bottom);

    width: 100%;
    height: 56px;

    display: flex;
    justify-content: space-around;
    align-items: center;

    background: rgba(30,30,30,.92);

    z-index: 99999;
  }

  /* スマホ下部ボタン本体 */
  .mobile_footer button,
  .mobile_footer a{

    width: 100%;
    height: 48px;
    margin: 0 3px;

    border: none;
    border-radius: 6px;

    background: #3a3a3a;
    color: white;

    font-size: 16px;
    text-align: center;
    line-height: 48px;

    text-decoration: none;
  }

  /* HOME：通信対局を少し広くする */
  body.mobile-home #mobile_friend_btn,
  body.mobile-home #mobile_bot_btn{
    width: auto;
    flex: 1 1 0;
  }

  body.mobile-home #mobile_pvp_btn{
    width: auto;
    flex: 1.25 1 0;
    background: #4f7df3;
  }

  /* 履歴操作ボタンの枠 */
  body.mobile-board #record_operation {
    width: 100%;
    height: 56px;

    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 0;
  }

  /* 履歴操作各ボタンを入れている枠 */
  body.mobile-board #record_operation > * {
    flex: 1;
    margin: 0 3px;
  }

  /* 履歴操作文字ボタン専用設定 */
  body.mobile-board #record_operation .btn {
    width: 100%;
    box-sizing: border-box;
  }

  /* 履歴操作各ボタン本体 */
  body.mobile-board #record_operation .btn,
  body.mobile-board #record_operation .material-icons {
    height: 48px;
    border-radius: 6px;
    background: #3a3a3a;
    color: white;

    display: flex;
    align-items: center;
    justify-content: center;

    line-height: 48px;
    font-size: 16px;
  }

  /* ホーム画面に追加時の対策 */
  body.standalone .mobile_footer {
    bottom: calc(env(safe-area-inset-bottom) + 18px);
    overflow: visible;
  }

  body.standalone .mobile_footer::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;

    height: calc(env(safe-area-inset-bottom) + 18px);

    background: rgba(30,30,30,.92);
    pointer-events: none;
  }

  /* ダブルタップズーム無効化 */
  body.mobile-board #record_operation,
  body.mobile-board #record_operation * {
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
  }

  body.mobile-home #rec_chart_opt .rec_chart3,
  body.mobile-home #watchings .rec_chart3 {
    background: transparent;
    border-radius: 4px;
  }

  body.mobile-home #rec_chart_opt .rec_chart3:hover,
  body.mobile-home #watchings .rec_chart3:hover {
    background: transparent;
  }

  body.mobile-home form[name="mode_form"],
  body.mobile-home #mode_form_desc {
    display: none;
  }

  body,
  .logo,
  .kifu_body,
  .menu{
    background: #eef3f8;
  }

  .content_panel{
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
  }


  body.free-mode .main-home {
    display: none;
  }

  body.free-mode #mobile_page_btn {
    display: none;
  }

  body.free-mode .mobile_header {
    justify-content: center;
  }

  body.free-mode .free_finish_panel {
    position: fixed;

    left: 8px;
    right: 8px;
    bottom: calc(64px + env(safe-area-inset-bottom));
    top: auto;

    width: auto;
    padding: 10px 12px;

    background: rgba(250, 250, 250, .96);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);

    z-index: 99998;
  }

  body.free-mode .free_finish_close_btn {
    position: absolute;
    top: 4px;
    right: 6px;

    width: 28px;
    height: 28px;
    padding: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border: none;
    background: transparent;
    color: #666;

    font-size: 22px;
    line-height: 1;
    cursor: pointer;
  }

}
