:root {
  --bg: #121212;
  --text: #e0e0e0;
  --border: #333;
  --header: #1e1e1e;
  --green: #3cb371;
  --blue: #4d88ff;
  --red: #ff4d4d;
}


/* === NIGHT TOGGLE === */

#night-toggle {
  position: fixed;
  bottom: 20px;
  right: 60px;
  padding: 10px 14px;
  font-size: 14px;
  background: #333;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  z-index: 1000;
}

body.light-mode {
  --bg: #f9f9f9;
  --text: #222;
  --border: #ccc;
  --header: #eee;
  --green: #388e3c;
  --blue: #1976d2;
  --red: #d32f2f;
}


body.light-mode #night-toggle {
  background: #eee;
  color: black;
}

/* API Modal Overlay */
#api-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

#api-modal.show {
  display: flex;
}

/* Centered Modal */
.api-modal-content,
.modal-content {
  background: var(--bg);
  color: var(--text);
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 100%;
  max-width: 800px;
  box-shadow: 0 0 10px #000;
  position: relative;
  text-align: center;
}

.api-close {
  position: absolute;
  top: 1px;
  right: 8px;
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--text);
  cursor: pointer;
}

/* API Input */
.api-key-input {
  font-size: 0.85rem !important;
  font-family: monospace !important;
  letter-spacing: 0.5px;
  width: 80%;
  background: var(--header);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  white-space: nowrap;
  overflow-x: auto;
}

/* Submit */
#submit-api-key {
  margin-top: 0.2rem;
  padding: 0.5rem 0.5rem;
  font-size: 0.8rem;
  background-color: var(--header);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

/* Floating Button */
#open-api-modal {
  position: fixed;
  top: 15px;
  right: 15px;
  z-index: 3002;
  background-color: var(--header);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.flat-button {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s;
}
.clear-api-button {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s;
}


.flat-button:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.account-greeting {
  margin-bottom: 1rem;
}

.guild-button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5em;
  width: 100%;
  padding: 0.5em 1em;
  box-sizing: border-box;
}

.guild-list {
  font-family: monospace;
  font-size: 0.95rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.crown {
  width: 1.5em;
  text-align: center;
}

.guild-tag {
  font-family: monospace;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: default;
  display: inline-block;
  margin: 0 5px 5px 0;
  background-color: var(--header);
  color: var(--text);
  transition: background-color 0.3s, color 0.3s;
}

.guild-name {
  font-weight: normal;
}

body {
  margin: 0;
  padding: 2rem;
  background-color: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", sans-serif;
}

h1 {
  text-align: center;
  margin-bottom: 2rem;
}

.search-container {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

input[type="text"],
button {
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background-color: var(--header);
  color: var(--text);
}

#output,
#matchup-table-container,
#simulated-container {
  max-width: 1000px;
  margin: 0 auto;
  margin-top: 2rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

th,
td {
  border: 1px solid var(--border);
  padding: 0.75rem;
  text-align: center;
}

th {
  background-color: var(--header);
}

.green {
  color: var(--green);
  font-weight: bold;
}

.blue {
  color: var(--blue);
  font-weight: bold;
}

.red {
  color: var(--red);
  font-weight: bold;
}

/* === BUTTON: Guild Tags === */
.guild-tag-button {
  display: inline-block;
  margin: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  background-color: var(--header);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.9rem;
}
button.guild-tag-button.red {
  color: var(--red);
}

button.guild-tag-button.green {
  color: var(--green);
}

button.guild-tag-button.blue {
  color: var(--blue);
}

/* === Team Name Header === */
.wvw-team-red {
  color: var(--red);
  font-weight: bold;
}

.wvw-team-green {
  color: var(--green);
  font-weight: bold;
}

.wvw-team-blue {
  color: var(--blue);
  font-weight: bold;
}



#teamGuildsModal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 2000;
}

#teamGuildsModalContent {
  background: var(--bg);
  color: var(--text);
  max-width: 500px;
  margin: 10% auto;
  padding: 1rem;
  border-radius: 8px;
  position: relative;
}

#closeGuildModalButton {
  position: absolute;
  top: 8px;
  right: 12px;
  cursor: pointer;
  font-weight: bold;
}


#cornerImage {
  position: fixed;
  bottom: 80px;
  left: 44px;
  width: 115px;
  height: auto;
  z-index: 1000;
}
/* Hide Icon on mobile */
@media (max-width: 768px) {
  #cornerImage {
    display: none;
  }
}


/* Mobile spacing fix */
@media (max-width: 800px) and (orientation: portrait),
       (max-height: 550px) and (orientation: landscape) {
  .mobile-spacer {
    height: 225px;
  }
}


/* Modal ApI Help Buttons */
.guild-output {
  margin-top: 1rem;
}

.api-footer {
  margin-top: 1em;
  font-size: 0.8em;
  text-align: center;
}

.api-link {
  color: gray;
  text-decoration: underline;
}

.api-scopes {
  color: gray;
}

.api-divider {
  margin: 0 0.5em;
  color: gray;
}
