:root {
  --primary: #0ea5e9;
  --primary-dark: #0284c7;
  --accent: #fbbf24;
  --bg-gradient: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  --white: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: rgba(14, 165, 233, 0.2);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
}

body {
  background: var(--bg-gradient);
  color: var(--text-main);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

.container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  flex-shrink: 0;
  height: 70px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1.5rem;
  background: var(--white);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  z-index: 10;
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.controls {
  display: flex;
  gap: 0.75rem;
}

.control-btn {
  border: 2px solid var(--primary);
  background: var(--white);
  color: var(--primary);
  padding: 0.5rem 1.25rem;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.control-btn.active {
  background: var(--primary);
  color: var(--white);
}

/* View Wrapper */
.view-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* Setup View */
#setup-view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: var(--bg-gradient);
  z-index: 5;
}

#setup-view input {
  width: 100%;
  max-width: 320px;
  border: 2px solid var(--primary);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
  text-align: center;
  outline: none;
}

#setup-view button {
  width: 100%;
  max-width: 320px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 12px;
  padding: 1rem;
  font-weight: 800;
  font-size: 1.1rem;
  cursor: pointer;
}

/* Chat View Layout */
#chat-view {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-main {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Sidebar */
.members-sidebar {
  width: 240px;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.members-sidebar h3 {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 1rem;
  letter-spacing: 0.1em;
  padding-left: 0.5rem;
}

#member-list {
  list-style: none;
  overflow-y: auto;
}

#member-list li {
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  background: var(--white);
  border-radius: 12px;
  margin-bottom: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.member-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.member-info::before {
  content: "";
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
}

.status-icons {
  display: flex;
  gap: 0.4rem;
}

.status-icon {
  width: 16px;
  height: 16px;
  color: var(--primary);
  opacity: 0.7;
}

.status-icon.muted {
  color: #ef4444;
  opacity: 1;
}

/* Messages Area */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.message {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}

.message.sent { align-self: flex-end; }
.message.received { align-self: flex-start; }

/* System Message Style */
.message.system {
  align-self: center;
  max-width: 90%;
  margin: 0.5rem 0;
}

.message.system .bubble {
  background: rgba(14, 165, 233, 0.1);
  color: var(--primary-dark);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 50px;
  padding: 0.4rem 1.25rem;
  box-shadow: none;
  border: 1px solid rgba(14, 165, 233, 0.2);
}

.message.system .sender-name { display: none; }

/* Normal Chat Bubbles */
.bubble {
  padding: 0.75rem 1.15rem;
  border-radius: 18px;
  font-size: 1rem;
  line-height: 1.5;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.message.sent .bubble {
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.message.received .bubble {
  background: var(--white);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
}

.sender-name {
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--text-muted);
}

.message.sent .sender-name { text-align: right; margin-right: 0.5rem; }
.message.received .sender-name { margin-left: 0.5rem; }

/* Input Area */
.chat-input-area {
  flex-shrink: 0;
  padding: 1.5rem 2rem;
  background: var(--white);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 1rem;
}

.chat-input-area input {
  flex: 1;
  border: 1px solid var(--border);
  background: #f8fafc;
  border-radius: 24px;
  padding: 0.9rem 1.5rem;
  font-size: 1rem;
  outline: none;
}

.chat-input-area button {
  background: var(--primary);
  color: var(--white);
  border: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: transform 0.2s;
}

.chat-input-area button:hover { transform: scale(1.05); }

.hidden { display: none !important; }
