* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  min-height: 100vh;
}

body.theme-default {
  background-color: #fff;
  color: #000;
}

body.theme-dark {
  background-color: #222;
  color: #ddd;
}

body.theme-light {
  background-color: #f9f9f9;
  color: #333;
}

body.theme-blue {
  background-color: #e0f7fa;
  color: #006064;
}

.hidden {
  display: none !important;
}

#auth-section {
  min-height: calc(100vh - 60px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.auth-container {
  background: white;
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 400px;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-container h1 {
  text-align: center;
  color: #333;
  margin-bottom: 30px;
  font-size: 28px;
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.auth-form h3 {
  color: #333;
  margin-bottom: 10px;
}

.auth-hint {
  color: #666;
  font-size: 14px;
  margin-bottom: 20px;
}

.auth-form input {
  width: 100%;
  padding: 15px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  margin-bottom: 15px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.auth-form input:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}

.auth-form button {
  width: 100%;
  padding: 15px;
  background-color: #3498db;
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s;
}

.auth-form button:hover {
  background-color: #2980b9;
  transform: scale(1.05);
}

.auth-toggle {
  text-align: center;
  margin-top: 20px;
  color: #666;
  font-size: 14px;
}

.auth-toggle a {
  color: #3498db;
  cursor: pointer;
  text-decoration: underline;
}

.auth-toggle a:hover {
  color: #2980b9;
}

.error-message {
  color: #e74c3c;
  font-size: 14px;
  padding: 10px;
  background: #fdeaea;
  border-radius: 8px;
  margin-top: 15px;
  animation: shake 0.5s ease;
}

.success-message {
  color: #27ae60;
  font-size: 14px;
  padding: 10px;
  background: #e8f8f0;
  border-radius: 8px;
  margin-top: 15px;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

#chat-section {
  margin-top: 0px;
  padding: 20px;
}

.chat-header {
  text-align: center;
  margin-bottom: 10px;
}

.chat-header h2 {
  font-size: 24px;
  color: #333;
}

.theme-dark .chat-header h2 {
  color: #ddd;
}

.chat-header h3 {
  font-size: 14px;
  color: #666;
  margin-top: 5px;
}

.theme-dark .chat-header h3 {
  color: #aaa;
}

#chat-box {
  border: 1px solid #ccc;
  height: 600px;
  overflow-y: scroll;
  padding: 10px;
  margin-bottom: 10px;
  background: #f9f9f9;
  position: relative;
}

#new-message-notice {
  position: fixed;
  top: 20px;
  right: 20px;
  background-color: #3498db;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 1001;
  cursor: pointer;
  font-weight: bold;
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.theme-dark #chat-box {
  background: #333;
  border-color: #555;
}

.message-container {
  border: 1px solid #ccc;
  background-color: #f5f5f5;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 4px;
  box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
  position: relative;
}

.message-container.own-message {
  border-left: 4px solid #2ecc71;
}

.theme-dark .message-container {
  background-color: #444;
  border-color: #666;
}

.theme-dark .message-container.own-message {
  border-left: 4px solid #27ae60;
}

.message-name {
  font-weight: bold;
  margin-bottom: 5px;
}

.status-text {
  font-size: 14px;
  color: #555;
  opacity: 1;
  margin-left: 8px;
  font-weight: normal;
  display: inline-block;
}

.message-text {
  white-space: pre-wrap;
  margin-bottom: 5px;
  font-size: 16px;
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: break-word;
}

.reply-quote {
  color: #888;
  font-style: italic;
  margin: 2px 0;
  padding: 5px;
  background: rgba(0,0,0,0.05);
  border-left: 3px solid #ccc;
  border-radius: 3px;
  font-size: 13px;
}

.theme-dark .reply-quote {
  background: rgba(255,255,255,0.1);
  border-left-color: #666;
}

.message-time {
  font-size: 0.8em;
  color: gray;
  text-align: right;
}

.theme-dark .message-time {
  color: #aaa;
}

.message-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.edited-mark {
  font-size: 12px;
  color: #888;
  font-style: italic;
}

.input-area {
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
}

.input-hint {
  font-size: 12px;
  color: #888;
  margin: 5px;
}

.input-area textarea {
  margin: 5px;
  padding: 14px;
  width: calc(100% - 10px);
  height: 140px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 18px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
}

.theme-dark .input-area textarea {
  background: #333;
  border-color: #555;
  color: #ddd;
}

.input-area textarea:focus {
  outline: none;
  border: 1px solid #3498db;
  box-shadow: 0 0 5px rgba(52,152,219,0.5);
  transition: box-shadow 0.3s ease, border 0.3s ease;
}

.input-controls {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 0 5px;
  gap: 10px;
}

.input-controls .input-hint {
  margin-right: auto;
}

.input-area button#send-btn {
  align-self: flex-start;
  margin: 5px;
  background-color: #3498db;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
  font-size: 14px;
  font-weight: bold;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 5px;
  margin-bottom: 15px;
  align-items: center;
}

