@font-face {
    font-family: 'ALKATIP Tor Tom';
    src: url('fonts/ALKATIP Tor Tom.TTF') format('truetype');
    font-weight: normal;
    font-style: normal;
}

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

body {
    font-family: 'ALKATIP Tor Tom', 'Arial', sans-serif;
    background-color: #E6D2B5;
    height: 100%;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    padding: 0px 0px 5px;
    background-color: #a4926a;
    box-sizing: border-box;
}

.text-area {
    flex: 1;
    width: 100%;
    max-width: 100%;
    background-color: #cab37d;
    border-radius: 33px;
    padding-top: 0px;
    padding-bottom: 0px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    margin-bottom: 20px;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
}

.text-area h2 {
    color: white;
    font-size: 18px;
    margin-bottom: 20px;
}

.header-row {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    box-sizing: border-box;
    overflow-x: hidden;
    flex-wrap: wrap;
    gap: 10px;
    background-color: #a4926a;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.copy-button, .download-button, .font-size-button {
    padding: 8px 16px;
    background-color: #D4B996;
    color: #383838;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.copy-button:hover, .download-button:hover, .font-size-button:hover {
    background-color: #C4A986;
}

.header-row h2 {
    margin-bottom: 0;
    color: #383838;
}

.search-input {
    width: 80px;
    padding: 8px 12px;
    font-size: 14px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    background-color: transparent;
    color: #383838;
    text-align: center;
    z-index: 100;
    position: relative;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.search-input:focus {
    outline: none;
    border-color: white;
}

.search-input::-webkit-outer-spin-button,
.search-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.text-area h2 .order-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    background-color: #d79033;
    border-radius: 50%;
    font-weight: bold;
    font-size: 16px;
    opacity: 1;
    margin-right: 12px;
}

.text-wrapper {
    width: 100%;
    height: 100%;
    min-height: calc(100vh - 80px);
    max-height: calc(100vh - 80px);
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}

.text-content-wrapper {
    position: relative;
    width: 100%;
    min-height: 100%;
    overflow: hidden;
}

.next-text-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translateX(100%);
    display: none;
    position: relative;
}

.next-text-container #next-text {
    padding-top: 70px;
}

.text-content {
    font-size: 18px;
    line-height: 1.8;
    white-space: pre-wrap;
    color: #383838;
    width: 100%;
    min-height: 100%;
    position: relative;
    padding: 70px 25px 50px;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

.char-count {
    position: absolute;
    bottom: 10px;
    left: 25px;
    font-size: 14px;
    color: rgba(56, 56, 56, 0.6);
    pointer-events: none;
}

.text-content.slide-left {
    transform: translateX(-100%);
}

.text-content.slide-right {
    transform: translateX(100%);
}

.text-content.fade-out {
    opacity: 0;
    transform: translateY(10px);
}

.text-content.fade-in {
    opacity: 1;
    transform: translateY(0);
}

.text-content.slide-left-prepare {
    animation: slideLeftKey 0.15s ease-out forwards;
}

.text-content.slide-right-prepare {
    animation: slideRightKey 0.15s ease-out forwards;
}

@keyframes slideLeftKey {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    100% {
        transform: translateX(-20px);
        opacity: 0.8;
    }
}

@keyframes slideRightKey {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    100% {
        transform: translateX(20px);
        opacity: 0.8;
    }
}

/* Scrollbar styling */
.text-wrapper::-webkit-scrollbar {
    width: 8px;
}

.text-wrapper::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.text-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.text-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.edit-wrapper {
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    touch-action: none;
    -webkit-overflow-scrolling: touch;
}

.edit-wrapper.active {
    display: flex;
}

.edit-wrapper.active ~ .text-content {
    display: none;
}

.text-area.edit-mode .header-row {
    display: none;
}

.text-area.edit-mode .text-wrapper {
    height: 100%;
    max-height: none;
}

body.edit-mode {
    overflow: hidden !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    height: 100vh !important;
}

html.edit-mode {
    overflow: hidden !important;
    height: 100vh !important;
}

.container.edit-mode {
    overflow: hidden !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    height: 100vh !important;
}

.text-area.edit-mode {
    overflow: hidden !important;
    position: relative !important;
    touch-action: none;
    height: calc(100vh - 80px) !important;
}

.edit-wrapper.active {
    display: flex;
    flex-direction: row;
    touch-action: none;
    height: 100%;
    max-height: calc(100vh - 80px);
    min-height: 300px;
}

.original-text {
    flex: none;
    width: 50%;
    max-width: 50%;
    min-width: 50%;
    height: auto;
    max-height: calc(100vh - 140px);
    min-height: 200px;
    font-size: 18px;
    line-height: 1.6;
    white-space: pre-wrap;
    color: #383838;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    border-right: 2px solid rgba(255, 255, 255, 0.3);
    font-family: 'ALKATIP Tor Tom', 'Arial', sans-serif;
    cursor: pointer;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y pinch-zoom;
    box-sizing: border-box;
    flex-grow: 1;
}

textarea {
    flex: none;
    width: 50%;
    max-width: 50%;
    min-width: 50%;
    height: auto;
    max-height: calc(100vh - 140px);
    min-height: 200px;
    padding: 20px;
    font-size: 18px;
    border: none;
    background-color: transparent;
    color: #363636;
    resize: none;
    font-family: 'ALKATIP Tor Tom', 'Arial', sans-serif;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y pinch-zoom;
    box-sizing: border-box;
    flex-grow: 1;
}

textarea::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.buttons {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

button {
    flex: 1;
    padding: 15px;
    background-color: #D4B996;
    color: #383838;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
}

.cancel-button {
    background-color: #C4A986;
}

.cancel-button:hover {
    background-color: #B49976;
}

button:hover {
    background-color: #C4A986;
}

.message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 15px;
    border-radius: 5px;
    color: white;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    text-align: cente.replacer-form input {
    background-color: #f4f0e5;
}.replacer-form input {
    background-color: #f4f0e5;
}r;
    min-width: 200px;
}

.message.success {
    background-color: #4CAF50;
}

.message.error {
    background-color: #f44336;
}

@media (max-width: 768px) {
    .container {
        padding: 0px;
    }

    .text-area {
        padding: 0px 10px;
    }

    .text-area h2 {
        font-size: 20px;
    }

    .text-content {
        font-size: 16px;
    }

    textarea {
        font-size: 16px;
        padding: 0px;
    }

    button {
        font-size: 16px;
        padding: 12px;
    }

    .font-size-button {
        display: none;
    }
}
/* 退出按钮样式 */
.logout-button {
    background-color: #D4B996;
    color: #383838;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.logout-button:hover {
    background-color: #c0392b;
}

/* 登录界面样式 */
.login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #E6D2B5;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.login-box {
    background-color: #cab37d;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    text-align: center;
    color: #383838;
    margin-bottom: 30px;
    font-size: 28px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #383838;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.3);
    color: #383838;
    font-size: 16px;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: white;
    background-color: rgba(255, 255, 255, 0.5);
}

.form-group input::placeholder {
    color: rgba(56, 56, 56, 0.5);
}

.login-button {
    width: 100%;
    padding: 14px;
    background-color: #d79033;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.login-button:hover {
    background-color: #c88023;
}

/* 自定义右上角消息提示样式 */
.custom-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 24px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: bold;
    z-index: 3000;
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.custom-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.custom-toast.success {
    background-color: #4CAF50;
}

.custom-toast.error {
    background-color: #f44336;
}

.custom-toast.info {
    background-color: #2196F3;
}

/* 隐藏主容器 */
#main-container {
    display: none;
}
