body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 20px;
  background-color: #f0f0f0;
}

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  background-color: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

.instruction {
  text-align: center;
  margin-bottom: 15px;
  font-style: italic;
  color: #666;
}

/* Network Simulator Common Styles */
.network-simulator {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
  min-height: 250px;
}

.dns-simulator, .tcp-simulator {
  align-items: stretch;
}

.client-container, .server-container {
  width: 42%;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background-color: #f9f9f9;
  display: flex;
  flex-direction: column;
}

.client-container h3, .server-container h3 {
  margin-top: 0;
  margin-bottom: 12px;
  color: #333;
  text-align: center;
  border-bottom: 1px solid #ddd;
  padding-bottom: 8px;
}

.network-middle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 10%;
  padding: 10px 0;
}

.arrow {
  font-size: 24px;
  margin: 20px 0;
  color: #0066cc;
  font-weight: bold;
}

/* DNS Challenge Specific Styles */
.dns-part {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 12px;
  background-color: #f5f5f5;
  margin-bottom: 10px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.dns-part h4 {
  margin-top: 0;
  margin-bottom: 12px;
  color: #333;
  text-align: center;
  border-bottom: 1px solid #ddd;
  padding-bottom: 6px;
}

.dns-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-grow: 1;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%; /* Ensure form group takes full width */
  box-sizing: border-box; /* Include padding in width calculation */
}

.dns-input {
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  width: 100%;
}

/* Form styling */
.dns-input, .http-input, .https-input {
  background-color: rgba(15, 45, 60, 0.9);
  border: 1px solid #2e8b57;
  color: #f0f0f0;
  box-sizing: border-box; /* Add box-sizing to include padding/border in width */
  width: 100%; /* Make sure it's 100% of parent */
  max-width: 100%; /* Prevent overflow */
}

/* HTTP and HTTPS form specific styling */
.http-form, .https-form {
  width: 100%;
  box-sizing: border-box;
}

/* Host header and user agent inputs */
#host-header, #https-host-header, 
#user-agent, #https-user-agent {
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Improve container sizing for HTTP and HTTPS parts */
.http-part, .https-part {
  width: 100%;
  box-sizing: border-box;
}

/* Response preview areas - Challenge 3, 4, 5 */
.http-response-preview, .https-response-preview {
  background-color: rgba(15, 45, 60, 0.8);
  color: #ffffff;
  border: 1px solid #2e8b57;
  width: 100%;
  box-sizing: border-box;
  overflow-x: auto; /* Add horizontal scrolling if needed */
}

/* TCP Challenge Specific Styles */
.connection-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  flex-grow: 1;
  justify-content: space-around;
  padding: 10px 0;
}

.tcp-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 20px 12px;
  margin: 0 auto;
}

.tcp-simulator {
  display: block;
}

.tcp-table td {
  vertical-align: middle;
}

.tcp-client-cell,
.tcp-server-cell {
  width: 40%;
}

.tcp-arrow-cell {
  width: 20%;
  text-align: center;
}

.tcp-panel {
  border: 1px solid #ddd;
  border-radius: 8px;
  background-color: #f9f9f9;
  padding: 15px;
  width: 100%;
  box-sizing: border-box;
}

.tcp-panel h3 {
  margin-top: 0;
  margin-bottom: 12px;
  color: #333;
  text-align: center;
  border-bottom: 1px solid #ddd;
  padding-bottom: 8px;
}

.tcp-slot-wrapper {
  display: flex;
  justify-content: center;
  width: 100%;
}

.tcp-slot-wrapper .connection-slot {
  width: 100%;
  max-width: 260px;
}

.tcp-arrow-cell .arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0;
}

.server-ip-display {
  text-align: center;
  font-family: monospace;
  background-color: #e8f5e9;
  border: 1px solid #4CAF50;
  border-radius: 4px;
  padding: 5px;
  margin-bottom: 10px;
  font-weight: bold;
}

.connection-slot {
  height: 48px;
  border: 2px dashed #ccc;
  border-radius: 5px;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #f0f0f0;
  transition: all 0.3s;
}

.connection-slot.over {
  border-color: #0066cc;
  background-color: rgba(0, 102, 204, 0.1);
}

.slot-placeholder {
  color: #999;
  font-style: italic;
}

.used {
  cursor: not-allowed;
}

.packet-palette {
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background-color: #f9f9f9;
  margin-top: 20px;
}

.packet-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.packet-container.over {
  border: 2px dashed #0066cc;
  background-color: rgba(0, 102, 204, 0.1);
}

.packet {
  padding: 10px 15px;
  border-radius: 5px;
  color: white;
  font-weight: bold;
  cursor: move;
  user-select: none;
  transition: transform 0.2s;
}