.button-row button,
.button-row a {
  background-color: #3498db;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
  text-decoration: none;
  font-size: 14px;
  font-weight: bold;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.button-row button:hover,
.button-row a:hover {
  background-color: #2980b9;
  transform: scale(1.05);
}

#logoutButton {
  background-color: #e74c3c !important;
  color: #fff !important;
  border: none !important;
  padding: 10px 20px !important;
  border-radius: 4px !important;
  cursor: pointer !important;
  font-size: 14px !important;
  font-weight: bold !important;
  transition: background-color 0.3s ease, transform 0.2s ease !important;
  height: 40px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#logoutButton:hover {
  background-color: #c0392b !important;
}

.logout-container {
  margin-left: auto;
}

#command-summary {
  background: #f0f0f0;
  border: 1px solid #ccc;
  border-radius: 16px;
  padding: 25px;
  margin: 20px 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.theme-dark #command-summary {
  background: #333;
  border-color: #555;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#command-summary h3 {
  margin-top: 0;
  color: #333;
  margin-bottom: 20px;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-dark #command-summary h3 {
  color: #ddd;
}

#command-summary h3::before {
  content: "⚡";
  font-size: 22px;
}

.command-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.command-item {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 15px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.theme-dark .command-item {
  background: #444;
  border-color: #555;
}

.command-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.command-name {
  font-family: 'Courier New', monospace;
  font-weight: bold;
  font-size: 15px;
  color: #3498db;
  margin-bottom: 6px;
}

.theme-dark .command-name {
  color: #5dade2;
}

.command-desc {
  font-size: 13px;
  color: #666;
  line-height: 1.4;
}

.theme-dark .command-desc {
  color: #aaa;
}

.command-example {
  margin-top: 6px;
  font-size: 11px;
  color: #999;
  font-style: italic;
}

.theme-dark .command-example {
  color: #777;
}

.command-item.admin-only {
  border-color: #e74c3c;
  background: #fff5f5;
}

.theme-dark .command-item.admin-only {
  background: #4a3333;
  border-color: #c0392b;
}

.admin-badge {
  font-size: 10px;
  background: #e74c3c;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

#profile-settings {
  margin: 20px 0;
  padding: 15px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background-color: #f0f0f0;
}

.theme-dark #profile-settings {
  background-color: #333;
  border-color: #555;
}

#profile-settings h3 {
  margin-top: 0;
  margin-bottom: 15px;
  color: #333;
}

.theme-dark #profile-settings h3 {
  color: #ddd;
}

.profile-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
}

#profile-settings input,
#profile-settings select {
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}

.theme-dark #profile-settings input,
.theme-dark #profile-settings select {
  background-color: #444;
  border-color: #666;
  color: #ddd;
}

#profile-settings input[type="text"] {
  width: 150px;
}

#profile-settings input[type="color"] {
  width: 50px;
  height: 35px;
  padding: 2px;
  cursor: pointer;
}

#profile-settings button {
  background-color: #2ecc71;
  border: none;
  padding: 8px 16px;
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
}

#profile-settings button:hover {
  background-color: #27ae60;
}

.action-menu-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background-color: #f0f0f0;
  border: 1px solid #ccc;
  color: #333;
  border-radius: 4px;
  cursor: pointer;
  font-size: 18px;
  padding: 5px 8px;
  opacity: 0;
  transition: opacity 0.2s;
}

.theme-dark .action-menu-btn {
  background-color: #555;
  border-color: #666;
  color: #ddd;
}

.message-container:hover .action-menu-btn {
  opacity: 1;
}

.action-menu {
  position: absolute;
  right: 5px;
  top: 30px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  z-index: 100;
}

.theme-dark .action-menu {
  background: #444;
  border-color: #666;
}

.action-menu div {
  padding: 8px 12px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 14px;
}

.action-menu div:hover {
  background-color: #eee;
}

