html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    font-family:"Yu Gothic", "游ゴシック", YuGothic, "游ゴシック体", "ヒラギノ角ゴ Pro W3", "メイリオ", sans-serif;
}

video {
    height: 100dvh;
    width: 100%;
    object-fit: contain;
    position: absolute;
}

.talkBox {
    display: none;
    opacity: 0.8;
    background-color: white;
    border-radius: 16px;
}
.talkTxt {
    float: right;
    padding: 4px 4px;
    font-size: 16px;
    color: black;
    width: 144px;
    height: 64px;
}
.talkBtn {
    background-color: white;
    width: 72px;
    height: 72px;
    border: 8px solid green;
    border-radius: 16px;
    box-sizing: border-box;
}
#aiTalkBtn:disabled {
    border-color: red;
    opacity: 0.2;
}
#aiTalkBtn img {
    width: 100%;
    height: 100%;
}

#usrTalkBtn:disabled {
    border-color: red;
    opacity: 0.2;
}
#usrTalkBtn img {
    width: 100%;
    height: 100%;
}

#ai_bottom {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    pointer-events: none;
}

.ai_row {
    display: flex;
    justify-content: flex-start;
    align-items: flex-end;
    margin-bottom: 8px;
    gap: 8px;
    pointer-events: auto;
}

.ai_col {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai_status {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    width: 60px;
    height: auto;
    position: relative;
    z-index: 1;
}
.ai_status img {
    position: static;
    width: 52px;
    height: 52px;
    border-radius: 8px;
    border: 4px solid #ccc;
    visibility: hidden;
    opacity: 0;
}

.ai_status img.active {
    visibility: visible;
    opacity: 1;
}
.ai_left {
    margin-left: 0;
    margin-right: auto;
}
.ai_right {
    margin-left: auto;
    margin-right: 0;
}

#controls {
    position: absolute;
    top: 10px;
    right: 10px;
    left: 10px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 0px;
    align-items: flex-stretch;
}
.controls-row.single {
    display: block;   /* 横に分けない */
    width: 100%;
}
.controls-row.split {
    display: flex;
    justify-content: space-between; /* 左右に分ける */
    align-items: flex-start;
}
.controls-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.controls-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* 右寄せ */
    gap: 4px;
}.controls-top button {
    margin-left: 8px;
    padding: 10px 16px;
    font-size: 18px;
    color: #2196F3;
}

.controls-top {
    display: flex;
    flex-direction: row;
    margin-bottom: 0px;
}

.controls-menu button {
    margin-left: 8px;
    padding: 6px 8px;
    font-size: 16px;
    color: #2196F3;
}

.controls-menu {
    padding-bottom: 5px;
}

.howto-text {
    background: #e5ed77;
    color: #e6540b;
    opacity: 0.8;
    text-align: left;
    font-size: 10px;
    padding: 4px 6px;
}

.howto-arrow {
    display: flex;
    height: 100%;
    margin-right: 12px;
    text-align: right;
    flex-direction: column;
    justify-content: flex-end;
    opacity: 0.8;
}
.howto-arrow-wrapper {
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
}
.howto-arrow-in {
    display: inline-block;
    background: #e5ed77;
    color: #e6540b;
    font-size: 12px;
    padding: 4px 6px;
}

#howto_area {
    display: none;
}
.howto {
    background: #e5ed77;
    color: #e6540b;
    opacity: 0.8;
    text-align: left;
    font-size: 12px;
    font-weight: bold;
    padding: 4px 6px;
    border-radius: 8px;
    position: relative;
    right: 0;
    top: 0;
    width: 90px;
    float: right;
    margin-left: 8px;
    pointer-events: none;
}
.howto-arrow {
    display: block;
    text-align: center;
}


#menu_area {
    position: relative;
    right: 0;
    top: 0;
    width: max-content;
    z-index: 9; 
    display: none;
    flex-direction: column;
    /* 縦並び */
    gap: 5px;
    /* 各行の間隔 */
    background: rgba(33, 150, 243, 0.75);
}
#menu_area.is-disabled {
  opacity: .5;
  filter: grayscale(1);
  pointer-events: none;
}

#menu_area label {
    display: flex;
    z-index: 10;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 4px;
    color: white;
}

#menu_area .label-text {
    display: inline-block;
    width: 115px;
}

#menu_area select {
    padding: 6px 10px;
    font-size: 14px;
    width: 130px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
}

#lang_label .label-text {
    width: 150px; !important;
}

#lang_label select {
    width: 60px; !important;
}

#ai_command {
    z-index: 2;
}

#ai_command_action {
    display: none;
    position: absolute;
    bottom: 20px;
    left: 10px;
    font-size: 20px;
    background: #8bdce8;
    opacity: 0.8;
    border: 4px solid #ccc;
    border-radius: 8px;
}

#closeInline {
    font-size: 20px;
}