.packet:hover {
  transform: scale(1.05);
}

.packet.SYN {
  background-color: #4CAF50;
}

.packet.ACK {
  background-color: #2196F3;
}

.packet.SYN-ACK {
  background-color: #9C27B0;
}

.packet.FIN {
  background-color: #F44336;
}

.packet.RST {
  background-color: #FF9800;
}

.packet.PUSH {
  background-color: #607D8B;
}

.packet.URG {
  background-color: #9C27B0;
}

.packet.dragging {
  opacity: 0.5;
}

.hint {
  padding: 10px;
  background-color: #fffde7;
  border-left: 4px solid #ffeb3b;
  margin-bottom: 15px;
}

.reset-button {
  margin-top: 20px;
  padding: 10px 15px;
  background-color: #4CAF50;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
}

.reset-button:hover {
  background-color: #388e3c;
}

.reset-button.dns-reset {
  background-color: #FF9800;
}

.reset-button.dns-reset:hover {
  background-color: #F57C00;
}

.reset-button.tcp-reset {
  background-color: #FF9800;
  margin-top: 15px;
}

.reset-button.tcp-reset:hover {
  background-color: #F57C00;
}

.victory {
  margin-top: 15px;
  padding: 10px;
  background-color: #e8f5e9;
  border-left: 4px solid #4CAF50;
  font-family: monospace;
  word-break: break-all;
}

footer {
  margin-top: 30px;
  text-align: center;
  color: #666;
}

#wigwag {
  font-weight: bold;
  margin-top: 10px;
}

/* Challenge Section Styling */
.challenge-section {
  margin-bottom: 30px;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 15px;
  background-color: #f9f9f9;
}

/* Add disabled state styling */
.challenge-section.disabled {
  opacity: 0.5;
  pointer-events: none;
  position: relative;
}

.challenge-section.disabled::after {
  content: "Complete the previous challenge to unlock";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  font-weight: bold;
  border-radius: 8px;
}

.challenge-section h2 {
  margin-top: 0;
  color: #333;
  border-bottom: 1px solid #ddd;
  padding-bottom: 10px;
}

/* DNS Challenge Specific Styles */
.dns-challenge {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 10px;
  transition: all 0.3s;
}

.dns-challenge.completed {
  border-left: 4px solid #4CAF50;
  background-color: rgba(76, 175, 80, 0.1);
}

.dns-result {
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 5px;
  min-height: 80px;
  background-color: white;
  margin-top: 10px;
}

.dns-result .error {
  color: #F44336;
}

.dns-result .success {
  color: #4CAF50;
  font-weight: bold;
}

.challenge-complete {
  font-weight: bold;
  color: #4CAF50;
}

/* Challenge Button Styles */
.challenge-buttons, .tcp-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 15px 0;
}

/* HTTP Challenge Specific Styles */
.http-simulator {
  align-items: stretch;
}

.http-part {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 12px;
  background-color: #f5f5f5;
  margin-bottom: 10px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.http-part h4 {
  margin-top: 0;
  margin-bottom: 12px;
  color: #333;
  text-align: center;
  border-bottom: 1px solid #ddd;
  padding-bottom: 6px;
}

.http-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-grow: 1;
}

.http-input {
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  width: 100%;
}

.http-input[readonly] {
  background-color: #f5f5f5;
  cursor: not-allowed;
  border-color: #ddd;
}

.http-response-preview {
  padding: 10px;
  background-color: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  min-height: 150px;
  font-family: monospace;
  font-size: 13px;
}

.http-response-content {
  line-height: 1.4;
}

.http-simulator.completed {
  border-left: 4px solid #4CAF50;
  background-color: rgba(76, 175, 80, 0.1);
}

.http-result {
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 5px;
  min-height: 80px;
  background-color: white;
  margin-top: 10px;
}

.http-submit-button {
  padding: 10px 15px;
  background-color: #2196F3;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
}

.http-submit-button:hover {
  background-color: #0b7dda;
}

.reset-button.http-reset {
  background-color: #FF9800;
}

.reset-button.http-reset:hover {
  background-color: #F57C00;
}

/* TCP Challenge Specific Styles */
.tcp-simulator .network-middle {
  justify-content: flex-start;
  padding-top: 50px;
}

.tcp-simulator .arrow {
  margin: 18px 0;
}

.tcp-simulator .server-container {
  padding-top: 32px;
}

.tcp-simulator.completed {
  border-left: 4px solid #4CAF50;
  background-color: rgba(76, 175, 80, 0.1);
}

.tcp-success-message {
  margin-top: 15px;
  padding: 10px;
  background-color: #e8f5e9;
  border-left: 4px solid #4CAF50;
  border-radius: 4px;
  text-align: center;
}

