/* ========== 基本レイアウト ========== */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: 'Share Tech Mono', system-ui, sans-serif;
  background: #111;
  color: #eee;
  overflow-x: hidden;
  overflow-y: auto;
  display: block;
  min-height: 100vh;
}

/* ========== グリッドレイアウト ========== */
.container {
  display: grid;
  grid-template-columns: 300px 1fr 200px;
  grid-template-rows: 1fr auto;
  grid-template-areas:
    "menu content ad"
    "footer footer footer";
  min-height: 100vh;
}

@media (max-width: 1000px) {
  .container {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto auto;
    grid-template-areas:
      "menu"
      "content"
      "ad"
      "footer";
    height: auto;
  }
}

/* ========== メニュー ========== */
.menu {
  grid-area: menu;
  background: #222;
  padding: 10px;
  box-sizing: border-box;
  overflow-y: auto;
}

/* ========== コンテンツ ========== */
.content {
  grid-area: content;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #000;
}

@media (max-width: 1000px) {
  .menu {
    padding-bottom: 4px;
  }

  .content {
    min-height: 60vh;
    padding: 8px 0;
  }

  iframe {
    height: 65vh;
    min-height: 320px;
  }

  .ad {
    margin-top: 6px;
  }
}

/* ========== 広告 ========== */
.ad {
  grid-area: ad;
  background: #222;
  padding: 10px;
  box-sizing: border-box;
  overflow-y: auto;
}

/* ========== フッター ========== */
.footer {
  grid-area: footer;
  background: #111;
  text-align: center;
  padding: 5px;
  font-size: 12px;
  color: #888;
  height: 40px;
  box-sizing: border-box;
}

/* ========== ログインバー ========== */
.user-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: #fff;
  font-size: 14px;
  font-family: system-ui, sans-serif;
}

#user-name {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#loginBtn,
#logoutBtn {
  background: #222;
  color: #eee;
  border: 1px solid #555;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 12px;
}

#loginBtn:hover,
#logoutBtn:hover {
  background: #555;
}

/* ========== メールアドレス説明 ========== */
.email-info {
  position: relative;
  margin-bottom: 12px;
}

.email-info__label {
  background: transparent;
  border: 1px solid #555;
  color: #ddd;
  padding: 4px 8px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 6px;
  width: 100%;
  text-align: left;
}

.email-info__label:hover {
  background: #2b2b2b;
}

.email-info__bubble {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #161616;
  border: 1px solid #444;
  color: #eee;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  width: 100%;
  box-sizing: border-box;
  display: none;
  box-shadow: 0 8px 20px rgba(0,0,0,0.5);
  z-index: 10;
}

.email-info__bubble::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 12px;
  border: 6px solid transparent;
  border-bottom-color: #444;
}

.email-info__bubble.is-open {
  display: block;
}

/* ========== ダイアログ全体（submit / logout 共通） ========== */
#submit-dialog,
#logout-dialog {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

/* 非表示 */
#submit-dialog.sd-hidden,
#logout-dialog.sd-hidden {
  display: none;
}

/* ========== ダイアログパネル（共通） ========== */
.sd-panel {
  width: min(420px, 92vw);
  background: #101317;
  border: 1px solid #2a2f37;
  border-radius: 12px;
  padding: 18px 20px;
  color: #fff;
  box-shadow: 0 10px 30px rgba(0,0,0,0.45);
}

/* タイトル */
.sd-panel h2 {
  font-size: 22px;
  margin: 0 0 12px 0;
  text-align: center;
}

/* テキスト */
.sd-panel p {
  font-size: 15px;
  margin: 0 0 15px 0;
  text-align: center;
}

/* ========== ダイアログボタン ========== */
.sd-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

.sd-btn {
  padding: 8px 14px;
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
  border: none;
}

.sd-btn-primary {
  background: #007bff;
  color: #fff;
}

.sd-btn-primary:hover {
  background: #0069d9;
}

.sd-btn-ghost {
  background: transparent;
  color: #ccc;
  border: 1px solid #555;
}

.sd-btn-ghost:hover {
  background: #333;
}

/* ========== 汎用 ========== */
a {
  color: #9cf;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}
