:root {
    --bg-color: #f0f2f5;
    --container-bg: #ffffff;
    --text-color: #1d1d1f;
    --secondary-text-color: #6e6e73;
    --accent-color: #007aff;
    --accent-color-hover: #0071e3;
    --border-color: #d2d2d7;
    --input-bg: #f5f5f7;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

.hidden {
    display: none !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    margin: 0;
    line-height: 1.5;
}

.main-layout {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 1600px;
    gap: 20px;
}

#settings-container {
    width: 45%;
}

#display-container {
    width: 45%;
}

#ai-section {
    width: 90%;
    max-width: 800px;
    margin: 0 auto;
}

#question-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#question-container h2 {
    width: 100%;
    text-align: left;
}

#feedback {
    margin-top: 1rem;
}

h1, h2 {
    color: var(--text-color);
    font-weight: 600;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 1.5rem;
    margin-top: 0;
    margin-bottom: 1rem;
}

.container {
    background-color: var(--container-bg);
    padding: 2rem;
    border-radius: 18px;
    box-shadow: 0 4px 12px var(--shadow-color);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    box-sizing: border-box;
    background-color: var(--input-bg);
    color: var(--text-color);
    transition: border-color 0.2s, box-shadow 0.2s;
}

textarea {
    height: 150px;
    margin-bottom: 1rem;
}

textarea:focus,
.control-group select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.3);
}


.button-container {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 1rem;
    justify-content: center;
}

.controls-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .controls-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start; /* Align items to the left */
}

.control-group label {
    font-weight: 500;
    color: var(--secondary-text-color);
}

.control-group input[type="color"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 100%;
    height: 52px;
    padding: 4px;
    cursor: pointer;
    background-color: transparent;
    border: none; /* 移除瀏覽器預設的邊框 */
    box-sizing: border-box;
}
.control-group input[type="color"]::-webkit-color-swatch {
    border-radius: 99px;
    border: 1px solid;
}
.control-group input[type="color"]::-moz-color-swatch {
    border-radius: 99px;
    border: 1px solid;
}

#status {
    margin-top: 1rem;
    font-style: italic;
    color: var(--secondary-text-color);
    width: 100%;
    text-align: center;
}

#currentWordDisplay {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 7vw;
    font-weight: 600;
    min-height: 250px;
    padding: 2rem;
    border: none;
    border-radius: 18px;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    overflow-wrap: break-word;
    word-break: break-all;
    background-color: #F5F5DC; /* 恢復背景顏色 */
    color: #222222;
    line-height: 1.4;
    transition: background-color 0.3s, color 0.3s;
}

#box {
    position: fixed; /* 讓背景覆蓋整個視窗 */
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2; /* 確保背景在所有內容下方 */
}

@media (max-width: 800px) {
    .main-layout {
        flex-direction: column;
        align-items: center;
    }

    #settings-container,
    #display-container {
        width: 90%;
    }

    #ai-section {
        width: 90%;
        max-width: 800px; /* 保持最大寬度限制 */
    }
}

@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    #currentWordDisplay { font-size: 9vw; min-height: 200px; }
}

@media (max-width: 480px) {
    body { padding: 1rem; }
    h1 { font-size: 1.8rem; }
    .container { padding: 1.5rem; }
    #currentWordDisplay { font-size: 12vw; min-height: 180px; }
    .button-container { flex-direction: column; }
    button { width: 100%; }
}

#ai-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
}

#ai-controls h2 {
    width: 100%;
    text-align: left;
}


/* From Uiverse.io by Pradeepsaranbishnoi */ 
.tabs {
  display: flex;
  position: relative;
  background-color: #fff;
  box-shadow: 0 0 1px 0 rgba(24, 94, 224, 0.15), 0 6px 12px 0 rgba(24, 94, 224, 0.15);
  padding: 0.75rem;
  border-radius: 99px;
  width: -moz-fit-content;
  width: fit-content;
}

.main-tabs {
  margin: 0 auto;
}

.tabs * {
  z-index: 2;
}

.container input[type="radio"] {
  display: none;
}

.tab {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  width: 100px;
  font-size: .8rem;
  color: black;
  font-weight: 500;
  border-radius: 99px;
  cursor: pointer;
  transition: color 0.15s ease-in;
}

.notification {
  display: flex;
  align-items: center;
  justify-content: center;
  width: .8rem;
  height: .8rem;
  position: absolute;
  top: 10px;
  left: 30%;
  font-size: 10px;
  margin-left: 0.75rem;
  border-radius: 50%;
  margin: 0px;
  background-color: #e6eef9;
  transition: 0.15s ease-in;
}

.container input[type="radio"]:checked + label {
  color: #185ee0;
}

.container input[type="radio"]:checked + label > .notification {
  background-color: #185ee0;
  color: #fff;
  margin: 0px;
}

.container input[id="radio-1"]:checked ~ .glider {
  transform: translateX(0);
}

.container input[id="radio-2"]:checked ~ .glider {
  transform: translateX(100%);
}

.container input[id="radio-3"]:checked ~ .glider {
  transform: translateX(200%);
}

.difficulty-tabs {
    width: 100%;
    margin: 0;
}

.difficulty-tabs .tab {
    width: 33.33%;
}

.difficulty-tabs .glider {
    width: 33.33%;
}

.container input[id="diff-easy"]:checked ~ .glider {
  transform: translateX(0);
}

.container input[id="diff-medium"]:checked ~ .glider {
  transform: translateX(100%);
}

.container input[id="diff-hard"]:checked ~ .glider {
  transform: translateX(200%);
}

.glider {
  position: absolute;
  display: flex;
  height: 30px;
  width: 100px;
  background-color: #e6eef9;
  z-index: 1;
  border-radius: 99px;
  transition: 0.25s ease-out;
}

@media (max-width: 700px) {
 
  .tabs {
    /* transform: scale(0.6); */
  }
}

/* Styles for the new split mode tabs */
.split-mode-tabs {
    margin: 0;
    width: 100%;
}

.split-mode-tabs .tab {
    width: 50%;
}

.split-mode-tabs .glider {
    width: 50%;
}

.tabs .glider {
    width: 100px; /* Match the tab width */
}

.container input[id="split-word"]:checked ~ .glider {
  transform: translateX(0);
}

.container input[id="split-sentence"]:checked ~ .glider {
  transform: translateX(100%);
}
