@charset "utf-8";
/* CSS Document */

:root {
--bg-0: #2a9d8f;
--bg-1: #0f766e;
--bg-2: #0b4f4a;
--paper: #f6f2e8;    
--paper-2: #f1eadc;
--ink: #1a1a1a;
--shadow: 0 18px 50px rgba(0,0,0,.28);
--radius-lg: 18px;

--radius-xl: 24px;
--btn-play: #ffd34d;
--btn-repeat: #ff5d5d;
--btn-write: #a7f3d0;
--btn-dictate: #c4b5fd;
--btn-ink: #1d1d1d;
}
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
}    
.stroke-body {
    font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
    margin: 0;
    color: var(--paper);
    background-color: var(--bg-1);
    background: linear-gradient(180deg, var(--bg-0), var(--bg-1) 45%, var(--bg-2));
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.brand__title {
    font-weight: 900;
    font-size: 24px;
    margin: 0 0 15px 0;
    letter-spacing: 2px;
    text-align: center;
}
.brand__title a {
    text-decoration: none;
    color: var(--ink);
    transition: opacity 0.3s ease;
}
.brand__title a:hover {
    opacity: 0.8;
    color: #0f5f47;
}

/* --- Multi-character navigation bar --- */
.multi-nav-bar {
    width: 100%;
    max-width: 800px;
    margin: 0 auto 15px auto;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    box-sizing: border-box;
}
.multi-nav-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    background: white;
    color: #0f5f47;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    font-size: 16px;
    transition: all 0.2s ease;
    cursor: pointer;
}
.multi-nav-item:hover {
    background: #0f5f47;
    color: white;
    transform: translateY(-2px);
}
.multi-nav-current {
    background: #ffd34d;
    color: #2a0505;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.wrap {
    width: 100%;
    /*max-width: 1080px;*/
    max-width: 1320px;
    
    padding: 20px;
    box-sizing: border-box;
}
.sheet {
    background: linear-gradient(180deg, var(--paper), var(--paper-2));
    color: var(--ink);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.standard-selector {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 15px;
    width: 100%;
    max-width: 800px;
}
.standard-selector label {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.limit-warning {
    width: 100%;
    max-width: 400px;
    margin: 0 auto 15px auto;
    padding: 10px 15px;
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #f87171;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    box-sizing: border-box;
    display: none;
}
.history-container {
    width: 100%;
    max-width: 800px;
    margin-bottom: 20px;
}
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.history-title {
    font-size: 13px;
    font-weight: bold;
    color: #555;
}
.btn-toggle-history {
    background: transparent;
    border: none;
    color: #0f5f47;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
}
.history-list {
    display: none;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 110px;
    overflow-y: auto;
    padding: 2px;
}
.history-chip {
    display: inline-flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 16px;
    padding: 4px 10px;
    font-size: 14px;
    cursor: pointer;
}
.history-label {
    margin-right: 6px;
    font-weight: 600;
}
.history-del {
    border: none;
    background: transparent;
    color: #888;
    font-size: 12px;
    cursor: pointer;
    padding: 0 2px;
    font-weight: bold;
}
.custom-font-display {
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 15px;
}
#writersContainer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    width: 100%;
}
.writer-box {
    flex: 1 1 180px;
    min-width: 180px;
    max-width: 260px;    
    aspect-ratio: 1 / 1;
    background: linear-gradient(180deg, #ffffff, #fbf7ef);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(0,0,0,.10);
    box-shadow: 0 10px 24px rgba(0,0,0,.12);
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}
.writer-box::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .85;
    z-index: 0;
}
.writer-box svg {
    position: relative;
    z-index: 1;
}

/* --- Single character link button --- */
.char-link-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    color: #0f5f47;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    z-index: 20;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
    border: 1px solid rgba(15, 95, 71, 0.2);
}
.char-link-btn:hover {
    background: #0f5f47;
    color: white;
    transform: scale(1.1);
}
.char-link-btn.disabled {
    opacity: 0.3;
    pointer-events: none;
    cursor: not-allowed;
}

/* --- Single character play button --- */
.char-play-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    color: #0f5f47;
    border-radius: 50%;
    font-size: 16px;
    z-index: 20;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
    border: 1px solid rgba(15, 95, 71, 0.2);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.char-play-btn:hover {
    background: #0f5f47;
    color: white;
    transform: scale(1.1);
}
.char-play-btn.disabled {
    opacity: 0.3;
    pointer-events: none;
    cursor: not-allowed;
}