.theme-dark .action-menu div:hover {
  background-color: #555;
}

.action-menu div.delete {
  color: #e74c3c;
}

.system-message {
  text-align: center;
  color: #888;
  font-size: 13px;
  padding: 10px;
  font-style: italic;
  opacity: 1;
}

.system-message.spam-alert {
  color: #e74c3c;
  font-weight: bold;
  opacity: 1;
  font-style: normal;
  font-size: 14px;
}

.message-text a {
  color: #3498db;
  text-decoration: underline;
  word-break: break-all;
}

.message-text a:hover {
  color: #2980b9;
}

.theme-dark .message-text a {
  color: #5dade2;
}

.theme-dark .message-text a:hover {
  color: #85c1e9;
}

#reply-preview {
  background: #f0f0f0;
  padding: 10px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-bottom: 10px;
}

.theme-dark #reply-preview {
  background: #444;
  border-color: #666;
}

#reply-to-text {
  font-size: 13px;
  color: #666;
}

.theme-dark #reply-to-text {
  color: #aaa;
}

#cancel-reply {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #999;
  padding: 5px;
}

#cancel-reply:hover {
  color: #e74c3c;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  padding: 30px;
  border-radius: 16px;
  width: 90%;
  max-width: 500px;
}

.theme-dark .modal-content {
  background: #333;
  color: #ddd;
}

.modal-content h3 {
  margin-bottom: 20px;
  color: #333;
}

.theme-dark .modal-content h3 {
  color: #ddd;
}

.modal-content textarea {
  width: 100%;
  padding: 15px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  resize: vertical;
  min-height: 100px;
  margin-bottom: 20px;
  font-family: inherit;
}

.theme-dark .modal-content textarea {
  background: #444;
  border-color: #666;
  color: #ddd;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.modal-buttons button {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s;
}

#save-edit-btn {
  background: #3498db;
  color: white;
}

#save-edit-btn:hover {
  background: #2980b9;
}

#cancel-edit-btn {
  background: #e0e0e0;
  color: #333;
}

#cancel-edit-btn:hover {
  background: #d0d0d0;
}

#typing-indicator {
  font-size: 14px;
  font-style: italic;
  color: #888;
  margin-bottom: 10px;
}

.online-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px;
  background: #f5f5f5;
  border-radius: 4px;
}

.theme-dark .online-info {
  background: #333;
}

.online-info span {
  font-size: 14px;
  color: #666;
}

.theme-dark .online-info span {
  color: #aaa;
}

#user-count {
  background: #3498db;
  color: white;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
}

.user-info-display {
  background: #e8f4fd;
  border: 1px solid #3498db;
  padding: 10px 15px;
  border-radius: 8px;
  margin-bottom: 15px;
  font-size: 14px;
}

.theme-dark .user-info-display {
  background: #2a4a5a;
  border-color: #5dade2;
}

.user-info-display .display-name {
  font-weight: bold;
  color: #2980b9;
}

.theme-dark .user-info-display .display-name {
  color: #85c1e9;
}

#user-ip-list {
  background: #ffe0e0;
  border: 2px solid #e74c3c;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
}

.theme-dark #user-ip-list {
  background: #4a2a2a;
  border-color: #c0392b;
}

#user-ip-list h4 {
  margin: 0 0 10px 0;
  color: #c0392b;
  font-size: 14px;
}

.theme-dark #user-ip-list h4 {
  color: #e74c3c;
}

.ip-search-box {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 13px;
  margin-bottom: 10px;
  box-sizing: border-box;
}

.theme-dark .ip-search-box {
  background: #333;
  border-color: #666;
  color: #ddd;
}

.ip-list-item {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid rgba(0,0,0,0.1);
  font-size: 13px;
}

.ip-list-item:last-child {
  border-bottom: none;
}

.ip-list-username {
  font-weight: bold;
  color: #333;
}

.theme-dark .ip-list-username {
  color: #ddd;
}

.ip-list-ip {
  font-family: monospace;
  color: #666;
}

.theme-dark .ip-list-ip {
  color: #aaa;
}

#user-ip-history {
  background: #e0ffe0;
  border: 2px solid #27ae60;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
}

.theme-dark #user-ip-history {
  background: #2a4a2a;
  border-color: #27ae60;
}

#user-ip-history h4 {
  margin: 0 0 10px 0;
  color: #27ae60;
  font-size: 14px;
}