/* TLS Challenge Specific Styles */
.tls-simulator {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.tls-simulator.completed {
  border-left: 4px solid #4CAF50;
  background-color: rgba(76, 175, 80, 0.1);
}

.tls-simulator > .client-container,
.tls-simulator > .server-container {
  width: 48%;
  margin-bottom: 15px;
}

.tls-simulator .container-row {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 20px;
}

.tls-handshake-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  width: 90%;
  max-width: 400px;
  margin: 0 auto;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background-color: #f9f9f9;
}

.tls-message-pair {
  display: flex;
  width: 100%;
  align-items: center;
  margin: 5px 0;
  position: relative;
}

.tls-direction-indicator {
  margin: 0 10px;
  font-size: 20px;
  color: #0066cc;
  font-weight: bold;
}

.client-slot {
  margin-right: auto;
  margin-left: 40px;
  width: 250px;
}

.server-slot {
  margin-left: auto;
  margin-right: 40px;
  width: 250px;
}

.tls-message {
  padding: 10px 15px;
  border-radius: 5px;
  color: white;
  font-weight: bold;
  cursor: move;
  user-select: none;
  transition: transform 0.2s;
  margin: 5px;
  width: 220px;
  text-align: center;
}

.tls-message:hover {
  transform: scale(1.05);
}

.tls-message.ClientHello, 
.tls-message.ClientKeyExchange {
  background-color: #4CAF50;
}

.tls-message.ServerHello, 
.tls-message.Certificate, 
.tls-message.ServerChangeCipherSpec, 
.tls-message.Finished {
  background-color: #2196F3;
}

.tls-message.dragging {
  opacity: 0.5;
}

.tls-message.in-use {
  opacity: 0.5;
  pointer-events: none;
}

.tls-slot {
  height: 60px;
  border: 2px dashed #ccc;
  border-radius: 5px;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #f0f0f0;
  transition: all 0.3s;
}

.tls-slot.over {
  border-color: #0066cc;
  background-color: rgba(0, 102, 204, 0.1);
}

.tls-success-message {
  margin-top: 15px;
  padding: 10px;
  background-color: #e8f5e9;
  border-left: 4px solid #4CAF50;
  border-radius: 4px;
  text-align: center;
}

.reset-button.tls-reset {
  background-color: #FF9800;
  margin-top: 15px;
}

.reset-button.tls-reset:hover {
  background-color: #F57C00;
}

.tls-result {
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 5px;
  min-height: 80px;
  background-color: white;
  margin-top: 10px;
}

/* Add style for the lock icon */
.https-lock-icon {
  color: #4CAF50;
  font-size: 18px;
  margin-left: 5px;
}

/* Update the palette to match the new layout */
.tls-palette {
  margin-top: 20px;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background-color: #f9f9f9;
}

.tls-palette h3 {
  margin-top: 0;
  margin-bottom: 15px;
  text-align: center;
}

#tls-packet-palette {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.tls-buttons {
  display: flex;
  justify-content: center;
  margin-top: 15px;
}

/* HTTPS Challenge Specific Styles */
.https-simulator {
  align-items: stretch;
}

.https-part {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 12px;
  background-color: #f5f5f5;
  margin-bottom: 10px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.https-part h4 {
  margin-top: 0;
  margin-bottom: 12px;
  color: #333;
  text-align: center;
  border-bottom: 1px solid #ddd;
  padding-bottom: 6px;
}

.https-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-grow: 1;
}

.https-input {
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  width: 100%;
}

.https-input[readonly] {
  background-color: #f5f5f5;
  cursor: not-allowed;
  border-color: #ddd;
}

.https-response-preview {
  padding: 10px;
  background-color: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  min-height: 150px;
  font-family: monospace;
  font-size: 13px;
}

.https-response-content {
  line-height: 1.4;
}

.https-preview-image {
  max-width: 100%;
  height: auto;
  margin: 10px 0;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.https-simulator.completed {
  border-left: 4px solid #4CAF50;
  background-color: rgba(76, 175, 80, 0.1);
}

.https-result {
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 5px;
  min-height: 80px;
  background-color: white;
  margin-top: 10px;
}

.https-submit-button {
  padding: 10px 15px;
  background-color: #2196F3;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
}

.https-submit-button:hover {
  background-color: #0b7dda;
}

.reset-button.https-reset {
  background-color: #FF9800;
}

.reset-button.https-reset:hover {
  background-color: #F57C00;
}

.https-success-message {
  margin-top: 15px;
  padding: 10px;
  background-color: #e8f5e9;
  border-left: 4px solid #4CAF50;
  border-radius: 4px;
  text-align: center;
}

.https-lock-icon {
  color: #4CAF50;
  margin-right: 5px;
}