.bg-cross::before {
    background-image: repeating-linear-gradient(to bottom, rgba(37,183,176,.55) 0 3px, transparent 3px 10px), repeating-linear-gradient(to right, rgba(37,183,176,.55) 0 3px, transparent 3px 10px);
    background-size: 2px 100%, 100% 2px;
    background-position: 50% 0, 0 50%;
    background-repeat: repeat-y, repeat-x;
}
.bg-nine::before {
    background-image: repeating-linear-gradient(to bottom, rgba(37,183,176,.55) 0 3px, transparent 3px 10px), repeating-linear-gradient(to bottom, rgba(37,183,176,.55) 0 3px, transparent 3px 10px), repeating-linear-gradient(to right, rgba(37,183,176,.55) 0 3px, transparent 3px 10px), repeating-linear-gradient(to right, rgba(37,183,176,.55) 0 3px, transparent 3px 10px);
    background-size: 2px 100%, 2px 100%, 100% 2px, 100% 2px;
    background-position: 33.33% 0, 66.66% 0, 0 33.33%, 0 66.66%;
    background-repeat: repeat-y, repeat-y, repeat-x, repeat-x;
}
.bg-diagonal::before {
    background-image: url("data:image/svg+xml,%3Csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='0' x2='100%25' y2='100%25' stroke='rgba(37,183,176,0.55)' stroke-width='2' stroke-dasharray='3,7'/%3E%3Cline x1='100%25' y1='0' x2='0' y2='100%25' stroke='rgba(37,183,176,0.55)' stroke-width='2' stroke-dasharray='3,7'/%3E%3C/svg%3E");
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
}
.std-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    font-size: 12px;
    font-weight: 900;
    color: rgba(0,0,0,0.6);
    background: rgba(255,255,255,0.85);

    padding: 2px 6px;
    border-radius: 6px;
    pointer-events: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    z-index: 10;
}
.char-number-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 11px;
    font-weight: bold;
    color: rgba(0,0,0,0.5);
    background: rgba(255,255,255,0.7);
    padding: 2px 4px;
    border-radius: 4px;
    pointer-events: none;
    z-index: 10;
}
.missing-char-badge {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 28px;
    font-weight: 900;
    color: rgba(0,0,0,0.25);
    pointer-events: none;
    z-index: 10;
}
.feedback-wrapper {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 15px;
    width: 100%;
}


.feedback-msg {
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 15px;
    font-weight: bold;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
}
.feedback-msg.show {
    opacity: 1;
    transform: translateY(0);
}
.controls {
    position: sticky;
    top: 66px;
    z-index: 100;
    background: var(--paper);
    padding: 12px;
    border-radius: var(--radius-lg);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
    margin: 10px auto 15px auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 500px;
    box-sizing: border-box;
}
.btn {
    padding: 11px 12px;
    font-size: 15px;
    font-weight: 900;
    cursor: pointer;
    flex: 1 1 50px;
    border-radius: 16px;
    border: 0;
    color: var(--btn-ink);
    box-shadow: 0 14px 22px rgba(0,0,0,.18);
}
.btn--play {
    background: linear-gradient(180deg, var(--btn-play), #ffbf2f);
}
.btn--write {
    background: linear-gradient(180deg, var(--btn-write), #34d399);
    color: #052c28;
}
.btn--dictate {
    background: linear-gradient(180deg, var(--btn-dictate), #a78bfa);
    color: #2e1065;
}
.btn--repeat {
    background: linear-gradient(180deg, var(--btn-repeat), #f33a3a);
    color: #2a0505;
}
.link-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 15px 0 25px 0;
    padding: 15px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 12px;
    width: 100%;
    max-width: 1080px;
}
.custom-link {
    text-decoration: none;
    color: #0f5f47;
    font-size: 16px;
    font-weight: 600;
    padding: 8px 14px;
    background: white;
    border-radius: 8px;
    border: 1px solid rgba(15, 95, 71, 0.2);
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    white-space: nowrap; /* Prevents text wrapping inside the button itself */
}
.custom-link:hover {
    background: #0f5f47;
    color: white;
    border-color: #0f5f47;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
    
/* 針對詞語連結的樣式 */
.lexical-word-link {
    color: #0f5f47;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.2s ease;
}
.lexical-word-link:hover {
    text-decoration: underline;
    color: #0a4231;
}    

/* --- Pinyin Audio Button Styles --- */
.pinyin-audio-btn {
    background: rgba(15, 95, 71, 0.08);
    border: 1px solid rgba(15, 95, 71, 0.2);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #0f5f47;
    transition: all 0.2s ease;
    padding: 0;
    margin-left: 6px;
    vertical-align: middle;
}
.pinyin-audio-btn:hover {
    background: #0f5f47;
    color: #fff;
}
.pinyin-audio-btn.not-found {
    background: #fee2e2;
    color: #dc2626;
    border-color: #f87171;
    cursor: not-allowed;
}
.pinyin-audio-btn.playing {
    background: #0f5f47;
    color: #fff;
}

/* --- Lexical Table Styles based on tool-pinyin --- */
.table-container {
    width: 100%;
    max-height: auto;
    overflow-y: visible;
    border-radius: var(--radius-lg);
    border: 2px solid rgba(15, 118, 110, 0.3);
    background: #fff;
    margin-bottom: 20px;
    padding: 15px;
    box-sizing: border-box;
}
.lexical-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}
.lexical-table td {
    padding: 14px 12px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 16px;
}
.lexical-table tr:last-child td {
    border-bottom: none;
}

@media (max-width: 768px) {
  .wrap { padding: 5px; }
  .sheet { padding: 10px; }
  .controls { padding: 8px; gap: 6px; top: 54px; }
  .btn { padding: 8px 1px; font-size: 14px; }
  #writersContainer { gap: 8px; }
  .char-link-btn { width: 24px; height: 24px; font-size: 12px; top: 6px; right: 6px; }
  .char-play-btn { width: 24px; height: 24px; font-size: 14px; bottom: 6px; right: 6px; }
}   