.theme-dark #user-ip-history h4 {
  color: #2ecc71;
}

.ip-history-item {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid rgba(0,0,0,0.1);
  font-size: 13px;
  flex-wrap: wrap;
}

.ip-history-item:last-child {
  border-bottom: none;
}

.ip-history-username {
  font-weight: bold;
  color: #333;
}

.theme-dark .ip-history-username {
  color: #ddd;
}

.ip-history-ip {
  font-family: monospace;
  color: #666;
}

.theme-dark .ip-history-ip {
  color: #aaa;
}

.system-message.hidden {
  display: none !important;
}

#chat-box.hide-system-messages .system-message {
  display: none !important;
}

#chat-box.hide-prm .private-message {
  display: none !important;
}

.command-item.privileged-admin-only {
  border-color: #9b59b6;
  background: #f5e6ff;
}

.theme-dark .command-item.privileged-admin-only {
  background: #3d2a4a;
  border-color: #8e44ad;
}

.toggle-ip-btn {
  background-color: #f0f0f0 !important;
  color: #666 !important;
  border: 1px solid #ccc !important;
  padding: 5px 12px !important;
  border-radius: 4px !important;
  cursor: pointer !important;
  font-size: 12px !important;
  font-weight: normal !important;
  transition: all 0.2s ease !important;
  height: 30px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.toggle-ip-btn:hover {
  background-color: #e0e0e0 !important;
  transform: none !important;
  color: #333 !important;
}

.toggle-ip-btn.active {
  background-color: #27ae60 !important;
}

.toggle-ip-btn.active:hover {
  background-color: #1e8449 !important;
}

#shared-ip-result {
  margin: 10px 0;
  padding: 10px 14px;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 8px;
}

#shared-ip-result h4 {
  font-size: 13px;
  color: #7b5800;
  margin-bottom: 8px;
}

.shared-ip-group {
  background: #fff;
  border: 1px solid #ffe082;
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.shared-ip-group:last-child {
  margin-bottom: 0;
}

.shared-ip-addr {
  font-size: 12px;
  font-weight: bold;
  color: #555;
  font-family: monospace;
  margin-bottom: 5px;
}

.shared-ip-users {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 4px;
}

.shared-ip-user-tag {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: bold;
}

.shared-ip-user-tag.online {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.shared-ip-user-tag.offline {
  background: #f5f5f5;
  color: #757575;
  border: 1px solid #e0e0e0;
}

.shared-ip-time {
  font-size: 11px;
  color: #aaa;
}

#meet-container {
  margin-bottom: 15px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #ccc;
}

.theme-dark #meet-container {
  border-color: #555;
}

#meet-iframe {
  width: 100%;
  height: 600px;
  border: none;
  display: block;
}

@media (max-width: 600px) {
  #meet-iframe {
    height: 400px;
  }
}

@media (max-width: 600px) {
  #chat-section {
    padding: 10px;
  }

  #chat-box {
    height: 400px;
  }

  .input-area textarea {
    width: calc(100% - 12px);
    height: 110px;
    font-size: 16px;
  }

  .button-row {
    flex-direction: column;
  }

  .button-row button,
  .button-row a {
    width: 100%;
    text-align: center;
  }

  .profile-row {
    flex-direction: column;
    align-items: stretch;
  }

  #profile-settings input[type="text"] {
    width: 100%;
  }
}

/* 管理者リストボタン */
.chat-header {
  position: relative;
}

.header-buttons {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  gap: 6px;
  align-items: center;
}

#admin-list-btn {
  background: #8e44ad;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

#admin-list-btn:hover {
  background: #6c3483;
}

#admin-panel-btn {
  background: #c0392b;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

#admin-panel-btn:hover {
  background: #a93226;
}

.theme-dark #admin-list-btn {
  background: #6c3483;
}

.theme-dark #admin-list-btn:hover {
  background: #5b2c6f;
}

.theme-dark #admin-panel-btn {
  background: #922b21;
}

.theme-dark #admin-panel-btn:hover {
  background: #7b241c;
}

/* 管理者リストモーダル */
.admin-list-modal-content {
  max-width: 380px;
}

.admin-list-section {
  margin-bottom: 20px;
}

.admin-list-section-title {
  font-size: 13px;
  font-weight: bold;
  color: white;
  padding: 4px 10px;
  border-radius: 4px;
  margin-bottom: 10px;
  display: inline-block;
}

