:root{
    --bg:#16171b;
    --gutter:#23293a;
    --gutterText:#a2b3e6;
    --text:#e4e8fa;
    --muted:#98a4c8;
    --inputBg:#191a20;
    --accent:#5b9df7;
    --border:#2a3142;
    --btnMain:#5b9df7;
    --btnMainHover:#3a7adf;
    --btnDanger:#e36f7d;
    --btnDangerHover:#d84e5d;
    --shadow: 0 8px 32px rgba(20,25,40,0.14);
    --radius: 14px;
    --maxwidth: 700px;
    --scrollbar-bg: #23293a;
    --scrollbar-thumb: #5b9df7;
    --scrollbar-thumb-hover: #3a7adf;
    --scrollbar-corner: #191a20;
}
.share-footer {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:10px 18px;
    background: var(--inputBg);
    color: var(--muted);
    font-size:0.95rem;
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow);
}

.share-left { display:flex; align-items:center; gap:8px; color:var(--muted); }
.share-left strong { color: var(--text); font-weight:700; font-size:0.98rem; }

.share-actions { display:flex; gap:8px; align-items:center; }
.share-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.04);
    padding:10px;
    border-radius:10px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
    transition: transform .12s ease, background .12s ease, border-color .12s ease;
    color: var(--text);
}
.share-btn svg { display:block; }
.share-btn:hover, .share-btn:focus {
    transform: translateY(-2px);
    border-color: rgba(91,157,247,0.25);
    background: rgba(91,157,247,0.04);
    outline: none;
}
.share-btn:active { transform: translateY(0); }
@media (max-width:700px) {
    .share-footer { flex-direction:column; gap:8px; align-items:stretch; }
    .share-actions { justify-content:center; }
}
html,body{height:100%;margin:0;background:var(--bg);color:var(--text);font-family:'JetBrains Mono',ui-monospace,monospace;}
body { min-height: 100vh; }
.centered-content {
    max-width: var(--maxwidth);
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.app{display:flex;flex-direction:column;min-height:100vh;box-sizing:border-box;}
#topNotify {
    position: fixed;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    min-width: 220px;
    max-width: 90vw;
    background: var(--btnMain);
    color: #fff;
    font-size: 1.12rem;
    font-weight: 600;
    padding: 18px 22px;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(91,157,247,0.15);
    z-index: 9999;
    text-align: center;
    pointer-events: none;
    transition: top 0.45s cubic-bezier(.61,.35,.52,1.14);
}
#topNotify.show {
    top: 24px;
}
#topNotify.error {
    background: var(--btnDanger);
}
header {
    padding: 18px 24px;
    background: var(--inputBg);
    color: var(--gutterText);
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 1.07rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    border-radius: 0 0 var(--radius) var(--radius);
}
header h1 {
    margin: 0;
    font-size: 1.12rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-shadow: 0 2px 14px rgba(91,157,247,0.07);
    background: linear-gradient(90deg,var(--accent) 30%,var(--gutterText) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
#feedback {
    margin-left:auto;
    color:var(--muted);
    font-size:0.98rem;
    padding: 2px 12px;
    border-radius: 6px;
    background:rgba(91,157,247,0.06);
    font-weight: 500;
    letter-spacing: 1px;
    user-select: none;
}
.editor-wrap {
    flex:1;
    display: flex;
    justify-content: center;
    align-items: stretch;
    min-height: 200px;
    background: var(--bg);
    box-shadow: var(--shadow);
    border-top:1px solid var(--border);
}
.gutter {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    width: 3.2rem;
    background: var(--gutter);
    color: var(--gutterText);
    min-height: 100px;
    border-right: 1px solid var(--border);
    text-align: right;
    user-select: none;
    padding-top: 16px;
    overflow-y: auto;
}
.gutter div {
    height: 1.7em;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin: 0;
    padding-right: 10px;
    font-size: 1.07rem;
}
.story {
    flex:1;
    padding: 16px 18px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.7;
    font-size: 1.07rem;
    background: linear-gradient(120deg,rgba(110,130,168,0.02) 0%,rgba(91,157,247,0.05) 100%);
    border-radius: 0 var(--radius) var(--radius) 0;
    min-height: 0;
}
.story span.word {
    font-weight: 600;
    margin-right: 2.5px;
    padding: 0;
    border-radius: 0;
    background: none;
    transition: none;
    display: inline-block;
}
.story span.word:hover {
    background: none;
    box-shadow: none;
}
.typing-indicator-bar {
    position: absolute;
    left: 0;
    bottom: 100%;
    margin-bottom: 6px;
    min-width: 120px;
    max-width: 220px;
    background: var(--inputBg);
    color: var(--accent);
    border-radius: 6px;
    font-size: 0.92rem;
    font-weight: 500;
    padding: 3px 13px 3px 12px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 11px rgba(91,157,247,0.07);
    line-height: 1.3;
    display: none;
    align-items: center;
    gap: 7px;
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.28s;
}
.typing-indicator-bar.show {
    display: flex;
    opacity: 1;
    animation: typingFade 0.3s;
}
.typing-dots {
    display: inline-block;
    vertical-align: middle;
    width: 20px;
    text-align: left;
}
.typing-dots span {
    display: inline-block;
    width: 4px;
    height: 4px;
    margin-right: 2px;
    background: var(--accent);
    border-radius: 50%;
    opacity: 0.8;
    animation: typingDot 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s;}
.typing-dots span:nth-child(3) { animation-delay: 0.4s;}
@keyframes typingDot {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.6;}
    40% { transform: scale(1.2); opacity: 1;}
}
@keyframes typingFade {
    from { opacity: 0; transform: translateY(6px);}
    to { opacity: 1; transform: translateY(0);}
}
.bottom {
    display: flex;
    gap: 12px;
    padding: 14px 0;
    background: var(--inputBg);
    border-top: 1px solid var(--border);
    box-shadow: 0 2px 24px rgba(20,25,40,0.05);
    border-radius: 0 0 var(--radius) var(--radius);
    align-items: center;
    justify-content: center;
    position: relative;
}
.word-input {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    border: 0;
    background: #232435;
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    box-shadow: 0 2px 16px rgba(91,157,247,0.07);
    transition: background 0.2s, box-shadow 0.23s;
    max-width: 270px;
    margin: 0 auto;
}
.word-input:focus {
    background: #2b3148;
    outline: 2px solid var(--accent);
}
.btn {
    padding: 12px 18px;
    border-radius: 10px;
    border: 0;
    background: var(--btnMain);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 14px rgba(91,157,247,0.09);
    transition: background 0.2s, transform 0.13s;
}
.btn:active { transform: translateY(2px) scale(0.98);}
.btn:hover, .btn:focus { background: var(--btnMainHover);}
.btn-danger {
    background: var(--btnDanger);
}
.btn-danger:hover, .btn-danger:focus {
    background: var(--btnDangerHover);
}
.btn.voted {
    background: var(--btnDangerHover)!important;
    color: #fff;
    opacity: 0.7;
    cursor: not-allowed;
}
.vote-count {
    margin-left: 7px;
    font-size: 0.99rem;
    color: var(--muted);
    font-weight: 600;
}
.msg {
    margin-left: 10px;
    font-weight: 600;
    color: var(--accent);
    font-size: 1rem;
    opacity: 0;
    animation: fadeMsg 0.8s cubic-bezier(.61,.35,.52,1.14) forwards;
}
@keyframes fadeMsg {
    0% { opacity: 0; transform: translateY(8px);}
    40% { opacity: 1; transform: translateY(0);}
    100% { opacity: 1; }
}
.story::-webkit-scrollbar, .gutter::-webkit-scrollbar {
    width: 12px;
    background: var(--scrollbar-bg);
}
.story::-webkit-scrollbar-thumb, .gutter::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 8px;
    border: 2px solid var(--scrollbar-bg);
}
.story::-webkit-scrollbar-thumb:hover, .gutter::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}
.story::-webkit-scrollbar-corner, .gutter::-webkit-scrollbar-corner {
    background: var(--scrollbar-corner);
}
.story, .gutter {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-bg);
}
footer {
    padding: 10px 18px;
    background: var(--inputBg);
    color: var(--muted);
    font-size: 0.95rem;
    text-align: center;
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow);
}
@media (max-width:950px){
    .centered-content { max-width: 98vw; }
    .app{font-size: 1rem;}
    header, .bottom, .story {padding-left: 8px;padding-right: 8px;}
    .story {font-size: 0.97rem; padding: 12px 6px;}
}
@media (max-width:700px){
    .centered-content { max-width: 100vw; }
    .editor-wrap { flex-direction:column; }
    .gutter { display:none; }
    .story { border-radius: var(--radius); }
    header, .bottom, footer { border-radius: var(--radius); }
    .bottom { flex-direction:column; gap:10px; }
    .btn, .word-input { width:100%; max-width: none;}
    .vote-count { margin-left:0; margin-top:4px;}
    .msg { margin-left:0; margin-top:4px;}
    .typing-indicator-bar {
        left: 0;
        right: auto;
        min-width: 90px;
        max-width: 99vw;
        font-size: 0.91rem;
        padding-left: 7px;
        padding-right: 7px;
    }
}
@media (max-width:500px){
    .story { font-size:0.93rem; padding: 8px 2px;}
    .word-input, .btn { font-size:0.94rem;}
}