body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  background-color: #f5f5f5;
  background: #f5f6fa;
}

h1 {
  color: #333;
  text-align: center;
  margin-bottom: 30px;
}

button {
  background-color: #1a73e8;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s;
}

button:hover {
  background-color: #1557b0;
}

button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

#createBtn {
  display: block;
  margin: 20px auto;
}

#roomList {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  padding: 20px 0;
}

.card {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: transform 0.3s;
  cursor: pointer;
}

.card:hover {
  transform: translateY(-5px);
}

.card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.card h3 {
  margin: 15px;
  color: #333;
}

.card p {
  margin: 0 15px 15px;
  color: #666;
}

#playerContainer {
  margin: 20px auto;
  max-width: 800px;
}

input {
  width: 100%;
  padding: 8px;
  margin: 5px 0;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
}

label {
  display: block;
  margin: 10px 0;
  color: #333;
} 


.room-container {
  max-width: 800px;
  margin: 30px auto;
  padding: 30px 20px;
  background: #fff;
  border: 2px solid #ccc;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
#roomName {
  font-size: 1.1rem;
  
  margin-bottom: 0.5em;
}

.room-description {
  color: #666;
  font-size: 1.1rem;
  margin: 0.5em 0 1.5em 0;
  line-height: 1.5;
  white-space: pre-wrap;
}

