/* ===========================
   基本レイアウト
============================ */
html, body {
  height: 100%;
  margin: 0;
  background: #111;
  font-family: system-ui,-apple-system,Segoe UI,Roboto,"Noto Sans JP";
  font-size: 11px;
}

.stage {
  height: 100%;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  background: linear-gradient(to bottom,#8fc8ff 0%,#7bb8f4 30%,#c7b59a 55%,#b49c85 75%,#f0eeee 100%);
}

.card {
  width: 92vw;
  height: 86vh;
  position: relative;
  border-radius: 16px;
  border: 1px solid #494949;
  overflow: visible;
  box-shadow: 0 30px 80px rgba(0,0,0,.55),0 8px 24px rgba(0,0,0,.35);
  background: #000;
}

model-viewer {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}

/* ===========================
   右側マテリアルパネル
============================ */
.sidepanel {
  z-index: 20;
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 16px;
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: rgba(18,18,18,0.6);
  border: 1px solid #444;
  border-radius: 12px;
  backdrop-filter: blur(6px);
}

.mat-list {
  flex: 1 1 auto;
  min-height: 50px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.instructions {
  font-size: 11px;
  color: #ccc;
  margin-top: 6px;
  line-height: 1.2;
  text-align: center;
}

.mat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 6px;
  border: 1px solid #555;
  border-radius: 999px;
  background: #1a1a1a;
  color: #eaeaea;
  font-size: 13px;
  line-height: 1.12;
}

.mat-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.mat-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.mat-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mat-right input[type=color] {
  width: 24px;
  height: 20px;
  border: none;
  border-radius: 6px;
  background: transparent;
  padding: 0;
}

.mat-right input[type=range] {
  width: 70px;
}

.sidepanel .title {
  opacity: .8;
  color: #ddd;
  font-size: 13px;
  margin-bottom: 4px;
}

/* ===========================
   左上ビュー操作
============================ */
.leftpanel {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 140px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  background: rgba(18,18,18,0.6);
  border: 1px solid #444;
  border-radius: 12px;
  backdrop-filter: blur(6px);
  z-index: 40;
}

.leftpanel .title {
  color: #eaeaea;
  font-size: 12px;
  opacity: .9;
  margin-bottom: 2px;
}

.leftpanel button {
  cursor: pointer;
  font-weight: 600;
}

/* ハンバーガーメニュー共通設定 */
.nav-menu {
  display: flex;
  flex-direction: column;
}

/* ===========================
   ハンバーガーボタン
============================ */
.menu-toggle {
  display: none;
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 50;
  width: 36px;
  height: 36px;
  background: #333;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 20px;
  cursor: pointer;
}

/* ===========================
   ボタン共通
============================ */
button, input[type=range], input[type=color] {
  appearance: none;
  border: 1px solid #555;
  border-radius: 10px;
  padding: 6px 8px;
  background: #1a1a1a;
  color: #eaeaea;
}

button:hover {
  background: #222;
}

/* ===========================
   スマホ対応
=========================== */
@media (max-width: 768px), (max-height: 600px) {
  /* 背景・カード */
  .stage { background: none; }
  .card { width: 100vw; height: 100vh; overflow: visible !important; }

  /* ハンバーガーボタン表示 */
  .menu-toggle {
    display: block;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 999;
  }

  /* 左右パネルは非表示→activeで開く */
  .nav-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 80vw;
    height: 100vh;
    flex-direction: column;
    padding: 12px;
    background: rgba(18,18,18,0.95);
    overflow-y: auto;
    z-index: 998;
  }

  .nav-menu.active {
    display: flex;
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    max-height: calc(100vh - 40px); /* コピーライト高さ＋余裕 */
    padding: 8px;
    border-radius: 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: rgba(18,18,18,0.9);
    z-index: 50;
}

  /* ▼ コピーライト（スマホも常時表示） */
  .copyright {
    display: block;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    background: rgba(0,0,0,0.6);
    color: #eeeeee;
    padding: 6px 10px;
    border-radius: 6px;
    z-index: 1000;
    line-height: 1.4;
    pointer-events: auto;
  }

  /* 「©表示」ボタンは不要なので非表示 */
  .sm-only { display: none; }
}

/* ===========================
   PC対応（スマホ以外）
=========================== */
@media (min-width: 769px) {
  .copyright {
    display: block;
    position: fixed;
    bottom: 8px;
    left: 0;
    width: 100%;
    text-align: center;
    background: rgba(0,0,0,0.6);
    color: #eeeeee;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    z-index: 9999;
    line-height: 1.4;
  }

  .sm-only { display: none; } /* PCではボタン非表示 */
}

/* コピーライト内リンク */
.copyright a {
  color: #a8d8ff;
  text-decoration: none;
}
.copyright a:hover {
  text-decoration: underline;
}
