* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: #081014;
  color: #e2e8f0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", monospace;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* 背景 iframe (操作不能・透過背景) */
#bg-frame {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  border: none;
  z-index: 0;
  pointer-events: none;
  opacity: 0.45;
}

/* メインコンテナ：浮遊感のあるグラスモフィズムパネル */
.app-container {
  position: relative;
  z-index: 10;
  width: 94%;
  max-width: 960px;
  height: 92vh;
  display: flex;
  flex-direction: column;
  background: rgba(8, 16, 20, 0.65);
  border: 1px solid rgba(0, 255, 136, 0.25);
  border-radius: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), 0 0 20px rgba(0, 255, 136, 0.1);
  overflow: hidden;
}

/* ヘッダー領域 */
.header-bar {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0, 255, 136, 0.25);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(18, 29, 36, 0.4);
}

.header-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

h1 {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(0, 255, 136, 0.4);
}

#status {
  font-size: 11px;
  font-family: monospace;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 170, 0, 0.4);
  border-radius: 20px;
  color: #ffaa00;
  letter-spacing: 0.5px;
}

/* モデル切替バー */
.model-bar {
  display: none;
  gap: 8px;
}

.model-bar input {
  display: none;
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  padding: 6px 12px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 12px;
  outline: none;
  transition: border-color 0.2s;
}

.model-bar input:focus {
  display: none;
  border-color: #00ff88;
}

.model-bar button {
  display: none;
  background: rgba(0, 255, 136, 0.15);
  color: #00ff88;
  border: 1px solid #00ff88;
  padding: 0 16px;
  font-size: 11px;
  font-weight: bold;
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: all 0.2s;
}

.model-bar button:hover:not(:disabled) {
  display: none;
  background: #00ff88;
  color: #000;
}

/* チャットログ表示エリア */
#chat-box {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 14px;
  line-height: 1.6;
}

/* スクロールバー装飾 */
#chat-box::-webkit-scrollbar {
  width: 6px;
}
#chat-box::-webkit-scrollbar-thumb {
  background: rgba(0, 255, 136, 0.2);
  border-radius: 3px;
}

/* メッセージ吹き出し（普通のチャットUIスタイル） */
.msg-wrap {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-meta {
  font-size: 11px;
  color: #64748b;
  margin-bottom: 4px;
  font-family: monospace;
}

.msg-bubble {
  padding: 12px 16px;
  border-radius: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ユーザー発言：右寄せ・シアン系 */
.msg-wrap.user {
  align-self: flex-end;
}
.msg-wrap.user .msg-meta {
  text-align: right;
}
.msg-wrap.user .msg-bubble {
  background: rgba(3, 105, 161, 0.45);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #f0f9ff;
  border-bottom-right-radius: 2px;
}

/* AI発言：左寄せ・ダークグリーンネオン系 */
.msg-wrap.ai {
  align-self: flex-start;
}
.msg-wrap.ai .msg-bubble {
  background: rgba(6, 78, 59, 0.35);
  border: 1px solid rgba(0, 255, 136, 0.3);
  color: #ecfdf5;
  border-bottom-left-radius: 2px;
}

/* システム通知 */
.msg-wrap.system {
  align-self: center;
  max-width: 90%;
}
.msg-wrap.system .msg-bubble {
  background: rgba(15, 23, 42, 0.6);
  border: 1px dashed #334155;
  color: #94a3b8;
  font-size: 12px;
  font-family: monospace;
  text-align: center;
  padding: 6px 14px;
}

/* 入力エリア */
.input-area {
  padding: 16px 20px;
  border-top: 1px solid rgba(0, 255, 136, 0.25);
  display: flex;
  gap: 12px;
  background: rgba(18, 29, 36, 0.4);
}

input[type="text"]#user-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]#user-input:focus {
  border-color: #00ff88;
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.2);
}

button#send-btn {
  background: #00ff88;
  color: #081014;
  border: none;
  padding: 0 24px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: all 0.2s;
}

button#send-btn:hover:not(:disabled) {
  background: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

button:disabled {
  background: #334155 !important;
  color: #64748b !important;
  border-color: transparent !important;
  cursor: not-allowed;
  box-shadow: none !important;
}