.video-title {
  font-size: 1.3rem;
  font-weight: bold;
  margin-bottom: 1em;
}
#thumbnailContainer img {
  width: 260px;
  height: 150px;
  background: #6cf;
  border-radius: 8px;
  margin: 20px 0 10px 0;
  object-fit: cover;
}
.start-time-display {
  margin: 18px 0 10px 0;
  font-size: 1.1rem;
  font-weight: bold;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.big-time {
  font-size: 2rem;
  font-weight: bold;
  margin-top: 5px;
  letter-spacing: 2px;
}
.yt-link-btn {
  display: inline-block;
  margin: 15px 0;
  color: #fff;
  text-decoration: none;
  font-size: 18px;
  font-weight: bold;
  background: #0ecc00;
  padding: 12px 24px;
  border-radius: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.yt-link-btn:hover {
  background: #0ecc00;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  text-decoration: none;
}

.yt-link-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.desc {
  margin: 10px 0 20px 0;
  color: #222;
  font-size: 15px;
}
.input-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}
.time-input {
  width: 3em;
  font-size: 1.1em;
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid #ccc;
  text-align: right;
}
.reflect-btn {
  background: #2584e2;
  color: #fff;
  border: none;
  padding: 8px 24px;
  font-size: 1.1em;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 20px;
}
.reflect-btn:hover {
  background: #1560a8;
}
.pause-btn {
  background: #32da64;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 6px 18px;
  font-size: 1.1em;
  font-weight: bold;
  cursor: pointer;
  margin-left: 10px;
  transition: background 0.2s;
}
.pause-btn:hover { background: #666; }

.reset-btn {
  background: #e22;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 24px;
  font-size: 1.1em;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 20px;
}
.pause-btn:hover { background: #666; }
.reset-btn { background: #e22; }
.reset-btn:hover { background: #a00; }
.cancel-btn {
  background: #ccc;
  color: #333;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 1.1em;
  font-weight: bold;
  cursor: pointer;
  margin-left: 6px;
  transition: background 0.2s;
}
.cancel-btn:hover { background: #aaa; }

.close-btn {
  background: #e22;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 24px;
  font-size: 1.1em;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 20px;
}

.close-btn:hover {
  background: #a00;
}

.telop {
  margin: 10px 0;
  color: #e22;
  font-size: 1.8em;
  font-weight: bold;
  text-align: center;
}

/* チャット欄 */
.chat-container {
  max-width: 800px;
  margin: 30px auto 0 auto;
  background: #f8f8f8;
  border: 1px solid #ccc;
  border-radius: 10px;
  padding: 0 0 10px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.chat-header {
  background: #eaeaea;
  border-radius: 10px 10px 0 0;
  padding: 10px;
  font-weight: bold;
  font-size: 1.1em;
  border-bottom: 1px solid #ccc;
}
.chat-list {
  max-height: 220px;
  overflow-y: auto;
  padding: 10px;
  font-size: 1em;
}
.chat-item {
  padding: 8px;
  margin: 4px 0;
  border-radius: 4px;
  background-color: #fff;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.chat-time {
  color: #666;
  font-size: 0.8em;
  min-width: 28px;
}

.chat-res {
  color: #666;
  font-size: 0.9em;
  min-width: 30px;
}

.chat-name {
  color: #1a73e8;
  font-size: 0.9em;
  margin-right: 8px;
  min-width: 60px;
}

.chat-message {
  font-size: 1.0em;
  color: #333;
  word-break: break-word;
  flex: 1;
}

.chat-form {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid #ccc;
  background: #fafafa;
  border-radius: 0 0 10px 10px;
}
.chat-name-input {
  width: 120px;
  font-size: 1em;
  padding: 4px;
}
.chat-input {
  flex: 1;
  font-size: 1em;
  padding: 4px;
}
.chat-send-btn {
  background: #2584e2;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 16px;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}
.chat-send-btn:hover {
  background-color: #1557b0;
}

/* テロップ */
.telop-float {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 20px 40px;
  border-radius: 10px;
  font-size: 24px;
  z-index: 1000;
  animation: fadeInOut 5s ease-in-out;
  white-space: nowrap;
  max-width: 80%;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 10px 0;
}

.telop-float:nth-child(1) { top: 15%; }
.telop-float:nth-child(2) { top: 30%; }
.telop-float:nth-child(3) { top: 45%; }
.telop-float:nth-child(4) { top: 60%; }
.telop-float:nth-child(5) { top: 75%; }

.telop-float.system-telop {
  background-color: rgba(255, 0, 0, 0.8);
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

@keyframes fadeInOut {
  0% {
    opacity: 0;
    transform: translateX(-50%) scale(0.8);
  }
  10% {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
  90% {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) scale(0.8);
  }
}

/* システムメッセージのスタイル */
.system-message {
  background-color: #ffebee;
  color: #c62828;
  padding: 8px 12px;
  margin: 4px 0;
  border-radius: 4px;
  font-weight: bold;
  text-align: center;
}

/* AI返答のスタイル */
.ai-response {
  background-color: #f0f8ff;
  border-left: 4px solid #3EA6FF;
  padding: 8px 12px;
  margin: 4px 0;
  border-radius: 4px;
  font-size: 0.9em;
}

.ai-response .chat-name {
  color: #3EA6FF;
  font-weight: bold;
}

/* 招待モーダル用 */
.modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.3);
  justify-content: center;
  align-items: center;
}
.modal[style*="display: flex"] {
  display: flex !important;
}

#inviteBtn {
  background: linear-gradient(90deg, #ff9800 0%, #ffc107 100%);
  color: #ffffff;
  font-weight: bold;
  font-size: 1.0em;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  box-shadow: 0 4px 16px rgba(255, 152, 0, 0.2);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}

#inviteBtn:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 24px rgba(255, 152, 0, 0.3);
}

.owner-controls {
  background: #f8fafc;
  border: 2px solid #e0e7ef;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  padding: 18px 12px;
  margin: 24px auto 18px auto;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.owner-controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 4px;
}

.owner-controls button {
  min-width: 120px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1.08em;
}

@media (max-width: 600px) {
  .owner-controls {
    padding: 10px 2vw;
    max-width: 98vw;
  }
  .owner-controls-row {
    flex-direction: column;
    gap: 8px;
  }
  .owner-controls button {
    width: 100%;
    justify-content: center;
  }
}

/* 部屋作成ページのスタイル */
.create-room-card {
  max-width: 600px;
  margin: 2rem auto;
  padding: 2rem;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.create-room-card h1 {
  text-align: center;
  color: #333;
  margin-bottom: 2rem;
  font-size: 1.8rem;
}

#createRoomForm {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

#createRoomForm label {
  font-weight: 500;
  color: #444;
  margin-bottom: 0.3rem;
  display: block;
}

#createRoomForm input[type="text"],
#createRoomForm input[type="password"],
#createRoomForm textarea {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

#createRoomForm input[type="text"]:focus,
#createRoomForm input[type="password"]:focus,
#createRoomForm textarea:focus {
  outline: none;
  border-color: #4a90e2;
  box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

#passwordContainer {
  margin-top: -0.5rem;
}

.reflect-btn {
  background: #4a90e2;
  color: white;
  border: none;
  padding: 1rem;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
  margin-top: 1rem;
}

.reflect-btn:hover {
  background: #357abd;
}

.reflect-btn:active {
  transform: translateY(1px);
}

/* レスポンシブ対応 */
@media (max-width: 640px) {
  .create-room-card {
    margin: 1rem;
    padding: 1.5rem;
  }
}

/* --- 再生開始ボタンを控えめに目立たせる --- */
.special-play-btn {
  background: #43a047 !important; /* 落ち着いた緑 */
  color: #fff !important;
  font-size: 1.15rem !important;
  border: 2px solid #388e3c !important;
  box-shadow: 0 0 10px #43a04733, 0 4px 12px rgba(0,0,0,0.08);
  padding: 0.8rem 2.2rem !important;
  border-radius: 40px !important;
  font-weight: bold;
  letter-spacing: 0.03em;
  position: relative;
  z-index: 2;
  animation: playbtn-pulse 1.6s infinite;
  transition: transform 0.2s, box-shadow 0.2s;
}
.special-play-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 0 18px #66bb6a66, 0 8px 18px rgba(0,0,0,0.12);
}
@keyframes playbtn-pulse {
  0% { box-shadow: 0 0 0 0 #43a04733; }
  70% { box-shadow: 0 0 0 8px #43a04700; }
  100% { box-shadow: 0 0 0 0 #43a04733; }
}
.play-btn-label {
  font-size: 1.05em;
  font-weight: bold;
  margin-left: 0.5em;
}

/* --- オーナーボタン群を2列グリッドで整列 --- */
.owner-btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.5rem;
  justify-items: center;
  align-items: stretch;
  max-width: 500px;
  margin: 0 auto 1.5rem auto;
}
@media (max-width: 600px) {
  .owner-btn-grid {
    grid-template-columns: 1fr;
    gap: 0.7rem 0;
  }
  .special-play-btn {
    font-size: 1.2rem !important;
    padding: 0.8rem 1.5rem !important;
  }
}

/* 2カラムレイアウト */
.room-container.two-column {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}
.main-column {
  flex: 1 1 0%;
  min-width: 0;
}
.playlist-column {
  width: 320px;
  background: #f7f7fa;
  border-radius: 12px;
  padding: 24px 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  min-width: 220px;
}
@media (max-width: 900px) {
  .room-container.two-column {
    flex-direction: column;
  }
  .playlist-column {
    width: 100%;
    margin-top: 24px;
  }
}

/* 再生リストの見た目を調整 */
#playlistContainer h3 {
  font-size: 1.2em;
  margin-bottom: 1em;
}
#videoPlaylist {
  list-style: none;
  padding: 0;
  margin: 0;
}
#videoPlaylist .video-item {
  padding: 12px 8px;
  border-radius: 8px;
  margin-bottom: 8px;
  background: #fff;
  cursor: pointer;
  transition: background 0.2s;
}
#videoPlaylist .video-item.current {
  background: #ffecd6;
  font-weight: bold;
  border-left: 4px solid #ff6b35;
}
#videoPlaylist .video-item.completed {
  opacity: 0.6;
}

#remainingTimeText {
  color: #e53935;
  font-size: 1.5em;
  font-weight: bold;
  letter-spacing: 0.05em;
  margin-left: 0.5em;
}
