*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Signika', sans-serif;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 60% at 75% 10%, #5c1e0888 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 20% 80%, #1a0a0444 0%, transparent 60%),
    #0d0905;
  color: #c9b9a0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

header {
  width: 100%;
  text-align: center;
  padding: 2rem 1rem 1.5rem;
  border-bottom: 1px solid #3a2510;
  background: linear-gradient(180deg, #00000066 0%, transparent 100%);
}

header h1 {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #e8d5a0;
  text-shadow: 0 0 30px #c9a84c55, 0 2px 6px #000;
}

.panel {
  width: 100%;
  max-width: 960px;
  margin: 1.5rem auto;
  padding: 0 1rem 2rem;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  color: #c9a84c;
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-heading::before,
.section-heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, #c9a84c88, transparent);
}

.status-banner {
  background: #12100d;
  border: 1px solid #3a2510;
  border-top: 2px solid #c9a84c66;
  padding: 0.7rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-active {
  background: #6aaa5a;
  box-shadow: 0 0 6px #6aaa5a99;
}

.dot-inactive {
  background: #c9a84c;
  box-shadow: 0 0 6px #c9a84c88;
}

.dot-error {
  background: #aa4444;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
}

@media (max-width: 640px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) and (min-width: 641px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.card {
  position: relative;
  background: #1a1008;
  border: 1px solid #3a2510;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}

.card:hover {
  border-color: #c9a84c99;
  transform: translateY(-2px);
}

.card-image {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  background: #12100d;
}

.card-image-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #1a1008 0%, #0d0905 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3a2510;
  font-size: 2rem;
}

.card-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 0.6rem 0.75rem;
  background: linear-gradient(180deg, #000000cc 0%, transparent 100%);
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  text-shadow: 0 1px 4px #000;
}

.card-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.4rem 0.75rem;
  background: linear-gradient(0deg, #000000cc 0%, transparent 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: #c9b9a0bb;
}

.card-system {
  background: #1a3a1a;
  color: #6aaa5a;
  border: 1px solid #6aaa5a44;
  padding: 0.1rem 0.4rem;
  font-size: 0.68rem;
  font-weight: 600;
}

.card.active-world .card-image {
  filter: brightness(0.4);
}

.card-active-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #000000bb;
  border: 1px solid #6aaa5a88;
  color: #6aaa5a;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.4rem 1rem;
  display: none;
}

.card.active-world .card-active-badge {
  display: block;
}

.empty {
  text-align: center;
  color: #3a2510;
  padding: 3rem;
  font-style: italic;
  grid-column: 1/-1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: #000000bb;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: #12100d;
  border: 1px solid #3a2510;
  border-top: 2px solid #c9a84c88;
  width: 100%;
  max-width: 420px;
  margin: 1rem;
  box-shadow: 0 8px 40px #000000cc;
  transform: translateY(12px);
  transition: transform 0.2s;
}

.modal-backdrop.open .modal {
  transform: translateY(0);
}

.modal-header {
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid #3a2510;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  color: #e8d5a0;
  letter-spacing: 0.04em;
}

.modal-close {
  background: none;
  border: none;
  color: #6a5a40;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.1rem 0.3rem;
  transition: color 0.15s;
}

.modal-close:hover {
  color: #c9b9a0;
}

.modal-body {
  padding: 1.25rem;
}

.modal-body label {
  display: block;
  font-size: 0.82rem;
  color: #8a7a60;
  margin-bottom: 0.4rem;
  letter-spacing: 0.03em;
}

.modal-body input[type="password"] {
  width: 100%;
  background: #0d0905;
  border: 1px solid #555;
  border-radius: 3px;
  color: #c9b9a0;
  padding: 0.5rem 0.75rem;
  font-family: 'Signika', sans-serif;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.modal-body input[type="password"]:focus {
  border-color: #c9a84c;
  box-shadow: 0 0 0 1px #c9a84c33;
}

.modal-body input[type="password"]::placeholder {
  color: #444;
}

.modal-msg {
  margin-top: 0.75rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  display: none;
  border-left: 3px solid;
}

.modal-msg.visible {
  display: block;
}

.modal-msg.error {
  border-left-color: #aa4444;
  color: #d47070;
  background: #200e0e;
}

.modal-msg.success {
  border-left-color: #4a8a4a;
  color: #7ab87a;
  background: #0e1e0e;
}

.modal-footer {
  padding: 0.75rem 1.25rem 1.25rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.btn {
  background: #191813;
  color: #c9b9a0;
  border: 1px solid #555;
  border-radius: 3px;
  padding: 0.45rem 1.1rem;
  font-family: 'Signika', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn:hover:not(:disabled) {
  background: #2a2418;
  border-color: #c9a84c;
  color: #e8d5a0;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: #2a2010;
  border-color: #c9a84c88;
  color: #c9a84c;
}

.btn-primary:hover:not(:disabled) {
  background: #3a2e14;
  border-color: #c9a84c;
  color: #e8d5a0;
}

.btn-danger {
  background: #2a1010;
  border-color: #aa444488;
  color: #d47070;
}

.btn-danger:hover:not(:disabled) {
  background: #3a1616;
  border-color: #aa4444;
  color: #e09090;
}

.world-detail {
  text-align: center;
  margin-bottom: 1.5rem;
}

.world-detail h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.6rem;
  color: #e8d5a0;
  margin-bottom: 0.5rem;
}

.world-detail p {
  color: #8a7a60;
}

#launch-section {
  flex-direction: column;
  gap: 0.75rem;
  max-width: 420px;
  margin: 0 auto;
}

#launch-section label {
  font-size: 0.82rem;
  color: #8a7a60;
}

#launch-section input[type="password"] {
  width: 100%;
  background: #0d0905;
  border: 1px solid #555;
  border-radius: 3px;
  color: #c9b9a0;
  padding: 0.5rem 0.75rem;
  font-family: 'Signika', sans-serif;
  font-size: 0.95rem;
  outline: none;
}

#launch-section input[type="password"]:focus {
  border-color: #c9a84c;
}

.msg {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  border-left: 3px solid;
  display: none;
}

.msg.visible {
  display: block;
}

.msg.error {
  border-left-color: #aa4444;
  color: #d47070;
  background: #200e0e;
}

.msg.success {
  border-left-color: #4a8a4a;
  color: #7ab87a;
  background: #0e1e0e;
}

#swap-section .grid {
  margin-top: 1rem;
}

#swap-section .card {
  cursor: default;
  padding-bottom: 0.75rem;
}

#swap-section .stop-btn {
  margin: 0.5rem 0.75rem 0;
}