#captionArea {
    display: none;
    z-index: 1;
    height: 25vh;
    background: #ccc;
    opacity: 0.6;
    font-size: 18px;
    pointer-events: auto;
    overflow-y: auto;
}

#captionBox {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: #eee;
  border-radius: 6px;
}

.switch {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    cursor: pointer;
}

.switch input {
    display: none;
    /* デフォルトのチェックボックス非表示 */
}

.slider {
    position: relative;
    width: 50px;
    height: 28px;
    background-color: #ccc;
    border-radius: 34px;
    transition: background-color 0.3s;
}

.slider::before {
    content: "";
    position: absolute;
    width: 22px;
    height: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

input:checked+.slider {
    background-color: #4caf50;
}

input:checked+.slider::before {
    transform: translateX(22px);
}

#joinBtn {
  background: #2196F3;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 16px;
  cursor: pointer;
}
#joinBtn:disabled {
  background: #aaa;
  color: #666;
  cursor: not-allowed;
}
#menuBtn {
  background: #fff;
  color: #2196F3;
  border: 1px solid #000;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 16px;
  cursor: pointer;
}

#backBtn {
  display: none;
  z-index: 11;
  background: orange;
  color: white;
  border: 1px solid #000;
  border-radius: 8px;
  padding: 10px 4px;
  font-size: 16px;
}

#remaining {
  display: inline-block;
  margin-top: 8px;
  padding: 8px 12px;

  background: #52ba0d;
  color: white;

  font-size: 16px;
  font-weight: bold;
  text-align: center;

  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);

  letter-spacing: 0.05em;
}

#wakeLockBtn {
  display: none; /* 初期は非表示（ui.jsで制御） */
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3000;

  background: #3cdb2e;
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 18px 36px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;

  box-shadow: 0 10px 40px rgba(33, 150, 243, 0.45);
  transition:
    background 0.2s ease,
    transform 0.1s ease,
    box-shadow 0.25s ease,
    opacity 0.2s ease;
}

#wakeLockBtn:hover {
  background: #1c85d8;
  transform: translate(-50%, -52%);
  box-shadow: 0 12px 48px rgba(33, 150, 243, 0.55);
}

#wakeLockBtn:active {
  transform: translate(-50%, -50%) scale(0.97);
  box-shadow: 0 6px 24px rgba(33, 150, 243, 0.35);
}

#wakeLockBtn:disabled {
  background: #aaa;
  color: #666;
  cursor: not-allowed;
  box-shadow: none;
}

/* ===== Pop "AI thinking" Loading ===== */
#loading-indicator {
  border: 3px solid rgba(255, 170, 0, 0.55);
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  text-align: center;
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: rgba(255, 255, 255, 0.95);
	color: #222;
	padding: 20px 30px;
	border-radius: 8px;
	z-index: 100;
    width: min(80vw, 300px);
    box-sizing: border-box;
	text-align: center;
	visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

/* 見出しテキスト */
#loading-text {
  white-space: nowrap;
  overflow: hidden;
  word-break: keep-all;
  text-align: left;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.2;
}
#loading-indicator::after {
  content: "✨";
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
  animation: floatStar 2s ease-in-out infinite;
  text-shadow:
    -80px -40px 0px #ff6b6b,
     60px -50px 0px #ffd93d,
    -120px  20px 0px #6bcBef,
     90px   40px 0px #6bff95,
    -60px   70px 0px #c77dff,
     40px  -90px 0px #ff9ed6;
}
#loading-indicator.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

#loading-text::before {
  content: "🤖 ";
  display: inline-block;
  animation: wiggle 0.8s ease-in-out infinite;
}

/* 下の一言 */
.pop-dots {
  white-space: nowrap;
}
.pop-dots::after {
  content: "";
  animation: popDots 1.1s steps(4, end) infinite;
}

.pop-sub {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  color: rgba(0,0,0,0.55);
  display: inline-block;
  animation: bounceText 1.4s ease-in-out infinite;
}

/* スピナー */
.spinner {
  margin: 0 auto 10px auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 6px solid rgba(255, 120, 120, 0.35);
  border-top: 6px solid rgba(80, 180, 255, 0.95);
  border-right: 6px solid rgba(120, 255, 190, 0.95);
  animation: spin 0.9s linear infinite;
  position: relative;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ドットが増える（…） */
@keyframes popDots {
  0%   { content: ""; }
  25%  { content: "・"; }
  50%  { content: "・・"; }
  75%  { content: "・・・"; }
  100% { content: ""; }
}

@keyframes floatStar {
  0%   { opacity: 0; }
  20%  { opacity: 1; }
  50%  { opacity: 0.6; }
  100% { opacity: 0; }
}

@keyframes wiggle {
  0%,100% { transform: rotate(0deg); }
  25%     { transform: rotate(-8deg); }
  75%     { transform: rotate(8deg); }
}

@keyframes bounceText {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-4px); }
}
