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

html,
body {
  height: 100%;
  width: 100%;
}

body {
  font-family: "Noto Sans KR", sans-serif;
  background-color: #f0f2f5;
  color: #333;
  transition: background-color 0.3s, color 0.3s;
}

.container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  position: relative;
}

h1 {
  font-size: 2.5rem;
  color: #2c3e50;
  text-align: center;
}

#mainMenu {
  display: none;
  width: 100%;
  max-width: 400px;
}

#mainMenu.active {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 1rem;
}

#topicList {
  display: none;
  width: 100%;
  max-width: 600px;
}

#inputForm {
  display: none;
  width: 100%;
  max-width: 400px;
}

#inputForm.active {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#topicList.active {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
  justify-content: center;
  padding: 1rem;
  background-color: transparent;
}

button {
  padding: 1rem 2rem;
  font-size: 1.1rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.1s;
}

#randomBtn {
  background-color: #3498db;
  color: #fff;
}

#inputBtn {
  background-color: #e74c3c;
  color: #fff;
}

#topicList button {
  background-color: #f39c12;
  color: #fff;
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
}

#inputForm button {
  background-color: #27ae60;
  color: #fff;
}

button:hover {
  opacity: 0.8;
  transform: translateY(-2px);
}

button:active {
  transform: translateY(0);
}

#nameInput {
  padding: 0.8rem;
  font-size: 1rem;
  border: 1px solid #bdc3c7;
  border-radius: 5px;
  width: 100%;
}

.back-button {
  display: none;
  position: absolute;
  background: none;
  border: none;
  font-size: 3rem;
  cursor: pointer;
  padding: 0.5rem;
  left: 1rem;
  top: 1rem;
}

#rotateButton {
  position: absolute;
  bottom: 20px;
  right: 20px;
  background-color: transparent;
  color: black;
  width: 40px;
  height: 40px;
  font-size: 3rem;
  display: flex;
  justify-content: center;
  align-items: center;
  border: none;
  cursor: pointer;
}

#rotateButton:hover {
  background-color: transparent;
}

.rotated {
  transform: rotate(-90deg);
  transform-origin: top left;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100vh;
  height: 100vw;
}

#retryButton {
  display: none;
  margin: 20px;
  width: 100%;
  max-width: 400px;
  background-color: #3498db;
  color: white;
  border-radius: 5px;
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.1s;
}

#retryButton:hover {
  opacity: 0.8;
  transform: translateY(-2px);
}

#retryButton:active {
  transform: translateY(0);
}

#logo {
  width: 128px;
  height: 128px;
  border-radius: 20%;
  justify-content: center;
  display: block;
  margin-bottom: -20px;
}

#version {
  font-size: 0.9rem;
  color: #888;
  text-align: center;
  margin-bottom: 20px;
  font-weight: normal;
  font-style: italic;
}

#copyright {
  font-size: 0.7rem;
  color: #888;
  text-align: center;
  margin-top: 10px;
  font-weight: normal;
}

#copyright a {
  color: inherit;
  text-decoration: none;
}

#copyright i {
  font-size: 1.2em;
}

.option-button {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 10;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 50;
}

.modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 2rem;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  width: 80%;
  max-width: 400px;
}

.close-button {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-size: 1.5rem;
  cursor: pointer;
}

.option-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.option-item label {
  font-size: 1.1rem;
}

.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
}

input:checked + .slider {
  background-color: #2196f3;
}

input:focus + .slider {
  box-shadow: 0 0 1px #2196f3;
}

input:checked + .slider:before {
  transform: translateX(26px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

.modal.active {
  display: block;
}

#nameDisplay {
  display: none;
  width: 100%;
  height: 100%;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  padding: 0px;
  box-sizing: border-box;
}

#nameText {
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 10px;
}

#descriptionText {
  font-size: 1rem;
  color: #666;
  white-space: normal;
  word-wrap: break-word;
}
