:root{color-scheme:dark;--felt:#063d31;--felt2:#032820;--gold:#edc76d;--cream:#fff7da;--line:rgba(237,199,109,.55);--mint:#75e0b1;--danger:#ff8d83;--tile-w:clamp(28px,7vw,54px);--tile-h:calc(var(--tile-w)*1.33)}
*{box-sizing:border-box}html,body{min-height:100%;margin:0;background:#001b16;color:#f7f1d9;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Hiragino Kaku Gothic ProN",Meiryo,sans-serif}body{background:radial-gradient(circle at 50% 20%,rgba(39,126,94,.28),transparent 42%),linear-gradient(#001d18,#00100d)}button,a,select,input{font:inherit}button,a,select{min-height:44px;border:1px solid rgba(237,199,109,.42);border-radius:12px;background:rgba(12,65,51,.9);color:var(--cream);font-weight:800}button:disabled{opacity:.4}.editor-shell{width:min(100%,1040px);min-height:100vh;margin:auto;padding:max(12px,env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) max(20px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left))}.editor-header{display:flex;align-items:center;justify-content:space-between;padding:12px 6px}.editor-header h1{margin:2px 0;font-size:clamp(24px,5vw,38px)}.eyebrow{color:var(--gold);font-family:Georgia,serif;font-weight:800;letter-spacing:.16em}.editor-gear{width:54px;height:54px;border-color:#e0bd68;background:linear-gradient(#9c7931,#634615);color:#fff1bd;box-shadow:inset 0 1px rgba(255,245,190,.38),0 2px 8px rgba(44,28,5,.45);font-size:28px}.editor-lock,.editor-summary,.editor-board,.editor-palette-section{border:1px solid var(--line);border-radius:20px;background:linear-gradient(145deg,rgba(13,74,57,.94),rgba(2,42,34,.96));box-shadow:0 12px 32px rgba(0,0,0,.22)}.editor-lock{margin:18vh auto 0;padding:30px;max-width:560px;text-align:center}.editor-lock strong{font-size:24px;color:var(--gold)}.editor-summary{padding:12px 16px;margin-bottom:10px}.editor-summary>div{display:flex;justify-content:space-between}.editor-summary strong{color:var(--gold);font-size:18px}.editor-summary p{margin:6px 0 0}.editor-condition-warning,.condition-message{color:#ffd1a5}.editor-board{padding:12px;min-height:150px}.editor-dora-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap;font-size:13px}.editor-dora-row button{min-height:34px;padding:5px 12px}.editor-indicator{width:calc(var(--tile-w)*.8);height:calc(var(--tile-h)*.8)}.editor-hand-layout{display:flex;align-items:flex-end;justify-content:center;gap:0;margin-top:14px;min-height:calc(var(--tile-h) + 30px);touch-action:none}.hand-row{display:flex;align-items:flex-end;min-height:var(--tile-h)}.hand-row-two{display:none}.draw-gap{width:clamp(10px,2.5vw,24px)}.draw-slot{position:relative;display:block;width:var(--tile-w);height:calc(var(--tile-h) + 20px);border:1px dashed rgba(237,199,109,.65);border-radius:7px}.draw-slot>.editor-tile{position:absolute;left:0;top:0}.draw-slot>span{position:absolute;left:0;top:calc(var(--tile-h) + 2px);width:100%;text-align:center;font-size:10px;font-weight:800;color:var(--gold)}.editor-tile{position:relative;flex:0 0 var(--tile-w);width:var(--tile-w);height:var(--tile-h);border:0;border-radius:3px;padding:0;background:transparent;min-height:0;touch-action:none}.editor-tile img{width:100%;height:100%;object-fit:fill;display:block;pointer-events:none;transform-origin:center}.editor-tile.inverted img{transform:rotate(180deg)}.editor-tile.drop-replace{outline:4px solid #ffb54b;z-index:3}.insert-marker{width:4px;height:var(--tile-h);background:#74f2c0;box-shadow:0 0 8px #74f2c0}.drop-message{min-height:20px;text-align:center;color:#ffcf8d;font-weight:800}.editor-actions{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px;margin:10px 0}.editor-actions button,.editor-actions a{display:grid;place-items:center;text-align:center;text-decoration:none;padding:7px 4px}.editor-actions .primary,.primary{background:linear-gradient(#22845f,#126044);border-color:#79e1b0}.editor-palette-section{padding:12px}.section-title{display:flex;align-items:center;justify-content:space-between}.section-title h2{margin:0;color:var(--gold)}.section-title span{font-size:12px}.editor-palette,.indicator-palette{display:grid;grid-template-columns:repeat(10,minmax(0,1fr));gap:5px;margin-top:10px}.palette-tile{position:relative;min-height:0;height:auto;aspect-ratio:.75;border:0;padding:0;background:transparent;touch-action:none}.palette-tile img{width:100%;height:100%;object-fit:fill;display:block}.palette-tile.disabled{filter:grayscale(.7) brightness(.35);pointer-events:none}.palette-tile small{position:absolute;right:1px;bottom:1px;display:grid;place-items:center;min-width:16px;height:16px;border-radius:9px;background:#022b23;color:white;font-size:9px}.editor-modal,.generating,.drag-overlay{position:fixed;inset:0;z-index:1000;background:rgba(0,12,10,.78);padding:max(12px,env(safe-area-inset-top)) 10px max(12px,env(safe-area-inset-bottom));overflow:auto}.editor-modal>section{width:min(100%,720px);margin:auto;border:1px solid var(--line);border-radius:20px;background:#073c30;box-shadow:0 20px 50px #000}.editor-modal header{position:sticky;top:0;z-index:2;display:flex;justify-content:space-between;align-items:center;padding:12px 16px;background:#073c30;border-bottom:1px solid rgba(255,255,255,.12);border-radius:20px 20px 0 0}.editor-modal h2{margin:0}.editor-modal header button{width:46px;font-size:24px}.modal-body,.preview-body{padding:14px}.modal-body fieldset{margin:0 0 12px;padding:10px;border:1px solid rgba(237,199,109,.32);border-radius:12px}.modal-body label{display:inline-flex;align-items:center;gap:6px;margin-right:16px}.check-row{width:100%;padding:12px;margin-bottom:10px;border:1px solid rgba(255,255,255,.16);border-radius:12px}.generation-order-checks{display:grid;grid-template-columns:1fr 1fr;gap:8px}.generation-order-checks .check-row{margin:0}.modal-body input[type=checkbox],.modal-body input[type=radio]{width:22px;height:22px;accent-color:#e6b557}.modal-body select{width:100%;padding:8px}.wind-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}.wind-grid label{display:block;margin:0}.yaku-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}.yaku-option{display:flex!important;margin:0!important;padding:8px;border-radius:8px;background:rgba(0,0,0,.16);font-size:13px}.yaku-option.disabled{opacity:.46}.yaku-option small{display:block;color:#ffc5a8}.wide{width:100%}.indicator-palette{padding:10px}.preview-dialog{margin-top:3vh!important}.preview-body canvas{display:block;width:100%;height:auto;border-radius:10px;background:#063d31}.preview-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px}.generating{display:grid;place-items:center}.generating>div{text-align:center;padding:26px;border:1px solid var(--line);border-radius:18px;background:#073c30}.generating span{display:block;width:36px;height:36px;margin:18px auto;border:4px solid rgba(255,255,255,.2);border-top-color:var(--gold);border-radius:50%;animation:spin .8s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.drag-overlay{z-index:2000;padding:0;background:transparent;pointer-events:none;overflow:hidden}.drag-overlay #dragGhost{position:fixed;width:var(--tile-w);height:var(--tile-h);filter:drop-shadow(0 8px 6px rgba(0,0,0,.45));transform:translate(-50%,-65%)}.drag-overlay #dragGhost img{width:100%;height:100%}.drag-overlay strong{position:fixed;left:50%;bottom:calc(18px + env(safe-area-inset-bottom));transform:translateX(-50%);padding:8px 14px;border-radius:99px;background:#8d2e2a;color:#fff;white-space:nowrap}
@media (orientation:portrait) and (max-width:680px){.editor-hand-layout.two-rows{display:grid;grid-template-columns:auto 14px var(--tile-w);grid-template-rows:auto auto;justify-content:center;align-items:end;gap:4px 0}.editor-hand-layout.two-rows .hand-row-one{grid-column:1;grid-row:1}.editor-hand-layout.two-rows .hand-row-two{display:flex;grid-column:1;grid-row:2}.editor-hand-layout.two-rows .draw-gap{grid-column:2;grid-row:2}.editor-hand-layout.two-rows .draw-slot{grid-column:3;grid-row:2}.editor-actions{grid-template-columns:repeat(2,minmax(0,1fr))}.editor-palette,.indicator-palette{grid-template-columns:repeat(8,minmax(0,1fr))}.yaku-options{grid-template-columns:1fr}:root{--tile-w:clamp(30px,10.2vw,48px)}}
@media (orientation:landscape){.editor-shell{width:min(96vw,1120px)}.editor-header{padding-block:5px}.editor-summary{padding:8px 14px}.editor-board{padding:8px}.editor-palette,.indicator-palette{grid-template-columns:repeat(13,minmax(0,1fr))}.editor-actions{grid-template-columns:repeat(8,minmax(0,1fr))}:root{--tile-w:clamp(30px,5.1vw,56px)}}
@media (orientation:portrait) and (max-width:680px){.editor-hand-layout.one-row{--tile-w:clamp(21px,6.15vw,42px)}}
[hidden]{display:none!important}

/* The parent settings toolbar already names the page. Keep the editor itself on one screen. */
html,body{height:100%;overflow:hidden}
.editor-shell{position:relative;width:100%;height:100dvh;min-height:0;padding:4px max(4px,env(safe-area-inset-right)) max(4px,env(safe-area-inset-bottom)) max(4px,env(safe-area-inset-left));overflow:hidden}
.editor-header{position:absolute;z-index:20;top:3px;right:max(4px,env(safe-area-inset-right));padding:0}
.editor-header>div{display:none}
.editor-gear{width:42px;height:42px;min-height:42px;padding:0;border:0;border-radius:0;background:transparent;color:#c99f4a;box-shadow:none;-webkit-appearance:none;appearance:none;font-size:27px}
#editorContent{height:100%;min-height:0;display:grid;grid-template-rows:auto auto auto auto;align-content:start;gap:4px}
.editor-summary{margin:0 48px 0 0;padding:5px 8px;border-radius:10px;box-shadow:none}
.editor-summary>div{align-items:center}
.editor-summary strong{font-size:14px}
.editor-summary p{margin:2px 0 0;font-size:11px;line-height:1.22}
.editor-condition-warning{display:-webkit-box;overflow:hidden;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.editor-board{width:100%;min-height:0;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none}
.editor-dora-row{min-height:36px;padding:0 2px;gap:6px;font-size:10px;white-space:nowrap}
.editor-dora-row button{min-height:28px;padding:2px 8px;border-radius:8px;font-size:10px}
.editor-indicator{--indicator-tile-w:clamp(32px,7vw,56px);display:flex;align-items:center;justify-content:center;flex:0 0 var(--indicator-tile-w);width:var(--indicator-tile-w);height:auto;aspect-ratio:3/4}
.editor-indicator .editor-tile{width:100%!important;height:100%!important;flex:0 0 100%;aspect-ratio:3/4}
.editor-hand-layout{--draw-gap:6px;width:100%;min-height:0;margin-top:2px;padding:0;justify-content:center}
.editor-hand-layout.one-row{--tile-w:min(54px,calc((100vw - 14px - var(--draw-gap))/14))}
.editor-hand-layout.two-rows{--tile-w:min(48px,calc((100vw - 22px)/7.5))}
.editor-tile{width:var(--tile-w);height:auto;aspect-ratio:3/4;flex-basis:var(--tile-w)}
.editor-tile img{width:100%;height:100%;object-fit:contain;aspect-ratio:3/4}
.draw-gap{width:var(--draw-gap)}
.draw-slot{width:var(--tile-w);height:calc(var(--tile-w)*4/3 + 13px);min-height:calc(var(--tile-w)*4/3 + 13px);aspect-ratio:auto;border-radius:4px;overflow:visible}
.draw-slot>span{top:calc(var(--tile-w)*4/3 + 1px);font-size:8px;line-height:11px}
.drop-message{min-height:13px;font-size:10px;line-height:13px}
.editor-palette-section{display:flex;min-height:0;flex-direction:column;padding:3px 4px;border-radius:10px;box-shadow:none;overflow:hidden}
.section-title{flex:0 0 auto;min-height:20px}
.section-title h2{font-size:14px;line-height:20px}
.section-title span{font-size:9px}
.editor-palette{flex:0 0 auto;min-height:0;margin-top:2px;grid-template-columns:repeat(10,minmax(0,1fr));grid-template-rows:repeat(4,auto);gap:2px;align-content:start;align-items:start}
.palette-tile{justify-self:center;width:100%;height:auto;max-width:100%;aspect-ratio:3/4}
.palette-tile img{object-fit:contain;aspect-ratio:3/4}
.palette-tile small{min-width:13px;height:13px;font-size:8px}
.editor-actions{grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;margin:0}
.editor-actions button,.editor-actions a{min-height:36px;padding:3px 4px;border-radius:8px;font-size:12px;line-height:1.1}

@media (orientation:portrait) and (max-width:680px){
  .editor-hand-layout.two-rows{grid-template-columns:auto 6px var(--tile-w);gap:2px 0}
  .editor-palette{grid-template-columns:repeat(10,minmax(0,1fr));grid-template-rows:repeat(4,auto)}
  .indicator-palette{grid-template-columns:repeat(10,minmax(0,1fr))}
  .editor-actions{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media (orientation:landscape){
  #editorContent{grid-template-rows:auto auto auto auto;align-content:start}
  .editor-board{--landscape-tile-w:clamp(30px,4.6vw,50px);--landscape-tile-h:clamp(40px,6.14vw,67px);display:grid;grid-template-rows:auto var(--landscape-tile-h) 13px;row-gap:2px}
  .editor-indicator{--indicator-tile-w:32px}
  .editor-hand-layout.one-row{--tile-w:var(--landscape-tile-w);height:var(--landscape-tile-h);min-height:var(--landscape-tile-h);margin-top:0}
  .editor-hand-layout.one-row .hand-row{height:var(--landscape-tile-h);min-height:var(--landscape-tile-h)}
  .editor-hand-layout.one-row .editor-tile{height:var(--landscape-tile-h)}
  .editor-hand-layout.one-row .draw-slot{height:calc(var(--landscape-tile-h) + 13px);min-height:calc(var(--landscape-tile-h) + 13px)}
  .editor-palette-section{--landscape-palette-w:clamp(25px,3.9vw,47px);--landscape-palette-h:clamp(33.333px,5.2vw,62.667px);height:calc(var(--landscape-palette-h) + var(--landscape-palette-h) + 30px);min-height:calc(var(--landscape-palette-h) + var(--landscape-palette-h) + 30px);flex:none}
  .editor-palette{height:calc(var(--landscape-palette-h) + var(--landscape-palette-h) + 2px);grid-template-columns:repeat(19,minmax(0,1fr));grid-template-rows:repeat(2,var(--landscape-palette-h));flex:none}
  .editor-palette .palette-tile{width:var(--landscape-palette-w);height:var(--landscape-palette-h);max-height:none}
  .editor-actions{position:relative;z-index:2;grid-template-columns:repeat(8,minmax(0,1fr));margin-top:6px}
}

.editor-modal header{position:static;top:auto;z-index:auto}
