* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, sans-serif; }
body { background: #130826; color: #f5e9ee; min-height: 100vh; }
#app { max-width: 640px; margin: 0 auto; padding: 16px; }
.screen { display: none; }
.screen.active { display: block; }
h1 { text-align: center; margin: 40px 0 8px; font-size: 28px; }
h1.brand { color: #e03d9c; font-size: 34px; letter-spacing: 1px; }
h2 { margin: 12px 0; }
h3 { margin: 16px 0 8px; color: #ffc857; }
.sub { text-align: center; color: #a58bc4; margin-bottom: 32px; }
input, select, textarea {
  width: 100%; padding: 12px; margin: 6px 0; border-radius: 10px;
  border: 1px solid #452367; background: #1f0f3d; color: #f5e9ee; font-size: 16px;
}
textarea { min-height: 80px; resize: vertical; }
button {
  width: 100%; padding: 14px; margin: 8px 0; border: none; border-radius: 12px;
  background: linear-gradient(135deg, #8b3df0, #e03d9c); color: #fff; font-size: 17px; font-weight: bold; cursor: pointer;
}
button:hover { background: linear-gradient(135deg, #9d4ff5, #ea4aab); }
button.ghost { background: transparent; border: 1px solid #452367; width: auto; padding: 8px 14px; }
button:disabled { opacity: .5; cursor: default; }
.err { color: #ff8fb0; min-height: 20px; font-size: 14px; }
.hidden { display: none !important; }

#roomList .room-item {
  display: flex; justify-content: space-between; align-items: center;
  background: #1f0f3d; border: 1px solid #452367; border-radius: 12px;
  padding: 12px; margin: 8px 0;
}
#roomList .room-item button { width: auto; padding: 8px 18px; margin: 0; }
#roomList .meta { color: #a58bc4; font-size: 13px; }
#roomList .empty { color: #a58bc4; text-align: center; padding: 20px; }

.room-head { display: flex; align-items: center; gap: 10px; }
.room-head h2 { flex: 1; }
.timer { background: linear-gradient(135deg, #8b3df0, #e03d9c); padding: 6px 14px; border-radius: 20px; font-weight: bold; font-size: 18px; }

/* مقاعد الروم: الأدمن فوق والباقي دواير */
#roomSeats.seats { margin: 14px 0; }
.host-row { display: flex; justify-content: center; margin-bottom: 16px; }
.seats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px 6px; justify-items: center; }
.seat { position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; width: 76px; }
.avatar {
  width: 60px; height: 60px; border-radius: 50%; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #3d1a66, #2a1650);
  border: 2px solid #452367; display: grid; place-items: center;
}
.host-row .avatar { width: 88px; height: 88px; border-width: 3px; border-color: #ffc857; }
.avatar .ini { font-size: 24px; font-weight: bold; color: #d9b3ff; }
.host-row .avatar .ini { font-size: 34px; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.seat.me .avatar { border-color: #e03d9c; }
.seat.speaking .avatar {
  border-color: #2ee6a8;
  animation: speakPulse 1.2s ease-in-out infinite;
}
@keyframes speakPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(46, 230, 168, .25); }
  50% { box-shadow: 0 0 0 7px rgba(46, 230, 168, .45); }
}
.seat-name {
  font-size: 12px; color: #e9ced9; text-align: center;
  max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.seat-name .crown { font-size: 11px; }
.host-mic, .seat-muted {
  position: absolute; top: -3px; left: 2px; width: 24px; height: 24px; border-radius: 50%;
  background: #2a1650; border: 1px solid #452367; display: grid; place-items: center; z-index: 2;
}
.host-mic svg, .seat-muted svg {
  width: 14px; height: 14px; fill: none; stroke: #d9b3ff; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.host-mic svg .slash, .seat-muted svg .slash { stroke: #ff5f6d; stroke-width: 2.4; }
.seat .plus {
  width: 60px; height: 60px; border-radius: 50%; border: 2px dashed #4b2a75;
  color: #8f5cc9; font-size: 26px; display: grid; place-items: center;
}
.seat.tappable { cursor: pointer; }
.seat.tappable:active .avatar { transform: scale(.94); }

.card {
  background: #1f0f3d; border: 1px solid #452367; border-radius: 12px;
  padding: 14px; margin: 12px 0;
}
.card pre { white-space: pre-wrap; font-size: 15px; line-height: 1.7; color: #ecd7e0; }
#briefCard { border-color: #ffc857; }

#roomFeed {
  background: #180b30; border: 1px solid #452367; border-radius: 12px;
  height: 220px; overflow-y: auto; padding: 10px; margin: 12px 0;
}
#chatBox .msg { margin: 4px 0; font-size: 14px; line-height: 1.5; }
#chatBox .msg .who { color: #ffc857; font-weight: bold; }
#chatBox .msg.sys { color: #8a5a6d; font-style: italic; text-align: center; }
.chat-input { display: flex; gap: 8px; }
.chat-input input { flex: 1; }
.chat-input button { width: 56px; }

#mutedBanner { color: #ff8fb0; font-weight: bold; }
#resultHead { color: #ffc857; }

.tabs { display: flex; gap: 8px; margin: 12px 0; }
.tab { flex: 1; background: transparent; border: 1px solid rgba(255,255,255,.25); color: inherit; padding: 8px; border-radius: 8px; }
.tab.active { background: rgba(139,61,240,.22); border-color: #e03d9c; }

.voice-bar { display: flex; align-items: center; gap: 14px; margin: 14px 0; flex-wrap: wrap; }
.voice-ctrls { display: flex; gap: 14px; }
.voice-ctrls.hidden { display: none; }
.vjoin { width: auto; padding: 10px 18px; background: #2a1650; border: 1px solid #452367; border-radius: 999px; }
.rbtn {
  width: 64px; height: 64px; border-radius: 50%; background: #3d1a66; border: none;
  display: grid; place-items: center; padding: 0; box-shadow: 0 6px 18px rgba(0,0,0,.35);
  transition: background .15s ease, transform .08s ease;
}
.rbtn svg { width: 30px; height: 30px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rbtn svg .slash { stroke-width: 2.4; }
.rbtn .ic-off { display: none; }
.rbtn.off { background: #6e1e4e; }
.rbtn.off .ic-on { display: none; }
.rbtn.off .ic-off { display: block; }
.rbtn:disabled { opacity: .55; }
.rbtn:active { transform: scale(.96); }

.app-logo { width: 96px; height: 96px; display: block; margin: 8px auto 6px; border-radius: 24px; }
.app-logo.small { width: 72px; height: 72px; border-radius: 18px; }

.pmenu {
  position: fixed; z-index: 50; left: 12px; right: 12px; bottom: 12px;
  background: #1f0f3d; border: 1px solid #452367; border-radius: 16px;
  padding: 10px; box-shadow: 0 -6px 30px rgba(0,0,0,.55);
}
.pmenu-title { color: #a58bc4; font-size: 13px; text-align: right; padding: 2px 6px 8px; }
.pmenu-item.cancel { color: #a58bc4; }
.pmenu.hidden { display: none; }
.pmenu-item {
  display: block; width: 100%; margin: 0; padding: 11px 12px; text-align: right;
  background: transparent; border: none; border-radius: 8px; color: #f5e9ee; font-size: 15px; font-weight: normal;
}
.pmenu-item:hover { background: #2a1650; }
.pmenu-item.danger { color: #ff8fb0; }

.muted-tag { color: #ff8fb0; font-size: 12px; }

/* شاشة الإعدادات */
.settings-avatar { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 18px 0; }
.avatar.big { width: 110px; height: 110px; border-width: 3px; border-color: #e03d9c; }
.avatar.big .ini { font-size: 42px; }
.seat-name .crown { color: #ffc857; font-size: 11px; font-weight: bold; }


/* ---------- مقاعد الأزواج وخط النبض ---------- */
.seat-pair { display: flex; align-items: center; justify-content: center; gap: 6px; }
.pulse { width: 26px; height: 2px; background: linear-gradient(90deg, transparent, #b06bff, transparent); position: relative; }
.pulse::after {
  content: ""; position: absolute; inset: -5px 0;
  background: radial-gradient(circle, #b06bff 1px, transparent 1.6px) repeat-x;
  background-size: 7px 7px; opacity: .5;
}
.seat.owner .avatar { border-color: #ffc857; box-shadow: 0 0 0 2px rgba(255,200,87,.35), 0 0 16px rgba(255,200,87,.45); }
.seat.owner .seat-name { color: #ffc857; font-weight: bold; }
.seat.owner .seat-name .crown { color: #ffc857; }

/* ---------- الشريط السفلي ---------- */
.bottom-bar { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.bottom-bar input {
  flex: 1; min-width: 0; background: #180b30; border: 1px solid #452367; color: #fff;
  border-radius: 12px; padding: 10px 12px; font-size: 14px;
}
.bbtn {
  width: 40px; height: 40px; border-radius: 12px; background: #180b30;
  border: 1px solid #452367; color: #fff; font-size: 18px; line-height: 1;
}
.bsend { width: 44px; height: 40px; border-radius: 12px; background: #7a3cff; color: #fff; border: 0; font-size: 16px; }
.room-feed { margin-top: 10px; max-height: 30vh; overflow-y: auto; }
.panel {
  position: fixed; left: 0; right: 0; bottom: 0; max-height: 62vh; overflow-y: auto;
  background: #12082a; border-top: 1px solid #452367; border-radius: 18px 18px 0 0;
  padding: 14px 14px 22px; z-index: 40;
}
.panel h3 { margin: 0 0 10px; font-size: 16px; color: #d9b3ff; }


/* ================= [room-extras] START ================= */
.info-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 8px; }
.info-title { color: #d9b3ff; font-size: 14px; font-weight: bold; }
.info-close { width: auto; margin: 0; padding: 4px 12px; background: transparent; border: 1px solid #452367; border-radius: 10px; color: #a58bc4; font-size: 13px; font-weight: normal; }
.info-row { display: flex; justify-content: space-between; gap: 10px; padding: 5px 4px; border-bottom: 1px solid #2a1650; font-size: 13px; }
.info-k { color: #a58bc4; }
.info-v { color: #f5e9ee; }
.info-sub { color: #d9b3ff; font-size: 13px; font-weight: bold; padding: 10px 4px 6px; }
.info-list { display: flex; flex-direction: column; gap: 6px; }
.info-player { display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: #1f0f3d; border: 1px solid #452367; border-radius: 10px; }
.info-name { flex: 1; color: #f5e9ee; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.info-name.super, .is-super-name { color: #ffd700; font-weight: bold; }
.info-tag { font-size: 10px; padding: 2px 6px; border-radius: 8px; background: #2a1650; color: #c9a7e8; }
.info-tag.host { color: #ffc857; border: 1px solid #6b4a12; }
.info-tag.super { color: #ffd700; background: #3a2a00; border: 1px solid #8a6b00; }
.info-tag.muted { color: #ff8b8b; }
.emoji-bar { display: flex; gap: 6px; overflow-x: auto; padding: 8px 6px; background: #180b30; border: 1px solid #452367; border-radius: 12px; margin: 6px 0; }
.emoji-btn { width: auto; margin: 0; min-width: 38px; padding: 6px 8px; background: #1f0f3d; border: 1px solid #452367; border-radius: 10px; font-size: 19px; font-weight: normal; line-height: 1; }
.seat.super .avatar, .is-super-frame { border-color: #ffd700; box-shadow: 0 0 0 2px #ffd70055, 0 0 12px #ffd70066; }
.seat-name.super { color: #ffd700; }
.seat-badge { display: inline-flex; margin-inline-end: 4px; vertical-align: middle; }
.seat-badge[hidden] { display: none; }
.pw-box { margin-top: 18px; padding-top: 14px; border-top: 1px solid #2a1650; }
.pw-box h3 { font-size: 14px; color: #d9b3ff; margin: 0 0 8px; }
.ok { color: #7ee0a3; font-size: 13px; }
/* ================= [room-extras] END ================= */

/* ================= [gifts-panel] START ================= */
/* Playora gifts (PIECE 2): #giftPanel grid, gift cells, gift rows in #roomFeed.
   الرفض والأخطاء بتروح في #roomErr الموجود - مفيش توست جديد. */
#giftPanel { background: #180b30; border: 1px solid #452367; border-radius: 16px; padding: 10px; margin: 10px 0; }
.gift-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px 10px; }
.gift-panel-title { color: #d9b3ff; font-size: 14px; font-weight: bold; }
.gift-panel-close {
  width: auto; margin: 0; padding: 4px 12px; background: transparent;
  border: 1px solid #452367; border-radius: 10px; color: #a58bc4; font-size: 14px; font-weight: normal;
}
.gift-panel-close:hover { background: #2a1650; }
.gift-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.gift-cell {
  display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 0;
  padding: 10px 4px 8px; background: #1f0f3d; border: 1px solid #452367; border-radius: 12px;
  color: #f5e9ee; font-size: 12px; font-weight: normal;
}
.gift-cell:hover { background: #2a1650; }
.gift-cell:disabled { opacity: .5; }
.gift-cell-emoji { font-size: 24px; line-height: 1.2; }
.gift-cell-name { font-size: 12px; color: #e9ced9; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gift-cell-price { font-size: 11px; color: #a58bc4; } /* السعر عرض بس، ومش ذهبي: الذهبي للأدمن */
#roomFeed .feed-gift { padding: 6px 10px; background: #1f0f3d; border: 1px solid #452367; border-radius: 12px; }
#roomFeed .feed-gift .gift-emoji { font-size: 17px; }
/* ================= [gifts-panel] END ================= */

/* إعدادات الروم داخل #roomInfo */
.room-settings { margin-top: 12px; padding-top: 10px; border-top: 1px solid #2a1650; display: flex; flex-direction: column; gap: 8px; }
.room-settings label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #a58bc4; }
.room-settings input { width: 100%; }
#joinPw { margin-top: 12px; }