.admin-list-section-title.privileged {
  background: #8e44ad;
}

.admin-list-section-title.regular {
  background: #2980b9;
}

.admin-list-names {
  list-style: none;
  padding: 0;
  margin: 0;
}

.admin-list-names li {
  padding: 6px 10px;
  border-bottom: 1px solid #eee;
  font-size: 14px;
}

.theme-dark .admin-list-names li {
  border-bottom-color: #555;
  color: #ddd;
}

.admin-list-names li:last-child {
  border-bottom: none;
}

.admin-list-empty {
  color: #aaa;
  font-size: 13px;
  padding: 4px 10px;
}

#close-admin-list-btn {
  background: #7f8c8d;
  color: white;
}

#close-admin-list-btn:hover {
  background: #636e72;
}

/* 管理者パネルモーダル */
#admin-panel-modal {
  background: transparent;
  pointer-events: none;
}

.admin-panel-modal-content {
  max-width: 480px;
  width: 95%;
  pointer-events: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.28);
  user-select: none;
}

.admin-panel-section {
  margin-bottom: 16px;
}

.admin-panel-label {
  display: block;
  font-size: 12px;
  font-weight: bold;
  color: #666;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.theme-dark .admin-panel-label {
  color: #aaa;
}

.admin-user-select-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

#admin-target-user {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  color: #333;
}

.theme-dark #admin-target-user {
  background: #2d2d2d;
  border-color: #555;
  color: #ddd;
}

.admin-refresh-btn {
  background: #ecf0f1;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s;
  color: #555;
}

.admin-refresh-btn:hover {
  background: #bdc3c7;
}

.theme-dark .admin-refresh-btn {
  background: #3d3d3d;
  border-color: #555;
  color: #bbb;
}

.admin-manual-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.admin-manual-label {
  font-size: 12px;
  color: #888;
  white-space: nowrap;
  flex-shrink: 0;
}

.admin-manual-input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  color: #333;
}

.admin-manual-input:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 2px rgba(52,152,219,0.15);
}

.theme-dark .admin-manual-input {
  background: #2d2d2d;
  border-color: #555;
  color: #ddd;
}

.admin-target-hint {
  margin-top: 5px;
  font-size: 11px;
  min-height: 14px;
}

.admin-target-hint.online {
  color: #27ae60;
}

.admin-target-hint.offline {
  color: #e67e22;
}

.admin-mute-input {
  width: 120px;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
}

.theme-dark .admin-mute-input {
  background: #2d2d2d;
  border-color: #555;
  color: #ddd;
}

.admin-action-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-action-btn {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  color: white;
}

.admin-action-btn:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

.admin-action-btn:active {
  transform: translateY(0);
}

