@font-face {
  font-family: "yangjin";
  src: url("https://cdn.jsdelivr.net/gh/supernovice-lab/font@0.9/yangjin.woff")
    format("woff");
  font-weight: normal;
  font-style: normal;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "yangjin";
}

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

body {
  background-color: #f4f4f4;
  color: #333;
  transition: background-color 0.3s, color 0.3s;
  display: flex;
  justify-content: center;
  align-items: center;
}

.container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  position: relative;
  background-color: #fff;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  max-width: 600px;
  max-height: 800px;
}

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

#logo {
  width: 128px;
  height: 128px;
  border-radius: 20%;
}

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

#mainMenu.active {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 400px;
  width: 100%;
}

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

#questionDisplay.active {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  white-space: pre-wrap;
  overflow: hidden;
  height: auto;
  padding: 1rem;
  box-sizing: border-box;
  min-height: 100px;
  border: 1px solid #ddd;
  border-radius: 5px;
  background-color: #f8f8f8;
}

button {
  padding: 1rem 2rem;
  font-size: 1.1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s, box-shadow 0.2s;
  color: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

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

#inputBtn {
  background-color: #e74c3c;
}

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

#topicList button:hover,
button:hover {
  opacity: 0.95;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#topicList button:active,
button:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

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

.back-button:hover {
  color: #333;
}

#retryButton {
  display: none;
  margin: 20px;
  width: 100%;
  max-width: 400px;
  background-color: #3498db;
  border-radius: 8px;
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
  border: none;
}

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

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

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

.option-button:hover {
  color: #333;
}

.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;
  background-color: #fff;
  color: #333;
}

.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;
  color: #333;
}

.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: #2ecc71;
}

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

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

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

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

.modal.active {
  display: block;
}

body.dark-theme {
  background-color: #2c3e50;
  color: #ecf0f1;
}

body.dark-theme .container {
  background-color: #34495e;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.6);
}

body.dark-theme h1 {
  color: #fff;
}

body.dark-theme #randomBtn,
body.dark-theme #retryButton {
  background-color: #2ecc71;
}

body.dark-theme #inputBtn {
  background-color: #e74c3c;
}

body.dark-theme #topicList button {
  background-color: #f1c40f;
  color: #2c3e50;
}

body.dark-theme #topicList button:hover {
  opacity: 0.95;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

body.dark-theme #topicList button:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

body.dark-theme #questionDisplay.active,
body.dark-theme .modal-content {
  border: 1px solid #7f8c8d;
  background-color: #34495e;
  color: #ecf0f1;
}

body.dark-theme #version {
  color: #bbb;
}

body.dark-theme .option-item label {
  color: #ecf0f1;
}

body.dark-theme .option-button,
body.dark-theme .back-button {
  color: #ecf0f1;
}

body.dark-theme .option-button:hover,
body.dark-theme .back-button:hover {
  color: #fff;
}

.emoji {
  font-size: inherit;
  display: inline-block;
  transition: color 0.3s;
}

.back-button .emoji,
.option-button .emoji {
  color: #777;
}

.back-button:hover .emoji,
.option-button:hover .emoji {
  color: #333;
}

body.dark-theme .back-button .emoji,
body.dark-theme .option-button .emoji {
  color: #ecf0f1;
}

body.dark-theme .back-button:hover .emoji,
body.dark-theme .option-button:hover .emoji {
  color: #fff;
}