.mute-btn   { background: #e67e22; }
.unmute-btn { background: #27ae60; }
.ban-btn    { background: #e74c3c; }
.unban-btn  { background: #2ecc71; }
.shadowban-btn { background: #8e44ad; }
.ipban-btn  { background: #c0392b; }
.ipunban-btn { background: #1abc9c; }
.ipbanlist-btn { background: #2980b9; }
.system-btn { background: #7f8c8d; }
.shadowbanlist-btn { background: #6c3483; }

.admin-panel-log {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  color: #333;
  margin-top: 4px;
  white-space: pre-wrap;
  max-height: 80px;
  overflow-y: auto;
}

.admin-panel-log.success {
  background: #d4edda;
  border-color: #c3e6cb;
  color: #155724;
}

.admin-panel-log.error {
  background: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}

.theme-dark .admin-panel-log {
  background: #2d2d2d;
  border-color: #555;
  color: #ddd;
}

#close-admin-panel-btn {
  background: #7f8c8d;
  color: white;
}

#close-admin-panel-btn:hover {
  background: #636e72;
}

.ipban-list-entry {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  margin-bottom: 6px;
  background: #fff;
  font-size: 12px;
}

.theme-dark .ipban-list-entry {
  background: #2d2d2d;
  border-color: #555;
  color: #ddd;
}

.ipban-list-entry.temp {
  border-left: 3px solid #e67e22;
}

.ipban-list-entry.perm {
  border-left: 3px solid #e74c3c;
}

.ipban-entry-info {
  flex: 1;
  word-break: break-all;
}

.ipban-entry-ip {
  font-weight: bold;
  font-size: 13px;
}

.ipban-entry-detail {
  color: #888;
  margin-top: 2px;
  font-size: 11px;
}

.ipban-unban-btn {
  background: #27ae60;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.ipban-unban-btn:hover {
  background: #1e8449;
}

#admin-ipban-list-body {
  max-height: 180px;
  overflow-y: auto;
  margin-top: 6px;
}

#admin-ipbanlist-load-btn {
  background: #2980b9;
  color: white;
}

#connection-log {
  background: #fff3e0;
  border: 2px solid #e67e22;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
  max-height: 400px;
  overflow-y: auto;
}

.theme-dark #connection-log {
  background: #3a2a10;
  border-color: #e67e22;
}

#connection-log h4 {
  margin: 0 0 10px 0;
  color: #e67e22;
  font-size: 14px;
}

.theme-dark #connection-log h4 {
  color: #f39c12;
}

.conn-log-item {
  padding: 8px 0;
  border-bottom: 1px solid rgba(230, 126, 34, 0.25);
  font-size: 12px;
}

.conn-log-item:last-child {
  border-bottom: none;
}

.conn-log-time {
  color: #888;
  font-size: 11px;
  margin-bottom: 3px;
}

.theme-dark .conn-log-time {
  color: #aaa;
}

.conn-log-row {
  display: flex;
  gap: 6px;
  margin-bottom: 2px;
  flex-wrap: wrap;
}

.conn-log-label {
  font-weight: bold;
  color: #666;
  min-width: 130px;
  font-size: 11px;
}

.theme-dark .conn-log-label {
  color: #bbb;
}

.conn-log-ip {
  font-family: monospace;
  color: #333;
}

.theme-dark .conn-log-ip {
  color: #ddd;
}

.conn-log-ip.resolved {
  color: #27ae60;
  font-weight: bold;
}

.theme-dark .conn-log-ip.resolved {
  color: #2ecc71;
}

.conn-log-xff {
  font-family: monospace;
  color: #c0392b;
  word-break: break-all;
}

.theme-dark .conn-log-xff {
  color: #e74c3c;
}

.conn-log-reason {
  margin-top: 3px;
  font-size: 11px;
  color: #e67e22;
  font-weight: bold;
}

.theme-dark .conn-log-reason {
  color: #f39c12;
}

.tos-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.tos-modal.hidden {
  display: none;
}

.tos-modal-content {
  background: #fff;
  border-radius: 10px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  overflow: hidden;
}

.tos-title {
  padding: 20px 24px 6px;
  font-size: 20px;
  font-weight: bold;
  border-bottom: 1px solid #e0e0e0;
  color: #222;
}

.tos-instruction {
  padding: 8px 24px;
  font-size: 13px;
  color: #888;
  border-bottom: 1px solid #f0f0f0;
  background: #fafafa;
}

.tos-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  font-size: 14px;
  line-height: 1.8;
  color: #333;
}

.tos-body h3 {
  font-size: 15px;
  font-weight: bold;
  margin: 18px 0 6px;
  color: #111;
}

.tos-body h4 {
  font-size: 14px;
  font-weight: bold;
  margin: 12px 0 4px;
  color: #333;
}

.tos-body p {
  margin-bottom: 8px;
}

.tos-body ol,
.tos-body ul {
  padding-left: 20px;
  margin-bottom: 8px;
}

.tos-body li {
  margin-bottom: 4px;
}

.tos-footer {
  padding: 14px 24px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fafafa;
}

.tos-scroll-hint {
  font-size: 13px;
  color: #e67e22;
  font-weight: bold;
  transition: opacity 0.3s;
}

.tos-scroll-hint.done {
  opacity: 0;
}

.tos-agree-btn {
  padding: 10px 28px;
  background: #2ecc71;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.tos-agree-btn:disabled {
  background: #aaa;
  cursor: not-allowed;
  opacity: 0.6;
}

.tos-agree-btn:not(:disabled):hover {
  background: #27ae60;
}

.theme-dark .tos-modal-content {
  background: #2a2a2a;
  color: #ddd;
}

.theme-dark .tos-title {
  color: #eee;
  border-bottom-color: #444;
}

.theme-dark .tos-instruction {
  color: #aaa;
  background: #222;
  border-bottom-color: #333;
}

.theme-dark .tos-body {
  color: #ccc;
}

.theme-dark .tos-body h3 {
  color: #eee;
}

.theme-dark .tos-body h4 {
  color: #ddd;
}

.theme-dark .tos-footer {
  background: #222;
  border-top-color: #444;
}
